diff options
author | Jim Meyering <jim@meyering.net> | 1995-08-09 05:33:19 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1995-08-09 05:33:19 +0000 |
commit | a03000790854e177cce6a14bc264d2d8a6a2b132 (patch) | |
tree | f7304edc4e7f0aae017e7c4852e20f611c2753e7 /src | |
parent | 10c5aeabc5cde076c484c2c047120a412f32e26b (diff) | |
download | coreutils-a03000790854e177cce6a14bc264d2d8a6a2b132.tar.xz |
(my_strtol): Remove function.
(main): Use xstrtol instead.
Diffstat (limited to 'src')
-rw-r--r-- | src/mknod.c | 37 |
1 files changed, 5 insertions, 32 deletions
diff --git a/src/mknod.c b/src/mknod.c index a9becb330..ae79a8493 100644 --- a/src/mknod.c +++ b/src/mknod.c @@ -36,6 +36,7 @@ #include "modechange.h" #include "version.h" #include "error.h" +#include "xstrtol.h" static void usage (); @@ -56,34 +57,6 @@ static struct option const longopts[] = {NULL, 0, NULL, 0} }; -static int -my_strtol (str, ptr, base, result) - const char *str; - const char **ptr; - int base; - long int *result; -{ - long int val; - char *terminator; - int return_code; - - return_code = 0; - - errno = 0; - val = strtol (str, &terminator, base); - - if (terminator == str - || (ptr == NULL && *terminator != '\0') - || errno == ERANGE) - return_code = 1; - - if (ptr != NULL) - *ptr = terminator; - - *result = val; - return return_code; -} - void main (argc, argv) int argc; @@ -165,11 +138,11 @@ numbers must be specified"); } s = argv[optind + 2]; - if (my_strtol (s, NULL, 0, &tmp_major)) + if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK) error (1, 0, "invalid major device number `%s'", s); s = argv[optind + 3]; - if (my_strtol (s, NULL, 0, &tmp_minor)) + if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK) error (1, 0, "invalid minor device number `%s'", s); i_major = (int) tmp_major; @@ -194,11 +167,11 @@ numbers must be specified"); } s = argv[optind + 2]; - if (my_strtol (s, NULL, 0, &tmp_major)) + if (xstrtol (s, NULL, 0, &tmp_major, NULL) != LONGINT_OK) error (1, 0, "invalid major device number `%s'", s); s = argv[optind + 3]; - if (my_strtol (s, NULL, 0, &tmp_minor)) + if (xstrtol (s, NULL, 0, &tmp_minor, NULL) != LONGINT_OK) error (1, 0, "invalid minor device number `%s'", s); i_major = (int) tmp_major; |