jdk/src/java.base/share/native/launcher/main.c
changeset 32267 4e96a9ee01b1
parent 30822 e26f66cc0f05
child 34000 a5c49d5a7d7f
equal deleted inserted replaced
32266:e0a235a11254 32267:4e96a9ee01b1
    29  * this is the only file which will be repeatedly compiled by other
    29  * this is the only file which will be repeatedly compiled by other
    30  * tools. The rest of the files will be linked in.
    30  * tools. The rest of the files will be linked in.
    31  */
    31  */
    32 
    32 
    33 #include "defines.h"
    33 #include "defines.h"
       
    34 #include "jli_util.h"
    34 
    35 
    35 #ifdef _MSC_VER
    36 #ifdef _MSC_VER
    36 #if _MSC_VER > 1400 && _MSC_VER < 1600
    37 #if _MSC_VER > 1400 && _MSC_VER < 1600
    37 
    38 
    38 /*
    39 /*
    94 {
    95 {
    95     int margc;
    96     int margc;
    96     char** margv;
    97     char** margv;
    97     const jboolean const_javaw = JNI_FALSE;
    98     const jboolean const_javaw = JNI_FALSE;
    98 #endif /* JAVAW */
    99 #endif /* JAVAW */
       
   100 
       
   101     JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile);
       
   102 
    99 #ifdef _WIN32
   103 #ifdef _WIN32
   100     {
   104     {
   101         int i = 0;
   105         int i = 0;
   102         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
   106         if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {
   103             printf("Windows original main args:\n");
   107             printf("Windows original main args:\n");
   117             margv[i] = stdargs[i].arg;
   121             margv[i] = stdargs[i].arg;
   118         }
   122         }
   119         margv[i] = NULL;
   123         margv[i] = NULL;
   120     }
   124     }
   121 #else /* *NIXES */
   125 #else /* *NIXES */
   122     margc = argc;
   126     {
   123     margv = argv;
   127         // accommodate the NULL at the end
       
   128         JLI_List args = JLI_List_new(argc + 1);
       
   129         int i = 0;
       
   130         for (i = 0; i < argc; i++) {
       
   131             JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
       
   132             if (NULL == argsInFile) {
       
   133                 JLI_List_add(args, JLI_StringDup(argv[i]));
       
   134             } else {
       
   135                 int cnt, idx;
       
   136                 cnt = argsInFile->size;
       
   137                 for (idx = 0; idx < cnt; idx++) {
       
   138                     JLI_List_add(args, argsInFile->elements[idx]);
       
   139                 }
       
   140                 // Shallow free, we reuse the string to avoid copy
       
   141                 JLI_MemFree(argsInFile->elements);
       
   142                 JLI_MemFree(argsInFile);
       
   143             }
       
   144         }
       
   145         margc = args->size;
       
   146         // add the NULL pointer at argv[argc]
       
   147         JLI_List_add(args, NULL);
       
   148         margv = args->elements;
       
   149     }
   124 #endif /* WIN32 */
   150 #endif /* WIN32 */
   125     return JLI_Launch(margc, margv,
   151     return JLI_Launch(margc, margv,
   126                    sizeof(const_jargs) / sizeof(char *), const_jargs,
   152                    sizeof(const_jargs) / sizeof(char *), const_jargs,
   127                    sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
   153                    sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
   128                    FULL_VERSION,
   154                    FULL_VERSION,