Added include for isdigit(); simplified -<num> detection
authorRobert Griebl <griebl@gmx.de>
Mon, 27 May 2002 22:24:53 +0000 (22:24 -0000)
committerRobert Griebl <griebl@gmx.de>
Mon, 27 May 2002 22:24:53 +0000 (22:24 -0000)
coreutils/head.c
coreutils/tail.c

index c5c11fc7b682fffb031d1f4a238ed40b5c342836..ad21e1b959d5fd95bded797a7ed8799371923977 100644 (file)
@@ -25,6 +25,7 @@
 #include <getopt.h>
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include "busybox.h"
 
 static int head(int len, FILE *fp)
@@ -47,7 +48,7 @@ int head_main(int argc, char **argv)
        FILE *fp;
        int need_headers, opt, len = 10, status = EXIT_SUCCESS;
 
-       if (( argc >= 2 ) && ( strlen ( argv [1] ) >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
+       if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
                len = atoi ( &argv [1][1] );
                optind = 2;
        }
index 8201c80a098523d27519f1bdb55a4ca085249dce..024441e733c3adb813c755464ec4ac84cace6079 100644 (file)
@@ -25,6 +25,7 @@
 #include <fcntl.h>
 #include <getopt.h>
 #include <string.h>
+#include <ctype.h>
 #include <stdlib.h>
 #include <unistd.h>
 #include <sys/types.h>
@@ -68,7 +69,7 @@ int tail_main(int argc, char **argv)
        char *s, *start, *end, buf[BUFSIZ];
        int i, opt;
 
-       if (( argc >= 2 ) && ( strlen ( argv [1] ) >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
+       if (( argc >= 2 ) && ( argv [1][0] == '-' ) && isdigit ( argv [1][1] )) {
                count = atoi ( &argv [1][1] );
                optind = 2;
        }