for (argi = 1; argi < argc; argi++) {
char *arg = (*argv)[argi];
isVMType = 0;
#ifdef JAVA_ARGS
if (arg[0] != '-') {
newArgv[newArgvIdx++] = arg;
continue;
}
#else
if (strcmp(arg, "-classpath") == 0 ||
strcmp(arg, "-cp") == 0) {
newArgv[newArgvIdx++] = arg;
argi++;
if (argi < argc) {
newArgv[newArgvIdx++] = (*argv)[argi];
}
continue;
}
if (arg[0] != '-') break;
#endif
/* Did the user pass an explicit VM type? */
i = KnownVMIndex(arg);
if (i >= 0) {
jvmtype = knownVMs[jvmidx = i].name + 1; /* skip the - */
isVMType = 1;
*pargc = *pargc - 1;
}
/* Did the user specify an "alternate" VM? */
else if (strncmp(arg, "-XXaltjvm=", 10) == 0 || strncmp(arg, "-J-XXaltjvm=", 12) == 0) {
isVMType = 1;
jvmtype = arg+((arg[1]=='X')? 10 : 12);
jvmidx = -1;
}
if (!isVMType) {
newArgv[newArgvIdx++] = arg;
}
}
/*
* Finish copying the arguments if we aborted the above loop.
* NOTE that if we aborted via "break" then we did NOT copy the
* last argument above, and in addition argi will be less than
* argc.
*/
while (argi < argc) {
newArgv[newArgvIdx++] = (*argv)[argi];
argi++;
}
/* argv is null-terminated */
newArgv[newArgvIdx] = 0;
/* Copy back argv */
*argv = newArgv;
*pargc = newArgvIdx;
/* use the default VM type if not specified (no alias processing) */
if (jvmtype == NULL) {
char* result = knownVMs[0].name+1;
/* Use a different VM type if we are on a server class machine? */
if ((knownVMs[0].flag == VM_IF_SERVER_CLASS) &&
(ServerClassMachine() == JNI_TRUE)) {
result = knownVMs[0].server_class+1;
}
if (_launcher_debug) {
printf("Default VM: %s\n", result);
}
return result;
}
/* if using an alternate VM, no alias processing */
if (jvmidx < 0)
return jvmtype;
/* Resolve aliases first */
{
int loopCount = 0;
while (knownVMs[jvmidx].flag == VM_ALIASED_TO) {
int nextIdx = KnownVMIndex(knownVMs[jvmidx].alias);
if (loopCount > knownVMsCount) {
if (!speculative) {
ReportErrorMessage("Error: Corrupt jvm.cfg file; cycle in alias list.",
JNI_TRUE);
exit(1);
} else {
return "ERROR";
/* break; */
}
}
if (nextIdx < 0) {
if (!speculative) {
ReportErrorMessage2("Error: Unable to resolve VM alias %s",
knownVMs[jvmidx].alias, JNI_TRUE);
exit(1);
=7= |