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); 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 *saved_environment;
struct env_stack *pushd_directories; struct env_stack *pushd_directories;
@ -612,6 +606,11 @@ void WCMD_pushd (void) {
} else { } else {
curdir -> next = pushd_directories; curdir -> next = pushd_directories;
curdir -> strings = thisdir; curdir -> strings = thisdir;
if (pushd_directories == NULL) {
curdir -> stackdepth = 1;
} else {
curdir -> stackdepth = pushd_directories -> stackdepth + 1;
}
pushd_directories = curdir; pushd_directories = curdir;
} }
} }

View File

@ -94,6 +94,15 @@ typedef struct {
BOOL skip_rest; /* Skip the rest of the batch program and exit */ BOOL skip_rest; /* Skip the rest of the batch program and exit */
} BATCH_CONTEXT; } 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 */ #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]; char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
BATCH_CONTEXT *context = NULL; BATCH_CONTEXT *context = NULL;
static HANDLE old_stdin = INVALID_HANDLE_VALUE, old_stdout = INVALID_HANDLE_VALUE; 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); static char *WCMD_expand_envvar(char *start);
@ -932,10 +933,16 @@ void WCMD_show_prompt (void) {
case 'V': case 'V':
lstrcat (q, version_string); lstrcat (q, version_string);
while (*q) q++; while (*q) q++;
break; break;
case '_': case '_':
*q++ = '\n'; *q++ = '\n';
break; break;
case '+':
if (pushd_directories) {
memset(q, '+', pushd_directories->stackdepth);
q = q + pushd_directories->stackdepth;
}
break;
} }
p++; p++;
*q = '\0'; *q = '\0';