1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00

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@
This commit is contained in:
guenther 2016-08-14 18:34:48 +00:00
parent 9a58b8c65c
commit f5cc6d1c3e
7 changed files with 24 additions and 23 deletions

View File

@ -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')

View File

@ -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)) {

View File

@ -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) {

View File

@ -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;
}

View File

@ -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;

View File

@ -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;

View File

@ -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;