cmd.exe: PROMPT option to show pushd levels.

This commit is contained in:
Jason Edmeades 2007-03-04 22:34:20 +00:00 committed by Alexandre Julliard
parent 00ba810dbf
commit 8049ae1af8
3 changed files with 22 additions and 7 deletions

View File

@ -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;
}
}

View File

@ -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 */
/*

View File

@ -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';