summaryrefslogtreecommitdiff
path: root/support/popt.c
diff options
context:
space:
mode:
authorMarc Ewing <marc@src.gnome.org>1997-11-02 22:49:50 +0000
committerMarc Ewing <marc@src.gnome.org>1997-11-02 22:49:50 +0000
commit2928c4e707104b312d1ab3e75e24c57e680313ce (patch)
tree933be0bb42a2f912d70e4c1e68246bda53ca7873 /support/popt.c
parent50e6e5c4f7b8b07d8c0487fd23113846e58c7479 (diff)
downloadshared-mime-info-2928c4e707104b312d1ab3e75e24c57e680313ce.tar.gz
Added POPT_KEEP_FIRST to cause popt to *not* ignore first arg.r5-0-4r2-4-99r2-4-12r2-4-11r2-4-102r2-4-101r2-4-100r2-4-10r2-4-treer-2-4-tree
svn path=/trunk/; revision=39
Diffstat (limited to 'support/popt.c')
-rw-r--r--support/popt.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/support/popt.c b/support/popt.c
index ead28da4..d75a5e12 100644
--- a/support/popt.c
+++ b/support/popt.c
@@ -29,6 +29,7 @@ struct poptContext_s {
char * appName;
struct poptAlias * aliases;
int numAliases;
+ int flags;
};
poptContext poptGetContext(char * name ,int argc, char ** argv,
@@ -41,7 +42,11 @@ poptContext poptGetContext(char * name ,int argc, char ** argv,
con->os->currAlias = NULL;
con->os->nextCharArg = NULL;
con->os->nextArg = NULL;
- con->os->next = 1; /* skip argv[0] */
+
+ if (flags & POPT_KEEP_FIRST)
+ con->os->next = 0; /* include argv[0] */
+ else
+ con->os->next = 1; /* skip argv[0] */
con->leftovers = malloc(sizeof(char *) * (argc + 1));
con->numLeftovers = 0;
@@ -50,6 +55,7 @@ poptContext poptGetContext(char * name ,int argc, char ** argv,
con->options = options;
con->aliases = NULL;
con->numAliases = 0;
+ con->flags = 0;
if (!name)
con->appName = NULL;