static jboolean expectingNoDashArg = JNI_FALSE; // Initialize to 1, as the first argument is the app name and not preprocessed static size_t argsCount = 1; static jboolean stopExpansion = JNI_FALSE; static jboolean relaunch = JNI_FALSE;
// All arguments arrive here must be a launcher argument, // ie. by now, all argfile expansions must have been performed. if (*arg == '-') {
expectingNoDashArg = JNI_FALSE; if (IsWhiteSpaceOption(arg)) { // expect an argument
expectingNoDashArg = JNI_TRUE;
if (JLI_StrCmp(arg, "-jar") == 0 ||
JLI_StrCmp(arg, "--module") == 0 ||
JLI_StrCmp(arg, "-m") == 0) { // This is tricky, we do expect NoDashArg // But that is considered main class to stop expansion
expectingNoDashArg = JNI_FALSE; // We can not just update the idx here because if -jar @file // still need expansion of @file to get the argument for -jar
}
} elseif (JLI_StrCmp(arg, "--disable-@files") == 0) {
stopExpansion = JNI_TRUE;
} elseif (JLI_StrCCmp(arg, "--module=") == 0) {
idx = argsCount;
}
} else { if (!expectingNoDashArg) { // this is main class, argsCount is index to next arg
idx = argsCount;
}
expectingNoDashArg = JNI_FALSE;
} // only update on java mode and not yet found main class if (firstAppArgIndex == NOT_FOUND && idx != 0) {
firstAppArgIndex = (int) idx;
}
}
assert(nextc == eob); // Only need partial token, not comment or whitespaces if (pctx->state == IN_TOKEN || pctx->state == IN_QUOTE) { if (anchor < nextc) { // not yet return until end of stream, we have part of a token.
JLI_List_addSubstring(pctx->parts, anchor, nextc - anchor);
}
} return NULL;
}
// This is retained until the process terminates as it is saved as the args
p = JLI_MemAlloc(JLI_StrLen(str) + 1); while (*str != '\0') { while (*str != '\0' && isspace(*str)) {
str++;
}
for (token = nextToken(&ctx); token != NULL; token = nextToken(&ctx)) { // should not have more tokens than expected if (actual_cnt >= cnt_tokens) {
printf("FAILED: Extra token detected: <%s>\n", token); exit(2);
} if (JLI_StrCmp(token, tokens[actual_cnt]) != 0) {
fail(tokens[actual_cnt], token, actual_cnt);
}
actual_cnt++;
}
char* last = NULL; if (ctx.parts->size != 0) {
last = JLI_List_combine(ctx.parts);
}
JLI_List_free(ctx.parts);
if (actual_cnt >= cnt_tokens) { // same number of tokens, should have nothing left to parse if (last != NULL) { if (*last != '#') {
printf("Leftover detected: %s", last); exit(2);
}
}
} else { if (JLI_StrCmp(last, tokens[actual_cnt]) != 0) {
fail(tokens[actual_cnt], last, actual_cnt);
}
actual_cnt++;
} if (actual_cnt != cnt_tokens) {
printf("FAILED: Number of tokens not match, expected %lu, got %lu\n",
cnt_tokens, actual_cnt); exit(3);
}
printf("PASS\n");
}
#define DO_CASE(name) \
test_case(name[0], name + 1, sizeof(name)/sizeof(char*) - 1)
// note the open quote at the end char* case2[] = { "com.foo.Panda \"Furious 5\"\fand\t'Shi Fu' \"escape\tprison", "com.foo.Panda", "Furious 5", "and", "Shi Fu", "escape\tprison"};
DO_CASE(case2);
char* mixed_quote[] = { "\"mix 'single quote' in double\" 'mix \"double quote\" in single' partial\"quote me\"this", "mix 'single quote' in double", "mix \"double quote\" in single", "partialquote methis"};
DO_CASE(mixed_quote);
char* comments[] = { "line one #comment\n'line #2' #rest are comment\r\n#comment on line 3\nline 4 #comment to eof", "line", "one", "line #2", "line", "4"};
DO_CASE(comments);
char* open_quote[] = { "This is an \"open quote \n across line\n\t, note for WS.", "This", "is", "an", "open quote ", "across", "line", ",", "note", "for", "WS." };
DO_CASE(open_quote);
char* escape_in_open_quote[] = { "Try \"this \\\\\\\\ escape\\n double quote \\\" in open quote", "Try", "this \\\\ escape\n double quote \" in open quote" };
DO_CASE(escape_in_open_quote);
char* quote[] = { "'-Dmy.quote.single'='Property in single quote. Here a double quote\" Add some slashes \\\\/'", "-Dmy.quote.single=Property in single quote. Here a double quote\" Add some slashes \\/" };
DO_CASE(quote);
char* multi[] = { "\"Open quote to \n new \"line \\\n\r third\\\n\r\\\tand\ffourth\"", "Open quote to ", "new", "line third\tand\ffourth" };
DO_CASE(multi);
if (argc > 1) { for (i = 0; i < argc; i++) {
JLI_List tokens = JLI_PreprocessArg(argv[i], JNI_FALSE); if (NULL != tokens) { for (j = 0; j < tokens->size; j++) {
printf("Token[%lu]: <%s>\n", (unsignedlong) j, tokens->elements[j]);
}
}
}
}
}
#endif// DEBUG_ARGFILE
Messung V0.5 in Prozent
¤ Diese beiden folgenden Angebotsgruppen bietet das Unternehmen0.14Angebot
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-10-01)
¤