--- ray/src/common/badarg.c 1991/11/12 16:56:14 2.1 +++ ray/src/common/badarg.c 2014/02/28 21:03:40 2.8 @@ -1,41 +1,51 @@ -/* Copyright (c) 1991 Regents of the University of California */ - #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static const char RCSid[] = "$Id: badarg.c,v 2.8 2014/02/28 21:03:40 greg Exp $"; #endif - /* * Check argument list against format string. + * + * External symbols declared in rtio.h */ +#include "copyright.h" + #include -#define NULL 0 +#include "rtio.h" + int -badarg(ac, av, fl) /* check argument list */ -int ac; -register char **av; -register char *fl; +badarg( /* check argument list */ +int ac, +char **av, +char *fl +) { - register int i; + int i; + char *s; if (fl == NULL) fl = ""; /* no arguments? */ for (i = 1; *fl; i++,av++,fl++) { if (i > ac || *av == NULL) return(-1); + s = *av; switch (*fl) { case 's': /* string */ - if (**av == '\0' || isspace(**av)) + while (isspace(*s)) + ++s; + if (*s == '\0') return(i); + while (*s) + if (!isprint(*s++)) + return(i); break; case 'i': /* integer */ - if (!isintd(*av, " \t\r\n")) + if (!isintd(s, " \t\r\n")) return(i); break; case 'f': /* float */ - if (!isfltd(*av, " \t\r\n")) + if (!isfltd(s, " \t\r\n")) return(i); break; default: /* bad call! */