diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2006-04-25 05:45:21 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2006-04-25 05:45:21 +0000 |
commit | fbdaad4027577812d857e2365a1dc83a879384e5 (patch) | |
tree | 780e5af65ebb76836c04b57a0665422b3a708282 | |
parent | a16acc46edc2de105156e6e78405805b1c2e7aa5 (diff) |
two strtol calls that were begging to be converted to strtonum
-rw-r--r-- | usr.bin/ftp/cmds.c | 29 | ||||
-rw-r--r-- | usr.bin/ftp/cmdtab.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/complete.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/domacro.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/fetch.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/ftp.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/main.c | 6 | ||||
-rw-r--r-- | usr.bin/ftp/ruserpass.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/stringlist.c | 4 | ||||
-rw-r--r-- | usr.bin/ftp/util.c | 4 |
10 files changed, 34 insertions, 33 deletions
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c index eda879e1f2c..49a62bea422 100644 --- a/usr.bin/ftp/cmds.c +++ b/usr.bin/ftp/cmds.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmds.c,v 1.49 2005/10/12 06:50:42 otto Exp $ */ +/* $OpenBSD: cmds.c,v 1.50 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: cmds.c,v 1.49 2005/10/12 06:50:42 otto Exp $"; +static const char rcsid[] = "$OpenBSD: cmds.c,v 1.50 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ /* @@ -779,12 +779,13 @@ sethash(int argc, char *argv[]) else if (strcasecmp(argv[1], "off") == 0) hash = 0; else { - long nmark; - char *ep; + int nmark; + const char *errstr; - nmark = strtol(argv[1], &ep, 10); - if (nmark < 1 || nmark > INT_MAX || *ep != '\0') { - fprintf(ttyout, "%s: bad bytecount value.\n", argv[1]); + nmark = strtonum(argv[1], 1, INT_MAX, &errstr); + if (errstr) { + fprintf(ttyout, "bytecount value is %s: %s\n", + errstr, argv[1]); code = -1; return; } @@ -940,17 +941,17 @@ setdebug(int argc, char *argv[]) else if (strcasecmp(argv[1], "off") == 0) debug = 0; else { - char *ep; - long val; + const char *errstr; + int val; - val = strtol(argv[1], &ep, 10); - if (val < 0 || val > INT_MAX || *ep != '\0') { - fprintf(ttyout, "%s: bad debugging value.\n", - argv[1]); + val = strtonum(argv[1], 0, INT_MAX, &errstr); + if (errstr) { + fprintf(ttyout, "debugging value is %s: %s\n", + errstr, argv[1]); code = -1; return; } - debug = (int)val; + debug = val; } } else debug = !debug; diff --git a/usr.bin/ftp/cmdtab.c b/usr.bin/ftp/cmdtab.c index 72dcb1c7770..7f8f8abf005 100644 --- a/usr.bin/ftp/cmdtab.c +++ b/usr.bin/ftp/cmdtab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmdtab.c,v 1.19 2005/07/11 15:40:43 fgsch Exp $ */ +/* $OpenBSD: cmdtab.c,v 1.20 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: cmdtab.c,v 1.17 1997/08/18 10:20:17 lukem Exp $ */ /* @@ -31,7 +31,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: cmdtab.c,v 1.19 2005/07/11 15:40:43 fgsch Exp $"; +static const char rcsid[] = "$OpenBSD: cmdtab.c,v 1.20 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ #include <stdio.h> diff --git a/usr.bin/ftp/complete.c b/usr.bin/ftp/complete.c index 33620ccbf7f..e8232d92bf5 100644 --- a/usr.bin/ftp/complete.c +++ b/usr.bin/ftp/complete.c @@ -1,4 +1,4 @@ -/* $OpenBSD: complete.c,v 1.17 2004/09/16 04:39:16 deraadt Exp $ */ +/* $OpenBSD: complete.c,v 1.18 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */ /*- @@ -39,7 +39,7 @@ #ifndef SMALL #ifndef lint -static char rcsid[] = "$OpenBSD: complete.c,v 1.17 2004/09/16 04:39:16 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: complete.c,v 1.18 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint */ /* diff --git a/usr.bin/ftp/domacro.c b/usr.bin/ftp/domacro.c index 545691fef71..669b9f1b3fc 100644 --- a/usr.bin/ftp/domacro.c +++ b/usr.bin/ftp/domacro.c @@ -1,4 +1,4 @@ -/* $OpenBSD: domacro.c,v 1.11 2004/07/20 03:50:25 deraadt Exp $ */ +/* $OpenBSD: domacro.c,v 1.12 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: domacro.c,v 1.10 1997/07/20 09:45:45 lukem Exp $ */ /* @@ -31,7 +31,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: domacro.c,v 1.11 2004/07/20 03:50:25 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: domacro.c,v 1.12 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ #include <ctype.h> diff --git a/usr.bin/ftp/fetch.c b/usr.bin/ftp/fetch.c index d12341dc39a..730e69faf1e 100644 --- a/usr.bin/ftp/fetch.c +++ b/usr.bin/ftp/fetch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fetch.c,v 1.59 2006/04/03 21:05:14 uwe Exp $ */ +/* $OpenBSD: fetch.c,v 1.60 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: fetch.c,v 1.14 1997/08/18 10:20:20 lukem Exp $ */ /*- @@ -38,7 +38,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: fetch.c,v 1.59 2006/04/03 21:05:14 uwe Exp $"; +static const char rcsid[] = "$OpenBSD: fetch.c,v 1.60 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ /* diff --git a/usr.bin/ftp/ftp.c b/usr.bin/ftp/ftp.c index fe3cc035a1f..e3b2d022454 100644 --- a/usr.bin/ftp/ftp.c +++ b/usr.bin/ftp/ftp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftp.c,v 1.61 2006/02/16 07:41:01 pvalchev Exp $ */ +/* $OpenBSD: ftp.c,v 1.62 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: ftp.c,v 1.27 1997/08/18 10:20:23 lukem Exp $ */ /* @@ -60,7 +60,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: ftp.c,v 1.61 2006/02/16 07:41:01 pvalchev Exp $"; +static const char rcsid[] = "$OpenBSD: ftp.c,v 1.62 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ #include <sys/types.h> diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c index ca87d115d9b..7448ef9266b 100644 --- a/usr.bin/ftp/main.c +++ b/usr.bin/ftp/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.59 2005/09/21 22:31:47 fgsch Exp $ */ +/* $OpenBSD: main.c,v 1.60 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */ /* @@ -60,13 +60,13 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1985, 1989, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: main.c,v 1.59 2005/09/21 22:31:47 fgsch Exp $"; +static const char rcsid[] = "$OpenBSD: main.c,v 1.60 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ /* diff --git a/usr.bin/ftp/ruserpass.c b/usr.bin/ftp/ruserpass.c index de58d4f79ff..511f65d9973 100644 --- a/usr.bin/ftp/ruserpass.c +++ b/usr.bin/ftp/ruserpass.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ruserpass.c,v 1.18 2004/07/20 03:50:26 deraadt Exp $ */ +/* $OpenBSD: ruserpass.c,v 1.19 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: ruserpass.c,v 1.14 1997/07/20 09:46:01 lukem Exp $ */ /* @@ -35,7 +35,7 @@ static char sccsid[] = "@(#)ruserpass.c 8.4 (Berkeley) 4/27/95"; #else #ifndef SMALL -static char rcsid[] = "$OpenBSD: ruserpass.c,v 1.18 2004/07/20 03:50:26 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: ruserpass.c,v 1.19 2006/04/25 05:45:20 tedu Exp $"; #endif /* SMALL */ #endif #endif /* not lint */ diff --git a/usr.bin/ftp/stringlist.c b/usr.bin/ftp/stringlist.c index 3273c9229e3..28bba57c8df 100644 --- a/usr.bin/ftp/stringlist.c +++ b/usr.bin/ftp/stringlist.c @@ -1,4 +1,4 @@ -/* $OpenBSD: stringlist.c,v 1.6 2004/09/16 04:39:16 deraadt Exp $ */ +/* $OpenBSD: stringlist.c,v 1.7 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: stringlist.c,v 1.2 1997/01/17 07:26:20 lukem Exp $ */ /* @@ -33,7 +33,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) && !defined(SMALL) -static char *rcsid = "$OpenBSD: stringlist.c,v 1.6 2004/09/16 04:39:16 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: stringlist.c,v 1.7 2006/04/25 05:45:20 tedu Exp $"; #endif /* LIBC_SCCS and not lint and not SMALL */ #include <stdio.h> diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c index c8a419dbd85..cb37ac7ddcc 100644 --- a/usr.bin/ftp/util.c +++ b/usr.bin/ftp/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.41 2005/10/12 06:50:42 otto Exp $ */ +/* $OpenBSD: util.c,v 1.42 2006/04/25 05:45:20 tedu Exp $ */ /* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */ /*- @@ -71,7 +71,7 @@ */ #if !defined(lint) && !defined(SMALL) -static char rcsid[] = "$OpenBSD: util.c,v 1.41 2005/10/12 06:50:42 otto Exp $"; +static const char rcsid[] = "$OpenBSD: util.c,v 1.42 2006/04/25 05:45:20 tedu Exp $"; #endif /* not lint and not SMALL */ /* |