cmd.exe: Add TYPE multiple file support.
This commit is contained in:
parent
085c0f4a3a
commit
4ef2f8ba1a
@ -1432,21 +1432,40 @@ void WCMD_title (char *command) {
|
|||||||
* Copy a file to standard output.
|
* Copy a file to standard output.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WCMD_type (void) {
|
void WCMD_type (char *command) {
|
||||||
|
|
||||||
HANDLE h;
|
int argno = 0;
|
||||||
char buffer[512];
|
char *argN = command;
|
||||||
DWORD count;
|
BOOL writeHeaders = FALSE;
|
||||||
|
|
||||||
if (param1[0] == 0x00) {
|
if (param1[0] == 0x00) {
|
||||||
WCMD_output ("Argument missing\n");
|
WCMD_output ("Argument missing\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
h = CreateFile (param1, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
|
||||||
|
if (param2[0] != 0x00) writeHeaders = TRUE;
|
||||||
|
|
||||||
|
/* Loop through all args */
|
||||||
|
errorlevel = 0;
|
||||||
|
while (argN) {
|
||||||
|
char *thisArg = WCMD_parameter (command, argno++, &argN);
|
||||||
|
|
||||||
|
HANDLE h;
|
||||||
|
char buffer[512];
|
||||||
|
DWORD count;
|
||||||
|
|
||||||
|
if (!argN) break;
|
||||||
|
|
||||||
|
WINE_TRACE("type: Processing arg '%s'\n", thisArg);
|
||||||
|
h = CreateFile (thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||||
if (h == INVALID_HANDLE_VALUE) {
|
if (h == INVALID_HANDLE_VALUE) {
|
||||||
WCMD_print_error ();
|
WCMD_print_error ();
|
||||||
return;
|
WCMD_output ("%s :Failed\n", thisArg);
|
||||||
|
errorlevel = 1;
|
||||||
|
} else {
|
||||||
|
if (writeHeaders) {
|
||||||
|
WCMD_output("\n%s\n\n", thisArg);
|
||||||
}
|
}
|
||||||
while (ReadFile (h, buffer, sizeof(buffer), &count, NULL)) {
|
while (ReadFile (h, buffer, sizeof(buffer), &count, NULL)) {
|
||||||
if (count == 0) break; /* ReadFile reports success on EOF! */
|
if (count == 0) break; /* ReadFile reports success on EOF! */
|
||||||
@ -1455,6 +1474,8 @@ void WCMD_type (void) {
|
|||||||
}
|
}
|
||||||
CloseHandle (h);
|
CloseHandle (h);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* WCMD_verify
|
* WCMD_verify
|
||||||
|
@ -71,7 +71,7 @@ void WCMD_setshow_time (void);
|
|||||||
void WCMD_shift (char *command);
|
void WCMD_shift (char *command);
|
||||||
void WCMD_show_prompt (void);
|
void WCMD_show_prompt (void);
|
||||||
void WCMD_title (char *);
|
void WCMD_title (char *);
|
||||||
void WCMD_type (void);
|
void WCMD_type (char *);
|
||||||
void WCMD_verify (char *command);
|
void WCMD_verify (char *command);
|
||||||
void WCMD_version (void);
|
void WCMD_version (void);
|
||||||
int WCMD_volume (int mode, char *command);
|
int WCMD_volume (int mode, char *command);
|
||||||
|
@ -669,7 +669,7 @@ void WCMD_process_command (char *command)
|
|||||||
WCMD_title(&whichcmd[count+1]);
|
WCMD_title(&whichcmd[count+1]);
|
||||||
break;
|
break;
|
||||||
case WCMD_TYPE:
|
case WCMD_TYPE:
|
||||||
WCMD_type ();
|
WCMD_type (p);
|
||||||
break;
|
break;
|
||||||
case WCMD_VER:
|
case WCMD_VER:
|
||||||
WCMD_version ();
|
WCMD_version ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user