include/libtu/optparser.h

changeset 12
5fd153b29d40
parent 9
55e7f2ff6021
child 34
828f3afd5c76
--- a/include/libtu/optparser.h	Sat May 20 17:43:36 2000 +0200
+++ b/include/libtu/optparser.h	Sun May 21 17:33:48 2000 +0200
@@ -11,8 +11,11 @@
 #include "types.h"
 
 
-#define OPT_ID(X)			((X)|0x10000)
-#define OPT_ID_RESERVED(X)	((X)|0x20000)
+#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)
 
 /* OPTP_CHAIN is the normal behavior, i.e. single-letter options can be
  *		"chained" together: 'lr -lR'. Use for normal command line programs.
@@ -27,6 +30,7 @@
 
 enum{
 	OPTP_CHAIN=0,
+	OPTP_DEFAULT=0,
 	OPTP_MIDLONG=1,
 	OPTP_IMMEDIATE=2,
 	OPTP_NO_DASH=3
@@ -38,13 +42,22 @@
 };
 
 
-typedef struct{
+typedef struct _OptParserOpt{
 	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;
+} OptParserCommonInfo;
+
+
 enum{
 	OPT_ID_END=0,
 	OPT_ID_ARGUMENT=1,
@@ -58,7 +71,9 @@
 
 
 extern void optparser_init(int argc, char *const argv[], int mode,
-						   const OptParserOpt *opts);
+						   const OptParserOpt *opts,
+						   const OptParserCommonInfo *cinfo);
+
 extern int  optparser_get_opt();
 extern const char* optparser_get_arg();
 extern void optparser_print_error();

mercurial