type accepts more than one file specification

F3 working in command line history (for now simply the same as up arrow)

svn path=/trunk/; revision=803
This commit is contained in:
Paolo Pantaleo 1999-11-27 19:14:59 +00:00
parent 0d630c9ee3
commit 6d3a97eb5e
2 changed files with 61 additions and 10 deletions

View file

@ -302,7 +302,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
ClearCommandLine (str, maxlen, orgx, orgy); ClearCommandLine (str, maxlen, orgx, orgy);
current = charcount = 0; current = charcount = 0;
break; break;
case VK_F3:
case VK_UP: case VK_UP:
#ifdef FEATURE_HISTORY #ifdef FEATURE_HISTORY
/* get previous command from buffer */ /* get previous command from buffer */

View file

@ -18,6 +18,9 @@
* *
* 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>) * 19-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
* Unicode and redirection ready! * Unicode and redirection ready!
*
* 19-Jan-1999 (Paolo Pantaleo <paolopan@freemail.it>)
* Added multiple file support (copied from y.c)
*/ */
#include "config.h" #include "config.h"
@ -33,13 +36,18 @@
INT cmd_type (LPTSTR cmd, LPTSTR param) INT cmd_type (LPTSTR cmd, LPTSTR param)
{ {
TCHAR szBuffer[256]; TCHAR buff[256];
HANDLE hFile; HANDLE hFile, hConsoleOut, hFind;
DWORD dwBytesRead; DWORD dwRead;
DWORD dwBytesWritten; DWORD dwWritten;
BOOL bResult; BOOL bRet;
INT args; INT argc,i;
LPTSTR *arg; LPTSTR *argv;
WIN32_FIND_DATA FindData;
hConsoleOut=GetStdHandle (STD_OUTPUT_HANDLE);
if (!_tcsncmp (param, _T("/?"), 2)) if (!_tcsncmp (param, _T("/?"), 2))
{ {
@ -54,8 +62,50 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
return 1; return 1;
} }
arg = split (param, &args); argv = split (param, &argc);
for (i = 1; i < argc; i++)
{
hFind=FindFirstFile(argv[i],&FindData);
if (hFind==INVALID_HANDLE_VALUE)
{
ConErrPrintf("File not found - %s\n",argv[i]);
continue;
}
do
{
hFile = CreateFile(FindData.cFileName,
GENERIC_READ,
FILE_SHARE_READ,NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
ConErrPrintf("File not found - %s\n",FindData.cFileName);
continue;
}
do
{
bRet = ReadFile(hFile,buff,sizeof(buff),&dwRead,NULL);
if (dwRead>0 && bRet)
WriteFile(hConsoleOut,buff,dwRead,&dwWritten,NULL);
} while(dwRead>0 && bRet);
CloseHandle(hFile);
}
while(FindNextFile(hFind,&FindData));
FindClose(hFile);
}
/*
if (args > 1) if (args > 1)
{ {
error_too_many_parameters (_T("\b \b")); error_too_many_parameters (_T("\b \b"));
@ -86,7 +136,8 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
while (bResult && dwBytesRead > 0); while (bResult && dwBytesRead > 0);
CloseHandle (hFile); CloseHandle (hFile);
freep (arg); */
freep (argv);
return 0; return 0;
} }