diff options
author | Nils Fuhrmann <nf@openoffice.org> | 2001-04-23 10:38:42 +0000 |
---|---|---|
committer | Nils Fuhrmann <nf@openoffice.org> | 2001-04-23 10:38:42 +0000 |
commit | c196af53e70d992168e64fda41ea35e85b372996 (patch) | |
tree | a368ea0d2f013b539b4bfd45af8aeceaeb6a339c /soltools/javadep | |
parent | Removed usage of getopt.lib (diff) | |
download | core-c196af53e70d992168e64fda41ea35e85b372996.tar.gz core-c196af53e70d992168e64fda41ea35e85b372996.zip |
Fixed core in simple_getopt when calling javadep without parameters
Diffstat (limited to 'soltools/javadep')
-rw-r--r-- | soltools/javadep/javadep.c | 48 |
1 files changed, 25 insertions, 23 deletions
diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c index 578453b478e0..7ee2fc290f5a 100644 --- a/soltools/javadep/javadep.c +++ b/soltools/javadep/javadep.c @@ -2,9 +2,9 @@ * * $RCSfile: javadep.c,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: hr $ $Date: 2001-04-23 10:20:56 $ + * last change: $Author: nf $ $Date: 2001-04-23 11:38:42 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -795,29 +795,31 @@ simple_getopt(int nargc, char *pargv[], const char *poptstring) char *parg = pargv[optind]; /* skip all response file arguments */ - while ( *parg == '@' ) - parg = pargv[++optind]; - - if ( parg[0] == '-' && parg[1] != '\0' ) { - char *popt; - int c = parg[1]; - if ( (popt = strchr(poptstring, c)) == NULL ) { - optopt = c; - if ( opterr ) - fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); - return '?'; - } - if ( *(++popt) == ':') { - if ( parg[2] != '\0' ) { - optarg = ++parg; + if ( parg ) { + while ( *parg == '@' ) + parg = pargv[++optind]; + + if ( parg[0] == '-' && parg[1] != '\0' ) { + char *popt; + int c = parg[1]; + if ( (popt = strchr(poptstring, c)) == NULL ) { + optopt = c; + if ( opterr ) + fprintf(stderr, "Unknown option character `\\x%x'.\n", optopt); + return '?'; + } + if ( *(++popt) == ':') { + if ( parg[2] != '\0' ) { + optarg = ++parg; + } else { + optarg = pargv[++optind]; + } } else { - optarg = pargv[++optind]; + optarg = NULL; } - } else { - optarg = NULL; - } - ++optind; - return c; + ++optind; + return c; + } } return -1; } |