< prev index next >
src/java.base/share/native/launcher/main.c
Print this page
rev 12309 : 8027634: Support @argfiles for java command-line tool
Reviewed-by: ksrini, mchung
*** 29,38 ****
--- 29,39 ----
* this is the only file which will be repeatedly compiled by other
* tools. The rest of the files will be linked in.
*/
#include "defines.h"
+ #include "jli_util.h"
#ifdef _MSC_VER
#if _MSC_VER > 1400 && _MSC_VER < 1600
/*
*** 104,114 ****
for (i = 0 ; i < __argc ; i++) {
printf("wwwd_args[%d] = %s\n", i, __argv[i]);
}
}
}
! JLI_CmdToArgs(GetCommandLine());
margc = JLI_GetStdArgc();
// add one more to mark the end
margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));
{
int i = 0;
--- 105,115 ----
for (i = 0 ; i < __argc ; i++) {
printf("wwwd_args[%d] = %s\n", i, __argv[i]);
}
}
}
! JLI_CmdToArgs(GetCommandLine(), HAS_JAVA_ARGS);
margc = JLI_GetStdArgc();
// add one more to mark the end
margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));
{
int i = 0;
*** 117,128 ****
margv[i] = stdargs[i].arg;
}
margv[i] = NULL;
}
#else /* *NIXES */
! margc = argc;
! margv = argv;
#endif /* WIN32 */
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
FULL_VERSION,
--- 118,151 ----
margv[i] = stdargs[i].arg;
}
margv[i] = NULL;
}
#else /* *NIXES */
! // accommodate the NULL at the end
! JLI_List args = JLI_List_new(argc + 1);
! {
! int i = 0;
! for (i = 0; i < argc; i++) {
! JLI_List argsInFile = JLI_ExpandArgFile(argv[i], HAS_JAVA_ARGS);
! if (NULL == argsInFile) {
! JLI_List_add(args, JLI_StringDup(argv[i]));
! } else {
! int cnt, idx;
! cnt = argsInFile->size;
! for (idx = 0; idx < cnt; idx++) {
! JLI_List_add(args, argsInFile->elements[idx]);
! }
! // Shallow free, we reuse the string to avoid copy
! JLI_MemFree(argsInFile->elements);
! JLI_MemFree(argsInFile);
! }
! }
! }
! margc = args->size;
! // add the NULL pointer at argv[argc]
! JLI_List_add(args, NULL);
! margv = args->elements;
#endif /* WIN32 */
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
FULL_VERSION,
< prev index next >