Si prosegue con le modifiche per l'inclusione degli esempi di codice.
[gapil.git] / listati / errcode_mess.c
1     /* convert string to number */
2     err = strtol(argv[optind], NULL, 10);
3     /* testing error condition on conversion */
4     if (err==LONG_MIN) {
5         perror("Underflow on error code");
6         return 1;
7     } else if (err==LONG_MIN) {
8         perror("Overflow on error code");
9         return 1;
10     }
11     /* conversion is fine */
12     if (message) {
13         printf("Error message for %d is %s\n", err, strerror(err));
14     }
15     if (label) {
16         printf("Error label for %d is %s\n", err, err_code[err]);
17     }