< prev index next >

src/java.base/share/native/launcher/main.c

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 83,92 **** --- 83,94 ---- int WINAPI WinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow) { int margc; char** margv; + int jargc; + char** jargv; const jboolean const_javaw = JNI_TRUE; __initenv = _environ; #else /* JAVAW */
*** 93,107 **** int main(int argc, char **argv) { int margc; char** margv; const jboolean const_javaw = JNI_FALSE; #endif /* JAVAW */ ! JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile); #ifdef _WIN32 { int i = 0; if (getenv(JLDEBUG_ENV_ENTRY) != NULL) { printf("Windows original main args:\n"); --- 95,146 ---- int main(int argc, char **argv) { int margc; char** margv; + int jargc; + char** jargv; const jboolean const_javaw = JNI_FALSE; #endif /* JAVAW */ + { + int i, main_jargc, extra_jargc; + JLI_List list; ! main_jargc = (sizeof(const_jargs) / sizeof(char *)) > 1 ! ? sizeof(const_jargs) / sizeof(char *) ! : 0; // ignore the null terminator index + extra_jargc = (sizeof(const_extra_jargs) / sizeof(char *)) > 1 + ? sizeof(const_extra_jargs) / sizeof(char *) + : 0; // ignore the null terminator index + + if (main_jargc > 0 && extra_jargc > 0) { // combine extra java args + jargc = main_jargc + extra_jargc; + list = JLI_List_new(jargc + 1); + + for (i = 0 ; i < extra_jargc; i++) { + JLI_List_add(list, JLI_StringDup(const_extra_jargs[i])); + } + + for (i = 0 ; i < main_jargc ; i++) { + JLI_List_add(list, JLI_StringDup(const_jargs[i])); + } + + // terminate the list + JLI_List_add(list, NULL); + jargv = list->elements; + } else if (extra_jargc > 0) { // should never happen + fprintf(stderr, "EXTRA_JAVA_ARGS defined without JAVA_ARGS"); + abort(); + } else { // no extra args, business as usual + jargc = main_jargc; + jargv = (char **) const_jargs; + } + } + + JLI_InitArgProcessing(jargc > 0, const_disable_argfile); + #ifdef _WIN32 { int i = 0; if (getenv(JLDEBUG_ENV_ENTRY) != NULL) { printf("Windows original main args:\n");
*** 162,175 **** JLI_List_add(args, NULL); margv = args->elements; } #endif /* WIN32 */ return JLI_Launch(margc, margv, ! sizeof(const_jargs) / sizeof(char *), const_jargs, 0, NULL, VERSION_STRING, DOT_VERSION, (const_progname != NULL) ? const_progname : *margv, (const_launcher != NULL) ? const_launcher : *margv, ! HAS_JAVA_ARGS, const_cpwildcard, const_javaw, 0); } --- 201,214 ---- JLI_List_add(args, NULL); margv = args->elements; } #endif /* WIN32 */ return JLI_Launch(margc, margv, ! jargc, (const char**) jargv, 0, NULL, VERSION_STRING, DOT_VERSION, (const_progname != NULL) ? const_progname : *margv, (const_launcher != NULL) ? const_launcher : *margv, ! jargc > 0, const_cpwildcard, const_javaw, 0); }
< prev index next >