cmd.exe: Pass the command list through so it is available to built in commands.
This commit is contained in:
parent
aad1d8ce24
commit
8f12d8bde3
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
|
WINE_DEFAULT_DEBUG_CHANNEL(cmd);
|
||||||
|
|
||||||
void WCMD_execute (WCHAR *orig_command, WCHAR *parameter, WCHAR *substitution);
|
void WCMD_execute (WCHAR *orig_command, WCHAR *parameter, WCHAR *substitution, CMD_LIST **cmdList);
|
||||||
|
|
||||||
struct env_stack *saved_environment;
|
struct env_stack *saved_environment;
|
||||||
struct env_stack *pushd_directories;
|
struct env_stack *pushd_directories;
|
||||||
|
@ -575,7 +575,7 @@ void WCMD_echo (const WCHAR *command) {
|
||||||
* will probably work here, but the reverse is not necessarily the case...
|
* will probably work here, but the reverse is not necessarily the case...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_for (WCHAR *p) {
|
void WCMD_for (WCHAR *p, CMD_LIST **cmdList) {
|
||||||
|
|
||||||
WIN32_FIND_DATA fd;
|
WIN32_FIND_DATA fd;
|
||||||
HANDLE hff;
|
HANDLE hff;
|
||||||
|
@ -609,12 +609,12 @@ void WCMD_for (WCHAR *p) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
do {
|
do {
|
||||||
WCMD_execute (cmd, param, fd.cFileName);
|
WCMD_execute (cmd, param, fd.cFileName, cmdList);
|
||||||
} while (FindNextFile(hff, &fd) != 0);
|
} while (FindNextFile(hff, &fd) != 0);
|
||||||
FindClose (hff);
|
FindClose (hff);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
WCMD_execute (cmd, param, item);
|
WCMD_execute (cmd, param, item, cmdList);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -626,7 +626,7 @@ void WCMD_for (WCHAR *p) {
|
||||||
* Execute a command after substituting variable text for the supplied parameter
|
* Execute a command after substituting variable text for the supplied parameter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_execute (WCHAR *orig_cmd, WCHAR *param, WCHAR *subst) {
|
void WCMD_execute (WCHAR *orig_cmd, WCHAR *param, WCHAR *subst, CMD_LIST **cmdList) {
|
||||||
|
|
||||||
WCHAR *new_cmd, *p, *s, *dup;
|
WCHAR *new_cmd, *p, *s, *dup;
|
||||||
int size;
|
int size;
|
||||||
|
@ -644,7 +644,7 @@ void WCMD_execute (WCHAR *orig_cmd, WCHAR *param, WCHAR *subst) {
|
||||||
s = p + strlenW (param);
|
s = p + strlenW (param);
|
||||||
}
|
}
|
||||||
strcatW (new_cmd, s);
|
strcatW (new_cmd, s);
|
||||||
WCMD_process_command (new_cmd);
|
WCMD_process_command (new_cmd, cmdList);
|
||||||
free (dup);
|
free (dup);
|
||||||
LocalFree ((HANDLE)new_cmd);
|
LocalFree ((HANDLE)new_cmd);
|
||||||
}
|
}
|
||||||
|
@ -790,7 +790,7 @@ void WCMD_popd (void) {
|
||||||
* FIXME: Much more syntax checking needed!
|
* FIXME: Much more syntax checking needed!
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_if (WCHAR *p) {
|
void WCMD_if (WCHAR *p, CMD_LIST **cmdList) {
|
||||||
|
|
||||||
int negate = 0, test = 0;
|
int negate = 0, test = 0;
|
||||||
WCHAR condition[MAX_PATH], *command, *s;
|
WCHAR condition[MAX_PATH], *command, *s;
|
||||||
|
@ -834,7 +834,7 @@ void WCMD_if (WCHAR *p) {
|
||||||
}
|
}
|
||||||
if (test != negate) {
|
if (test != negate) {
|
||||||
command = WCMD_strdupW(command);
|
command = WCMD_strdupW(command);
|
||||||
WCMD_process_command (command);
|
WCMD_process_command (command, cmdList);
|
||||||
free (command);
|
free (command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,10 +51,10 @@ void WCMD_echo (const WCHAR *);
|
||||||
void WCMD_endlocal (void);
|
void WCMD_endlocal (void);
|
||||||
void WCMD_enter_paged_mode(const WCHAR *);
|
void WCMD_enter_paged_mode(const WCHAR *);
|
||||||
void WCMD_exit (void);
|
void WCMD_exit (void);
|
||||||
void WCMD_for (WCHAR *);
|
void WCMD_for (WCHAR *, CMD_LIST **cmdList);
|
||||||
void WCMD_give_help (WCHAR *command);
|
void WCMD_give_help (WCHAR *command);
|
||||||
void WCMD_goto (void);
|
void WCMD_goto (void);
|
||||||
void WCMD_if (WCHAR *);
|
void WCMD_if (WCHAR *, CMD_LIST **cmdList);
|
||||||
void WCMD_leave_paged_mode(void);
|
void WCMD_leave_paged_mode(void);
|
||||||
void WCMD_more (WCHAR *);
|
void WCMD_more (WCHAR *);
|
||||||
void WCMD_move (void);
|
void WCMD_move (void);
|
||||||
|
@ -65,7 +65,7 @@ void WCMD_pause (void);
|
||||||
void WCMD_pipe (CMD_LIST **command);
|
void WCMD_pipe (CMD_LIST **command);
|
||||||
void WCMD_popd (void);
|
void WCMD_popd (void);
|
||||||
void WCMD_print_error (void);
|
void WCMD_print_error (void);
|
||||||
void WCMD_process_command (WCHAR *command);
|
void WCMD_process_command (WCHAR *command, CMD_LIST **cmdList);
|
||||||
void WCMD_pushd (WCHAR *);
|
void WCMD_pushd (WCHAR *);
|
||||||
int WCMD_read_console (WCHAR *string, int str_len);
|
int WCMD_read_console (WCHAR *string, int str_len);
|
||||||
void WCMD_remove_dir (WCHAR *command);
|
void WCMD_remove_dir (WCHAR *command);
|
||||||
|
|
|
@ -463,7 +463,7 @@ int wmain (int argc, WCHAR *argvW[])
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
void WCMD_process_command (WCHAR *command)
|
void WCMD_process_command (WCHAR *command, CMD_LIST **cmdList)
|
||||||
{
|
{
|
||||||
WCHAR *cmd, *p, *s, *t, *redir;
|
WCHAR *cmd, *p, *s, *t, *redir;
|
||||||
int status, i;
|
int status, i;
|
||||||
|
@ -709,7 +709,7 @@ void WCMD_process_command (WCHAR *command)
|
||||||
WCMD_echo(&whichcmd[count]);
|
WCMD_echo(&whichcmd[count]);
|
||||||
break;
|
break;
|
||||||
case WCMD_FOR:
|
case WCMD_FOR:
|
||||||
WCMD_for (p);
|
WCMD_for (p, cmdList);
|
||||||
break;
|
break;
|
||||||
case WCMD_GOTO:
|
case WCMD_GOTO:
|
||||||
WCMD_goto ();
|
WCMD_goto ();
|
||||||
|
@ -718,7 +718,7 @@ void WCMD_process_command (WCHAR *command)
|
||||||
WCMD_give_help (p);
|
WCMD_give_help (p);
|
||||||
break;
|
break;
|
||||||
case WCMD_IF:
|
case WCMD_IF:
|
||||||
WCMD_if (p);
|
WCMD_if (p, cmdList);
|
||||||
break;
|
break;
|
||||||
case WCMD_LABEL:
|
case WCMD_LABEL:
|
||||||
WCMD_volume (1, p);
|
WCMD_volume (1, p);
|
||||||
|
@ -1503,19 +1503,19 @@ void WCMD_pipe (CMD_LIST **cmdEntry) {
|
||||||
p = strchrW(command, '|');
|
p = strchrW(command, '|');
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
wsprintf (temp_cmd, redirOut, command, temp_file);
|
wsprintf (temp_cmd, redirOut, command, temp_file);
|
||||||
WCMD_process_command (temp_cmd);
|
WCMD_process_command (temp_cmd, cmdEntry);
|
||||||
command = p;
|
command = p;
|
||||||
while ((p = strchrW(command, '|'))) {
|
while ((p = strchrW(command, '|'))) {
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
GetTempFileName (temp_path, cmdW, 0, temp_file2);
|
GetTempFileName (temp_path, cmdW, 0, temp_file2);
|
||||||
wsprintf (temp_cmd, redirBoth, command, temp_file, temp_file2);
|
wsprintf (temp_cmd, redirBoth, command, temp_file, temp_file2);
|
||||||
WCMD_process_command (temp_cmd);
|
WCMD_process_command (temp_cmd, cmdEntry);
|
||||||
DeleteFile (temp_file);
|
DeleteFile (temp_file);
|
||||||
strcpyW (temp_file, temp_file2);
|
strcpyW (temp_file, temp_file2);
|
||||||
command = p;
|
command = p;
|
||||||
}
|
}
|
||||||
wsprintf (temp_cmd, redirIn, command, temp_file);
|
wsprintf (temp_cmd, redirIn, command, temp_file);
|
||||||
WCMD_process_command (temp_cmd);
|
WCMD_process_command (temp_cmd, cmdEntry);
|
||||||
DeleteFile (temp_file);
|
DeleteFile (temp_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2080,10 +2080,10 @@ void WCMD_process_commands(CMD_LIST *thisCmd) {
|
||||||
if (strchrW(thisCmd->command,'|') != NULL) {
|
if (strchrW(thisCmd->command,'|') != NULL) {
|
||||||
WCMD_pipe (&thisCmd);
|
WCMD_pipe (&thisCmd);
|
||||||
} else {
|
} else {
|
||||||
WCMD_process_command (thisCmd->command);
|
WCMD_process_command (thisCmd->command, &thisCmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
thisCmd = thisCmd->nextcommand;
|
if (thisCmd) thisCmd = thisCmd->nextcommand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue