summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-22 19:38:46 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2006-03-22 19:38:46 +0000
commit8e46cd9849fdce1233a4232e4fba1533ff7207ee (patch)
tree65e15b1a056a286b53dc9828d59288b03944182d /usr.bin
parent97fa21b33f35ad11a93f7761afd37bab48787dea (diff)
use strtonum() instead of home-grown balony; ok otto
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/vgrind/vfontedpr.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c
index 3daec353ab4..e78ebe949ea 100644
--- a/usr.bin/vgrind/vfontedpr.c
+++ b/usr.bin/vgrind/vfontedpr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfontedpr.c,v 1.9 2003/06/03 02:56:21 millert Exp $ */
+/* $OpenBSD: vfontedpr.c,v 1.10 2006/03/22 19:38:45 deraadt Exp $ */
/* $NetBSD: vfontedpr.c,v 1.7 1998/12/19 23:41:53 christos Exp $ */
/*
@@ -40,11 +40,12 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: vfontedpr.c,v 1.9 2003/06/03 02:56:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: vfontedpr.c,v 1.10 2006/03/22 19:38:45 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <sys/stat.h>
+#include <sys/limits.h>
#include <time.h>
#include <ctype.h>
#include <stdlib.h>
@@ -185,10 +186,11 @@ main(int argc, char *argv[])
/* specify the font size */
if (!strncmp(argv[0], "-s", 2)) {
- i = 0;
- cp = argv[0] + 2;
- while (*cp)
- i = i * 10 + (*cp++ - '0');
+ const char *errstr;
+
+ i = (int)strtonum(argv[0] + 2, 0, UINT_MAX, &errstr);
+ if (errstr)
+ perror(argv[0]);
printf("'ps %d\n'vs %d\n", i, i+1);
argc--, argv++;
continue;