From: Jim Meyering Date: Wed, 9 Aug 1995 05:33:19 +0000 (+0000) Subject: (my_strtol): Remove function. X-Git-Tag: FILEUTILS-3_12a~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a03000790854e177cce6a14bc264d2d8a6a2b132;p=thirdparty%2Fcoreutils.git (my_strtol): Remove function. (main): Use xstrtol instead. --- diff --git a/src/mknod.c b/src/mknod.c index a9becb3307..ae79a8493a 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;