ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/badarg.c
Revision: 2.6
Committed: Fri Nov 14 17:22:06 2003 UTC (20 years, 5 months ago) by schorsch
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R7P2, rad3R7P1, rad4R1, rad4R0, rad3R6, rad3R6P1, rad3R8, rad3R9
Changes since 2.5: +6 -5 lines
Log Message:
Reduced compile warnings, and other compatibility fixes.

File Contents

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