--- src/usr.bin/head/head.c 2004/11/28 20:20:42 1.4 +++ src/usr.bin/head/head.c 2005/03/12 11:10:02 1.5 @@ -36,8 +36,6 @@ * $DragonFly$ */ -#include - #include #include #include @@ -69,12 +67,12 @@ main(int argc, char **argv) switch(ch) { case 'c': bytecnt = strtol(optarg, &ep, 10); - if (*ep || bytecnt <= 0) + if (*ep != NULL || bytecnt <= 0) errx(1, "illegal byte count -- %s", optarg); break; case 'n': linecnt = strtol(optarg, &ep, 10); - if (*ep || linecnt <= 0) + if (*ep != NULL || linecnt <= 0) errx(1, "illegal line count -- %s", optarg); break; default: @@ -95,7 +93,7 @@ main(int argc, char **argv) continue; } if (argc > 1) { - (void)printf("%s==> %s <==\n", + printf("%s==> %s <==\n", first ? "" : "\n", *argv); first = 0; } @@ -103,7 +101,7 @@ main(int argc, char **argv) head(fp, linecnt); else head_bytes(fp, bytecnt); - (void)fclose(fp); + fclose(fp); } } else if (bytecnt == -1) head(stdin, linecnt); @@ -157,10 +155,10 @@ obsolete(char **argv) if (ap[0] != '-' || ap[1] == '-' || !isdigit(ap[1])) return; if ((ap = malloc(strlen(*argv) + 2)) == NULL) - err(1, NULL); + err(1, "malloc failed"); ap[0] = '-'; ap[1] = 'n'; - (void)strcpy(ap + 2, *argv + 1); + strcpy(ap + 2, *argv + 1); *argv = ap; } } @@ -168,7 +166,6 @@ obsolete(char **argv) static void usage(void) { - - (void)fprintf(stderr, "usage: head [-n lines | -c bytes] [file ...]\n"); + fprintf(stderr, "usage: head [-n lines | -c bytes] [file ...]\n"); exit(1); }