summaryrefslogtreecommitdiffstats
path: root/soltools/javadep
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2010-06-16 19:57:33 +0200
committerMathias Bauer <mba@openoffice.org>2010-06-16 19:57:33 +0200
commit12684f8ad2b6d247b0bffefa97ae21ca78d07ac8 (patch)
tree6939982bee937b66eae006aa49d78b8127b55b2b /soltools/javadep
parentsystemlibc: update comment (diff)
downloadcore-12684f8ad2b6d247b0bffefa97ae21ca78d07ac8.tar.gz
core-12684f8ad2b6d247b0bffefa97ae21ca78d07ac8.zip
CWS systemlibc: #i69033#: some fixes for Windows
Diffstat (limited to 'soltools/javadep')
-rw-r--r--soltools/javadep/javadep.c51
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':