diff options
author | ewt <ewt> | 1999-02-25 20:16:43 +0000 |
---|---|---|
committer | ewt <ewt> | 1999-02-25 20:16:43 +0000 |
commit | abc4fe8cdc8830e179c09d9f79ad86d5e4407a33 (patch) | |
tree | e654f1cd13188fe89f6df3050a95c226910705b9 /test1.c | |
parent | 90af7153ca36f70f07232c992be85c21076e83f1 (diff) | |
download | libpopt-abc4fe8cdc8830e179c09d9f79ad86d5e4407a33.tar.gz |
allow single dash arguments (to represent stdin)
Diffstat (limited to 'test1.c')
-rw-r--r-- | test1.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -24,6 +24,7 @@ int main(int argc, char ** argv) { int help = 0; int usage = 0; int shortopt = 0; + int singleDash = 0; struct poptOption moreCallbackArgs[] = { { NULL, '\0', POPT_ARG_CALLBACK | POPT_CBFLAG_INC_DATA, option_callback, 0, NULL }, @@ -53,6 +54,7 @@ int main(int argc, char ** argv) { "This shouldn't show up", NULL }, { "unused", '\0', POPT_ARG_STRING, NULL, 0, "Unused option for help testing", "UNUSED" }, + { NULL, '-', POPT_ARG_NONE | POPT_ARGFLAG_DOC_HIDDEN, &singleDash, 0 }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &moreArgs, 0, NULL }, { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &callbackArgs, 0, "Callback arguments" }, POPT_AUTOHELP @@ -85,6 +87,8 @@ int main(int argc, char ** argv) { fprintf(stdout, " inc: %d", inc); if (shortopt) fprintf(stdout, " short: %d", shortopt); + if (singleDash) + fprintf(stdout, " -", shortopt); rest = poptGetArgs(optCon); if (rest) { |