This replaces all the calls to strtoq() and strtouq() in base (outside
gnu/) with calls to stroll/stroull. In those files, update types, use of
%q and QUAD_MAX as well.
While here, fix a bug in ftp: the 'page' command tries to save and restore
the restart position...but saved it in an int instead of an off_t.
Oops...
ok?
Philip Guenther
Index: games/factor/factor.c
===================================================================
RCS file: /data/src/openbsd/src/games/factor/factor.c,v
retrieving revision 1.28
diff -u -p -r1.28 factor.c
--- games/factor/factor.c 11 Jul 2016 18:30:21 -0000 1.28
+++ games/factor/factor.c 14 Aug 2016 07:39:42 -0000
@@ -114,7 +114,7 @@ main(int argc, char *argv[])
if (*p == '-')
errx(1, "negative numbers aren't permitted.");
errno = 0;
- val = strtouq(buf, &p, 10);
+ val = strtoull(buf, &p, 10);
if (errno)
err(1, "%s", buf);
for (; isblank((unsigned char)*p); ++p)
@@ -129,7 +129,7 @@ main(int argc, char *argv[])
if (argv[0][0] == '-')
errx(1, "negative numbers aren't permitted.");
errno = 0;
- val = strtouq(argv[0], &p, 10);
+ val = strtoull(argv[0], &p, 10);
if (errno)
err(1, "%s", argv[0]);
if (*p != '\0')
Index: usr.bin/cmp/cmp.c
===================================================================
RCS file: /data/src/openbsd/src/usr.bin/cmp/cmp.c,v
retrieving revision 1.14
diff -u -p -r1.14 cmp.c
--- usr.bin/cmp/cmp.c 29 Dec 2015 19:04:46 -0000 1.14
+++ usr.bin/cmp/cmp.c 14 Aug 2016 07:40:49 -0000
@@ -115,8 +115,8 @@ main(int argc, char *argv[])
if (pledge("stdio", NULL) == -1)
err(ERR_EXIT, "pledge");
- skip1 = argc > 2 ? strtoq(argv[2], NULL, 0) : 0;
- skip2 = argc == 4 ? strtoq(argv[3], NULL, 0) : 0;
+ skip1 = argc > 2 ? strtoll(argv[2], NULL, 0) : 0;
+ skip2 = argc == 4 ? strtoll(argv[3], NULL, 0) : 0;
if (!special) {
if (fstat(fd1, &sb1)) {
Index: usr.bin/ftp/cmds.c
===================================================================
RCS file: /data/src/openbsd/src/usr.bin/ftp/cmds.c,v
retrieving revision 1.77
diff -u -p -r1.77 cmds.c
--- usr.bin/ftp/cmds.c 25 May 2016 15:36:01 -0000 1.77
+++ usr.bin/ftp/cmds.c 14 Aug 2016 07:46:47 -0000
@@ -1501,14 +1501,14 @@ cdup(int argc, char *argv[])
void
restart(int argc, char *argv[])
{
- quad_t nrestart_point;
+ off_t nrestart_point;
char *ep;
if (argc != 2)
fputs("restart: offset not specified.\n", ttyout);
else {
- nrestart_point = strtoq(argv[1], &ep, 10);
- if (nrestart_point == QUAD_MAX || *ep != '\0')
+ nrestart_point = strtoll(argv[1], &ep, 10);
+ if (nrestart_point == LLONG_MAX || *ep != '\0')
fputs("restart: invalid offset.\n", ttyout);
else {
fprintf(ttyout, "Restarting at %lld. Execute get, put "
@@ -1652,7 +1652,8 @@ newer(int argc, char *argv[])
void
page(int argc, char *argv[])
{
- int orestart_point, ohash, overbose;
+ off_t orestart_point;
+ int ohash, overbose;
char *p, *pager, *oldargv1;
if ((argc < 2 && !another(&argc, &argv, "file")) || argc > 2) {
Index: usr.bin/ftp/util.c
===================================================================
RCS file: /data/src/openbsd/src/usr.bin/ftp/util.c,v
retrieving revision 1.78
diff -u -p -r1.78 util.c
--- usr.bin/ftp/util.c 28 Jul 2016 21:37:45 -0000 1.78
+++ usr.bin/ftp/util.c 14 Aug 2016 07:43:16 -0000
@@ -580,7 +580,7 @@ remotesize(const char *file, int noisy)
cp = strchr(reply_string, ' ');
if (cp != NULL) {
cp++;
- size = strtoq(cp, &ep, 10);
+ size = strtoll(cp, &ep, 10);
if (*ep != '\0' && !isspace((unsigned char)*ep))
size = -1;
}
Index: usr.sbin/memconfig/memconfig.c
===================================================================
RCS file: /data/src/openbsd/src/usr.sbin/memconfig/memconfig.c,v
retrieving revision 1.17
diff -u -p -r1.17 memconfig.c
--- usr.sbin/memconfig/memconfig.c 21 Dec 2015 21:37:09 -0000 1.17
+++ usr.sbin/memconfig/memconfig.c 14 Aug 2016 07:48:45 -0000
@@ -178,7 +178,7 @@ listfunc(int memfd, int argc, char *argv
continue;
if (owner && strcmp(mrd[i].mr_owner, owner))
continue;
- printf("%qx/%qx %.8s ", mrd[i].mr_base, mrd[i].mr_len,
+ printf("%llx/%llx %.8s ", mrd[i].mr_base, mrd[i].mr_len,
mrd[i].mr_owner[0] ? mrd[i].mr_owner : "-");
for (j = 0; j < 32; j++) {
if ( ((1<<j) & mrd[i].mr_flags) == 0)
@@ -213,12 +213,12 @@ setfunc(int memfd, int argc, char *argv[
while ((ch = getopt(argc, argv, "b:l:o:")) != -1)
switch(ch) {
case 'b':
- mrd.mr_base = strtouq(optarg, &ep, 0);
+ mrd.mr_base = strtoull(optarg, &ep, 0);
if ((ep == optarg) || (*ep != 0))
help("set");
break;
case 'l':
- mrd.mr_len = strtouq(optarg, &ep, 0);
+ mrd.mr_len = strtoull(optarg, &ep, 0);
if ((ep == optarg) || (*ep != 0))
help("set");
break;
@@ -272,14 +272,14 @@ clearfunc(int memfd, int argc, char *arg
while ((ch = getopt(argc, argv, "b:l:o:")) != -1)
switch(ch) {
case 'b':
- mrd.mr_base = strtouq(optarg, &ep, 0);
+ mrd.mr_base = strtoull(optarg, &ep, 0);
if ((ep == optarg) || (*ep != 0))
help("clear");
else
got_base = 1;
break;
case 'l':
- mrd.mr_len = strtouq(optarg, &ep, 0);
+ mrd.mr_len = strtoull(optarg, &ep, 0);
if ((ep == optarg) || (*ep != 0))
help("clear");
break;
Index: usr.sbin/mtree/spec.c
===================================================================
RCS file: /data/src/openbsd/src/usr.sbin/mtree/spec.c,v
retrieving revision 1.26
diff -u -p -r1.26 spec.c
--- usr.sbin/mtree/spec.c 8 Jul 2012 21:19:42 -0000 1.26
+++ usr.sbin/mtree/spec.c 14 Aug 2016 07:38:44 -0000
@@ -241,7 +241,7 @@ set(char *t, NODE *ip)
error("%s", strerror(errno));
break;
case F_SIZE:
- ip->st_size = strtouq(val, &ep, 10);
+ ip->st_size = strtoull(val, &ep, 10);
if (*ep)
error("invalid size %s", val);
break;
Index: usr.sbin/rmt/rmt.c
===================================================================
RCS file: /data/src/openbsd/src/usr.sbin/rmt/rmt.c,v
retrieving revision 1.19
diff -u -p -r1.19 rmt.c
--- usr.sbin/rmt/rmt.c 4 Nov 2015 21:27:03 -0000 1.19
+++ usr.sbin/rmt/rmt.c 14 Aug 2016 07:43:39 -0000
@@ -209,7 +209,7 @@ top:
getstring(count, sizeof(count));
getstring(pos, sizeof(pos));
DEBUG2("rmtd: L %s %s\n", count, pos);
- orval = lseek(tape, strtoq(count, NULL, 0), atoi(pos));
+ orval = lseek(tape, strtoll(count, NULL, 0), atoi(pos));
if (orval == -1)
goto ioerror;
goto respond;