--- a/optparser.h Mon Feb 16 18:09:03 2004 +0100 +++ b/optparser.h Mon Feb 16 18:50:28 2004 +0100 @@ -16,67 +16,67 @@ #define OPT_ID_NOSHORT_FLAG 0x10000 #define OPT_ID_RESERVED_FLAG 0x20000 -#define OPT_ID(X) ((X)|OPT_ID_NOSHORT_FLAG) -#define OPT_ID_RESERVED(X) ((X)|OPT_ID_RESERVED_FLAG) +#define OPT_ID(X) ((X)|OPT_ID_NOSHORT_FLAG) +#define OPT_ID_RESERVED(X) ((X)|OPT_ID_RESERVED_FLAG) /* OPTP_CHAIN is the normal behavior, i.e. single-letter options can be - * "chained" together: 'lr -lR'. Use for normal command line programs. + * "chained" together: 'lr -lR'. Use for normal command line programs. * OPTP_MIDLONG allows '-display foo' -like args but disables chaining - * of single-letter options. X programs should probably use this. + * of single-letter options. X programs should probably use this. * OPTP_IMMEDIATE allows immediate arguments (-I/usr/include) (and disables - * chaining and midlong options). + * chaining and midlong options). * OPTP_NO_DASH is the same as OPTP_CHAIN but allows the dash to be omitted - * for 'tar xzf foo' -like behavior. + * for 'tar xzf foo' -like behavior. * Long '--foo=bar' options are supported in all of the modes. */ enum{ - OPTP_CHAIN=0, - OPTP_DEFAULT=0, - OPTP_MIDLONG=1, - OPTP_IMMEDIATE=2, - OPTP_NO_DASH=3 + OPTP_CHAIN=0, + OPTP_DEFAULT=0, + OPTP_MIDLONG=1, + OPTP_IMMEDIATE=2, + OPTP_NO_DASH=3 }; - + enum{ - OPT_ARG=1, /* option has an argument */ - OPT_OPT_ARG=3 /* option may have an argument */ + OPT_ARG=1, /* option has an argument */ + OPT_OPT_ARG=3 /* option may have an argument */ }; #define END_OPTPARSEROPTS {0, NULL, 0, NULL, NULL} typedef struct _OptParserOpt{ - int optid; - const char *longopt; - int flags; - const char *argname; - const char *descr; + int optid; + const char *longopt; + int flags; + const char *argname; + const char *descr; } OptParserOpt; typedef struct _OptParserCommonInfo{ - const char *version; - const char *usage_tmpl; - const char *about; + const char *version; + const char *usage_tmpl; + const char *about; } OptParserCommonInfo; enum{ - OPT_ID_END=0, - OPT_ID_ARGUMENT=1, + OPT_ID_END=0, + OPT_ID_ARGUMENT=1, - E_OPT_INVALID_OPTION=-1, - E_OPT_INVALID_CHAIN_OPTION=-2, - E_OPT_SYNTAX_ERROR=-3, - E_OPT_MISSING_ARGUMENT=-4, - E_OPT_UNEXPECTED_ARGUMENT=-5 + E_OPT_INVALID_OPTION=-1, + E_OPT_INVALID_CHAIN_OPTION=-2, + E_OPT_SYNTAX_ERROR=-3, + E_OPT_MISSING_ARGUMENT=-4, + E_OPT_UNEXPECTED_ARGUMENT=-5 }; extern void optparser_init(int argc, char *const argv[], int mode, - const OptParserOpt *opts, - const OptParserCommonInfo *cinfo); + const OptParserOpt *opts, + const OptParserCommonInfo *cinfo); extern int optparser_get_opt(); extern const char* optparser_get_arg();