mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 20:25:39 +00:00
[CMD] Code formatting; don't hardcode the string buffer sizes in function calls.
This commit is contained in:
parent
4bc5d44f06
commit
0bede0062a
1 changed files with 20 additions and 21 deletions
|
@ -52,7 +52,7 @@
|
||||||
static TCHAR DefaultPrompt[] = _T("$P$G");
|
static TCHAR DefaultPrompt[] = _T("$P$G");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize prompt support
|
* Initialize prompt support.
|
||||||
*/
|
*/
|
||||||
VOID InitPrompt(VOID)
|
VOID InitPrompt(VOID)
|
||||||
{
|
{
|
||||||
|
@ -62,12 +62,12 @@ VOID InitPrompt(VOID)
|
||||||
* Set the PROMPT environment variable if it doesn't exist already.
|
* Set the PROMPT environment variable if it doesn't exist already.
|
||||||
* You can change the PROMPT environment variable before cmd starts.
|
* You can change the PROMPT environment variable before cmd starts.
|
||||||
*/
|
*/
|
||||||
if (GetEnvironmentVariable(_T("PROMPT"), Buffer, ARRAYSIZE(Buffer)) == 0)
|
if (GetEnvironmentVariable(_T("PROMPT"), Buffer, _countof(Buffer)) == 0)
|
||||||
SetEnvironmentVariable(_T("PROMPT"), DefaultPrompt);
|
SetEnvironmentVariable(_T("PROMPT"), DefaultPrompt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print an information line on top of the screen
|
* Print an information line on top of the screen.
|
||||||
*/
|
*/
|
||||||
VOID PrintInfoLine(VOID)
|
VOID PrintInfoLine(VOID)
|
||||||
{
|
{
|
||||||
|
@ -104,14 +104,15 @@ VOID PrintInfoLine(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print the command-line prompt
|
* Print the command-line prompt.
|
||||||
*/
|
*/
|
||||||
VOID PrintPrompt(VOID)
|
VOID PrintPrompt(VOID)
|
||||||
{
|
{
|
||||||
TCHAR szPrompt[256];
|
|
||||||
LPTSTR pr;
|
LPTSTR pr;
|
||||||
|
TCHAR szPrompt[256];
|
||||||
|
TCHAR szPath[MAX_PATH];
|
||||||
|
|
||||||
if (GetEnvironmentVariable(_T("PROMPT"), szPrompt, 256))
|
if (GetEnvironmentVariable(_T("PROMPT"), szPrompt, _countof(szPrompt)))
|
||||||
pr = szPrompt;
|
pr = szPrompt;
|
||||||
else
|
else
|
||||||
pr = DefaultPrompt;
|
pr = DefaultPrompt;
|
||||||
|
@ -172,19 +173,17 @@ VOID PrintPrompt(VOID)
|
||||||
|
|
||||||
case _T('N'):
|
case _T('N'):
|
||||||
{
|
{
|
||||||
TCHAR szPath[MAX_PATH];
|
GetCurrentDirectory(_countof(szPath), szPath);
|
||||||
GetCurrentDirectory(MAX_PATH, szPath);
|
|
||||||
ConOutChar(szPath[0]);
|
ConOutChar(szPath[0]);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case _T('P'):
|
case _T('P'):
|
||||||
{
|
{
|
||||||
TCHAR szPath[MAX_PATH];
|
GetCurrentDirectory(_countof(szPath), szPath);
|
||||||
GetCurrentDirectory(MAX_PATH, szPath);
|
|
||||||
ConOutPrintf(_T("%s"), szPath);
|
ConOutPrintf(_T("%s"), szPath);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case _T('Q'):
|
case _T('Q'):
|
||||||
ConOutChar(_T('='));
|
ConOutChar(_T('='));
|
||||||
|
@ -216,8 +215,8 @@ VOID PrintPrompt(VOID)
|
||||||
INT i;
|
INT i;
|
||||||
for (i = 0; i < GetDirectoryStackDepth(); i++)
|
for (i = 0; i < GetDirectoryStackDepth(); i++)
|
||||||
ConOutChar(_T('+'));
|
ConOutChar(_T('+'));
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue