Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
365f86fd
Commit
365f86fd
authored
Feb 23, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Feb 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Add pushd and popd.
parent
7aa2e616
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
74 additions
and
2 deletions
+74
-2
En.rc
programs/cmd/En.rc
+8
-0
builtins.c
programs/cmd/builtins.c
+54
-0
wcmd.h
programs/cmd/wcmd.h
+5
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+7
-1
No files found.
programs/cmd/En.rc
View file @
365f86fd
...
@@ -196,6 +196,12 @@ The verify flag has no function in Wine.\n"
...
@@ -196,6 +196,12 @@ The verify flag has no function in Wine.\n"
WCMD_VOL, "Help about VOL\n"
WCMD_VOL, "Help about VOL\n"
WCMD_PUSHD, "PUSHD <directoryname> saves the current directory onto a\n\
stack, and then changes the current directory to the supplied one.\n"
WCMD_POPD, "POPD changes current directory to the last one saved with\n\
PUSHD.\n"
WCMD_EXIT,
WCMD_EXIT,
"EXIT terminates the current command session and returns\n\
"EXIT terminates the current command session and returns\n\
to the operating system or shell from which you invoked cmd.\n"
to the operating system or shell from which you invoked cmd.\n"
...
@@ -215,7 +221,9 @@ HELP\t\tShow brief help details on a topic\n\
...
@@ -215,7 +221,9 @@ HELP\t\tShow brief help details on a topic\n\
MD (MKDIR)\tCreate a subdirectory\n\
MD (MKDIR)\tCreate a subdirectory\n\
MOVE\t\tMove a file, set of files or directory tree\n\
MOVE\t\tMove a file, set of files or directory tree\n\
PATH\t\tSet or show the search path\n\
PATH\t\tSet or show the search path\n\
POPD\t\tRestores the directory to the last one saved with PUSHD\n\
PROMPT\t\tChange the command prompt\n\
PROMPT\t\tChange the command prompt\n\
PUSHD\t\tChanges to a new directory, saving the current one\n\
REN (RENAME)\tRename a file\n\
REN (RENAME)\tRename a file\n\
RD (RMDIR)\tDelete a subdirectory\n\
RD (RMDIR)\tDelete a subdirectory\n\
SET\t\tSet or show environment variables\n\
SET\t\tSet or show environment variables\n\
...
...
programs/cmd/builtins.c
View file @
365f86fd
...
@@ -45,6 +45,7 @@ struct env_stack
...
@@ -45,6 +45,7 @@ struct env_stack
};
};
struct
env_stack
*
saved_environment
;
struct
env_stack
*
saved_environment
;
struct
env_stack
*
pushd_directories
;
extern
HINSTANCE
hinst
;
extern
HINSTANCE
hinst
;
extern
char
*
inbuilt
[];
extern
char
*
inbuilt
[];
...
@@ -449,6 +450,59 @@ char string[MAX_PATH];
...
@@ -449,6 +450,59 @@ char string[MAX_PATH];
return
;
return
;
}
}
/*****************************************************************************
* WCMD_pushd
*
* Push a directory onto the stack
*/
void
WCMD_pushd
(
void
)
{
struct
env_stack
*
curdir
;
BOOL
status
;
WCHAR
*
thisdir
;
curdir
=
LocalAlloc
(
LMEM_FIXED
,
sizeof
(
struct
env_stack
));
thisdir
=
LocalAlloc
(
LMEM_FIXED
,
1024
*
sizeof
(
WCHAR
));
if
(
!
curdir
||
!
thisdir
)
{
LocalFree
(
curdir
);
LocalFree
(
thisdir
);
WCMD_output
(
"out of memory
\n
"
);
return
;
}
GetCurrentDirectoryW
(
1024
,
thisdir
);
status
=
SetCurrentDirectoryA
(
param1
);
if
(
!
status
)
{
WCMD_print_error
();
LocalFree
(
curdir
);
LocalFree
(
thisdir
);
return
;
}
else
{
curdir
->
next
=
pushd_directories
;
curdir
->
strings
=
thisdir
;
pushd_directories
=
curdir
;
}
}
/*****************************************************************************
* WCMD_popd
*
* Pop a directory from the stack
*/
void
WCMD_popd
(
void
)
{
struct
env_stack
*
temp
=
pushd_directories
;
if
(
!
pushd_directories
)
return
;
/* pop the old environment from the stack, and make it the current dir */
pushd_directories
=
temp
->
next
;
SetCurrentDirectoryW
(
temp
->
strings
);
LocalFree
(
temp
->
strings
);
LocalFree
(
temp
);
}
/****************************************************************************
/****************************************************************************
* WCMD_if
* WCMD_if
...
...
programs/cmd/wcmd.h
View file @
365f86fd
...
@@ -49,8 +49,10 @@ void WCMD_output_asis (const char *message);
...
@@ -49,8 +49,10 @@ void WCMD_output_asis (const char *message);
void
WCMD_parse
(
char
*
s
,
char
*
q
,
char
*
p1
,
char
*
p2
);
void
WCMD_parse
(
char
*
s
,
char
*
q
,
char
*
p1
,
char
*
p2
);
void
WCMD_pause
(
void
);
void
WCMD_pause
(
void
);
void
WCMD_pipe
(
char
*
command
);
void
WCMD_pipe
(
char
*
command
);
void
WCMD_popd
(
void
);
void
WCMD_print_error
(
void
);
void
WCMD_print_error
(
void
);
void
WCMD_process_command
(
char
*
command
);
void
WCMD_process_command
(
char
*
command
);
void
WCMD_pushd
(
void
);
int
WCMD_read_console
(
char
*
string
,
int
str_len
);
int
WCMD_read_console
(
char
*
string
,
int
str_len
);
void
WCMD_remove_dir
(
void
);
void
WCMD_remove_dir
(
void
);
void
WCMD_rename
(
void
);
void
WCMD_rename
(
void
);
...
@@ -137,9 +139,11 @@ typedef struct {
...
@@ -137,9 +139,11 @@ typedef struct {
#define WCMD_ENDLOCAL 36
#define WCMD_ENDLOCAL 36
#define WCMD_SETLOCAL 37
#define WCMD_SETLOCAL 37
#define WCMD_PUSHD 38
#define WCMD_POPD 39
/* Must be last in list */
/* Must be last in list */
#define WCMD_EXIT
38
#define WCMD_EXIT
40
/* Some standard messages */
/* Some standard messages */
extern
const
char
nyi
[];
extern
const
char
nyi
[];
...
...
programs/cmd/wcmdmain.c
View file @
365f86fd
...
@@ -32,7 +32,7 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY",
...
@@ -32,7 +32,7 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY",
"HELP"
,
"IF"
,
"LABEL"
,
"MD"
,
"MKDIR"
,
"MOVE"
,
"PATH"
,
"PAUSE"
,
"HELP"
,
"IF"
,
"LABEL"
,
"MD"
,
"MKDIR"
,
"MOVE"
,
"PATH"
,
"PAUSE"
,
"PROMPT"
,
"REM"
,
"REN"
,
"RENAME"
,
"RD"
,
"RMDIR"
,
"SET"
,
"SHIFT"
,
"PROMPT"
,
"REM"
,
"REN"
,
"RENAME"
,
"RD"
,
"RMDIR"
,
"SET"
,
"SHIFT"
,
"TIME"
,
"TITLE"
,
"TYPE"
,
"VERIFY"
,
"VER"
,
"VOL"
,
"TIME"
,
"TITLE"
,
"TYPE"
,
"VERIFY"
,
"VER"
,
"VOL"
,
"ENDLOCAL"
,
"SETLOCAL"
,
"EXIT"
};
"ENDLOCAL"
,
"SETLOCAL"
,
"
PUSHD"
,
"POPD"
,
"
EXIT"
};
HINSTANCE
hinst
;
HINSTANCE
hinst
;
DWORD
errorlevel
;
DWORD
errorlevel
;
...
@@ -522,6 +522,12 @@ void WCMD_process_command (char *command)
...
@@ -522,6 +522,12 @@ void WCMD_process_command (char *command)
case
WCMD_VOL
:
case
WCMD_VOL
:
WCMD_volume
(
0
,
p
);
WCMD_volume
(
0
,
p
);
break
;
break
;
case
WCMD_PUSHD
:
WCMD_pushd
();
break
;
case
WCMD_POPD
:
WCMD_popd
();
break
;
case
WCMD_EXIT
:
case
WCMD_EXIT
:
WCMD_exit
();
WCMD_exit
();
break
;
break
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment