annotate src/windows/bin/cmdtoargs.c @ 10890:e7c32c6758c0

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