85 86 // for tools, this value remains 0 all the time. 87 firstAppArgIndex = isJava ? NOT_FOUND : 0; 88 } 89 90 int JLI_GetAppArgIndex() { 91 // Will be 0 for tools 92 return firstAppArgIndex; 93 } 94 95 static void checkArg(const char *arg) { 96 size_t idx = 0; 97 argsCount++; 98 if (argsCount == 1) { 99 // ignore first argument, the application name 100 return; 101 } 102 103 // All arguments arrive here must be a launcher argument, 104 // ie. by now, all argfile expansions must have been performed. 105 if (*arg++ == '-') { 106 expectingNoDashArg = JNI_FALSE; 107 if (JLI_StrCmp(arg, "cp") == 0 || 108 JLI_StrCmp(arg, "classpath") == 0 || 109 JLI_StrCmp(arg, "addmods") == 0 || 110 JLI_StrCmp(arg, "limitmods") == 0 || 111 JLI_StrCmp(arg, "mp") == 0 || 112 JLI_StrCmp(arg, "modulepath") == 0 || 113 JLI_StrCmp(arg, "upgrademodulepath") == 0) { 114 expectingNoDashArg = JNI_TRUE; 115 } else if (JLI_StrCmp(arg, "jar") == 0 || 116 JLI_StrCmp(arg, "m") == 0) { 117 // This is tricky, we do expect NoDashArg 118 // But that is considered main class to stop expansion 119 expectingNoDashArg = JNI_FALSE; 120 // We can not just update the idx here because if -jar @file 121 // still need expansion of @file to get the argument for -jar 122 } else if (JLI_StrCmp(arg, "Xdisable-@files") == 0) { 123 stopExpansion = JNI_TRUE; 124 } 125 } else { 126 if (!expectingNoDashArg) { 127 // this is main class, argsCount is index to next arg 128 idx = argsCount; 129 } 130 expectingNoDashArg = JNI_FALSE; 131 } 132 // only update on java mode and not yet found main class 133 if (firstAppArgIndex == NOT_FOUND && idx != 0) { 134 firstAppArgIndex = (int) idx; 135 } 136 } 137 138 /* 139 [\n\r] +------------+ +------------+ [\n\r] 140 +---------+ IN_COMMENT +<------+ | IN_ESCAPE +---------+ 141 | +------------+ | +------------+ | 142 | [#] ^ |[#] ^ | | | 85 86 // for tools, this value remains 0 all the time. 87 firstAppArgIndex = isJava ? NOT_FOUND : 0; 88 } 89 90 int JLI_GetAppArgIndex() { 91 // Will be 0 for tools 92 return firstAppArgIndex; 93 } 94 95 static void checkArg(const char *arg) { 96 size_t idx = 0; 97 argsCount++; 98 if (argsCount == 1) { 99 // ignore first argument, the application name 100 return; 101 } 102 103 // All arguments arrive here must be a launcher argument, 104 // ie. by now, all argfile expansions must have been performed. 105 if (*arg == '-') { 106 expectingNoDashArg = JNI_FALSE; 107 if (IsWhiteSpaceOption(arg)) { 108 // expect an argument 109 expectingNoDashArg = JNI_TRUE; 110 111 if (JLI_StrCmp(arg, "-jar") == 0 || 112 JLI_StrCmp(arg, "-m") == 0) { 113 // This is tricky, we do expect NoDashArg 114 // But that is considered main class to stop expansion 115 expectingNoDashArg = JNI_FALSE; 116 // We can not just update the idx here because if -jar @file 117 // still need expansion of @file to get the argument for -jar 118 } 119 } else if (JLI_StrCmp(arg, "-Xdisable-@files") == 0) { 120 stopExpansion = JNI_TRUE; 121 } 122 } else { 123 if (!expectingNoDashArg) { 124 // this is main class, argsCount is index to next arg 125 idx = argsCount; 126 } 127 expectingNoDashArg = JNI_FALSE; 128 } 129 // only update on java mode and not yet found main class 130 if (firstAppArgIndex == NOT_FOUND && idx != 0) { 131 firstAppArgIndex = (int) idx; 132 } 133 } 134 135 /* 136 [\n\r] +------------+ +------------+ [\n\r] 137 +---------+ IN_COMMENT +<------+ | IN_ESCAPE +---------+ 138 | +------------+ | +------------+ | 139 | [#] ^ |[#] ^ | | |