diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1998-06-08 16:55:59 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1998-06-08 16:55:59 +0000 |
commit | cc9e6eaf80a144fd276a4d9b0efe8b4b191bb222 (patch) | |
tree | ce48ae6dcaacb6542457f5f31095679d97baeb68 /usr.bin | |
parent | 503cfb3b7d8ba1f4a1662a1ecb77832551c23278 (diff) |
Fix some problems noted by lukem@netbsd.org
o getopt string is wrong in main(); (missing : after P)
o use of vprintf(...) instead of vfprintf(ttyout,...) in ftp.c::command()
o missing \n in fputs in cmds.c::status()
o should use strtol() instead of atol()
o sometimes use 'NULL' instead of 'NUL' (in comments)
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/ftp/cmds.c | 28 | ||||
-rw-r--r-- | usr.bin/ftp/ftp.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/main.c | 6 |
3 files changed, 24 insertions, 16 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index aedb310027b..6524c49a3f5 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.26 1998/02/10 02:13:10 weingart Exp $ */ +/* $OpenBSD: cmds.c,v 1.27 1998/06/08 16:55:56 millert Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: cmds.c,v 1.26 1998/02/10 02:13:10 weingart Exp $"; +static char rcsid[] = "$OpenBSD: cmds.c,v 1.27 1998/06/08 16:55:56 millert Exp $"; #endif #endif /* not lint */ @@ -684,7 +684,7 @@ status(argc, argv) fprintf(ttyout, "Command line editing: %s.\n", onoff(editing)); #endif /* !SMALL */ if (macnum > 0) { - fputs("Macros:", ttyout); + fputs("Macros:\n", ttyout); for (i=0; i<macnum; i++) { fprintf(ttyout, "\t%s\n", macros[i].mac_name); } @@ -779,8 +779,8 @@ sethash(argc, argv) else if (strcasecmp(argv[1], "off") == 0) hash = 0; else { - int nmark = atol(argv[1]); - if (nmark < 1) { + long nmark = strtol(argv[1], NULL, 10); + if (nmark < 1 && nmark > INT_MAX) { fprintf(ttyout, "%s: bad bytecount value.\n", argv[1]); code = -1; return; @@ -1464,7 +1464,7 @@ quote1(initial, argc, argv) if (len >= sizeof(buf) - 1) break; - /* Copy next argument, NULL terminate always */ + /* Copy next argument, NUL terminate always */ strncpy(&buf[len], argv[i], sizeof(buf) - len - 1); buf[sizeof(buf) - 1] = '\0'; @@ -1473,7 +1473,7 @@ quote1(initial, argc, argv) } } - /* Make double (tripple?) sure the sucker is NULL terminated */ + /* Make double (tripple?) sure the sucker is NUL terminated */ buf[sizeof(buf) - 1] = '\0'; if (command(buf) == PRELIM) { @@ -2011,13 +2011,21 @@ restart(argc, argv) int argc; char *argv[]; { + quad_t nrestart_point; + char *ep; if (argc != 2) fputs("restart: offset not specified.\n", ttyout); else { - restart_point = atol(argv[1]); - fprintf(ttyout, "Restarting at %qd. Execute get, put or append" - " to initiate transfer\n", (quad_t)restart_point); + restart_point = strtoq(argv[1], &ep, 10); + if (nrestart_point == QUAD_MAX || *ep != '\0') + fputs("restart: invalid offset.\n", ttyout); + else { + fprintf(ttyout, "Restarting at %qd. Execute get, put or" + "append to initiate transfer\n", + nrestart_point); + restart_point = nrestart_point; + } } } diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index a70179ded88..d2b3da5c394 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp.c,v 1.27 1998/05/13 10:42:35 deraadt Exp $ */ +/* $OpenBSD: ftp.c,v 1.28 1998/06/08 16:55:57 millert Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)ftp.c 8.6 (Berkeley) 10/27/94"; #else -static char rcsid[] = "$OpenBSD: ftp.c,v 1.27 1998/05/13 10:42:35 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: ftp.c,v 1.28 1998/06/08 16:55:57 millert Exp $"; #endif #endif /* not lint */ @@ -239,7 +239,7 @@ command(va_alist) else if (strncmp("ACCT ", fmt, 5) == 0) fputs("ACCT XXXX", ttyout); else - vprintf(fmt, ap); + vfprintf(ttyout, fmt, ap); va_end(ap); putc('\n', ttyout); (void)fflush(ttyout); diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index ed508d90682..a6315217329 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.39 1998/05/13 08:59:08 deraadt Exp $ */ +/* $OpenBSD: main.c,v 1.40 1998/06/08 16:55:58 millert Exp $ */ /* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */ /* @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.39 1998/05/13 08:59:08 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.40 1998/06/08 16:55:58 millert Exp $"; #endif #endif /* not lint */ @@ -171,7 +171,7 @@ main(argc, argv) if (isatty(fileno(ttyout)) && !dumb_terminal && foregroundproc()) progress = 1; /* progress bar on if tty is usable */ - while ((ch = getopt(argc, argv, "Aadegino:pPr:tvV")) != -1) { + while ((ch = getopt(argc, argv, "Aadegino:pP:r:tvV")) != -1) { switch (ch) { case 'A': activefallback = 0; |