106 static void SetAddReadsProp(const jint n, const char *s); |
106 static void SetAddReadsProp(const jint n, const char *s); |
107 static void SetAddExportsProp(const jint n, const char *s); |
107 static void SetAddExportsProp(const jint n, const char *s); |
108 static void SetPatchProp(const jint n, const char *s); |
108 static void SetPatchProp(const jint n, const char *s); |
109 static void SelectVersion(int argc, char **argv, char **main_class); |
109 static void SelectVersion(int argc, char **argv, char **main_class); |
110 static void SetJvmEnvironment(int argc, char **argv); |
110 static void SetJvmEnvironment(int argc, char **argv); |
|
111 static jboolean IsWhiteSpaceOptionArgument(const char* name); |
111 static jboolean ParseArguments(int *pargc, char ***pargv, |
112 static jboolean ParseArguments(int *pargc, char ***pargv, |
112 int *pmode, char **pwhat, |
113 int *pmode, char **pwhat, |
113 int *pret, const char *jrepath); |
114 int *pret, const char *jrepath); |
114 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, |
115 static jboolean InitializeJVM(JavaVM **pvm, JNIEnv **penv, |
115 InvocationFunctions *ifn); |
116 InvocationFunctions *ifn); |
498 ret = (*env)->ExceptionOccurred(env) == NULL ? 0 : 1; |
499 ret = (*env)->ExceptionOccurred(env) == NULL ? 0 : 1; |
499 LEAVE(); |
500 LEAVE(); |
500 } |
501 } |
501 |
502 |
502 /* |
503 /* |
|
504 * Test if the given option name has a whitespace separated argument. |
|
505 */ |
|
506 jboolean |
|
507 IsWhiteSpaceOptionArgument(const char* name) { |
|
508 return JLI_StrCmp(name, "-classpath") == 0 || |
|
509 JLI_StrCmp(name, "-cp") == 0 || |
|
510 JLI_StrCmp(name, "-modulepath") == 0 || |
|
511 JLI_StrCmp(name, "-mp") == 0 || |
|
512 JLI_StrCmp(name, "-upgrademodulepath") == 0 || |
|
513 JLI_StrCmp(name, "-addmods") == 0 || |
|
514 JLI_StrCmp(name, "-limitmods") == 0; |
|
515 } |
|
516 |
|
517 /* |
503 * Checks the command line options to find which JVM type was |
518 * Checks the command line options to find which JVM type was |
504 * specified. If no command line option was given for the JVM type, |
519 * specified. If no command line option was given for the JVM type, |
505 * the default type is used. The environment variable |
520 * the default type is used. The environment variable |
506 * JDK_ALTERNATE_VM and the command line option -XXaltjvm= are also |
521 * JDK_ALTERNATE_VM and the command line option -XXaltjvm= are also |
507 * checked as ways of specifying which JVM type to invoke. |
522 * checked as ways of specifying which JVM type to invoke. |
532 if (arg[0] != '-') { |
547 if (arg[0] != '-') { |
533 newArgv[newArgvIdx++] = arg; |
548 newArgv[newArgvIdx++] = arg; |
534 continue; |
549 continue; |
535 } |
550 } |
536 } else { |
551 } else { |
537 if (JLI_StrCmp(arg, "-classpath") == 0 || |
552 if (IsWhiteSpaceOptionArgument(arg)) { |
538 JLI_StrCmp(arg, "-cp") == 0 || |
|
539 JLI_StrCmp(arg, "-modulepath") == 0 || |
|
540 JLI_StrCmp(arg, "-mp") == 0 || |
|
541 JLI_StrCmp(arg, "-upgrademodulepath") == 0 || |
|
542 JLI_StrCmp(arg, "-addmods") == 0 || |
|
543 JLI_StrCmp(arg, "-limitmods") == 0) { |
|
544 newArgv[newArgvIdx++] = arg; |
553 newArgv[newArgvIdx++] = arg; |
545 argi++; |
554 argi++; |
546 if (argi < argc) { |
555 if (argi < argc) { |
547 newArgv[newArgvIdx++] = (*argv)[argi]; |
556 newArgv[newArgvIdx++] = (*argv)[argi]; |
548 } |
557 } |
680 * the -jar argument). |
689 * the -jar argument). |
681 */ |
690 */ |
682 if (i > 0) { |
691 if (i > 0) { |
683 char *prev = argv[i - 1]; |
692 char *prev = argv[i - 1]; |
684 // skip non-dash arg preceded by class path specifiers |
693 // skip non-dash arg preceded by class path specifiers |
685 if (*arg != '-' && |
694 if (*arg != '-' && IsWhiteSpaceOptionArgument(prev)) { |
686 ((JLI_StrCmp(prev, "-cp") == 0 |
|
687 || JLI_StrCmp(prev, "-classpath") == 0))) { |
|
688 continue; |
695 continue; |
689 } |
696 } |
690 |
697 |
691 if (*arg != '-' |
698 if (*arg != '-' |
692 || JLI_StrCmp(arg, "-version") == 0 |
699 || JLI_StrCmp(arg, "-version") == 0 |
1026 } else if (JLI_StrCmp(arg, "-jre-no-restrict-search") == 0) { |
1033 } else if (JLI_StrCmp(arg, "-jre-no-restrict-search") == 0) { |
1027 JLI_ReportErrorMessage(SPC_ERROR2); |
1034 JLI_ReportErrorMessage(SPC_ERROR2); |
1028 } else { |
1035 } else { |
1029 if (JLI_StrCmp(arg, "-jar") == 0) |
1036 if (JLI_StrCmp(arg, "-jar") == 0) |
1030 jarflag = 1; |
1037 jarflag = 1; |
1031 /* deal with "unfortunate" classpath syntax */ |
1038 if (IsWhiteSpaceOptionArgument(arg) && (argc >= 2)) { |
1032 if ((JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) && |
|
1033 (argc >= 2)) { |
|
1034 argc--; |
1039 argc--; |
1035 argv++; |
1040 argv++; |
1036 arg = *argv; |
1041 arg = *argv; |
1037 } |
1042 } |
1038 |
1043 |