equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
36 #define JLI_ReportMessage(...) printf(__VA_ARGS__) |
36 #define JLI_ReportMessage(...) printf(__VA_ARGS__) |
37 #define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS" |
37 #define JDK_JAVA_OPTIONS "JDK_JAVA_OPTIONS" |
38 int IsWhiteSpaceOption(const char* name) { return 1; } |
38 int IsWhiteSpaceOption(const char* name) { return 1; } |
39 #else |
39 #else |
40 #include "java.h" |
40 #include "java.h" |
|
41 #include "jni.h" |
41 #endif |
42 #endif |
42 |
43 |
43 #include "jli_util.h" |
44 #include "jli_util.h" |
44 #include "emessages.h" |
45 #include "emessages.h" |
45 |
46 |
76 // Initialize to 1, as the first argument is the app name and not preprocessed |
77 // Initialize to 1, as the first argument is the app name and not preprocessed |
77 static size_t argsCount = 1; |
78 static size_t argsCount = 1; |
78 static jboolean stopExpansion = JNI_FALSE; |
79 static jboolean stopExpansion = JNI_FALSE; |
79 static jboolean relaunch = JNI_FALSE; |
80 static jboolean relaunch = JNI_FALSE; |
80 |
81 |
81 void JLI_InitArgProcessing(jboolean hasJavaArgs, jboolean disableArgFile) { |
82 JNIEXPORT void |
|
83 JLI_InitArgProcessing(jboolean hasJavaArgs, jboolean disableArgFile) { |
82 // No expansion for relaunch |
84 // No expansion for relaunch |
83 if (argsCount != 1) { |
85 if (argsCount != 1) { |
84 relaunch = JNI_TRUE; |
86 relaunch = JNI_TRUE; |
85 stopExpansion = JNI_TRUE; |
87 stopExpansion = JNI_TRUE; |
86 argsCount = 1; |
88 argsCount = 1; |
92 |
94 |
93 // for tools, this value remains 0 all the time. |
95 // for tools, this value remains 0 all the time. |
94 firstAppArgIndex = hasJavaArgs ? 0: NOT_FOUND; |
96 firstAppArgIndex = hasJavaArgs ? 0: NOT_FOUND; |
95 } |
97 } |
96 |
98 |
97 int JLI_GetAppArgIndex() { |
99 JNIEXPORT int |
|
100 JLI_GetAppArgIndex() { |
98 // Will be 0 for tools |
101 // Will be 0 for tools |
99 return firstAppArgIndex; |
102 return firstAppArgIndex; |
100 } |
103 } |
101 |
104 |
102 static void checkArg(const char *arg) { |
105 static void checkArg(const char *arg) { |
371 } |
374 } |
372 |
375 |
373 return rv; |
376 return rv; |
374 } |
377 } |
375 |
378 |
376 JLI_List JLI_PreprocessArg(const char *arg) |
379 JNIEXPORT JLI_List |
|
380 JLI_PreprocessArg(const char *arg) |
377 { |
381 { |
378 JLI_List rv; |
382 JLI_List rv; |
379 |
383 |
380 if (firstAppArgIndex > 0) { |
384 if (firstAppArgIndex > 0) { |
381 // In user application arg, no more work. |
385 // In user application arg, no more work. |
426 JLI_StrCmp(arg, "--version") == 0 || |
430 JLI_StrCmp(arg, "--version") == 0 || |
427 JLI_StrCmp(arg, "-fullversion") == 0 || |
431 JLI_StrCmp(arg, "-fullversion") == 0 || |
428 JLI_StrCmp(arg, "--full-version") == 0; |
432 JLI_StrCmp(arg, "--full-version") == 0; |
429 } |
433 } |
430 |
434 |
431 jboolean JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) { |
435 JNIEXPORT jboolean |
|
436 JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) { |
432 char *env = getenv(var_name); |
437 char *env = getenv(var_name); |
433 char *p, *arg; |
438 char *p, *arg; |
434 char quote; |
439 char quote; |
435 JLI_List argsInFile; |
440 JLI_List argsInFile; |
436 |
441 |