This unifies the input maximums on 32-bit and 64-bit platforms.
ok?
Index: head.c
===================================================================
RCS file: /cvs/src/usr.bin/head/head.c,v
retrieving revision 1.22
diff -u -p -r1.22 head.c
--- head.c 10 Oct 2021 15:57:25 -0000 1.22
+++ head.c 11 Oct 2021 00:09:31 -0000
@@ -50,9 +50,9 @@ main(int argc, char *argv[])
{
const char *errstr;
FILE *fp;
- long cnt;
+ long long cnt;
int ch, firsttime;
- long linecnt = 10;
+ long long linecnt = 10;
int status = 0;
if (pledge("stdio rpath", NULL) == -1)
@@ -61,7 +61,7 @@ main(int argc, char *argv[])
/* handle obsolete -number syntax */
if (argc > 1 && argv[1][0] == '-' &&
isdigit((unsigned char)argv[1][1])) {
- linecnt = strtonum(argv[1] + 1, 1, LONG_MAX, &errstr);
+ linecnt = strtonum(argv[1] + 1, 1, LLONG_MAX, &errstr);
if (errstr != NULL)
errx(1, "count is %s: %s", errstr, argv[1] + 1);
argc--;
@@ -71,7 +71,7 @@ main(int argc, char *argv[])
while ((ch = getopt(argc, argv, "n:")) != -1) {
switch (ch) {
case 'n':
- linecnt = strtonum(optarg, 1, LONG_MAX, &errstr);
+ linecnt = strtonum(optarg, 1, LLONG_MAX, &errstr);
if (errstr != NULL)
errx(1, "count is %s: %s", errstr, optarg);
break;