93 int 94 main(int argc, char **argv) 95 { 96 int margc; 97 char** margv; 98 const jboolean const_javaw = JNI_FALSE; 99 #endif /* JAVAW */ 100 101 JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile); 102 103 #ifdef _WIN32 104 { 105 int i = 0; 106 if (getenv(JLDEBUG_ENV_ENTRY) != NULL) { 107 printf("Windows original main args:\n"); 108 for (i = 0 ; i < __argc ; i++) { 109 printf("wwwd_args[%d] = %s\n", i, __argv[i]); 110 } 111 } 112 } 113 JLI_CmdToArgs(GetCommandLine()); 114 margc = JLI_GetStdArgc(); 115 // add one more to mark the end 116 margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *))); 117 { 118 int i = 0; 119 StdArg *stdargs = JLI_GetStdArgs(); 120 for (i = 0 ; i < margc ; i++) { 121 margv[i] = stdargs[i].arg; 122 } 123 margv[i] = NULL; 124 } 125 #else /* *NIXES */ 126 { 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 } | 93 int 94 main(int argc, char **argv) 95 { 96 int margc; 97 char** margv; 98 const jboolean const_javaw = JNI_FALSE; 99 #endif /* JAVAW */ 100 101 JLI_InitArgProcessing(!HAS_JAVA_ARGS, const_disable_argfile); 102 103 #ifdef _WIN32 104 { 105 int i = 0; 106 if (getenv(JLDEBUG_ENV_ENTRY) != NULL) { 107 printf("Windows original main args:\n"); 108 for (i = 0 ; i < __argc ; i++) { 109 printf("wwwd_args[%d] = %s\n", i, __argv[i]); 110 } 111 } 112 } 113 114 if (!JLI_DecodeArgs(&margc, &margv)) { 115 exit(1); 116 } 117 #else /* *NIXES */ 118 { 119 // accommodate the NULL at the end 120 JLI_List args = JLI_List_new(argc + 1); 121 int i = 0; 122 for (i = 0; i < argc; i++) { 123 JLI_List argsInFile = JLI_PreprocessArg(argv[i]); 124 if (NULL == argsInFile) { 125 JLI_List_add(args, JLI_StringDup(argv[i])); 126 } else { 127 int cnt, idx; 128 cnt = argsInFile->size; 129 for (idx = 0; idx < cnt; idx++) { 130 JLI_List_add(args, argsInFile->elements[idx]); 131 } 132 // Shallow free, we reuse the string to avoid copy 133 JLI_MemFree(argsInFile->elements); 134 JLI_MemFree(argsInFile); 135 } |