Some minor cleanup

svn path=/trunk/; revision=1832
This commit is contained in:
Eric Kohl 2001-04-26 11:31:33 +00:00
parent af3325ef66
commit 18f8e8da80
3 changed files with 36 additions and 32 deletions

View file

@ -1,4 +1,4 @@
/* $Id: cmd.c,v 1.24 2001/02/28 22:33:23 ekohl Exp $
/* $Id: cmd.c,v 1.25 2001/04/26 11:31:33 ekohl Exp $
*
* CMD.C - command-line interface.
*
@ -746,7 +746,7 @@ ProcessInput (BOOL bFlag)
{
TCHAR commandline[CMDLINE_LENGTH];
TCHAR readline[CMDLINE_LENGTH];
LPTSTR tp;
LPTSTR tp = NULL;
LPTSTR ip;
LPTSTR cp;
BOOL bEchoThisLine;
@ -800,7 +800,8 @@ ProcessInput (BOOL bFlag)
break;
default:
if ((tp = _tcschr (ip, _T('%'))) && (tp<=(unsigned int)strchr(ip,_T(' '))-1))
if ((tp == _tcschr(ip, _T('%'))) &&
(tp <= _tcschr(ip, _T(' '))-1))
{
char evar[512];
*tp = _T('\0');

View file

@ -38,25 +38,33 @@ PrintVolumeHeader (LPTSTR pszRootPath)
DWORD dwSerialNr;
/* get the volume information of the drive */
if(!GetVolumeInformation (pszRootPath, szVolName, 80, &dwSerialNr,
NULL, NULL, NULL, 0))
{
ErrorMessage (GetLastError (), _T(""));
return 1;
}
if(!GetVolumeInformation (pszRootPath,
szVolName,
80,
&dwSerialNr,
NULL,
NULL,
NULL,
0))
{
ErrorMessage (GetLastError (), _T(""));
return 1;
}
/* print drive info */
ConOutPrintf (_T(" Volume in drive %c:"), pszRootPath[0]);
if (szVolName[0] != '\0')
ConOutPrintf (_T(" is %s\n"), szVolName);
ConOutPrintf (_T(" is %s\n"),
szVolName);
else
ConOutPrintf (_T(" has no label\n"));
/* print the volume serial number */
ConOutPrintf (_T(" Volume Serial Number is %04X-%04X\n"),
HIWORD(dwSerialNr), LOWORD(dwSerialNr));
return 0;
HIWORD(dwSerialNr),
LOWORD(dwSerialNr));
return 0;
}
@ -68,7 +76,7 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts (_T("Displays the disk volume label and serial number, if they exist.\n\n"
"VOL [drive:]"));
"VOL [drive:]"));
return 0;
}
@ -96,8 +104,8 @@ INT cmd_vol (LPTSTR cmd, LPTSTR param)
}
/* print the header */
if (!PrintVolumeHeader (szRootPath))
return 1;
if (!PrintVolumeHeader (szRootPath))
return 1;
return 0;
}

View file

@ -102,29 +102,24 @@ SearchForExecutable (LPCTSTR pFileName, LPTSTR pFullName)
*pFullName = _T('\0');
#ifdef _DEBUG
DebugPrintf (_T("SearchForExecutable: \'%s\'\n"), pFileName);
DebugPrintf (_T("SearchForExecutable: \'%s\'\n"), pFileName);
#endif
if (_tcschr (pFileName, _T('\\')) != NULL)
{
LPTSTR pFilePart;
if (_tcschr (pFileName, _T('\\')) != NULL)
{
LPTSTR pFilePart;
#ifdef _DEBUG
DebugPrintf (_T("Absolute or relative path is given.\n"));
DebugPrintf (_T("Absolute or relative path is given.\n"));
#endif
if (GetFullPathName (pFileName,
MAX_PATH,
szPathBuffer,
&pFilePart) ==0)
return FALSE;
if (GetFullPathName (pFileName,
MAX_PATH,
szPathBuffer,
&pFilePart) ==0)
return FALSE;
if(pFilePart == 0)
return FALSE;
if(pFilePart == 0)
return FALSE;
if (_tcschr (pFilePart, _T('.')) != NULL)