From ef47860772967512752eb48efd2f057e2c17ee89 Mon Sep 17 00:00:00 2001 From: Hartmut Birr Date: Mon, 24 Feb 2003 23:16:13 +0000 Subject: [PATCH] - Fixed a bug within the parameter check. - Improved speed. svn path=/trunk/; revision=4191 --- rosapps/cmdutils/more.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/rosapps/cmdutils/more.c b/rosapps/cmdutils/more.c index 3155e443642..50855c2a3bc 100644 --- a/rosapps/cmdutils/more.c +++ b/rosapps/cmdutils/more.c @@ -84,7 +84,7 @@ int main (int argc, char **argv) { SHORT maxx,maxy; SHORT line_count=0,ch_count=0; - INT i; + INT i, last; /*reading/writing buffer*/ TCHAR *buff; @@ -100,7 +100,7 @@ int main (int argc, char **argv) hStdOut = GetStdHandle(STD_OUTPUT_HANDLE); hStdErr = GetStdHandle(STD_ERROR_HANDLE); - if (_tcsncmp (argv[1], _T("/?"), 2) == 0) + if (argc > 1 && _tcsncmp (argv[1], _T("/?"), 2) == 0) { ConOutPuts(_T("Help text still missing!!")); return 0; @@ -111,32 +111,34 @@ int main (int argc, char **argv) GetScreenSize(&maxx,&maxy); - buff=malloc(maxx); + buff=malloc(4096); FlushConsoleInputBuffer (hKeyboard); do { - bRet = ReadFile(hStdIn,buff,1,&dwRead,NULL); + bRet = ReadFile(hStdIn,buff,4096,&dwRead,NULL); - if (dwRead>0 && bRet) - WriteFile(hStdOut,buff,dwRead,&dwWritten,NULL); - - for(i=0;i0 && bRet);