ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/badarg.c
Revision: 2.3
Committed: Tue Feb 25 02:47:21 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R5
Changes since 2.2: +1 -56 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

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