Back to index

radiance  4R0+20100331
Functions | Variables
badarg.c File Reference
#include <ctype.h>
#include <stdio.h>
#include "parser.h"

Go to the source code of this file.

Functions

int badarg (int ac, char **av, char *fl)

Variables

static const char RCSid [] = "$Id: badarg.c,v 1.3 2003/11/15 17:54:06 schorsch Exp $"

Function Documentation

int badarg ( int  ac,
char **  av,
char *  fl 
)

Definition at line 15 of file badarg.c.

{
       register int  i;

       if (fl == NULL)
              fl = "";             /* no arguments? */
       for (i = 1; *fl; i++,av++,fl++) {
              if (i > ac || *av == NULL)
                     return(-1);
              switch (*fl) {
              case 's':            /* string */
                     if (**av == '\0' || isspace(**av))
                            return(i);
                     break;
              case 'i':            /* integer */
                     if (!isintd(*av, " \t\r\n"))
                            return(i);
                     break;
              case 'f':            /* float */
                     if (!isfltd(*av, " \t\r\n"))
                            return(i);
                     break;
              default:             /* bad call! */
                     return(-1);
              }
       }
       return(0);           /* all's well */
}

Here is the call graph for this function:


Variable Documentation

const char RCSid[] = "$Id: badarg.c,v 1.3 2003/11/15 17:54:06 schorsch Exp $" [static]

Definition at line 2 of file badarg.c.