chiark
/
gitweb
/
~mdw
/
runlisp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Lots of reformatting. Spurious wing comments expunged.
[runlisp]
/
mdwopt.h
diff --git
a/mdwopt.h
b/mdwopt.h
index 1fe79c25e02ab7a61277a54523116f490564004d..02e84ab7b0c507f4b72f2f2fabe8061c0bba3985 100644
(file)
--- a/
mdwopt.h
+++ b/
mdwopt.h
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mdwopt.h,v 1.
5 1999/05/19 20:23:59
mdw Exp $
+ * $Id: mdwopt.h,v 1.
7 1999/08/19 18:35:10
mdw Exp $
*
* Options parsing, similar to GNU @getopt_long@
*
*
* Options parsing, similar to GNU @getopt_long@
*
@@
-30,6
+30,13
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mdwopt.h,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mdwopt.h,v $
+ * Revision 1.7 1999/08/19 18:35:10 mdw
+ * Add a couple more flag constants.
+ *
+ * Revision 1.6 1999/05/20 23:00:30 mdw
+ * Carry through changes to the interface properly in the documentation.
+ * Other little formatting things.
+ *
* Revision 1.5 1999/05/19 20:23:59 mdw
* Change naming to match newer mLib conventions.
*
* Revision 1.5 1999/05/19 20:23:59 mdw
* Change naming to match newer mLib conventions.
*
@@
-143,8
+150,10
@@
enum {
/* --- New style flag names --- */
enum {
/* --- New style flag names --- */
enum {
+ OPTF_NOARG = 0 /* No argument */
OPTF_ARGREQ = 1, /* Required argument */
OPTF_ARGOPT = 2, /* Optional 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 */
};
OPTF_SWITCH = 4, /* OR val into flag, don't store */
OPTF_NEGATE = 8 /* Allow long option to be negated */
};
@@
-333,7
+342,7
@@
enum {
* the caller. A pointer to an argument is stored in
* @data->arg@, or @NULL@ is stored if there was no argument.
* If a negated option was found, the option character is
* the caller. A pointer to an argument is stored in
* @data->arg@, or @NULL@ is stored if there was no argument.
* If a negated option was found, the option character is
- * returned ORred with @
gFlag_negated
@ (bit 8 set).
+ * returned ORred with @
OPTF_NEGATED
@ (bit 8 set).
*
* Long options are described in a table. Each entry in the
* table is of type @struct option@, and the table is terminated
*
* Long options are described in a table. Each entry in the
* table is of type @struct option@, and the table is terminated
@@
-351,9
+360,9
@@
enum {
* table entry. If @flag@ is nonzero, it points to an integer
* to be modified by mdwopt. Usually the value in the @val@
* field is simply stored in the @flag@ variable. If the flag
* table entry. If @flag@ is nonzero, it points to an integer
* to be modified by mdwopt. Usually the value in the @val@
* field is simply stored in the @flag@ variable. If the flag
- * @
gFlag_switch
@ is set, however, the value is combined with
+ * @
OPTF_SWITCH
@ is set, however, the value is combined with
* the existing value of the flags using a bitwise OR. If
* the existing value of the flags using a bitwise OR. If
- * @
gFlag_negate
@ is set, then the flag bit will be cleared if a
+ * @
OPTF_NEGATE
@ is set, then the flag bit will be cleared if a
* matching negated long option is found. The value 0 is
* returned.
*
* matching negated long option is found. The value 0 is
* returned.
*
@@
-366,11
+375,12
@@
enum {
* Numeric options, if enabled, cause the value `%|#|%' to be
* returned, and the numeric value to be stored in @data->opt@.
*
* Numeric options, if enabled, cause the value `%|#|%' to be
* returned, and the numeric value to be stored in @data->opt@.
*
- * If the flag @
gFlag_envVar
@ is set on entry, options will be
+ * If the flag @
OPTF_ENVVAR
@ is set on entry, options will be
* extracted from an environment variable whose name is built by
* extracted from an environment variable whose name is built by
- * capitali
s
ing all the letters of the program's name. (This
+ * capitali
z
ing all the letters of the program's name. (This
* allows a user to have different default settings for a
* allows a user to have different default settings for a
- * program, by calling it through different symbolic links.) */
+ * program, by calling it through different symbolic links.)
+ */
extern int mdwopt(int /*argc*/, char *const */*argv*/,
const char */*shortopt*/,
extern int mdwopt(int /*argc*/, char *const */*argv*/,
const char */*shortopt*/,
@@
-379,10
+389,10
@@
extern int mdwopt(int /*argc*/, char *const */*argv*/,
/* --- Macros for more commonly used routines --- */
/* --- Macros for more commonly used routines --- */
-#define getopt(c, v, o) mdwopt(c, v, o, 0, 0, 0,
gFlag_noLongs
)
+#define getopt(c, v, o) mdwopt(c, v, o, 0, 0, 0,
OPTF_NOLONGS
)
#define getopt_long(c, v, o, l, li) mdwopt(c, v, o, l, li, 0, 0)
#define getopt_long_only(c, v, o, l, li) \
#define getopt_long(c, v, o, l, li) mdwopt(c, v, o, l, li, 0, 0)
#define getopt_long_only(c, v, o, l, li) \
- mdwopt(c, v, o, l, li, 0,
gFlag_noShorts
)
+ mdwopt(c, v, o, l, li, 0,
OPTF_NOSHORTS
)
#ifdef __cplusplus
}
#ifdef __cplusplus
}