ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/badarg.c
Revision: 1.2
Committed: Fri Feb 28 20:11:29 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 1.1: +1 -4 lines
Log Message:
Updates for 3.5 release

File Contents

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