From: mdw Date: Sat, 20 Jan 2001 12:00:36 +0000 (+0000) Subject: Define flags with macros, to ensure unsignedness. X-Git-Tag: 1.2.8~7 X-Git-Url: https://git.distorted.org.uk/~mdw/cfd/commitdiff_plain/204877d534c15e5e17aa008b78e6efc50fd9a6e6 Define flags with macros, to ensure unsignedness. --- diff --git a/mdwopt.h b/mdwopt.h index 1205b7b..9a67426 100644 --- a/mdwopt.h +++ b/mdwopt.h @@ -1,6 +1,6 @@ /* -*-c-*- * - * $Id: mdwopt.h,v 1.8 1999/08/19 18:37:43 mdw Exp $ + * $Id: mdwopt.h,v 1.9 2001/01/20 12:00:36 mdw Exp $ * * Options parsing, similar to GNU @getopt_long@ * @@ -30,6 +30,9 @@ /*----- Revision history --------------------------------------------------* * * $Log: mdwopt.h,v $ + * Revision 1.9 2001/01/20 12:00:36 mdw + * Define flags with macros, to ensure unsignedness. + * * Revision 1.8 1999/08/19 18:37:43 mdw * Fix stupid error. * @@ -152,28 +155,22 @@ enum { /* --- New style flag names --- */ -enum { - OPTF_NOARG = 0, /* No argument */ - OPTF_ARGREQ = 1, /* Required argument */ - OPTF_ARGOPT = 2, /* Optional argument */ - OPTF_ARG = 3, /* Argument type bitmask */ - 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 */ -}; +#define OPTF_NOARG 0u /* No argument */ +#define OPTF_ARGREQ 1u /* Required argument */ +#define OPTF_ARGOPT 2u /* Optional argument */ +#define OPTF_ARG 3u /* Argument type bitmask */ +#define OPTF_SWITCH 4u /* OR val into flag, don't store */ +#define OPTF_NEGATE 8u /* Allow long option to be negated */ + +#define OPTF_NOLONGS 1u /* Don't read long options */ +#define OPTF_NOSHORTS 2u /* Don't read short options */ +#define OPTF_NUMBERS 4u /* Read numeric options */ +#define OPTF_NEGATION 8u /* Allow `%|+|%' for negations */ +#define OPTF_ENVVAR 16u /* Parse options from env var */ +#define OPTF_NOPROGNAME 32u /* Don't set @optprog@ */ +#define OPTF_NEGNUMBER 64u /* Allow negated number options */ + +#define OPTF_NEGATED 256u /* Option flag was negated by user */ /* --- Older new-style names --- */