diff options
author | Mathias Bauer <mba@openoffice.org> | 2010-06-16 19:57:33 +0200 |
---|---|---|
committer | Mathias Bauer <mba@openoffice.org> | 2010-06-16 19:57:33 +0200 |
commit | 12684f8ad2b6d247b0bffefa97ae21ca78d07ac8 (patch) | |
tree | 6939982bee937b66eae006aa49d78b8127b55b2b /soltools | |
parent | 4feab2495d0634c59688374a97301db5bb9a47ca (diff) |
CWS systemlibc: #i69033#: some fixes for Windows
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/javadep/javadep.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/soltools/javadep/javadep.c b/soltools/javadep/javadep.c index cb752940941d..a573d78eed75 100644 --- a/soltools/javadep/javadep.c +++ b/soltools/javadep/javadep.c @@ -138,6 +138,15 @@ void usage(void); void err_quit(const char *, ...); void silent_quit(void); +#ifdef WNT +/* poor man's getopt() */ +int simple_getopt(char *pargv[], const char *poptstring); +char *optarg = NULL; +int optind = 1; +int optopt = 0; +int opterr = 0; +#endif + uint8 read_uint8(const file_t *pfile) { @@ -724,6 +733,44 @@ usage() pprogname); } +/* my very simple minded implementation of getopt() + * it's to sad that getopt() is not available everywhere + * note: this is not a full POSIX conforming getopt() + */ +int simple_getopt(char *pargv[], const char *poptstring) +{ + char *parg = pargv[optind]; + + /* skip all response file arguments */ + 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 = NULL; + } + ++optind; + return c; + } + } + return -1; +} + int CDECL main(int argc, char *argv[]) { @@ -771,7 +818,11 @@ main(int argc, char *argv[]) opterr = 0; pincs = allocate_growable(); +#ifdef WNT + while( (c = simple_getopt(pall_argv, ":i:I:s:S:o:OhHvV")) != -1 ) { +#else while( (c = getopt(nall_argc, pall_argv, ":i:I:s:S:o:OhHvV")) != -1 ) { +#endif switch(c) { case 'i': case 'I': |