ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/badarg.c
Revision: 1.1
Committed: Tue Jun 21 14:45:42 1994 UTC (29 years, 10 months ago) by greg
Content type: text/plain
Branch: MAIN
Log Message:
Initial revision

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1994 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     }