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. * CMD.C - command-line interface.
* *
@ -746,7 +746,7 @@ ProcessInput (BOOL bFlag)
{ {
TCHAR commandline[CMDLINE_LENGTH]; TCHAR commandline[CMDLINE_LENGTH];
TCHAR readline[CMDLINE_LENGTH]; TCHAR readline[CMDLINE_LENGTH];
LPTSTR tp; LPTSTR tp = NULL;
LPTSTR ip; LPTSTR ip;
LPTSTR cp; LPTSTR cp;
BOOL bEchoThisLine; BOOL bEchoThisLine;
@ -800,7 +800,8 @@ ProcessInput (BOOL bFlag)
break; break;
default: 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]; char evar[512];
*tp = _T('\0'); *tp = _T('\0');

View file

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

View file

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