ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/badarg.c
Revision: 1.3
Committed: Sat Nov 15 17:54:06 2003 UTC (20 years, 5 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R7P1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9, rad3R7P2
Changes since 1.2: +4 -2 lines
Log Message:
Continued ANSIfication and reduced compile warnings.

File Contents

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