Commit 8049ae1a authored by Jason Edmeades's avatar Jason Edmeades Committed by Alexandre Julliard

cmd.exe: PROMPT option to show pushd levels.

parent 00ba810d
......@@ -42,12 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(cmd);
void WCMD_execute (char *orig_command, char *parameter, char *substitution);
struct env_stack
{
struct env_stack *next;
WCHAR *strings;
};
struct env_stack *saved_environment;
struct env_stack *pushd_directories;
......@@ -612,6 +606,11 @@ void WCMD_pushd (void) {
} else {
curdir -> next = pushd_directories;
curdir -> strings = thisdir;
if (pushd_directories == NULL) {
curdir -> stackdepth = 1;
} else {
curdir -> stackdepth = pushd_directories -> stackdepth + 1;
}
pushd_directories = curdir;
}
}
......
......@@ -94,6 +94,15 @@ typedef struct {
BOOL skip_rest; /* Skip the rest of the batch program and exit */
} BATCH_CONTEXT;
/* Data structure to save setlocal and pushd information */
struct env_stack
{
struct env_stack *next;
int stackdepth; /* Only used for pushd and popd */
WCHAR *strings;
};
#endif /* !RC_INVOKED */
/*
......
......@@ -45,6 +45,7 @@ const char anykey[] = "Press Return key to continue: ";
char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
BATCH_CONTEXT *context = NULL;
static HANDLE old_stdin = INVALID_HANDLE_VALUE, old_stdout = INVALID_HANDLE_VALUE;
extern struct env_stack *pushd_directories;
static char *WCMD_expand_envvar(char *start);
......@@ -936,6 +937,12 @@ void WCMD_show_prompt (void) {
case '_':
*q++ = '\n';
break;
case '+':
if (pushd_directories) {
memset(q, '+', pushd_directories->stackdepth);
q = q + pushd_directories->stackdepth;
}
break;
}
p++;
*q = '\0';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment