diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-14 18:34:49 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2016-08-14 18:34:49 +0000 |
commit | 3f655d51d173e28f51350a362ca11460660bc20f (patch) | |
tree | ca0d8805f2a1e76176a7633fddd1071a96673d55 | |
parent | 9045d5e4e07d30d5b9e6e2f4b9f0db20f306ca4e (diff) |
Convert remaining calls to strtoq/strtouq in base with strtoll/strtoull.
Fix a type mismatch in ftp's "page" command and could make transfers restart
at the wrong position.
ok and a ull->ll tweak from natano@, ok tedu@
-rw-r--r-- | games/factor/factor.c | 6 | ||||
-rw-r--r-- | usr.bin/cmp/cmp.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/cmds.c | 11 | ||||
-rw-r--r-- | usr.bin/ftp/util.c | 4 | ||||
-rw-r--r-- | usr.sbin/memconfig/memconfig.c | 12 | ||||
-rw-r--r-- | usr.sbin/mtree/spec.c | 4 | ||||
-rw-r--r-- | usr.sbin/rmt/rmt.c | 4 |
7 files changed, 24 insertions, 23 deletions
diff --git a/games/factor/factor.c b/games/factor/factor.c index 4b00a043207..4c1cfd4150e 100644 --- a/games/factor/factor.c +++ b/games/factor/factor.c @@ -1,4 +1,4 @@ -/* $OpenBSD: factor.c,v 1.28 2016/07/11 18:30:21 tb Exp $ */ +/* $OpenBSD: factor.c,v 1.29 2016/08/14 18:34:48 guenther Exp $ */ /* $NetBSD: factor.c,v 1.5 1995/03/23 08:28:07 cgd Exp $ */ /* @@ -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') diff --git a/usr.bin/cmp/cmp.c b/usr.bin/cmp/cmp.c index 82a9c4b898f..58f6758ece0 100644 --- a/usr.bin/cmp/cmp.c +++ b/usr.bin/cmp/cmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmp.c,v 1.14 2015/12/29 19:04:46 gsoares Exp $ */ +/* $OpenBSD: cmp.c,v 1.15 2016/08/14 18:34:48 guenther Exp $ */ /* $NetBSD: cmp.c,v 1.7 1995/09/08 03:22:56 tls Exp $ */ /* @@ -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)) { diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index 9fdd8d25655..031a111a46e 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.77 2016/05/25 15:36:01 krw Exp $ */ +/* $OpenBSD: cmds.c,v 1.78 2016/08/14 18:34:48 guenther Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -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) { diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index 184a0a8b4f4..a2af0b49971 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.78 2016/07/28 21:37:45 tedu Exp $ */ +/* $OpenBSD: util.c,v 1.79 2016/08/14 18:34:48 guenther Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- @@ -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; } diff --git a/usr.sbin/memconfig/memconfig.c b/usr.sbin/memconfig/memconfig.c index 5f825c0872b..628675d4756 100644 --- a/usr.sbin/memconfig/memconfig.c +++ b/usr.sbin/memconfig/memconfig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: memconfig.c,v 1.17 2015/12/21 21:37:09 mmcc Exp $ */ +/* $OpenBSD: memconfig.c,v 1.18 2016/08/14 18:34:48 guenther Exp $ */ /*- * Copyright (c) 1999 Michael Smith <msmith@freebsd.org> @@ -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 *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("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; diff --git a/usr.sbin/mtree/spec.c b/usr.sbin/mtree/spec.c index f8caec2cb20..f74f9e7cf8c 100644 --- a/usr.sbin/mtree/spec.c +++ b/usr.sbin/mtree/spec.c @@ -1,5 +1,5 @@ /* $NetBSD: spec.c,v 1.6 1995/03/07 21:12:12 cgd Exp $ */ -/* $OpenBSD: spec.c,v 1.26 2012/07/08 21:19:42 naddy Exp $ */ +/* $OpenBSD: spec.c,v 1.27 2016/08/14 18:34:48 guenther Exp $ */ /*- * Copyright (c) 1989, 1993 @@ -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 = strtoll(val, &ep, 10); if (*ep) error("invalid size %s", val); break; diff --git a/usr.sbin/rmt/rmt.c b/usr.sbin/rmt/rmt.c index 8ea8c184c4f..e6cc762f2b0 100644 --- a/usr.sbin/rmt/rmt.c +++ b/usr.sbin/rmt/rmt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rmt.c,v 1.19 2015/11/04 21:27:03 tedu Exp $ */ +/* $OpenBSD: rmt.c,v 1.20 2016/08/14 18:34:48 guenther Exp $ */ /* * Copyright (c) 1983 Regents of the University of California. @@ -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; |