/* -*-c-*-
*
- * $Id: mdwopt.h,v 1.1 1999/05/05 19:23:47 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 --------------------------------------------------*
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
- * License along with `mdwopt'; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ * License along with `mdwopt'; if not, write to the Free
+ * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
+ * MA 02111-1307, USA.
*/
/*----- Revision history --------------------------------------------------*
*
* $Log: mdwopt.h,v $
- * Revision 1.1 1999/05/05 19:23:47 mdw
- * Initial revision
+ * 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.
+ *
+ * Revision 1.2 1999/05/13 22:57:23 mdw
+ * Change `-ise' to `-ize' throughout.
+ *
+ * Revision 1.1.1.1 1999/05/05 19:23:47 mdw
+ * New import. The old CVS repository was lost in a disk disaster.
*
* --- Previous lives ---
*
/* --- @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 ---------------------------------------------------------*/
* usually done by using a `%|+|%' instead of a `%|-|%' to
* introduce the option.
*
- * Long options, as popularised by the GNU utilities, are given
+ * Long options, as popularized by the GNU utilities, are given
* long-ish memorable names, preceded by a double-dash `%|--|%'.
* Since their names are more than a single character, long
* options can't be combined in the same way as short options.