ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/mgflib/badarg.c
Revision: 1.4
Committed: Tue Feb 22 15:58:41 2011 UTC (13 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +1 -1 lines
State: FILE REMOVED
Error occurred while calculating annotation data.
Log Message:
Finish of code reorg, moving MGF library into src/cv and src/common

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id: badarg.c,v 1.3 2003/11/15 17:54:06 schorsch 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 }