ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/badarg.c
Revision: 1.2
Committed: Fri Nov 8 09:58:38 1991 UTC (32 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.1: +5 -3 lines
Log Message:
added acceptance of larger delimiter set

File Contents

# Content
1 /* Copyright (c) 1991 Regents of the University of California */
2
3 #ifndef lint
4 static char SCCSid[] = "$SunId$ LBL";
5 #endif
6
7 /*
8 * Check argument list against format string.
9 */
10
11 #include <ctype.h>
12
13 #define NULL 0
14
15 int
16 badarg(ac, av, fl) /* check argument list */
17 int ac;
18 register char **av;
19 register char *fl;
20 {
21 register int i;
22
23 if (fl == NULL)
24 fl = ""; /* no arguments? */
25 for (i = 1; *fl; i++,av++,fl++) {
26 if (i > ac || *av == NULL)
27 return(-1);
28 switch (*fl) {
29 case 's': /* string */
30 if (**av == '\0' || isspace(**av))
31 return(i);
32 break;
33 case 'i': /* integer */
34 if (!isintd(*av, " \t\r\n"))
35 return(i);
36 break;
37 case 'f': /* float */
38 if (!isfltd(*av, " \t\r\n"))
39 return(i);
40 break;
41 default: /* bad call! */
42 return(-1);
43 }
44 }
45 return(0); /* all's well */
46 }