aboutsummaryrefslogtreecommitdiffstats
path: root/man0
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-11-14 23:07:52 +0100
committerMattias Andrée <maandree@kth.se>2018-11-14 23:07:52 +0100
commit548a358df5654e653329f2c9033ef94aeaa143ad (patch)
tree5ae1a435ee78a55ea68c25315044a1e052b62328 /man0
parentDocument libsimple-arg.h and add support optional arguments on long options and add KEEP_DASHDASH to ARGBEGIN3 (now named ARGBEGIN4) (diff)
downloadlibsimple-548a358df5654e653329f2c9033ef94aeaa143ad.tar.gz
libsimple-548a358df5654e653329f2c9033ef94aeaa143ad.tar.bz2
libsimple-548a358df5654e653329f2c9033ef94aeaa143ad.tar.xz
Some fixes to libsimple-arg.h, test everything except long arguments, and fix some man pages
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'man0')
-rw-r--r--man0/libsimple-arg.h.054
1 files changed, 24 insertions, 30 deletions
diff --git a/man0/libsimple-arg.h.0 b/man0/libsimple-arg.h.0
index 842f816..550eddd 100644
--- a/man0/libsimple-arg.h.0
+++ b/man0/libsimple-arg.h.0
@@ -13,21 +13,21 @@ struct longopt {
int with_arg;
};
-#define ARGBEGIN ARGBEGIN4(1, 1, argc, argv)
-#define SUBARGBEGIN ARGBEGIN4(0, 1, argc, argv)
-#define ARGBEGIN4(\fIWITH_ARGV0\fP, \fIKEEP_DASHDASH\fP, \fIargc\fP, \fIargv\fP) /* implementation omitted */
-#define ARGMAPLONG(\fILONGOPTS\fP) /* implementation omitted */
-#define ARGALT(\fISYMBOL\fP) /* implementation omitted */
-#define ARGEND /* implementation omitted */
-#define ARGNUM /* implementation omitted */
-#define FLAG() /* implementation omitted */
-#define LFLAG() /* implementation omitted */
-#define ARG() /* implementation omitted */
-#define ARGHERE() /* implementation omitted */
-#define NOFLAGS(...) /* implementation omitted */
-#define TESTLONG(\fIFLG\fP, \fIWARG\fP) /* implementation omitted */
-#define USAGE(\fISYNOPSIS\fP) /* implementation omitted */
-#define NUSAGE(\fISTATUS\fP, \fISYNOPSIS\fP) /* implementation omitted */
+#define ARGBEGIN ARGBEGIN2(1, 0)
+#define SUBARGBEGIN ARGBEGIN2(0, 0)
+#define ARGBEGIN2(\fIWITH_ARGV0\fP, \fIKEEP_DASHDASH\fP) /* implementation omitted */
+#define ARGMAPLONG(\fILONGOPTS\fP) /* implementation omitted */
+#define ARGALT(\fISYMBOL\fP) /* implementation omitted */
+#define ARGEND /* implementation omitted */
+#define ARGNUM /* implementation omitted */
+#define FLAG() /* implementation omitted */
+#define LFLAG() /* implementation omitted */
+#define ARG() /* implementation omitted */
+#define ARGHERE() /* implementation omitted */
+#define NOFLAGS(...) /* implementation omitted */
+#define TESTLONG(\fIFLG\fP, \fIWARG\fP) /* implementation omitted */
+#define USAGE(\fISYNOPSIS\fP) /* implementation omitted */
+#define NUSAGE(\fISTATUS\fP, \fISYNOPSIS\fP) /* implementation omitted */
.fi
.SH DESCRIPTION
The
@@ -179,7 +179,7 @@ and
are set to only contain the remaining, unparsed, arguments.
.PP
The
-.BR ARGBEGIN4 ()
+.BR ARGBEGIN2 ()
macro can be used instead of the
.B ARGBEGIN
and
@@ -214,12 +214,6 @@ is encounted, and it becomes visible to the application
code, implement GNU behaviour by running the parsing
in a loop and stop when the application code sees
.BR -- .
-The
-.BR ARGBEGIN4 ()
-also lets the user choose which variables to use as
-.I argc
-and
-.IR argv .
.PP
If the application should support flags starting with
another symbol than a dash
@@ -394,18 +388,18 @@ macro shall be used directly in a
(or
.BR default )
for
-.IR ARGBEGIN ,
-.IR SUBARGBEGIN ,
+.BR ARGBEGIN ,
+.BR SUBARGBEGIN ,
or
-.IR ARGBEGIN4 ,
+.BR ARGBEGIN2 ,
and not inside a loop or inner
.BR switch ),
and in the next iteration of the argument parsing loop,
the flag will be the short flag consisting of the two
characters
-.B long_flag[0]
+.I long_flag[0]
and
-.B short_flag
+.I short_flag
(in that order). Example:
.nf
@@ -435,13 +429,13 @@ have to map entries, one where
ends with
.RB ' = '
and
-.B with_arg
+.I with_arg
is non-zero, and one where
-.B long_flag
+.I long_flag
does not end with
.RB ' = '
and
-.B with_arg
+.I with_arg
is zero. These
.I cannot
have the same