< prev index next >

src/java.base/windows/native/libjli/cmdtoargs.c

Print this page




 229     // first argument is the app name, do not preprocess and make sure remains first
 230     argv[0].arg = JLI_StringDup(arg);
 231     argv[0].has_wildcard = wildcard;
 232     nargs++;
 233 
 234     for (i = 1; i < cnt; i++) {
 235         argv[i].arg = envArgs->elements[i - 1];
 236         // wildcard is not supported in argfile
 237         argv[i].has_wildcard = JNI_FALSE;
 238         nargs++;
 239     }
 240     JLI_MemFree(envArgs->elements);
 241     JLI_MemFree(envArgs);
 242 
 243     assert ((size_t) nargs == cnt);
 244     *arg = '\0';
 245 
 246     // iterate through rest of command line
 247     while (src != NULL) {
 248         src = next_arg(src, arg, &wildcard);
 249         argsInFile = JLI_PreprocessArg(arg);
 250         if (argsInFile != NULL) {
 251             // resize to accommodate another Arg
 252             cnt = argsInFile->size;
 253             argv = (StdArg*) JLI_MemRealloc(argv, (nargs + cnt) * sizeof(StdArg));
 254             for (i = 0; i < cnt; i++) {
 255                 argv[nargs].arg = argsInFile->elements[i];
 256                 // wildcard is not supported in argfile
 257                 argv[nargs].has_wildcard = JNI_FALSE;
 258                 nargs++;
 259             }
 260             // Shallow free, we reuse the string to avoid copy
 261             JLI_MemFree(argsInFile->elements);
 262             JLI_MemFree(argsInFile);
 263         } else {
 264             // resize to accommodate another Arg
 265             argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
 266             argv[nargs].arg = JLI_StringDup(arg);
 267             argv[nargs].has_wildcard = wildcard;
 268             *arg = '\0';
 269             nargs++;




 229     // first argument is the app name, do not preprocess and make sure remains first
 230     argv[0].arg = JLI_StringDup(arg);
 231     argv[0].has_wildcard = wildcard;
 232     nargs++;
 233 
 234     for (i = 1; i < cnt; i++) {
 235         argv[i].arg = envArgs->elements[i - 1];
 236         // wildcard is not supported in argfile
 237         argv[i].has_wildcard = JNI_FALSE;
 238         nargs++;
 239     }
 240     JLI_MemFree(envArgs->elements);
 241     JLI_MemFree(envArgs);
 242 
 243     assert ((size_t) nargs == cnt);
 244     *arg = '\0';
 245 
 246     // iterate through rest of command line
 247     while (src != NULL) {
 248         src = next_arg(src, arg, &wildcard);
 249         argsInFile = JLI_PreprocessArg(arg, JNI_TRUE);
 250         if (argsInFile != NULL) {
 251             // resize to accommodate another Arg
 252             cnt = argsInFile->size;
 253             argv = (StdArg*) JLI_MemRealloc(argv, (nargs + cnt) * sizeof(StdArg));
 254             for (i = 0; i < cnt; i++) {
 255                 argv[nargs].arg = argsInFile->elements[i];
 256                 // wildcard is not supported in argfile
 257                 argv[nargs].has_wildcard = JNI_FALSE;
 258                 nargs++;
 259             }
 260             // Shallow free, we reuse the string to avoid copy
 261             JLI_MemFree(argsInFile->elements);
 262             JLI_MemFree(argsInFile);
 263         } else {
 264             // resize to accommodate another Arg
 265             argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
 266             argv[nargs].arg = JLI_StringDup(arg);
 267             argv[nargs].has_wildcard = wildcard;
 268             *arg = '\0';
 269             nargs++;


< prev index next >