Some reformatting, no code change

svn path=/trunk/; revision=25991
This commit is contained in:
Hervé Poussineau 2007-03-04 23:18:28 +00:00
parent 55a11ded1b
commit abfa7fb417

View file

@ -92,7 +92,6 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
}
VOID ConInString (LPTSTR lpInput, DWORD dwLength)
{
DWORD dwOldMode;
@ -192,17 +191,17 @@ VOID ConPuts(LPTSTR szText, DWORD nStdHandle)
VOID ConOutResPaging(BOOL NewPage, UINT resID)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConOutPrintfPaging(NewPage, szMsg);
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConOutPrintfPaging(NewPage, szMsg);
}
VOID ConOutResPuts (UINT resID)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConPuts(szMsg, STD_OUTPUT_HANDLE);
ConPuts(szMsg, STD_OUTPUT_HANDLE);
}
VOID ConOutPuts (LPTSTR szText)
@ -246,16 +245,16 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
TCHAR szOut[OUTPUT_BUFFER_SIZE];
DWORD dwWritten;
/* used to count number of lines since last pause */
/* used to count number of lines since last pause */
static int LineCount = 0;
/* used to see how big the screen is */
/* used to see how big the screen is */
int ScreenLines = 0;
/* the number of chars in a roow */
/* the number of chars in a roow */
int ScreenCol = 0;
/* chars since start of line */
/* chars since start of line */
int CharSL = 0;
int i = 0;
@ -263,28 +262,28 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
if(NewPage == TRUE)
LineCount = 0;
/* rest LineCount and return if no string have been given */
if (szFormat == NULL)
return 0;
/* rest LineCount and return if no string have been given */
if (szFormat == NULL)
return 0;
//get the size of the visual screen that can be printed too
if (!GetConsoleScreenBufferInfo(hConsole, &csbi))
{
// we assuming its a file handle
ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0;
}
{
// we assuming its a file handle
ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0;
}
//subtract 2 to account for "press any key..." and for the blank line at the end of PagePrompt()
ScreenLines = (csbi.srWindow.Bottom - csbi.srWindow.Top) - 4;
ScreenCol = (csbi.srWindow.Right - csbi.srWindow.Left) + 1;
//make sure they didnt make the screen to small
if(ScreenLines<4)
{
ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0;
}
{
ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0;
}
len = _vstprintf (szOut, szFormat, arg_ptr);
pBuf = szOut;
@ -295,23 +294,23 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
for(; (i < len) && (pBuf[i] != _T('\n') && (CharSL<ScreenCol)) ; i++)
CharSL++;
WriteFile (GetStdHandle (nStdHandle),&pBuf[i-CharSL],sizeof(CHAR)*(CharSL+1),&dwWritten,NULL);
WriteFile (GetStdHandle (nStdHandle),&pBuf[i-CharSL],sizeof(CHAR)*(CharSL+1),&dwWritten,NULL);
LineCount++;
CharSL=0;
CharSL=0;
if(LineCount >= ScreenLines)
{
if(_tcsnicmp(&pBuf[i], _T("\n"), 2)!=0)
if(LineCount >= ScreenLines)
{
if(_tcsnicmp(&pBuf[i], _T("\n"), 2)!=0)
WriteFile (GetStdHandle (nStdHandle),_T("\n"),sizeof(CHAR),&dwWritten,NULL);
if(PagePrompt() != PROMPT_YES)
{
return 1;
}
//reset the number of lines being printed
LineCount = 0;
CharSL=0;
}
if(PagePrompt() != PROMPT_YES)
{
return 1;
}
//reset the number of lines being printed
LineCount = 0;
CharSL=0;
}
}
@ -408,7 +407,7 @@ VOID ConErrChar (TCHAR c)
VOID ConErrResPuts (UINT resID)
{
TCHAR szMsg[RC_STRING_MAX_SIZE];
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
LoadString(CMD_ModuleHandle, resID, szMsg, RC_STRING_MAX_SIZE);
ConPuts(szMsg, STD_ERROR_HANDLE);
}