/* -*-c-*-
*
- * $Id: mdwopt.h,v 1.3 1999/05/14 18:51:42 mdw Exp $
+ * $Id: mdwopt.h,v 1.5 1999/05/19 20:23:59 mdw Exp $
*
* Options parsing, similar to GNU @getopt_long@
*
- * (c) 1996 Mark Wooding
+ * (c) 1996 Straylight/Edgeware
*/
/*----- Licensing notice --------------------------------------------------*
/*----- Revision history --------------------------------------------------*
*
* $Log: mdwopt.h,v $
+ * Revision 1.5 1999/05/19 20:23:59 mdw
+ * Change naming to match newer mLib conventions.
+ *
+ * Revision 1.4 1999/05/15 10:25:38 mdw
+ * Fix copyright information.
+ *
* Revision 1.3 1999/05/14 18:51:42 mdw
* Reformat the LGPL notice slightly.
*
/* --- @mdwopt_data@ --- *
*
* Contains all the information needed by the @mdwopt@ routine to do its
- * work.
+ * work. Try not to use @prog@ any more. If you're using mLib, the @quis@/
+ * @ego@ interface works better.
*/
typedef struct {
+
/* --- Public variables --- */
char *arg; /* Arg of current option, or 0 */
/* --- New style flag names --- */
enum {
- gFlag_argReq = 1, /* Required argument */
- gFlag_argOpt = 2, /* Optional argument */
- gFlag_switch = 4, /* OR val into flag, don't store */
- gFlag_negate = 8, /* Allow long option to be negated */
- gFlag__last_long_opt_flag = 0 /* Dummy value */
+ OPTF_ARGREQ = 1, /* Required argument */
+ OPTF_ARGOPT = 2, /* Optional argument */
+ OPTF_SWITCH = 4, /* OR val into flag, don't store */
+ OPTF_NEGATE = 8 /* Allow long option to be negated */
+};
+
+enum {
+ OPTF_NOLONGS = 1, /* Don't read long options */
+ OPTF_NOSHORTS = 2, /* Don't read short options */
+ OPTF_NUMBERS = 4, /* Read numeric options */
+ OPTF_NEGATION = 8, /* Allow `%|+|%' for negations */
+ OPTF_ENVVAR = 16, /* Parse options from env var */
+ OPTF_NOPROGNAME = 32, /* Don't set @optprog@ */
+ OPTF_NEGNUMBER = 64 /* Allow negated number options */
+};
+
+enum {
+ OPTF_NEGATED = 256 /* Option flag was negated by user */
+};
+
+/* --- Older new-style names --- */
+
+enum {
+ gFlag_argReq = 1, gFlag_argOpt = 2, gFlag_switch = 4, gFlag_negate = 8
};
enum {
- gFlag_noLongs = 1, /* Don't read long options */
- gFlag_noShorts = 2, /* Don't read short options */
- gFlag_numbers = 4, /* Read numeric options */
- gFlag_negation = 8, /* Allow `%|+|%' for negations */
- gFlag_envVar = 16, /* Parse options from env var */
- gFlag_noProgName = 32, /* Don't set @optprog@ */
- gFlag_negNumber = 64, /* Allow negated number options */
- gFlag__last_mdwopt_flag = 0 /* Dummy value */
+ gFlag_noLongs = 1, gFlag_noShorts = 2, gFlag_numbers = 4,
+ gFlag_negation = 8, gFlag_envVar = 16, gFlag_noProgName = 32,
+ gFlag_negNumber = 64
};
enum {
- gFlag_negated = 256, /* Option flag was negated by user */
- gFlag__last_return_flag = 0 /* Dummy value */
+ gFlag_negated = 256
};
/*----- Main code ---------------------------------------------------------*/