Rename 'argv0' and 'argv1' to the more meaningful 'interp_name' and

'interp_args'.


git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2530
This commit is contained in:
Nicholas Nethercote 2004-07-26 15:32:47 +00:00
parent 7f9a4f8c64
commit c4a06df097
3 changed files with 22 additions and 22 deletions

View File

@ -565,19 +565,19 @@ static int load_script(char *hdr, int len, int fd, const char *name, struct exei
*cp = '\0';
}
info->argv0 = strdup(interp);
assert(NULL != info->argv0);
info->interp_name = strdup(interp);
assert(NULL != info->interp_name);
if (arg != NULL && *arg != '\0') {
info->argv1 = strdup(arg);
assert(NULL != info->argv1);
info->interp_args = strdup(arg);
assert(NULL != info->interp_args);
}
if (info->argv && info->argv[0] != NULL)
info->argv[0] = (char *)name;
if (0)
printf("#! script: argv0=\"%s\" argv1=\"%s\"\n",
info->argv0, info->argv1);
printf("#! script: interp_name=\"%s\" interp_args=\"%s\"\n",
info->interp_name, info->interp_args);
return do_exec_inner(interp, info);
}
@ -669,8 +669,8 @@ static int do_exec_inner(const char *exe, struct exeinfo *info)
int do_exec(const char *exe, struct exeinfo *info)
{
info->argv0 = NULL;
info->argv1 = NULL;
info->interp_name = NULL;
info->interp_args = NULL;
return do_exec_inner(exe, info);
}

View File

@ -70,8 +70,8 @@ struct exeinfo
addr_t brkbase; // base address of brk segment
// These are the extra args added by #! scripts
char* argv0; // INPUT: the interpreter name
char* argv1; // INPUT: the args for the interpreter
char* interp_name; // INPUT: the interpreter name
char* interp_args; // INPUT: the args for the interpreter
};
int do_exec(const char *exe, struct exeinfo *info);

View File

@ -1013,13 +1013,13 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
/* paste on the extra args if the loader needs them (ie, the #!
interpreter and its argument) */
argc = 0;
if (info->argv0 != NULL) {
if (info->interp_name != NULL) {
argc++;
stringsize += strlen(info->argv0) + 1;
stringsize += strlen(info->interp_name) + 1;
}
if (info->argv1 != NULL) {
if (info->interp_args != NULL) {
argc++;
stringsize += strlen(info->argv1) + 1;
stringsize += strlen(info->interp_args) + 1;
}
/* now scan the args we're given... */
@ -1091,13 +1091,13 @@ static Addr setup_client_stack(char **orig_argv, char **orig_envp,
*ptr++ = argc; /* client argc */
/* --- argv --- */
if (info->argv0) {
*ptr++ = (addr_t)copy_str(&strtab, info->argv0);
free(info->argv0);
if (info->interp_name) {
*ptr++ = (addr_t)copy_str(&strtab, info->interp_name);
free(info->interp_name);
}
if (info->argv1) {
*ptr++ = (addr_t)copy_str(&strtab, info->argv1);
free(info->argv1);
if (info->interp_args) {
*ptr++ = (addr_t)copy_str(&strtab, info->interp_args);
free(info->interp_args);
}
for (cpp = orig_argv; *cpp; ptr++, cpp++) {
*ptr = (addr_t)copy_str(&strtab, *cpp);
@ -1452,8 +1452,8 @@ static void load_client(char* cl_argv[], const char* exec, Int need_help,
if (need_help) {
VG_(clexecfd) = -1;
info->argv0 = NULL;
info->argv1 = NULL;
info->interp_name = NULL;
info->interp_args = NULL;
} else {
Int ret;
VG_(clexecfd) = VG_(open)(exec, O_RDONLY, VKI_S_IRUSR);