diff options
author | Erik Troan <ewt@src.gnome.org> | 1997-01-30 20:04:11 +0000 |
---|---|---|
committer | Erik Troan <ewt@src.gnome.org> | 1997-01-30 20:04:11 +0000 |
commit | d8741588589769b5773c544580171f62a5d8e6c5 (patch) | |
tree | cb16f915ac627f8ace99fa3436ea8ade3a568acf /support | |
parent | 35feb966b7490c06b27414cc619febe5b30e94e7 (diff) | |
download | gnome-common-d8741588589769b5773c544580171f62a5d8e6c5.tar.gz |
svn path=/trunk/; revision=6
Diffstat (limited to 'support')
-rw-r--r-- | support/popt.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/support/popt.c b/support/popt.c index 930cc5e..281cd35 100644 --- a/support/popt.c +++ b/support/popt.c @@ -40,7 +40,7 @@ poptContext poptGetContext(char * name ,int argc, char ** argv, con->os->currAlias = NULL; con->os->next = 1; /* skip argv[0] */ - con->leftovers = malloc(sizeof(char *) * argc); + con->leftovers = malloc(sizeof(char *) * (argc + 1)); con->numLeftovers = 0; con->nextLeftover = 0; con->restLeftover = 0; @@ -214,6 +214,10 @@ char * poptPeekArg(poptContext con) { char ** poptGetArgs(poptContext con) { if (con->numLeftovers == con->nextLeftover) return NULL; + + /* some apps like [like RPM ;-) ] need this NULL terminated */ + con->leftovers[con->numLeftovers] = NULL; + return (con->leftovers + con->nextLeftover); } |