jdk/src/windows/bin/cmdtoargs.c
author acorn
Tue, 03 Dec 2013 11:13:14 -0800
changeset 21913 0e2fd7282ac6
parent 20488 a2718559a91c
permissions -rw-r--r--
8028438: static superclass method masks default methods Reviewed-by: hseigel, lfoltan, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     1
/*
15523
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
     2
 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     4
 *
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    10
 *
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    15
 * accompanied this code).
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    16
 *
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    20
 *
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    23
 * questions.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    24
 */
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    25
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    26
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    27
/*
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    28
 * Converts a single string command line to the traditional argc, argv.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    29
 * There are rules which govern the breaking of the the arguments, and
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    30
 * these rules are embodied in the regression tests below, and duplicated
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    31
 * in the jdk regression tests.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    32
 */
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    33
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    34
#ifndef IDE_STANDALONE
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    35
#include "java.h"
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    36
#include "jli_util.h"
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    37
#else /* IDE_STANDALONE */
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    38
// The defines we need for stand alone testing
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    39
#include <stdio.h>
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    40
#include <stdlib.h>
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    41
#include <Windows.h>
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    42
#define JNI_TRUE       TRUE
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    43
#define JNI_FALSE      FALSE
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    44
#define JLI_MemRealloc realloc
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    45
#define JLI_StringDup  _strdup
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    46
#define JLI_MemFree    free
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    47
#define jboolean       boolean
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    48
typedef struct  {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    49
    char* arg;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    50
    boolean has_wildcard;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    51
} StdArg ;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    52
#endif
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    53
static StdArg *stdargs;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    54
static int    stdargc;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    55
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    56
static int copyCh(USHORT ch, char* dest) {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    57
    if (HIBYTE(ch) == 0) {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    58
        *dest = (char)ch;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    59
        return 1;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    60
    } else {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    61
        *((USHORT *)dest) = ch;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    62
        return 2;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    63
    }
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    64
}
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    65
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    66
static char* next_arg(char* cmdline, char* arg, jboolean* wildcard) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    67
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    68
    char* src = cmdline;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    69
    char* dest = arg;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    70
    jboolean separator = JNI_FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    71
    int quotes = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    72
    int slashes = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    73
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    74
    // "prev"/"ch" may contain either a single byte, or a double byte
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    75
    // character encoded in CP_ACP.
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    76
    USHORT prev = 0;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    77
    USHORT ch = 0;
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    78
    int i;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    79
    jboolean done = JNI_FALSE;
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    80
    int charLength;
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    81
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    82
    *wildcard = JNI_FALSE;
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    83
    while (!done) {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    84
        charLength = CharNextExA(CP_ACP, src, 0) - src;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    85
        if (charLength == 0) {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    86
            break;
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    87
        } else if (charLength == 1) {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    88
            ch = (USHORT)(UCHAR)src[0];
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    89
        } else {
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    90
            ch = ((USHORT *)src)[0];
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    91
        }
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    92
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    93
        switch (ch) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    94
        case L'"':
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    95
            if (separator) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    96
                done = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    97
                break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
    98
            }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
    99
            if (prev == L'\\') {
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   100
                for (i = 1; i < slashes; i += 2) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   101
                    dest += copyCh(prev, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   102
                }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   103
                if (slashes % 2 == 1) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   104
                    dest += copyCh(ch, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   105
                } else {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   106
                    quotes++;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   107
                }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   108
            } else if (prev == L'"' && quotes % 2 == 0) {
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   109
                quotes++;
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   110
                dest += copyCh(ch, dest); // emit every other consecutive quote
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   111
            } else if (quotes == 0) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   112
                quotes++; // starting quote
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   113
            } else {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   114
                quotes--; // matching quote
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   115
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   116
            slashes = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   117
            break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   118
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   119
        case L'\\':
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   120
            slashes++;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   121
            if (separator) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   122
                done = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   123
                separator = JNI_FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   124
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   125
            break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   126
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   127
        case L' ':
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   128
        case L'\t':
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   129
            if (prev == L'\\') {
15523
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   130
                for (i = 0 ; i < slashes; i++) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   131
                    dest += copyCh(prev, dest);
15523
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   132
                }
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   133
            }
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   134
            if (quotes % 2 == 1) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   135
                dest += copyCh(ch, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   136
            } else {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   137
                separator = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   138
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   139
            slashes = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   140
            break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   141
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   142
        case L'*':
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   143
        case L'?':
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   144
            if (separator) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   145
                done = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   146
                separator = JNI_FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   147
                break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   148
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   149
            if (quotes % 2 == 0) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   150
                *wildcard = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   151
            }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   152
            if (prev == L'\\') {
17714
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   153
                for (i = 0 ; i < slashes ; i++) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   154
                    dest += copyCh(prev, dest);
17714
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   155
                }
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   156
            }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   157
            dest += copyCh(ch, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   158
            break;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   159
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   160
        default:
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   161
            if (prev == L'\\') {
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   162
                for (i = 0 ; i < slashes ; i++) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   163
                    dest += copyCh(prev, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   164
                }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   165
                dest += copyCh(ch, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   166
            } else if (separator) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   167
                done = JNI_TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   168
            } else {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   169
                dest += copyCh(ch, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   170
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   171
            slashes = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   172
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   173
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   174
        if (!done) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   175
            prev = ch;
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   176
            src += charLength;
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   177
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   178
    }
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   179
    if (prev == L'\\') {
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   180
        for (i = 0; i < slashes; i++) {
20488
a2718559a91c 8016110: Japanese char (MS932) 0x5C cannot be used as an argument when quoted
naoto
parents: 17714
diff changeset
   181
            dest += copyCh(prev, dest);
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   182
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   183
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   184
    *dest = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   185
    return done ? src : NULL;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   186
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   187
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   188
int JLI_GetStdArgc() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   189
    return stdargc;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   190
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   191
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   192
StdArg* JLI_GetStdArgs() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   193
    return stdargs;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   194
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   195
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   196
void JLI_CmdToArgs(char* cmdline) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   197
    int nargs = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   198
    StdArg* argv = NULL;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   199
    jboolean wildcard = JNI_FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   200
    char* src = cmdline;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   201
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   202
    // allocate arg buffer with sufficient space to receive the largest arg
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   203
    char* arg = JLI_StringDup(cmdline);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   204
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   205
    do {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   206
        src = next_arg(src, arg, &wildcard);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   207
        // resize to accommodate another Arg
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   208
        argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   209
        argv[nargs].arg = JLI_StringDup(arg);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   210
        argv[nargs].has_wildcard = wildcard;
17714
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   211
        *arg = NULL;
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   212
        nargs++;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   213
    } while (src != NULL);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   214
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   215
    stdargc = nargs;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   216
    stdargs = argv;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   217
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   218
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   219
#ifdef IDE_STANDALONE
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   220
void doexit(int rv) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   221
    printf("Hit any key to quit\n");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   222
    int c = getchar();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   223
    exit(rv);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   224
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   225
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   226
void doabort() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   227
    doexit(1);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   228
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   229
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   230
class Vector {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   231
public:
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   232
    char* cmdline;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   233
    int argc;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   234
    char* argv[10];
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   235
    boolean wildcard[10];
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   236
    boolean enabled;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   237
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   238
    Vector(){}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   239
    // Initialize our test vector with the program name, argv[0]
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   240
    // and the single string command line.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   241
    Vector(char* pname, char* cline) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   242
        argv[0] = pname;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   243
        wildcard[0] = FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   244
        cmdline = cline;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   245
        argc = 1;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   246
        enabled = TRUE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   247
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   248
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   249
    // add our expected strings, the program name has already been
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   250
    // added so ignore that
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   251
    void add(char* arg, boolean w) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   252
        argv[argc] = arg;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   253
        wildcard[argc] = w;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   254
        argc++;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   255
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   256
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   257
    void disable() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   258
        enabled = FALSE;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   259
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   260
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   261
    // validate the returned arguments with the expected arguments, using the
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   262
    // new CmdToArgs method.
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   263
    bool check() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   264
        // "pgmname" rest of cmdline ie. pgmname + 2 double quotes + space + cmdline from windows
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   265
        char* cptr = (char*) malloc(strlen(argv[0]) + sizeof(char) * 3 + strlen(cmdline) + 1);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   266
        _snprintf(cptr, MAX_PATH, "\"%s\" %s", argv[0], cmdline);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   267
        JLI_CmdToArgs(cptr);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   268
        free(cptr);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   269
        StdArg *kargv = JLI_GetStdArgs();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   270
        int     kargc = JLI_GetStdArgc();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   271
        bool retval = true;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   272
        printf("\n===========================\n");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   273
        printf("cmdline=%s\n", cmdline);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   274
        if (argc != kargc) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   275
            printf("*** argument count does not match\n");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   276
            printme();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   277
            printtest(kargc, kargv);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   278
            doabort();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   279
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   280
        for (int i = 0 ; i < argc && retval == true ; i++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   281
            if (strcmp(argv[i], kargv[i].arg) != 0) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   282
                printf("*** argument at [%d] don't match\n  got: %s\n  exp: %s\n",
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   283
                       i, kargv[i].arg, argv[i]);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   284
                doabort();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   285
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   286
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   287
        for (int i = 0 ; i < argc && retval == true ; i++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   288
            if (wildcard[i] != kargv[i].has_wildcard) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   289
                printf("*** expansion flag at [%d] doesn't match\n  got: %d\n  exp: %d\n",
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   290
                       i, kargv[i].has_wildcard, wildcard[i]);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   291
                doabort();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   292
            }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   293
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   294
        for (int i = 0 ; i < kargc ; i++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   295
            printf("k[%d]=%s\n", i, kargv[i].arg);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   296
            printf(" [%d]=%s\n", i, argv[i]);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   297
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   298
        return retval;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   299
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   300
    void printtest(int kargc, StdArg* kargv) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   301
        for (int i = 0 ; i < kargc ; i++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   302
            printf("k[%d]=%s\n", i, kargv[i].arg);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   303
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   304
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   305
    void printme() {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   306
        for (int i = 0 ; i < argc ; i++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   307
            printf(" [%d]=%s\n", i, argv[i]);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   308
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   309
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   310
};
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   311
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   312
void dotest(Vector** vectors) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   313
    Vector* v = vectors[0];
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   314
    for (int i = 0 ; v != NULL;) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   315
        if (v->enabled) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   316
            v->check();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   317
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   318
        v = vectors[++i];
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   319
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   320
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   321
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   322
#define MAXV 128
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   323
int main(int argc, char* argv[]) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   324
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   325
    int n;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   326
    for (n=1; n < argc; n++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   327
        printf("%d %s\n", n, argv[n]);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   328
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   329
    if (n > 1) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   330
        JLI_CmdToArgs(GetCommandLine());
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   331
        for (n = 0; n < stdargc; n++) {
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   332
            printf(" [%d]=%s\n", n, stdargs[n].arg);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   333
            printf(" [%d]=%s\n", n, stdargs[n].has_wildcard ? "TRUE" : "FALSE");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   334
        }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   335
        doexit(0);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   336
    }
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   337
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   338
    Vector *vectors[MAXV];
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   339
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   340
    memset(vectors, 0, sizeof(vectors));
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   341
    int i = 0;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   342
    Vector* v = new Vector(argv[0], "abcd");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   343
    v->add("abcd", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   344
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   345
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   346
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   347
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   348
    v = new Vector(argv[0], "\"a b c d\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   349
    v->add("a b c d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   350
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   351
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   352
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   353
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   354
    v = new Vector(argv[0], "a\"b c d\"e");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   355
    v->add("ab c de", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   356
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   357
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   358
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   359
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   360
    v = new Vector(argv[0], "ab\\\"cd");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   361
    v->add("ab\"cd", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   362
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   363
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   364
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   365
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   366
    v = new Vector(argv[0], "\"a b c d\\\\\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   367
    v->add("a b c d\\", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   368
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   369
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   370
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   371
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   372
    v = new Vector(argv[0], "ab\\\\\\\"cd");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   373
    v->add("ab\\\"cd", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   374
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   375
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   376
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   377
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   378
    // Windows tests
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   379
    v = new Vector(argv[0], "a\\\\\\c");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   380
    v->add("a\\\\\\c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   381
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   382
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   383
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   384
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   385
    v = new Vector(argv[0], "\"a\\\\\\d\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   386
    v->add("a\\\\\\d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   387
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   388
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   389
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   390
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   391
    v = new Vector(argv[0], "\"a b c\" d e");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   392
    v->add("a b c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   393
    v->add("d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   394
    v->add("e", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   395
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   396
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   397
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   398
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   399
    v = new Vector(argv[0], "\"ab\\\"c\"  \"\\\\\"  d");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   400
    v->add("ab\"c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   401
    v->add("\\", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   402
    v->add("d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   403
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   404
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   405
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   406
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   407
    v = new Vector(argv[0], "a\\\\\\c d\"e f\"g h");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   408
    v->add("a\\\\\\c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   409
    v->add("de fg", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   410
    v->add("h", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   411
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   412
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   413
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   414
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   415
    v = new Vector(argv[0], "a\\\\\\\"b c d");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   416
    v->add("a\\\"b", FALSE); // XXX "a\\\\\\\"b"
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   417
    v->add("c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   418
    v->add("d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   419
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   420
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   421
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   422
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   423
    v = new Vector(argv[0], "a\\\\\\\\\"g c\" d e"); // XXX "a\\\\\\\\\"b c\" d e"
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   424
    v->add("a\\\\\g c", FALSE); // XXX "a\\\\\\\\\"b c"
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   425
    v->add("d", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   426
    v->add("e", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   427
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   428
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   429
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   430
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   431
    // Additional tests
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   432
    v = new Vector(argv[0], "\"a b c\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   433
    v->add("a b c\"", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   434
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   435
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   436
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   437
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   438
    v = new Vector(argv[0], "\"\"a b c\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   439
    v->add("a", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   440
    v->add("b", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   441
    v->add("c", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   442
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   443
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   444
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   445
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   446
    v = new Vector(argv[0], "\"\"\"a b c\"\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   447
    v->add("\"a b c\"", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   448
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   449
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   450
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   451
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   452
    v = new Vector(argv[0], "\"\"\"\"a b c\"\"\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   453
    v->add("\"a", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   454
    v->add("b", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   455
    v->add("c\"", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   456
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   457
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   458
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   459
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   460
    v = new Vector(argv[0], "\"\"\"\"\"a b c\"\"\"\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   461
    v->add("\"\"a b c\"\"", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   462
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   463
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   464
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   465
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   466
    v = new Vector(argv[0], "\"C:\\TEST A\\\\\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   467
    v->add("C:\\TEST A\\", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   468
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   469
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   470
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   471
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   472
    v = new Vector(argv[0], "\"\"C:\\TEST A\\\\\"\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   473
    v->add("C:\\TEST", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   474
    v->add("A\\", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   475
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   476
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   477
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   478
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   479
    // test if a wildcard is present
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   480
    v = new Vector(argv[0], "abc*def");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   481
    v->add("abc*def", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   482
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   483
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   484
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   485
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   486
    v = new Vector(argv[0], "\"abc*def\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   487
    v->add("abc*def", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   488
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   489
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   490
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   491
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   492
    v = new Vector(argv[0], "*.abc");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   493
    v->add("*.abc", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   494
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   495
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   496
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   497
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   498
    v = new Vector(argv[0], "\"*.abc\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   499
    v->add("*.abc", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   500
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   501
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   502
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   503
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   504
    v = new Vector(argv[0], "x.???");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   505
    v->add("x.???", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   506
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   507
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   508
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   509
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   510
    v = new Vector(argv[0], "\"x.???\"");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   511
    v->add("x.???", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   512
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   513
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   514
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   515
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   516
    v = new Vector(argv[0], "Debug\\*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   517
    v->add("Debug\\*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   518
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   519
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   520
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   521
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   522
    v = new Vector(argv[0], "Debug\\f?a");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   523
    v->add("Debug\\f?a", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   524
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   525
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   526
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   527
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   528
    v = new Vector(argv[0], "Debug\\?a.java");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   529
    v->add("Debug\\?a.java", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   530
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   531
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   532
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   533
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   534
    v = new Vector(argv[0], "foo *.noexts");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   535
    v->add("foo", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   536
    v->add("*.noexts", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   537
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   538
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   539
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   540
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   541
    v = new Vector(argv[0], "X\\Y\\Z");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   542
    v->add("X\\Y\\Z", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   543
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   544
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   545
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   546
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   547
    v = new Vector(argv[0], "\\X\\Y\\Z");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   548
    v->add("\\X\\Y\\Z", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   549
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   550
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   551
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   552
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   553
    v = new Vector(argv[0], "a b");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   554
    v->add("a", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   555
    v->add("b", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   556
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   557
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   558
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   559
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   560
    v = new Vector(argv[0], "a\tb");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   561
    v->add("a", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   562
    v->add("b", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   563
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   564
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   565
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   566
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   567
    v = new Vector(argv[0], "a \t b");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   568
    v->add("a", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   569
    v->add("b", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   570
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   571
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   572
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   573
    v = new Vector(argv[0], "*\\");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   574
    v->add("*\\", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   575
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   576
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   577
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   578
    v = new Vector(argv[0], "*/");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   579
    v->add("*/", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   580
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   581
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   582
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   583
    v = new Vector(argv[0], ".\\*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   584
    v->add(".\\*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   585
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   586
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   587
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   588
    v = new Vector(argv[0], "./*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   589
    v->add("./*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   590
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   591
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   592
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   593
    v = new Vector(argv[0], ".\\*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   594
    v->add(".\\*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   595
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   596
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   597
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   598
    v = new Vector(argv[0], ".//*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   599
    v->add(".//*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   600
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   601
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   602
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   603
    v = new Vector(argv[0], "..\\..\\*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   604
    v->add("..\\..\\*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   605
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   606
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   607
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   608
    v = new Vector(argv[0], "../../*");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   609
    v->add("../../*", TRUE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   610
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   611
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   612
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   613
    v = new Vector(argv[0], "..\\..\\");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   614
    v->add("..\\..\\", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   615
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   616
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   617
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   618
    v = new Vector(argv[0], "../../");
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   619
    v->add("../../", FALSE);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   620
    // v->disable();
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   621
    vectors[i++] = v;
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   622
15523
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   623
    v= new Vector(argv[0], "a b\\\\ d");
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   624
    v->add("a", FALSE);
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   625
    v->add("b\\\\", FALSE);
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   626
    v->add("d", FALSE);
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   627
    vectors[i++] = v;
cc0ee864bfb5 8006536: [launcher] removes trailing slashes on arguments
ksrini
parents: 13410
diff changeset
   628
17714
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   629
    v= new Vector(argv[0], "\\\\?");
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   630
    v->add("\\\\?", TRUE);
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   631
    vectors[i++] = v;
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   632
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   633
    v= new Vector(argv[0], "\\\\*");
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   634
    v->add("\\\\*", TRUE);
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   635
    vectors[i++] = v;
04271182b2c1 8007333: [launcher] removes multiple back slashes
ksrini
parents: 15523
diff changeset
   636
13410
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   637
    dotest(vectors);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   638
    printf("All tests pass [%d]\n", i);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   639
    doexit(0);
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   640
}
e667545511c7 7188114: (launcher) need an alternate command line parser for Windows
ksrini
parents:
diff changeset
   641
#endif /* IDE_STANDALONE */