#ifndef GETOPT_H_INCLUDED #define GETOPT_H_INCLUDED /* -*- c: tabs: 4 -*- ****************************************************** * Module name : getopt.h * Module type : Core Service public header * Compiler(s) : ANSI C * Environment(s): n/a * * Description: * Option parsing (with long name support) * * Version Who Date Description 1.0 APY 07/05/98 Taken from prt source * * $Name: $ * $Source: /cvsroot/device/DEVL/UTILS/CMDFILE/getopt.h,v $ * $Revision: 1.1 $ $Date: 2002/08/02 06:49:27 $ $State: Exp $ * $Author: adamy $ $Locker: $ *............................................................................*/ #include "cdefs.h" /* * Global Variables * ---------------- */ extern int opterr; /* if error message should be printed */ extern int optind; /* index into parent argv vector */ extern int optlidx; /* index into long argument list */ extern int optopt; /* character checked for validity */ extern char *optarg; /* argument associated with option */ /* * Function Prototypes * ------------------- */ #define no_argument 0 #define required_argument 1 #define optional_argument 2 struct option { char *name; /* long argument name */ int has_arg; /* 0=no arg, 1=arg required, 2=optional arg */ int *flag; /* var with 'val' value upon detection */ int val; /* value return on detection */ }; __BEGIN_DECLS extern int getopt __P((int nargc, char *const *nargv, const char *ostr)); extern int getoptl __P((int nargc, char *const *nargv, const char *ostr, const struct option *lopt, int long_only)); extern int getopt_long __P((int nargc, char *const *nargv, const char *ostr, const struct option *lopts, int *longind)); extern int getopt_long_only __P((int nargc, char *const *nargv, const char *ostr, const struct option *lopts, int *longind)); __END_DECLS #endif /* GETOPT_H_INCLUDED */