Yet again some whitespace fixes.

svn path=/trunk/; revision=59396
This commit is contained in:
Hermès Bélusca-Maïto 2013-06-30 16:10:54 +00:00
parent 67152105b1
commit 523f0d4f97
23 changed files with 286 additions and 288 deletions

View file

@ -32,7 +32,7 @@ PrintAssociation(LPTSTR extension)
return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey); return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
return -1; return -1;
@ -40,7 +40,7 @@ PrintAssociation(LPTSTR extension)
return_val = RegOpenKeyEx(hKey, extension, 0, KEY_READ, &hInsideKey); return_val = RegOpenKeyEx(hKey, extension, 0, KEY_READ, &hInsideKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
RegCloseKey(hInsideKey); RegCloseKey(hInsideKey);
@ -50,14 +50,14 @@ PrintAssociation(LPTSTR extension)
/* obtain string length */ /* obtain string length */
return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, NULL, &fileTypeLength); return_val = RegQueryValueEx(hInsideKey, NULL, NULL, NULL, NULL, &fileTypeLength);
if(return_val == ERROR_FILE_NOT_FOUND) /* no default value, don't display */ if (return_val == ERROR_FILE_NOT_FOUND) /* no default value, don't display */
{ {
RegCloseKey(hInsideKey); RegCloseKey(hInsideKey);
RegCloseKey(hKey); RegCloseKey(hKey);
return 0; return 0;
} }
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hInsideKey); RegCloseKey(hInsideKey);
RegCloseKey(hKey); RegCloseKey(hKey);
@ -72,18 +72,18 @@ PrintAssociation(LPTSTR extension)
RegCloseKey(hInsideKey); RegCloseKey(hInsideKey);
RegCloseKey(hKey); RegCloseKey(hKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
cmd_free(fileType); cmd_free(fileType);
return -2; return -2;
} }
if(fileTypeLength != 0) /* if there is a default key, display relevant information */ if (fileTypeLength != 0) /* if there is a default key, display relevant information */
{ {
ConOutPrintf(_T("%s=%s\r\n"), extension, fileType); ConOutPrintf(_T("%s=%s\r\n"), extension, fileType);
} }
if(fileTypeLength) if (fileTypeLength)
cmd_free(fileType); cmd_free(fileType);
return 1; return 1;
@ -102,7 +102,7 @@ PrintAllAssociations()
return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey); return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_READ, &hKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
return -1; return -1;
@ -110,7 +110,7 @@ PrintAllAssociations()
return_val = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numKeys, &extLength, NULL, NULL, NULL, NULL, NULL, NULL); return_val = RegQueryInfoKey(hKey, NULL, NULL, NULL, &numKeys, &extLength, NULL, NULL, NULL, NULL, NULL, NULL);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
return -2; return -2;
@ -123,9 +123,9 @@ PrintAllAssociations()
DWORD buffer_size = extLength; DWORD buffer_size = extLength;
return_val = RegEnumKeyEx(hKey, keyCtr, extName, &buffer_size, NULL, NULL, NULL, NULL); return_val = RegEnumKeyEx(hKey, keyCtr, extName, &buffer_size, NULL, NULL, NULL, NULL);
if(return_val == ERROR_SUCCESS || return_val == ERROR_MORE_DATA) if (return_val == ERROR_SUCCESS || return_val == ERROR_MORE_DATA)
{ {
if(*extName == _T('.')) if (*extName == _T('.'))
PrintAssociation(extName); PrintAssociation(extName);
} }
else else
@ -138,7 +138,7 @@ PrintAllAssociations()
RegCloseKey(hKey); RegCloseKey(hKey);
if(extName) if (extName)
cmd_free(extName); cmd_free(extName);
return numKeys; return numKeys;
@ -152,12 +152,12 @@ AddAssociation(LPTSTR extension, LPTSTR type)
return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_ALL_ACCESS, &hKey); return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_ALL_ACCESS, &hKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
return -1; return -1;
return_val = RegCreateKeyEx(hKey, extension, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &insideKey, NULL); return_val = RegCreateKeyEx(hKey, extension, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &insideKey, NULL);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
return -1; return -1;
@ -165,7 +165,7 @@ AddAssociation(LPTSTR extension, LPTSTR type)
return_val = RegSetValueEx(insideKey, NULL, 0, REG_SZ, (LPBYTE)type, (_tcslen(type) + 1) * sizeof(TCHAR)); return_val = RegSetValueEx(insideKey, NULL, 0, REG_SZ, (LPBYTE)type, (_tcslen(type) + 1) * sizeof(TCHAR));
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(insideKey); RegCloseKey(insideKey);
RegCloseKey(hKey); RegCloseKey(hKey);
@ -186,12 +186,12 @@ RemoveAssociation(LPTSTR extension)
return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_ALL_ACCESS, &hKey); return_val = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("SOFTWARE\\Classes"), 0, KEY_ALL_ACCESS, &hKey);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
return -1; return -1;
return_val = RegDeleteKey(hKey, extension); return_val = RegDeleteKey(hKey, extension);
if(return_val != ERROR_SUCCESS) if (return_val != ERROR_SUCCESS)
{ {
RegCloseKey(hKey); RegCloseKey(hKey);
return -2; return -2;
@ -214,12 +214,12 @@ INT CommandAssoc (LPTSTR param)
nErrorLevel = 0; nErrorLevel = 0;
if(_tcslen(param) == 0) if (_tcslen(param) == 0)
PrintAllAssociations(); PrintAllAssociations();
else else
{ {
LPTSTR lpEqualSign = _tcschr(param, _T('=')); LPTSTR lpEqualSign = _tcschr(param, _T('='));
if(lpEqualSign != NULL) if (lpEqualSign != NULL)
{ {
LPTSTR fileType = lpEqualSign + 1; LPTSTR fileType = lpEqualSign + 1;
LPTSTR extension = cmd_alloc((lpEqualSign - param + 1) * sizeof(TCHAR)); LPTSTR extension = cmd_alloc((lpEqualSign - param + 1) * sizeof(TCHAR));
@ -227,7 +227,7 @@ INT CommandAssoc (LPTSTR param)
_tcsncpy(extension, param, lpEqualSign - param); _tcsncpy(extension, param, lpEqualSign - param);
extension[lpEqualSign - param] = (TCHAR)0; extension[lpEqualSign - param] = (TCHAR)0;
if(_tcslen(fileType) == 0) if (_tcslen(fileType) == 0)
/* if the equal sign is the last character /* if the equal sign is the last character
in the string, then delete the key */ in the string, then delete the key */
{ {
@ -247,7 +247,7 @@ INT CommandAssoc (LPTSTR param)
/* no equal sign, print all associations */ /* no equal sign, print all associations */
INT retval = PrintAssociation(param); INT retval = PrintAssociation(param);
if(retval == 0) /* if nothing printed out */ if (retval == 0) /* if nothing printed out */
ConOutResPrintf(STRING_ASSOC_ERROR, param); ConOutResPrintf(STRING_ASSOC_ERROR, param);
} }
} }

View file

@ -230,7 +230,7 @@ CommandChoice (LPTSTR param)
ConInFlush (); ConInFlush ();
if(!bTimeout) if (!bTimeout)
{ {
while (TRUE) while (TRUE)
{ {

View file

@ -310,7 +310,7 @@ HANDLE RunFile(DWORD flags, LPTSTR filename, LPTSTR params,
* Rest - rest of command line * Rest - rest of command line
*/ */
static INT static INT
Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd) Execute(LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
{ {
TCHAR szFullName[MAX_PATH]; TCHAR szFullName[MAX_PATH];
TCHAR *first, *rest, *dot; TCHAR *first, *rest, *dot;
@ -415,8 +415,8 @@ Execute (LPTSTR Full, LPTSTR First, LPTSTR Rest, PARSED_COMMAND *Cmd)
stui.wShowWindow = SW_SHOWDEFAULT; stui.wShowWindow = SW_SHOWDEFAULT;
// return console to standard mode // return console to standard mode
SetConsoleMode (GetStdHandle(STD_INPUT_HANDLE), SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE),
ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT ); ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT | ENABLE_ECHO_INPUT);
if (CreateProcess (szFullName, if (CreateProcess (szFullName,
szFullCmdLine, szFullCmdLine,
@ -1439,7 +1439,7 @@ BOOL WINAPI BreakHandler (DWORD dwCtrlType)
} }
else else
{ {
if(SelfGenerated) if (SelfGenerated)
{ {
SelfGenerated = FALSE; SelfGenerated = FALSE;
return TRUE; return TRUE;
@ -1539,7 +1539,7 @@ ExecuteAutoRunFile(HKEY hkeyRoot)
KEY_READ, KEY_READ,
&hkey) == ERROR_SUCCESS) &hkey) == ERROR_SUCCESS)
{ {
if(RegQueryValueEx(hkey, if (RegQueryValueEx(hkey,
_T("AutoRun"), _T("AutoRun"),
0, 0,
0, 0,

View file

@ -112,7 +112,7 @@ static BOOL bInsert = TRUE;
static VOID static VOID
ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy) ClearCommandLine(LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
{ {
INT count; INT count;
@ -125,7 +125,7 @@ ClearCommandLine (LPTSTR str, INT maxlen, SHORT orgx, SHORT orgy)
/* read in a command line */ /* read in a command line */
BOOL ReadCommand (LPTSTR str, INT maxlen) BOOL ReadCommand(LPTSTR str, INT maxlen)
{ {
CONSOLE_SCREEN_BUFFER_INFO csbi; CONSOLE_SCREEN_BUFFER_INFO csbi;
SHORT orgx; /* origin x/y */ SHORT orgx; /* origin x/y */
@ -182,9 +182,7 @@ BOOL ReadCommand (LPTSTR str, INT maxlen)
do do
{ {
bReturn = FALSE; bReturn = FALSE;
ConInKey (&ir); ConInKey (&ir);
if (ir.Event.KeyEvent.dwControlKeyState & if (ir.Event.KeyEvent.dwControlKeyState &
@ -360,21 +358,21 @@ BOOL ReadCommand (LPTSTR str, INT maxlen)
/*if second TAB, list matches*/ /*if second TAB, list matches*/
if (ShowCompletionMatches (str, charcount)) if (ShowCompletionMatches (str, charcount))
{ {
PrintPrompt (); PrintPrompt();
GetCursorXY (&orgx, &orgy); GetCursorXY(&orgx, &orgy);
ConOutPrintf (_T("%s"), str); ConOutPrintf(_T("%s"), str);
/* set cursor position */ /* set cursor position */
SetCursorXY ((orgx + current) % maxx, SetCursorXY((orgx + current) % maxx,
orgy + (orgx + current) / maxx); orgy + (orgx + current) / maxx);
GetCursorXY (&curx, &cury); GetCursorXY(&curx, &cury);
} }
} }
} }
else else
{ {
MessageBeep (-1); MessageBeep(-1);
} }
#endif #endif
#ifdef FEATURE_4NT_FILENAME_COMPLETION #ifdef FEATURE_4NT_FILENAME_COMPLETION
@ -396,24 +394,24 @@ BOOL ReadCommand (LPTSTR str, INT maxlen)
_tcscpy(str,szPath); _tcscpy(str,szPath);
/* Figure out where cusor is going to be after we print it */ /* Figure out where cusor is going to be after we print it */
charcount = _tcslen (str); charcount = _tcslen(str);
current = charcount; current = charcount;
SetCursorXY (orgx, orgy); SetCursorXY(orgx, orgy);
/* Print out what we have now */ /* Print out what we have now */
ConOutPrintf (_T("%s"), str); ConOutPrintf(_T("%s"), str);
/* Move cursor accordingly */ /* Move cursor accordingly */
if(tempscreen > charcount) if (tempscreen > charcount)
{ {
GetCursorXY (&curx, &cury); GetCursorXY(&curx, &cury);
for(count = tempscreen - charcount; count--; ) for(count = tempscreen - charcount; count--; )
ConOutChar (_T(' ')); ConOutChar(_T(' '));
SetCursorXY (curx, cury); SetCursorXY(curx, cury);
} }
else else
{ {
if(((charcount + orgx) / maxx) + orgy > maxy - 1) if (((charcount + orgx) / maxx) + orgy > maxy - 1)
orgy += maxy - ((charcount + orgx) / maxx + orgy + 1); orgy += maxy - ((charcount + orgx) / maxx + orgy + 1);
} }
SetCursorXY((short)(((int)orgx + current) % maxx), (short)((int)orgy + ((int)orgx + current) / maxx)); SetCursorXY((short)(((int)orgx + current) % maxx), (short)((int)orgy + ((int)orgx + current) / maxx));
@ -425,7 +423,7 @@ BOOL ReadCommand (LPTSTR str, INT maxlen)
case _T('C'): case _T('C'):
/* ^M does the same as return */ /* ^M does the same as return */
bCharInput = TRUE; bCharInput = TRUE;
if(!(ir.Event.KeyEvent.dwControlKeyState & if (!(ir.Event.KeyEvent.dwControlKeyState &
(RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED))) (RIGHT_CTRL_PRESSED|LEFT_CTRL_PRESSED)))
{ {
break; break;

View file

@ -26,37 +26,37 @@ UINT InputCodePage;
UINT OutputCodePage; UINT OutputCodePage;
VOID ConInDisable (VOID) VOID ConInDisable(VOID)
{ {
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE); HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD dwMode; DWORD dwMode;
GetConsoleMode (hInput, &dwMode); GetConsoleMode(hInput, &dwMode);
dwMode &= ~ENABLE_PROCESSED_INPUT; dwMode &= ~ENABLE_PROCESSED_INPUT;
SetConsoleMode (hInput, dwMode); SetConsoleMode(hInput, dwMode);
} }
VOID ConInEnable (VOID) VOID ConInEnable(VOID)
{ {
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE); HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD dwMode; DWORD dwMode;
GetConsoleMode (hInput, &dwMode); GetConsoleMode(hInput, &dwMode);
dwMode |= ENABLE_PROCESSED_INPUT; dwMode |= ENABLE_PROCESSED_INPUT;
SetConsoleMode (hInput, dwMode); SetConsoleMode(hInput, dwMode);
} }
VOID ConInFlush (VOID) VOID ConInFlush (VOID)
{ {
FlushConsoleInputBuffer (GetStdHandle (STD_INPUT_HANDLE)); FlushConsoleInputBuffer(GetStdHandle(STD_INPUT_HANDLE));
} }
VOID ConInKey (PINPUT_RECORD lpBuffer) VOID ConInKey(PINPUT_RECORD lpBuffer)
{ {
HANDLE hInput = GetStdHandle (STD_INPUT_HANDLE); HANDLE hInput = GetStdHandle(STD_INPUT_HANDLE);
DWORD dwRead; DWORD dwRead;
if (hInput == INVALID_HANDLE_VALUE) if (hInput == INVALID_HANDLE_VALUE)
@ -64,7 +64,7 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
do do
{ {
ReadConsoleInput (hInput, lpBuffer, 1, &dwRead); ReadConsoleInput(hInput, lpBuffer, 1, &dwRead);
if ((lpBuffer->EventType == KEY_EVENT) && if ((lpBuffer->EventType == KEY_EVENT) &&
(lpBuffer->Event.KeyEvent.bKeyDown == TRUE)) (lpBuffer->Event.KeyEvent.bKeyDown == TRUE))
break; break;
@ -73,7 +73,7 @@ VOID ConInKey (PINPUT_RECORD lpBuffer)
} }
VOID ConInString (LPTSTR lpInput, DWORD dwLength) VOID ConInString(LPTSTR lpInput, DWORD dwLength)
{ {
DWORD dwOldMode; DWORD dwOldMode;
DWORD dwRead = 0; DWORD dwRead = 0;
@ -87,13 +87,13 @@ VOID ConInString (LPTSTR lpInput, DWORD dwLength)
#else #else
pBuf = lpInput; pBuf = lpInput;
#endif #endif
ZeroMemory (lpInput, dwLength * sizeof(TCHAR)); ZeroMemory(lpInput, dwLength * sizeof(TCHAR));
hFile = GetStdHandle (STD_INPUT_HANDLE); hFile = GetStdHandle(STD_INPUT_HANDLE);
GetConsoleMode (hFile, &dwOldMode); GetConsoleMode(hFile, &dwOldMode);
SetConsoleMode (hFile, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT); SetConsoleMode(hFile, ENABLE_LINE_INPUT | ENABLE_ECHO_INPUT);
ReadFile (hFile, (PVOID)pBuf, dwLength - 1, &dwRead, NULL); ReadFile(hFile, (PVOID)pBuf, dwLength - 1, &dwRead, NULL);
#ifdef _UNICODE #ifdef _UNICODE
MultiByteToWideChar(InputCodePage, 0, pBuf, dwRead, lpInput, dwLength - 1); MultiByteToWideChar(InputCodePage, 0, pBuf, dwRead, lpInput, dwLength - 1);
@ -108,7 +108,7 @@ VOID ConInString (LPTSTR lpInput, DWORD dwLength)
} }
} }
SetConsoleMode (hFile, dwOldMode); SetConsoleMode(hFile, dwOldMode);
} }
static VOID ConWrite(TCHAR *str, DWORD len, DWORD nStdHandle) static VOID ConWrite(TCHAR *str, DWORD len, DWORD nStdHandle)
@ -213,7 +213,7 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
int from = 0, i = 0; int from = 0, i = 0;
if(NewPage == TRUE) if (NewPage == TRUE)
LineCount = 0; LineCount = 0;
/* rest LineCount and return if no string have been given */ /* rest LineCount and return if no string have been given */
@ -233,7 +233,7 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
CharSL = csbi.dwCursorPosition.X; CharSL = csbi.dwCursorPosition.X;
//make sure they didnt make the screen to small //make sure they didnt make the screen to small
if(ScreenLines<4) if (ScreenLines<4)
{ {
ConPrintf(szFormat, arg_ptr, nStdHandle); ConPrintf(szFormat, arg_ptr, nStdHandle);
return 0; return 0;
@ -250,12 +250,12 @@ INT ConPrintfPaging(BOOL NewPage, LPTSTR szFormat, va_list arg_ptr, DWORD nStdHa
LineCount++; LineCount++;
CharSL=0; CharSL=0;
if(LineCount >= ScreenLines) if (LineCount >= ScreenLines)
{ {
WriteConsole(hOutput, &szOut[from], i-from, &dwWritten, NULL); WriteConsole(hOutput, &szOut[from], i-from, &dwWritten, NULL);
from = i; from = i;
if(PagePrompt() != PROMPT_YES) if (PagePrompt() != PROMPT_YES)
{ {
return 1; return 1;
} }
@ -286,7 +286,7 @@ VOID ConErrFormatMessage (DWORD MessageId, ...)
&arg_ptr); &arg_ptr);
va_end (arg_ptr); va_end (arg_ptr);
if(ret > 0) if (ret > 0)
{ {
ConErrPuts (text); ConErrPuts (text);
LocalFree(text); LocalFree(text);
@ -315,7 +315,7 @@ VOID ConOutFormatMessage (DWORD MessageId, ...)
&arg_ptr); &arg_ptr);
va_end (arg_ptr); va_end (arg_ptr);
if(ret > 0) if (ret > 0)
{ {
ConErrPuts (text); ConErrPuts (text);
LocalFree(text); LocalFree(text);

View file

@ -68,12 +68,12 @@ copy(TCHAR source[MAX_PATH],
SYSTEMTIME CurrentTime; SYSTEMTIME CurrentTime;
/* Check Breaker */ /* Check Breaker */
if(CheckCtrlBreak(BREAK_INPUT)) if (CheckCtrlBreak(BREAK_INPUT))
return 0; return 0;
TRACE ("checking mode\n"); TRACE ("checking mode\n");
if(bTouch) if (bTouch)
{ {
hFileSrc = CreateFile (source, GENERIC_WRITE, FILE_SHARE_READ, hFileSrc = CreateFile (source, GENERIC_WRITE, FILE_SHARE_READ,
NULL, OPEN_EXISTING, 0, NULL); NULL, OPEN_EXISTING, 0, NULL);
@ -86,7 +86,7 @@ copy(TCHAR source[MAX_PATH],
GetSystemTime(&CurrentTime); GetSystemTime(&CurrentTime);
SystemTimeToFileTime(&CurrentTime, &NewFileTime); SystemTimeToFileTime(&CurrentTime, &NewFileTime);
if(SetFileTime(hFileSrc,(LPFILETIME) NULL, (LPFILETIME) NULL, &NewFileTime)) if (SetFileTime(hFileSrc,(LPFILETIME) NULL, (LPFILETIME) NULL, &NewFileTime))
{ {
CloseHandle(hFileSrc); CloseHandle(hFileSrc);
nErrorLevel = 1; nErrorLevel = 1;
@ -120,7 +120,7 @@ copy(TCHAR source[MAX_PATH],
/* Check to see if /D or /Z are true, if so we need a middle /* Check to see if /D or /Z are true, if so we need a middle
man to copy the file too to allow us to use CopyFileEx later */ man to copy the file too to allow us to use CopyFileEx later */
if(lpdwFlags & COPY_DECRYPT) if (lpdwFlags & COPY_DECRYPT)
{ {
GetEnvironmentVariable(_T("TEMP"),TempSrc,MAX_PATH); GetEnvironmentVariable(_T("TEMP"),TempSrc,MAX_PATH);
_tcscat(TempSrc,_T("\\")); _tcscat(TempSrc,_T("\\"));
@ -134,7 +134,7 @@ copy(TCHAR source[MAX_PATH],
which would error when it tried to open the handles for ReadFile which would error when it tried to open the handles for ReadFile
and WriteFile */ and WriteFile */
_tcscat(TempSrc,_T(".decrypt")); _tcscat(TempSrc,_T(".decrypt"));
if(!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION)) if (!CopyFileEx(source, TempSrc, NULL, NULL, FALSE, COPY_FILE_ALLOW_DECRYPTED_DESTINATION))
{ {
nErrorLevel = 1; nErrorLevel = 1;
return 0; return 0;
@ -143,7 +143,7 @@ copy(TCHAR source[MAX_PATH],
} }
if(lpdwFlags & COPY_RESTART) if (lpdwFlags & COPY_RESTART)
{ {
_tcscpy(TrueDest, dest); _tcscpy(TrueDest, dest);
GetEnvironmentVariable(_T("TEMP"),dest,MAX_PATH); GetEnvironmentVariable(_T("TEMP"),dest,MAX_PATH);
@ -260,9 +260,9 @@ copy(TCHAR source[MAX_PATH],
SetFileAttributes (dest, dwAttrib); SetFileAttributes (dest, dwAttrib);
/* Now finish off the copy if needed with CopyFileEx */ /* Now finish off the copy if needed with CopyFileEx */
if(lpdwFlags & COPY_RESTART) if (lpdwFlags & COPY_RESTART)
{ {
if(!CopyFileEx(dest, TrueDest, NULL, NULL, FALSE, COPY_FILE_RESTARTABLE)) if (!CopyFileEx(dest, TrueDest, NULL, NULL, FALSE, COPY_FILE_RESTARTABLE))
{ {
nErrorLevel = 1; nErrorLevel = 1;
DeleteFile(dest); DeleteFile(dest);
@ -273,7 +273,7 @@ copy(TCHAR source[MAX_PATH],
} }
if(lpdwFlags & COPY_DECRYPT) if (lpdwFlags & COPY_DECRYPT)
DeleteFile(TempSrc); DeleteFile(TempSrc);
return 1; return 1;
@ -480,8 +480,8 @@ INT cmd_copy(LPTSTR param)
break; break;
case _T('-'): case _T('-'):
if(_tcslen(arg[i]) >= 3) if (_tcslen(arg[i]) >= 3)
if(_totupper(arg[i][2]) == _T('Y')) if (_totupper(arg[i][2]) == _T('Y'))
{ {
dwFlags &= ~COPY_NO_PROMPT; dwFlags &= ~COPY_NO_PROMPT;
dwFlags |= COPY_PROMPT; dwFlags |= COPY_PROMPT;
@ -538,7 +538,7 @@ INT cmd_copy(LPTSTR param)
bMoreFiles = FALSE; bMoreFiles = FALSE;
} }
else if(nDes == -1) else if (nDes == -1)
{ {
nDes = i; nDes = i;
} }
@ -825,7 +825,7 @@ INT cmd_copy(LPTSTR param)
_tcscat (tmpSrcPath, findBuffer.cFileName); _tcscat (tmpSrcPath, findBuffer.cFileName);
/* Check to see if the file is the same file */ /* Check to see if the file is the same file */
if(!bTouch && !_tcscmp(tmpSrcPath, tmpDestPath)) if (!bTouch && !_tcscmp(tmpSrcPath, tmpDestPath))
{ {
ConOutResPrintf(STRING_COPY_ERROR2); ConOutResPrintf(STRING_COPY_ERROR2);
@ -846,7 +846,7 @@ INT cmd_copy(LPTSTR param)
dwFlags |= COPY_NO_PROMPT; dwFlags |= COPY_NO_PROMPT;
/* Tell weather the copy was successful or not */ /* Tell weather the copy was successful or not */
if(copy(tmpSrcPath,tmpDestPath, bAppend, dwFlags, bTouch)) if (copy(tmpSrcPath,tmpDestPath, bAppend, dwFlags, bTouch))
{ {
nFiles++; nFiles++;
//LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE); //LoadString(CMD_ModuleHandle, STRING_MOVE_ERROR1, szMsg, RC_STRING_MAX_SIZE);

View file

@ -372,12 +372,12 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
/* Copy it to the entries list */ /* Copy it to the entries list */
temp = cmd_alloc((ptrEnd - ptrStart + 1) * sizeof (TCHAR)); temp = cmd_alloc((ptrEnd - ptrStart + 1) * sizeof (TCHAR));
if(!temp) if (!temp)
return FALSE; return FALSE;
memcpy(temp, ptrStart, (ptrEnd - ptrStart) * sizeof (TCHAR)); memcpy(temp, ptrStart, (ptrEnd - ptrStart) * sizeof (TCHAR));
temp[ptrEnd - ptrStart] = _T('\0'); temp[ptrEnd - ptrStart] = _T('\0');
StripQuotes(temp); StripQuotes(temp);
if(!add_entry(entries, params, temp)) if (!add_entry(entries, params, temp))
{ {
cmd_free(temp); cmd_free(temp);
freep(*params); freep(*params);
@ -404,9 +404,9 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
switch(cCurSwitch) switch(cCurSwitch)
{ {
case _T('A'): /* Switch parameters for /A (attributes filter) */ case _T('A'): /* Switch parameters for /A (attributes filter) */
if(cCurChar == _T('-')) if (cCurChar == _T('-'))
bPNegative = TRUE; bPNegative = TRUE;
else if(cCurUChar == _T('D')) else if (cCurUChar == _T('D'))
{ {
lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_DIRECTORY; lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_DIRECTORY;
if (bPNegative) if (bPNegative)
@ -414,7 +414,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
else else
lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_DIRECTORY; lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_DIRECTORY;
} }
else if(cCurUChar == _T('R')) else if (cCurUChar == _T('R'))
{ {
lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_READONLY; lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_READONLY;
if (bPNegative) if (bPNegative)
@ -422,7 +422,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
else else
lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_READONLY; lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_READONLY;
} }
else if(cCurUChar == _T('H')) else if (cCurUChar == _T('H'))
{ {
lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_HIDDEN; lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_HIDDEN;
if (bPNegative) if (bPNegative)
@ -430,7 +430,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
else else
lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_HIDDEN; lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_HIDDEN;
} }
else if(cCurUChar == _T('A')) else if (cCurUChar == _T('A'))
{ {
lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_ARCHIVE; lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_ARCHIVE;
if (bPNegative) if (bPNegative)
@ -438,7 +438,7 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
else else
lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_ARCHIVE; lpFlags->stAttribs.dwAttribVal |= FILE_ATTRIBUTE_ARCHIVE;
} }
else if(cCurUChar == _T('S')) else if (cCurUChar == _T('S'))
{ {
lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_SYSTEM; lpFlags->stAttribs.dwAttribMask |= FILE_ATTRIBUTE_SYSTEM;
if (bPNegative) if (bPNegative)
@ -453,11 +453,11 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
} }
break; break;
case _T('T'): /* Switch parameters for /T (time field) */ case _T('T'): /* Switch parameters for /T (time field) */
if(cCurUChar == _T('C')) if (cCurUChar == _T('C'))
lpFlags->stTimeField.eTimeField= TF_CREATIONDATE ; lpFlags->stTimeField.eTimeField= TF_CREATIONDATE ;
else if(cCurUChar == _T('A')) else if (cCurUChar == _T('A'))
lpFlags->stTimeField.eTimeField= TF_LASTACCESSEDDATE ; lpFlags->stTimeField.eTimeField= TF_LASTACCESSEDDATE ;
else if(cCurUChar == _T('W')) else if (cCurUChar == _T('W'))
lpFlags->stTimeField.eTimeField= TF_MODIFIEDDATE ; lpFlags->stTimeField.eTimeField= TF_MODIFIEDDATE ;
else else
{ {
@ -465,37 +465,37 @@ DirReadParam(LPTSTR Line, /* [IN] The line with the parameters & s
return FALSE; return FALSE;
} }
break; break;
case _T('O'): /* Switch parameters for /O (order) */ case _T('O'): /* Switch parameters for /O (order) */
/* Ok a switch parameter was given */ /* Ok a switch parameter was given */
bOrderByNoPar = FALSE; bOrderByNoPar = FALSE;
if(cCurChar == _T('-')) if (cCurChar == _T('-'))
bPNegative = TRUE; bPNegative = TRUE;
else if(cCurUChar == _T('N')) else if (cCurUChar == _T('N'))
{ {
if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++; if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative; lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_NAME; lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_NAME;
} }
else if(cCurUChar == _T('S')) else if (cCurUChar == _T('S'))
{ {
if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++; if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative; lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_SIZE; lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_SIZE;
} }
else if(cCurUChar == _T('G')) else if (cCurUChar == _T('G'))
{ {
if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++; if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative; lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_DIRECTORY; lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_DIRECTORY;
} }
else if(cCurUChar == _T('E')) else if (cCurUChar == _T('E'))
{ {
if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++; if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative; lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_EXTENSION; lpFlags->stOrderBy.eCriteria[lpFlags->stOrderBy.sCriteriaCount - 1] = ORDER_EXTENSION;
} }
else if(cCurUChar == _T('D')) else if (cCurUChar == _T('D'))
{ {
if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++; if (lpFlags->stOrderBy.sCriteriaCount < 3) lpFlags->stOrderBy.sCriteriaCount++;
lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative; lpFlags->stOrderBy.bCriteriaRev[lpFlags->stOrderBy.sCriteriaCount - 1] = bPNegative;
@ -1111,12 +1111,12 @@ DirPrintFiles(LPWIN32_FIND_DATA ptrFiles[], /* [IN] Files' Info */
/* Bare format */ /* Bare format */
DirPrintBareList(ptrFiles, dwCount, szCurPath, lpFlags); DirPrintBareList(ptrFiles, dwCount, szCurPath, lpFlags);
} }
else if(lpFlags->bShortName) else if (lpFlags->bShortName)
{ {
/* New list style / Short names */ /* New list style / Short names */
DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags); DirPrintNewList(ptrFiles, dwCount, szCurPath, lpFlags);
} }
else if(lpFlags->bWideListColSort || lpFlags->bWideList) else if (lpFlags->bWideListColSort || lpFlags->bWideList)
{ {
/* Wide list */ /* Wide list */
DirPrintWideList(ptrFiles, dwCount, szCurPath, lpFlags); DirPrintWideList(ptrFiles, dwCount, szCurPath, lpFlags);
@ -1348,7 +1348,7 @@ DirList(LPTSTR szPath, /* [IN] The path that dir starts */
do do
{ {
/*If retrieved FileName has extension,and szPath doesnt have extension then JUMP the retrieved FileName*/ /*If retrieved FileName has extension,and szPath doesnt have extension then JUMP the retrieved FileName*/
if(_tcschr(wfdFileInfo.cFileName,_T('.'))&&(fPoint==TRUE)) if (_tcschr(wfdFileInfo.cFileName,_T('.'))&&(fPoint==TRUE))
{ {
continue; continue;
/* Here we filter all the specified attributes */ /* Here we filter all the specified attributes */

View file

@ -47,7 +47,7 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
(LPTSTR)&szError, 0, NULL)) (LPTSTR)&szError, 0, NULL))
{ {
ConErrPrintf (_T("%s %s\n"), szError, szMessage); ConErrPrintf (_T("%s %s\n"), szError, szMessage);
if(szError) if (szError)
LocalFree (szError); LocalFree (szError);
return; return;
} }

View file

@ -169,7 +169,7 @@ VOID CompleteFilename (LPTSTR str, UINT charcount)
_tcscat (&str[start], maxmatch); _tcscat (&str[start], maxmatch);
} }
if(!perfectmatch) if (!perfectmatch)
{ {
MessageBeep (-1); MessageBeep (-1);
} }
@ -381,12 +381,12 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
/* Count number of " */ /* Count number of " */
for(i = 0; i < _tcslen(str); i++) for(i = 0; i < _tcslen(str); i++)
{ {
if(str[i] == _T('\"')) if (str[i] == _T('\"'))
nQuotes++; nQuotes++;
} }
/* Find the prefix and suffix */ /* Find the prefix and suffix */
if(nQuotes % 2 && nQuotes >= 1) if (nQuotes % 2 && nQuotes >= 1)
{ {
/* Odd number of quotes. Just start from the last " */ /* Odd number of quotes. Just start from the last " */
/* THis is the way MS does it, and is an easy way out */ /* THis is the way MS does it, and is an easy way out */
@ -398,9 +398,9 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
szSearch1 = _tcsrchr(str, _T('\"')); szSearch1 = _tcsrchr(str, _T('\"'));
szSearch2 = _tcsrchr(str, _T('\\')); szSearch2 = _tcsrchr(str, _T('\\'));
szSearch3 = _tcsrchr(str, _T('.')); szSearch3 = _tcsrchr(str, _T('.'));
if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2)) if (szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
szSearch = szSearch2; szSearch = szSearch2;
else if(szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3)) else if (szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3))
szSearch = szSearch3; szSearch = szSearch3;
else else
szSearch = szSearch1; szSearch = szSearch1;
@ -412,13 +412,13 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
} }
if(!_tcschr(str, _T(' '))) if (!_tcschr(str, _T(' ')))
{ {
/* No spaces, everything goes to Suffix */ /* No spaces, everything goes to Suffix */
_tcscpy(szSuffix,str); _tcscpy(szSuffix,str);
/* look for a slash just in case */ /* look for a slash just in case */
szSearch = _tcsrchr(str, _T('\\')); szSearch = _tcsrchr(str, _T('\\'));
if(szSearch) if (szSearch)
{ {
szSearch++; szSearch++;
szSearch[0] = _T('\0'); szSearch[0] = _T('\0');
@ -431,7 +431,7 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
return; return;
} }
if(!nQuotes) if (!nQuotes)
{ {
/* No quotes, and there is a space*/ /* No quotes, and there is a space*/
/* Take it after the last space */ /* Take it after the last space */
@ -443,9 +443,9 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
szSearch1 = _tcsrchr(str, _T(' ')); szSearch1 = _tcsrchr(str, _T(' '));
szSearch2 = _tcsrchr(str, _T('\\')); szSearch2 = _tcsrchr(str, _T('\\'));
szSearch3 = _tcsrchr(str, _T('/')); szSearch3 = _tcsrchr(str, _T('/'));
if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2)) if (szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2))
szSearch = szSearch2; szSearch = szSearch2;
else if(szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3)) else if (szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3))
szSearch = szSearch3; szSearch = szSearch3;
else else
szSearch = szSearch1; szSearch = szSearch1;
@ -460,11 +460,11 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix)
not inside a quotes */ not inside a quotes */
for(i = 0; i < _tcslen(str); i++) for(i = 0; i < _tcslen(str); i++)
{ {
if(str[i] == _T('\"')) if (str[i] == _T('\"'))
bInside = !bInside; bInside = !bInside;
if(str[i] == _T(' ') && !bInside) if (str[i] == _T(' ') && !bInside)
SBreak = i; SBreak = i;
if((str[i] == _T(' ') || str[i] == _T('\\')) && !bInside) if ((str[i] == _T(' ') || str[i] == _T('\\')) && !bInside)
PBreak = i; PBreak = i;
} }
SBreak++; SBreak++;
@ -493,7 +493,7 @@ int __cdecl compare(const void *arg1,const void *arg2)
return 0; return 0;
File2 = cmd_alloc(sizeof(FileName)); File2 = cmd_alloc(sizeof(FileName));
if(!File2) if (!File2)
{ {
cmd_free(File1); cmd_free(File1);
return 0; return 0;
@ -583,7 +583,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
while (_istspace (*line)) while (_istspace (*line))
line++; line++;
if(!_tcsnicmp (line, _T("rd "), 3) || !_tcsnicmp (line, _T("cd "), 3)) if (!_tcsnicmp (line, _T("rd "), 3) || !_tcsnicmp (line, _T("cd "), 3))
ShowAll = FALSE; ShowAll = FALSE;
/* Copy the string, str can be edited and orginal should not be */ /* Copy the string, str can be edited and orginal should not be */
@ -591,17 +591,17 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
_tcscpy(szOrginal,strIN); _tcscpy(szOrginal,strIN);
/* Look to see if the cusor is not at the end of the string */ /* Look to see if the cusor is not at the end of the string */
if((cusor + 1) < _tcslen(str)) if ((cusor + 1) < _tcslen(str))
str[cusor] = _T('\0'); str[cusor] = _T('\0');
/* Look to see if they hit tab again, if so cut off the diff length */ /* Look to see if they hit tab again, if so cut off the diff length */
if(_tcscmp(str,LastReturned) || !_tcslen(str)) if (_tcscmp(str,LastReturned) || !_tcslen(str))
{ {
/* We need to know how many chars we added from the start */ /* We need to know how many chars we added from the start */
StartLength = _tcslen(str); StartLength = _tcslen(str);
/* no string, we need all files in that directory */ /* no string, we need all files in that directory */
if(!StartLength) if (!StartLength)
{ {
_tcscat(str,_T("*")); _tcscat(str,_T("*"));
} }
@ -618,7 +618,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
/* Strip quotes */ /* Strip quotes */
for(i = 0; i < _tcslen(szBaseWord); ) for(i = 0; i < _tcslen(szBaseWord); )
{ {
if(szBaseWord[i] == _T('\"')) if (szBaseWord[i] == _T('\"'))
memmove(&szBaseWord[i],&szBaseWord[i + 1], _tcslen(&szBaseWord[i]) * sizeof(TCHAR)); memmove(&szBaseWord[i],&szBaseWord[i + 1], _tcslen(&szBaseWord[i]) * sizeof(TCHAR));
else else
i++; i++;
@ -639,7 +639,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
_tcscat(szSearchPath, szBaseWord); _tcscat(szSearchPath, szBaseWord);
} }
if(StartLength > 0) if (StartLength > 0)
{ {
_tcscat(szSearchPath,_T("*")); _tcscat(szSearchPath,_T("*"));
} }
@ -654,7 +654,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
} }
/* search for the files it might be */ /* search for the files it might be */
hFile = FindFirstFile (szSearchPath, &file); hFile = FindFirstFile (szSearchPath, &file);
if(hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
/* Assemble the orginal string and return */ /* Assemble the orginal string and return */
_tcscpy(strOut,szOrginal); _tcscpy(strOut,szOrginal);
@ -666,12 +666,12 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
{ {
FileName * oldFileList = FileList; FileName * oldFileList = FileList;
if(!_tcscmp (file.cFileName, _T(".")) || if (!_tcscmp (file.cFileName, _T(".")) ||
!_tcscmp (file.cFileName, _T(".."))) !_tcscmp (file.cFileName, _T("..")))
continue; continue;
/* Don't show files when they are doing 'cd' or 'rd' */ /* Don't show files when they are doing 'cd' or 'rd' */
if(!ShowAll && if (!ShowAll &&
file.dwFileAttributes != 0xFFFFFFFF && file.dwFileAttributes != 0xFFFFFFFF &&
!(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) !(file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
{ {
@ -681,7 +681,7 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
/* Add the file to the list of files */ /* Add the file to the list of files */
FileList = cmd_realloc(FileList, ++FileListSize * sizeof(FileName)); FileList = cmd_realloc(FileList, ++FileListSize * sizeof(FileName));
if(FileList == NULL) if (FileList == NULL)
{ {
/* Don't leak old buffer */ /* Don't leak old buffer */
cmd_free(oldFileList); cmd_free(oldFileList);
@ -700,10 +700,10 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
/* Check the size of the list to see if we /* Check the size of the list to see if we
found any matches */ found any matches */
if(FileListSize == 0) if (FileListSize == 0)
{ {
_tcscpy(strOut,szOrginal); _tcscpy(strOut,szOrginal);
if(FileList != NULL) if (FileList != NULL)
cmd_free(FileList); cmd_free(FileList);
return; return;
@ -712,18 +712,18 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
qsort(FileList,FileListSize,sizeof(FileName), compare); qsort(FileList,FileListSize,sizeof(FileName), compare);
/* Find the next/previous */ /* Find the next/previous */
if(!_tcscmp(szOrginal,LastReturned)) if (!_tcscmp(szOrginal,LastReturned))
{ {
if(bNext) if (bNext)
{ {
if(FileListSize - 1 == Sel) if (FileListSize - 1 == Sel)
Sel = 0; Sel = 0;
else else
Sel++; Sel++;
} }
else else
{ {
if(!Sel) if (!Sel)
Sel = FileListSize - 1; Sel = FileListSize - 1;
else else
Sel--; Sel--;
@ -750,24 +750,24 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
/* Find the place to put the " at the start */ /* Find the place to put the " at the start */
for(i = 0; i < _tcslen(szPrefix); i++) for(i = 0; i < _tcslen(szPrefix); i++)
{ {
if(szPrefix[i] == _T('\"')) if (szPrefix[i] == _T('\"'))
bInside = !bInside; bInside = !bInside;
if(szPrefix[i] == _T(' ') && !bInside) if (szPrefix[i] == _T(' ') && !bInside)
LastSpace = i; LastSpace = i;
} }
/* insert the quotation and move things around */ /* insert the quotation and move things around */
if(szPrefix[LastSpace + 1] != _T('\"') && LastSpace != -1) if (szPrefix[LastSpace + 1] != _T('\"') && LastSpace != -1)
{ {
memmove ( &szPrefix[LastSpace+1], &szPrefix[LastSpace], (_tcslen(szPrefix)-LastSpace+1) * sizeof(TCHAR) ); memmove ( &szPrefix[LastSpace+1], &szPrefix[LastSpace], (_tcslen(szPrefix)-LastSpace+1) * sizeof(TCHAR) );
if((UINT)(LastSpace + 1) == _tcslen(szPrefix)) if ((UINT)(LastSpace + 1) == _tcslen(szPrefix))
{ {
_tcscat(szPrefix,_T("\"")); _tcscat(szPrefix,_T("\""));
} }
szPrefix[LastSpace + 1] = _T('\"'); szPrefix[LastSpace + 1] = _T('\"');
} }
else if(LastSpace == -1) else if (LastSpace == -1)
{ {
/* Add quotation only if none exists already */ /* Add quotation only if none exists already */
if (szPrefix[0] != _T('\"')) if (szPrefix[0] != _T('\"'))
@ -783,22 +783,22 @@ VOID CompleteFilename (LPTSTR strIN, BOOL bNext, LPTSTR strOut, UINT cusor)
_tcscat(strOut,FileList[Sel].Name); _tcscat(strOut,FileList[Sel].Name);
/* check for odd number of quotes means we need to close them */ /* check for odd number of quotes means we need to close them */
if(!NeededQuote) if (!NeededQuote)
{ {
for(i = 0; i < _tcslen(strOut); i++) for(i = 0; i < _tcslen(strOut); i++)
{ {
if(strOut[i] == _T('\"')) if (strOut[i] == _T('\"'))
NeededQuote = !NeededQuote; NeededQuote = !NeededQuote;
} }
} }
if(szPrefix[_tcslen(szPrefix) - 1] == _T('\"') || NeededQuote) if (szPrefix[_tcslen(szPrefix) - 1] == _T('\"') || NeededQuote)
_tcscat(strOut,_T("\"")); _tcscat(strOut,_T("\""));
_tcscpy(LastReturned,strOut); _tcscpy(LastReturned,strOut);
//EndLength = _tcslen(strOut); //EndLength = _tcslen(strOut);
//DiffLength = EndLength - StartLength; //DiffLength = EndLength - StartLength;
if(FileList != NULL) if (FileList != NULL)
cmd_free(FileList); cmd_free(FileList);
} }
#endif #endif

View file

@ -219,8 +219,8 @@ VOID add_at_bottom(LPTSTR string)
return; return;
/*if new entry is the same than the last do not add it*/ /*if new entry is the same than the last do not add it*/
if(size) if (size)
if(_tcscmp(string,Bottom->next->string)==0) if (_tcscmp(string,Bottom->next->string)==0)
return; return;
/*fill bottom with string, it will become Bottom->next*/ /*fill bottom with string, it will become Bottom->next*/
@ -287,7 +287,7 @@ LPCTSTR PeekHistory(INT dir)
VOID History (INT dir, LPTSTR commandline) VOID History (INT dir, LPTSTR commandline)
{ {
if(dir==0) if (dir==0)
{ {
add_at_bottom(commandline); add_at_bottom(commandline);
curr_ptr=Bottom; curr_ptr=Bottom;
@ -300,7 +300,7 @@ VOID History (INT dir, LPTSTR commandline)
return; return;
} }
if(dir<0)/*key up*/ if (dir<0)/*key up*/
{ {
if (curr_ptr->next==Top || curr_ptr==Top) if (curr_ptr->next==Top || curr_ptr==Top)
{ {
@ -314,11 +314,11 @@ VOID History (INT dir, LPTSTR commandline)
} }
curr_ptr = curr_ptr->next; curr_ptr = curr_ptr->next;
if(curr_ptr->string) if (curr_ptr->string)
_tcscpy(commandline,curr_ptr->string); _tcscpy(commandline,curr_ptr->string);
} }
if(dir>0) if (dir>0)
{ {
if (curr_ptr->prev==Bottom || curr_ptr==Bottom) if (curr_ptr->prev==Bottom || curr_ptr==Bottom)
{ {
@ -332,7 +332,7 @@ VOID History (INT dir, LPTSTR commandline)
} }
curr_ptr=curr_ptr->prev; curr_ptr=curr_ptr->prev;
if(curr_ptr->string) if (curr_ptr->string)
_tcscpy(commandline,curr_ptr->string); _tcscpy(commandline,curr_ptr->string);
} }
} }

View file

@ -297,7 +297,7 @@ MakeFullPath(TCHAR * DirPath)
n = p ? p++ - DirPath : _tcslen(DirPath); n = p ? p++ - DirPath : _tcslen(DirPath);
_tcsncpy(path, DirPath, n); _tcsncpy(path, DirPath, n);
path[n] = _T('\0'); path[n] = _T('\0');
if( !CreateDirectory(path, NULL) && if ( !CreateDirectory(path, NULL) &&
(GetLastError() != ERROR_ALREADY_EXISTS)) (GetLastError() != ERROR_ALREADY_EXISTS))
{ {
return FALSE; return FALSE;
@ -334,7 +334,7 @@ INT cmd_mkdir (LPTSTR param)
{ {
if (!MakeFullPath(p[i])) if (!MakeFullPath(p[i]))
{ {
if(GetLastError() == ERROR_PATH_NOT_FOUND) if (GetLastError() == ERROR_PATH_NOT_FOUND)
{ {
ConErrResPuts(STRING_MD_ERROR2); ConErrResPuts(STRING_MD_ERROR2);
} }
@ -376,12 +376,12 @@ BOOL DeleteFolder(LPTSTR FileName)
_tcscpy(TempFileName,Base); _tcscpy(TempFileName,Base);
_tcscat(TempFileName,f.cFileName); _tcscat(TempFileName,f.cFileName);
if(f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (f.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
DeleteFolder(TempFileName); DeleteFolder(TempFileName);
else else
{ {
SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL); SetFileAttributes(TempFileName,FILE_ATTRIBUTE_NORMAL);
if(!DeleteFile(TempFileName)) if (!DeleteFile(TempFileName))
return 0; return 0;
} }

View file

@ -94,16 +94,16 @@ VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
for(i = 0; i < _tcslen(Path); i++) for(i = 0; i < _tcslen(Path); i++)
{ {
if(Path[i] != _T('\\')) if (Path[i] != _T('\\'))
{ {
_tcsncat(TempPath, &Path[i], 1); _tcsncat(TempPath, &Path[i], 1);
if(i != _tcslen(Path) - 1) if (i != _tcslen(Path) - 1)
continue; continue;
} }
/* Handle the base part of the path different. /* Handle the base part of the path different.
Because if you put it into findfirstfile, it will Because if you put it into findfirstfile, it will
return your current folder */ return your current folder */
if(_tcslen(TempPath) == 2 && TempPath[1] == _T(':')) if (_tcslen(TempPath) == 2 && TempPath[1] == _T(':'))
{ {
_tcscat(OutPath, TempPath); _tcscat(OutPath, TempPath);
_tcscat(OutPath, _T("\\")); _tcscat(OutPath, _T("\\"));
@ -112,7 +112,7 @@ VOID GetPathCase( TCHAR * Path, TCHAR * OutPath)
else else
{ {
hFind = FindFirstFile(TempPath,&FindFileData); hFind = FindFirstFile(TempPath,&FindFileData);
if(hFind == INVALID_HANDLE_VALUE) if (hFind == INVALID_HANDLE_VALUE)
{ {
_tcscpy(OutPath, Path); _tcscpy(OutPath, Path);
return; return;
@ -533,25 +533,25 @@ BOOL FileGetString (HANDLE hFile, LPTSTR lpBuffer, INT nBufferLength)
return TRUE; return TRUE;
} }
INT PagePrompt (VOID) INT PagePrompt(VOID)
{ {
INPUT_RECORD ir; INPUT_RECORD ir;
ConOutResPuts(STRING_MISC_HELP1); ConOutResPuts(STRING_MISC_HELP1);
RemoveBreakHandler (); RemoveBreakHandler();
ConInDisable (); ConInDisable();
do do
{ {
ConInKey (&ir); ConInKey(&ir);
} }
while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) || while ((ir.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT) ||
(ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) || (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
(ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL)); (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
AddBreakHandler (); AddBreakHandler();
ConInEnable (); ConInEnable();
if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) || if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) && ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&
@ -600,8 +600,8 @@ INT FilePromptYN (UINT resID)
/* unfinished solution */ /* unfinished solution */
#if 0 #if 0
RemoveBreakHandler (); RemoveBreakHandler();
ConInDisable (); ConInDisable();
do do
{ {
@ -616,8 +616,8 @@ INT FilePromptYN (UINT resID)
(ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) || (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
(ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL)); (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
AddBreakHandler (); AddBreakHandler();
ConInEnable (); ConInEnable();
if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) || if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
((ir.Event.KeyEvent.wVirtualKeyCode == 'C') && ((ir.Event.KeyEvent.wVirtualKeyCode == 'C') &&
@ -666,8 +666,8 @@ INT FilePromptYNA (UINT resID)
/* unfinished solution */ /* unfinished solution */
#if 0 #if 0
RemoveBreakHandler (); RemoveBreakHandler();
ConInDisable (); ConInDisable();
do do
{ {
@ -680,8 +680,8 @@ INT FilePromptYNA (UINT resID)
(ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) || (ir.Event.KeyEvent.wVirtualKeyCode == VK_MENU) ||
(ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL)); (ir.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL));
AddBreakHandler (); AddBreakHandler();
ConInEnable (); ConInEnable();
if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) || if ((ir.Event.KeyEvent.wVirtualKeyCode == VK_ESCAPE) ||
((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) && ((ir.Event.KeyEvent.wVirtualKeyCode == _T('C')) &&

View file

@ -283,7 +283,7 @@ INT cmd_move (LPTSTR param)
~MOVE_SRC_CURRENT_IS_DIR & ~MOVE_SRC_CURRENT_IS_DIR &
~MOVE_DEST_EXISTS; ~MOVE_DEST_EXISTS;
_tcscpy(szFullSrcPath,szSrcDirPath); _tcscpy(szFullSrcPath,szSrcDirPath);
if(szFullSrcPath[_tcslen(szFullSrcPath) - 1] != _T('\\')) if (szFullSrcPath[_tcslen(szFullSrcPath) - 1] != _T('\\'))
_tcscat (szFullSrcPath, _T("\\")); _tcscat (szFullSrcPath, _T("\\"));
_tcscat(szFullSrcPath,findBuffer.cFileName); _tcscat(szFullSrcPath,findBuffer.cFileName);
_tcscpy(szSrcPath, szFullSrcPath); _tcscpy(szSrcPath, szFullSrcPath);
@ -311,7 +311,7 @@ INT cmd_move (LPTSTR param)
/*build the dest string(accounts for *)*/ /*build the dest string(accounts for *)*/
_tcscpy (szFullDestPath, szDestPath); _tcscpy (szFullDestPath, szDestPath);
/*check to see if there is an ending slash, if not add one*/ /*check to see if there is an ending slash, if not add one*/
if(szFullDestPath[_tcslen(szFullDestPath) - 1] != _T('\\')) if (szFullDestPath[_tcslen(szFullDestPath) - 1] != _T('\\'))
_tcscat (szFullDestPath, _T("\\")); _tcscat (szFullDestPath, _T("\\"));
_tcscat (szFullDestPath, findBuffer.cFileName); _tcscat (szFullDestPath, findBuffer.cFileName);
@ -365,10 +365,10 @@ INT cmd_move (LPTSTR param)
} }
/*checks to make sure user wanted/wants the override*/ /*checks to make sure user wanted/wants the override*/
if((dwFlags & MOVE_OVER_NO) && if ((dwFlags & MOVE_OVER_NO) &&
(dwMoveStatusFlags & MOVE_DEST_EXISTS)) (dwMoveStatusFlags & MOVE_DEST_EXISTS))
continue; continue;
if(!(dwFlags & MOVE_OVER_YES) && if (!(dwFlags & MOVE_OVER_YES) &&
(dwMoveStatusFlags & MOVE_DEST_EXISTS)) (dwMoveStatusFlags & MOVE_DEST_EXISTS))
nOverwrite = MoveOverwrite (szFullDestPath); nOverwrite = MoveOverwrite (szFullDestPath);
if (nOverwrite == PROMPT_NO || nOverwrite == PROMPT_BREAK) if (nOverwrite == PROMPT_NO || nOverwrite == PROMPT_BREAK)
@ -440,9 +440,9 @@ INT cmd_move (LPTSTR param)
nDiff = _tcslen(szMoveDest) - _tcslen(szTempPath); nDiff = _tcslen(szMoveDest) - _tcslen(szTempPath);
pszDestDirPointer = pszDestDirPointer - nDiff; pszDestDirPointer = pszDestDirPointer - nDiff;
_tcscpy(pszDestDirPointer,_T("")); _tcscpy(pszDestDirPointer,_T(""));
if(szMoveSrc[_tcslen(szMoveSrc) - 1] != _T('\\')) if (szMoveSrc[_tcslen(szMoveSrc) - 1] != _T('\\'))
_tcscat (szMoveSrc, _T("\\")); _tcscat (szMoveSrc, _T("\\"));
if(szMoveDest[_tcslen(szMoveDest) - 1] != _T('\\')) if (szMoveDest[_tcslen(szMoveDest) - 1] != _T('\\'))
_tcscat (szMoveDest, _T("\\")); _tcscat (szMoveDest, _T("\\"));
pszDestDirPointer = szMoveDest + _tcslen(szMoveDest); pszDestDirPointer = szMoveDest + _tcslen(szMoveDest);
pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc); pszSrcDirPointer = szMoveSrc + _tcslen(szMoveSrc);

View file

@ -57,7 +57,7 @@ VOID PrintPrompt(VOID)
TCHAR szPrompt[256]; TCHAR szPrompt[256];
LPTSTR pr; LPTSTR pr;
if (GetEnvironmentVariable (_T("PROMPT"), szPrompt, 256)) if (GetEnvironmentVariable(_T("PROMPT"), szPrompt, 256))
pr = szPrompt; pr = szPrompt;
else else
pr = default_pr; pr = default_pr;
@ -66,24 +66,24 @@ VOID PrintPrompt(VOID)
{ {
if (*pr != _T('$')) if (*pr != _T('$'))
{ {
ConOutChar (*pr); ConOutChar(*pr);
} }
else else
{ {
pr++; pr++;
switch (_totupper (*pr)) switch (_totupper(*pr))
{ {
case _T('A'): case _T('A'):
ConOutChar (_T('&')); ConOutChar(_T('&'));
break; break;
case _T('B'): case _T('B'):
ConOutChar (_T('|')); ConOutChar(_T('|'));
break; break;
case _T('C'): case _T('C'):
ConOutChar (_T('(')); ConOutChar(_T('('));
break; break;
case _T('D'): case _T('D'):
@ -91,49 +91,49 @@ VOID PrintPrompt(VOID)
break; break;
case _T('E'): case _T('E'):
ConOutChar (_T('\x1B')); ConOutChar(_T('\x1B'));
break; break;
case _T('F'): case _T('F'):
ConOutChar (_T(')')); ConOutChar(_T(')'));
break; break;
case _T('G'): case _T('G'):
ConOutChar (_T('>')); ConOutChar(_T('>'));
break; break;
case _T('H'): case _T('H'):
ConOutChar (_T('\x08')); ConOutChar(_T('\x08'));
ConOutChar (_T(' ')); ConOutChar(_T(' '));
ConOutChar (_T('\x08')); ConOutChar(_T('\x08'));
break; break;
case _T('L'): case _T('L'):
ConOutChar (_T('<')); ConOutChar(_T('<'));
break; break;
case _T('N'): case _T('N'):
{ {
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, szPath); GetCurrentDirectory(MAX_PATH, szPath);
ConOutChar (szPath[0]); ConOutChar(szPath[0]);
} }
break; break;
case _T('P'): case _T('P'):
{ {
TCHAR szPath[MAX_PATH]; TCHAR szPath[MAX_PATH];
GetCurrentDirectory (MAX_PATH, 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('='));
break; break;
case _T('S'): case _T('S'):
ConOutChar (_T(' ')); ConOutChar(_T(' '));
break; break;
case _T('T'): case _T('T'):
@ -146,25 +146,25 @@ VOID PrintPrompt(VOID)
case VER_PLATFORM_WIN32_WINDOWS: case VER_PLATFORM_WIN32_WINDOWS:
if (osvi.dwMajorVersion == 4 && if (osvi.dwMajorVersion == 4 &&
osvi.dwMinorVersion == 1) osvi.dwMinorVersion == 1)
ConOutPrintf (_T("Windows 98")); ConOutPrintf(_T("Windows 98"));
else else
ConOutPrintf (_T("Windows 95")); ConOutPrintf(_T("Windows 95"));
break; break;
case VER_PLATFORM_WIN32_NT: case VER_PLATFORM_WIN32_NT:
ConOutPrintf (_T("Windows NT Version %lu.%lu"), ConOutPrintf(_T("Windows NT Version %lu.%lu"),
osvi.dwMajorVersion, osvi.dwMinorVersion); osvi.dwMajorVersion, osvi.dwMinorVersion);
break; break;
} }
break; break;
case _T('_'): case _T('_'):
ConOutChar (_T('\n')); ConOutChar(_T('\n'));
break; break;
case '$': case '$':
ConOutChar (_T('$')); ConOutChar(_T('$'));
break; break;
#ifdef FEATURE_DIRECTORY_STACK #ifdef FEATURE_DIRECTORY_STACK
@ -172,7 +172,7 @@ 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

View file

@ -171,24 +171,24 @@ INT cmd_rename (LPTSTR param)
while(_tcschr(srcFILE, _T('\\'))) while(_tcschr(srcFILE, _T('\\')))
{ {
srcFILE++; srcFILE++;
if(*srcFILE==_T('\\')) nSlash++ ; if (*srcFILE==_T('\\')) nSlash++ ;
if(!_tcschr(srcFILE, _T('\\'))) break; if (!_tcschr(srcFILE, _T('\\'))) break;
} }
_tcsncpy(srcPath,srcPattern,_tcslen(srcPattern)-_tcslen(srcFILE)); _tcsncpy(srcPath,srcPattern,_tcslen(srcPattern)-_tcslen(srcFILE));
if(_tcschr(dstPattern, _T('\\'))) //Checking if the Destiny (dstPattern)is also a Path.And splitting dstPattern in dstPath and srcPath. if (_tcschr(dstPattern, _T('\\'))) //Checking if the Destiny (dstPattern)is also a Path.And splitting dstPattern in dstPath and srcPath.
{ {
dstFILE = _tcschr(dstPattern, _T('\\')); dstFILE = _tcschr(dstPattern, _T('\\'));
nSlash=0; nSlash=0;
while(_tcschr(dstFILE, _T('\\'))) while(_tcschr(dstFILE, _T('\\')))
{ {
dstFILE++; dstFILE++;
if(*dstFILE==_T('\\')) nSlash++ ; if (*dstFILE==_T('\\')) nSlash++ ;
if(!_tcschr(dstFILE, _T('\\'))) break; if (!_tcschr(dstFILE, _T('\\'))) break;
} }
_tcsncpy(dstPath,dstPattern,_tcslen(dstPattern)-_tcslen(dstFILE)); _tcsncpy(dstPath,dstPattern,_tcslen(dstPattern)-_tcslen(dstFILE));
if((_tcslen(dstPath)!=_tcslen(srcPath))||(_tcsncmp(srcPath,dstPath,_tcslen(srcPath))!=0)) //If it has a Path,then MUST be equal than srcPath if ((_tcslen(dstPath)!=_tcslen(srcPath))||(_tcsncmp(srcPath,dstPath,_tcslen(srcPath))!=0)) //If it has a Path,then MUST be equal than srcPath
{ {
error_syntax(dstPath); error_syntax(dstPath);
freep(arg); freep(arg);
@ -205,7 +205,7 @@ INT cmd_rename (LPTSTR param)
if (!_tcschr(srcPattern, _T('\\'))) //If srcPattern isn't a Path but a name: if (!_tcschr(srcPattern, _T('\\'))) //If srcPattern isn't a Path but a name:
{ {
srcFILE=srcPattern; srcFILE=srcPattern;
if(_tcschr(dstPattern, _T('\\'))) if (_tcschr(dstPattern, _T('\\')))
{ {
error_syntax(dstPattern); error_syntax(dstPattern);
freep(arg); freep(arg);
@ -286,7 +286,7 @@ INT cmd_rename (LPTSTR param)
} }
*r = 0; *r = 0;
//Well we have splitted the Paths,so now we have to paste them again(if needed),thanks bPath. //Well we have splitted the Paths,so now we have to paste them again(if needed),thanks bPath.
if(bPath == TRUE) if (bPath == TRUE)
{ {
_tcscpy(srcFinal,srcPath); _tcscpy(srcFinal,srcPath);
_tcscat(srcFinal,f.cFileName); _tcscat(srcFinal,f.cFileName);

View file

@ -36,7 +36,7 @@ void invalid_switch(LPTSTR is)
/* retrives the pathe dependen om the input file name */ /* retrives the pathe dependen om the input file name */
void getPath(TCHAR* out, LPTSTR in) void getPath(TCHAR* out, LPTSTR in)
{ {
if(_tcslen(in) == 2 && in[1] == _T(':')) if (_tcslen(in) == 2 && in[1] == _T(':'))
GetRootPath(in,out,MAX_PATH); GetRootPath(in,out,MAX_PATH);
else else
GetFullPathName (in, MAX_PATH, out, NULL); GetFullPathName (in, MAX_PATH, out, NULL);
@ -83,7 +83,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
*/ */
dwAttrib = GetFileAttributes (source); dwAttrib = GetFileAttributes (source);
if(IsExistingFile (dest)) if (IsExistingFile (dest))
{ {
/* /*
* Resets the attributes to avoid probles with read only files, * Resets the attributes to avoid probles with read only files,
@ -94,7 +94,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
* Is the update flas set? The time has to be controled so that * Is the update flas set? The time has to be controled so that
* only older files are replaced. * only older files are replaced.
*/ */
if(dwFlags & REPLACE_UPDATE) if (dwFlags & REPLACE_UPDATE)
{ {
/* Read destination time */ /* Read destination time */
hFileDest = CreateFile(dest, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, hFileDest = CreateFile(dest, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
@ -108,7 +108,7 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
/* Compare time */ /* Compare time */
GetFileTime (hFileDest, &destCreationTime, &destLastAccessTime, &destLastWriteTime); GetFileTime (hFileDest, &destCreationTime, &destLastAccessTime, &destLastWriteTime);
if(!((srcLastWriteTime.dwHighDateTime > destLastWriteTime.dwHighDateTime) || if (!((srcLastWriteTime.dwHighDateTime > destLastWriteTime.dwHighDateTime) ||
(srcLastWriteTime.dwHighDateTime == destLastWriteTime.dwHighDateTime && (srcLastWriteTime.dwHighDateTime == destLastWriteTime.dwHighDateTime &&
srcLastWriteTime.dwLowDateTime > destLastWriteTime.dwLowDateTime))) srcLastWriteTime.dwLowDateTime > destLastWriteTime.dwLowDateTime)))
{ {
@ -123,25 +123,25 @@ INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *d
} }
/* Check confirm flag, and take appropriate action */ /* Check confirm flag, and take appropriate action */
if(dwFlags & REPLACE_CONFIRM) if (dwFlags & REPLACE_CONFIRM)
{ {
/* Output depending on add flag */ /* Output depending on add flag */
if(dwFlags & REPLACE_ADD) if (dwFlags & REPLACE_ADD)
ConOutResPrintf(STRING_REPLACE_HELP9, dest); ConOutResPrintf(STRING_REPLACE_HELP9, dest);
else else
ConOutResPrintf(STRING_REPLACE_HELP10, dest); ConOutResPrintf(STRING_REPLACE_HELP10, dest);
if( !FilePromptYNA (0)) if ( !FilePromptYNA (0))
return 0; return 0;
} }
/* Output depending on add flag */ /* Output depending on add flag */
if(dwFlags & REPLACE_ADD) if (dwFlags & REPLACE_ADD)
ConOutResPrintf(STRING_REPLACE_HELP11, dest); ConOutResPrintf(STRING_REPLACE_HELP11, dest);
else else
ConOutResPrintf(STRING_REPLACE_HELP5, dest); ConOutResPrintf(STRING_REPLACE_HELP5, dest);
/* Make sure source and destination is not the same */ /* Make sure source and destination is not the same */
if(!_tcscmp(s, d)) if (!_tcscmp(s, d))
{ {
ConOutResPaging(TRUE, STRING_REPLACE_ERROR7); ConOutResPaging(TRUE, STRING_REPLACE_ERROR7);
CloseHandle (hFileSrc); CloseHandle (hFileSrc);
@ -229,7 +229,7 @@ INT recReplace(DWORD dwFlags,
*/ */
for(i = (_tcslen(szSrcPath) - 1); i > -1; i--) for(i = (_tcslen(szSrcPath) - 1); i > -1; i--)
{ {
if(szSrcPath[i] != _T('\\')) if (szSrcPath[i] != _T('\\'))
szSrcPath[i] = _T('\0'); szSrcPath[i] = _T('\0');
else else
break; break;
@ -238,17 +238,17 @@ INT recReplace(DWORD dwFlags,
/* Go through all the soursfiles and copy/replace them */ /* Go through all the soursfiles and copy/replace them */
do do
{ {
if(CheckCtrlBreak(BREAK_INPUT)) if (CheckCtrlBreak(BREAK_INPUT))
{ {
return filesReplaced; return filesReplaced;
} }
/* Problem with file handler */ /* Problem with file handler */
if(hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
return filesReplaced; return filesReplaced;
/* We do not want to replace any .. . ocr directory */ /* We do not want to replace any .. . ocr directory */
if(!_tcscmp (findBuffer.cFileName, _T(".")) || if (!_tcscmp (findBuffer.cFileName, _T(".")) ||
!_tcscmp (findBuffer.cFileName, _T(".."))|| !_tcscmp (findBuffer.cFileName, _T(".."))||
findBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) findBuffer.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
continue; continue;
@ -259,23 +259,23 @@ INT recReplace(DWORD dwFlags,
dwAttrib = GetFileAttributes(tmpDestPath); dwAttrib = GetFileAttributes(tmpDestPath);
/* Check add flag */ /* Check add flag */
if(dwFlags & REPLACE_ADD) if (dwFlags & REPLACE_ADD)
{ {
if(IsExistingFile(tmpDestPath)) if (IsExistingFile(tmpDestPath))
continue; continue;
else else
dwAttrib = 0; dwAttrib = 0;
} }
else else
{ {
if(!IsExistingFile(tmpDestPath)) if (!IsExistingFile(tmpDestPath))
continue; continue;
} }
/* Check if file is read only, if so check if that should be ignored */ /* Check if file is read only, if so check if that should be ignored */
if(dwAttrib & FILE_ATTRIBUTE_READONLY) if (dwAttrib & FILE_ATTRIBUTE_READONLY)
{ {
if(!(dwFlags & REPLACE_READ_ONLY)) if (!(dwFlags & REPLACE_READ_ONLY))
{ {
ConOutResPrintf(STRING_REPLACE_ERROR5, tmpDestPath); ConOutResPrintf(STRING_REPLACE_ERROR5, tmpDestPath);
*doMore = FALSE; *doMore = FALSE;
@ -288,7 +288,7 @@ INT recReplace(DWORD dwFlags,
_tcscat (tmpSrcPath, findBuffer.cFileName); _tcscat (tmpSrcPath, findBuffer.cFileName);
/* Make the replace */ /* Make the replace */
if(replace(tmpSrcPath,tmpDestPath, dwFlags, doMore)) if (replace(tmpSrcPath,tmpDestPath, dwFlags, doMore))
{ {
filesReplaced++; filesReplaced++;
} }
@ -329,7 +329,7 @@ INT recFindSubDirs(DWORD dwFlags,
/* Remove the star added earlyer to dest path */ /* Remove the star added earlyer to dest path */
for(i = (_tcslen(szDestPath) - 1); i > -1; i--) for(i = (_tcslen(szDestPath) - 1); i > -1; i--)
{ {
if(szDestPath[i] != _T('\\')) if (szDestPath[i] != _T('\\'))
szDestPath[i] = _T('\0'); szDestPath[i] = _T('\0');
else else
break; break;
@ -341,7 +341,7 @@ INT recFindSubDirs(DWORD dwFlags,
/* Save the source path so that it will not be wrecked */ /* Save the source path so that it will not be wrecked */
_tcscpy(tmpSrcPath,szSrcPath); _tcscpy(tmpSrcPath,szSrcPath);
/* Check for reading problems */ /* Check for reading problems */
if(hFile == INVALID_HANDLE_VALUE) if (hFile == INVALID_HANDLE_VALUE)
{ {
ConOutFormatMessage (GetLastError(), tmpSrcPath); ConOutFormatMessage (GetLastError(), tmpSrcPath);
return filesReplaced; return filesReplaced;
@ -351,7 +351,7 @@ INT recFindSubDirs(DWORD dwFlags,
* Check if the we should enter the dir or if it is a file * Check if the we should enter the dir or if it is a file
* or . or .. if so thake the next object to process. * or . or .. if so thake the next object to process.
*/ */
if(!_tcscmp (findBuffer.cFileName, _T(".")) || if (!_tcscmp (findBuffer.cFileName, _T(".")) ||
!_tcscmp (findBuffer.cFileName, _T(".."))|| !_tcscmp (findBuffer.cFileName, _T(".."))||
IsExistingFile(findBuffer.cFileName)) IsExistingFile(findBuffer.cFileName))
continue; continue;
@ -359,20 +359,20 @@ INT recFindSubDirs(DWORD dwFlags,
_tcscpy(tmpDestPath,szDestPath); _tcscpy(tmpDestPath,szDestPath);
_tcscat (tmpDestPath, findBuffer.cFileName); _tcscat (tmpDestPath, findBuffer.cFileName);
/* Make sure that we have a directory */ /* Make sure that we have a directory */
if(IsExistingDirectory(tmpDestPath)) if (IsExistingDirectory(tmpDestPath))
{ {
/* Add a \ to the end or the path */ /* Add a \ to the end or the path */
if(szDestPath[_tcslen(tmpDestPath) - 1] != _T('\\')) if (szDestPath[_tcslen(tmpDestPath) - 1] != _T('\\'))
_tcscat(tmpDestPath, _T("\\")); _tcscat(tmpDestPath, _T("\\"));
/* Call the function to replace files in the new directory */ /* Call the function to replace files in the new directory */
filesReplaced += recReplace(dwFlags, tmpSrcPath, tmpDestPath, doMore); filesReplaced += recReplace(dwFlags, tmpSrcPath, tmpDestPath, doMore);
/* If there were problems break e.g. read-only file */ /* If there were problems break e.g. read-only file */
if(!*doMore) if (!*doMore)
break; break;
_tcscpy(tmpSrcPath,szSrcPath); _tcscpy(tmpSrcPath,szSrcPath);
/* Controle the next level of subdirs */ /* Controle the next level of subdirs */
filesReplaced += recFindSubDirs(dwFlags,tmpSrcPath,tmpDestPath, doMore); filesReplaced += recFindSubDirs(dwFlags,tmpSrcPath,tmpDestPath, doMore);
if(!*doMore) if (!*doMore)
break; break;
} }
/* Get the next handle */ /* Get the next handle */
@ -442,11 +442,11 @@ INT cmd_replace (LPTSTR param)
} }
else else
{ {
if(srcIndex == -1) if (srcIndex == -1)
{ {
srcIndex = i; srcIndex = i;
} }
else if(destIndex == -1) else if (destIndex == -1)
{ {
destIndex = i; destIndex = i;
} }
@ -468,7 +468,7 @@ INT cmd_replace (LPTSTR param)
return 1; return 1;
} }
/* Check so that not both update and add switch is added and subdir */ /* Check so that not both update and add switch is added and subdir */
if((dwFlags & REPLACE_UPDATE || dwFlags & REPLACE_SUBDIR) && (dwFlags & REPLACE_ADD)) if ((dwFlags & REPLACE_UPDATE || dwFlags & REPLACE_SUBDIR) && (dwFlags & REPLACE_ADD))
{ {
ConOutResPaging(TRUE,STRING_REPLACE_ERROR4); ConOutResPaging(TRUE,STRING_REPLACE_ERROR4);
ConOutResPaging(TRUE,STRING_REPLACE_HELP7); ConOutResPaging(TRUE,STRING_REPLACE_HELP7);
@ -477,9 +477,9 @@ INT cmd_replace (LPTSTR param)
} }
/* If we have a destination get the full path */ /* If we have a destination get the full path */
if(destIndex != -1) if (destIndex != -1)
{ {
if(_tcslen(arg[destIndex]) == 2 && arg[destIndex][1] == ':') if (_tcslen(arg[destIndex]) == 2 && arg[destIndex][1] == ':')
GetRootPath(arg[destIndex],szDestPath,MAX_PATH); GetRootPath(arg[destIndex],szDestPath,MAX_PATH);
else else
{ {
@ -494,7 +494,7 @@ INT cmd_replace (LPTSTR param)
} }
getPath(szDestPath, arg[destIndex]); getPath(szDestPath, arg[destIndex]);
/* Make sure that destination exists */ /* Make sure that destination exists */
if(!IsExistingDirectory(szDestPath)) if (!IsExistingDirectory(szDestPath))
{ {
ConOutResPrintf(STRING_REPLACE_ERROR2, szDestPath); ConOutResPrintf(STRING_REPLACE_ERROR2, szDestPath);
ConOutResPaging(TRUE,STRING_REPLACE_HELP3); ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
@ -510,7 +510,7 @@ INT cmd_replace (LPTSTR param)
} }
/* Get the full source path */ /* Get the full source path */
if(!(_tcslen(arg[srcIndex]) == 2 && arg[srcIndex][1] == ':')) if (!(_tcslen(arg[srcIndex]) == 2 && arg[srcIndex][1] == ':'))
getPath(szSrcPath, arg[srcIndex]); getPath(szSrcPath, arg[srcIndex]);
else else
_tcscpy(szSrcPath,arg[srcIndex]); _tcscpy(szSrcPath,arg[srcIndex]);
@ -520,7 +520,7 @@ INT cmd_replace (LPTSTR param)
_tcschr (arg[srcIndex], _T('?')) == NULL) _tcschr (arg[srcIndex], _T('?')) == NULL)
{ {
/* Check so that source is not a directory, because that is not allowed */ /* Check so that source is not a directory, because that is not allowed */
if(IsExistingDirectory(szSrcPath)) if (IsExistingDirectory(szSrcPath))
{ {
ConOutResPrintf(STRING_REPLACE_ERROR6, szSrcPath); ConOutResPrintf(STRING_REPLACE_ERROR6, szSrcPath);
ConOutResPaging(TRUE,STRING_REPLACE_HELP3); ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
@ -528,7 +528,7 @@ INT cmd_replace (LPTSTR param)
return 1; return 1;
} }
/* Check if the file exists */ /* Check if the file exists */
if(!IsExistingFile(szSrcPath)) if (!IsExistingFile(szSrcPath))
{ {
ConOutResPaging(TRUE,STRING_REPLACE_HELP3); ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
freep(arg); freep(arg);
@ -536,14 +536,14 @@ INT cmd_replace (LPTSTR param)
} }
} }
/* /w switch is set so wait for any key to be pressed */ /* /w switch is set so wait for any key to be pressed */
if(dwFlags & REPLACE_DISK) if (dwFlags & REPLACE_DISK)
{ {
msg_pause(); msg_pause();
cgetchar(); cgetchar();
} }
/* Add an extra \ to the destination path if needed */ /* Add an extra \ to the destination path if needed */
if(szDestPath[_tcslen(szDestPath) - 1] != _T('\\')) if (szDestPath[_tcslen(szDestPath) - 1] != _T('\\'))
_tcscat(szDestPath, _T("\\")); _tcscat(szDestPath, _T("\\"));
/* Save source path */ /* Save source path */
@ -551,19 +551,19 @@ INT cmd_replace (LPTSTR param)
/* Replace in dest dir */ /* Replace in dest dir */
filesReplaced += recReplace(dwFlags, tmpSrcPath, szDestPath, &doMore); filesReplaced += recReplace(dwFlags, tmpSrcPath, szDestPath, &doMore);
/* If subdir switch is set replace in the subdirs to */ /* If subdir switch is set replace in the subdirs to */
if(dwFlags & REPLACE_SUBDIR && doMore) if (dwFlags & REPLACE_SUBDIR && doMore)
{ {
filesReplaced += recFindSubDirs(dwFlags, szSrcPath, szDestPath, &doMore); filesReplaced += recFindSubDirs(dwFlags, szSrcPath, szDestPath, &doMore);
} }
/* If source == dest write no more */ /* If source == dest write no more */
if(filesReplaced != -1) if (filesReplaced != -1)
{ {
/* No files replaced */ /* No files replaced */
if(filesReplaced==0) if (filesReplaced==0)
{ {
/* Add switch dependent output */ /* Add switch dependent output */
if(dwFlags & REPLACE_ADD) if (dwFlags & REPLACE_ADD)
ConOutResPaging(TRUE,STRING_REPLACE_HELP7); ConOutResPaging(TRUE,STRING_REPLACE_HELP7);
else else
ConOutResPaging(TRUE,STRING_REPLACE_HELP3); ConOutResPaging(TRUE,STRING_REPLACE_HELP3);
@ -572,7 +572,7 @@ INT cmd_replace (LPTSTR param)
else else
{ {
/* Add switch dependent output */ /* Add switch dependent output */
if(dwFlags & REPLACE_ADD) if (dwFlags & REPLACE_ADD)
ConOutResPrintf(STRING_REPLACE_HELP8, filesReplaced); ConOutResPrintf(STRING_REPLACE_HELP8, filesReplaced);
else else
ConOutResPrintf(STRING_REPLACE_HELP4, filesReplaced); ConOutResPrintf(STRING_REPLACE_HELP4, filesReplaced);

View file

@ -33,7 +33,7 @@ INT CommandScreen (LPTSTR param)
while(_istspace(*param)) while(_istspace(*param))
param++; param++;
if(!(*param)) if (!(*param))
{ {
error_req_param_missing (); error_req_param_missing ();
return 1; return 1;
@ -48,7 +48,7 @@ INT CommandScreen (LPTSTR param)
} }
//get col //get col
if(!(param = _tcschr(param,_T(' ')))) if (!(param = _tcschr(param,_T(' '))))
{ {
error_req_param_missing (); error_req_param_missing ();
return 1; return 1;
@ -57,7 +57,7 @@ INT CommandScreen (LPTSTR param)
while(_istspace(*param)) while(_istspace(*param))
param++; param++;
if(!(*param)) if (!(*param))
{ {
error_req_param_missing (); error_req_param_missing ();
return 1; return 1;
@ -71,7 +71,7 @@ INT CommandScreen (LPTSTR param)
} }
//get text //get text
if(!(param = _tcschr(param,_T(' ')))) if (!(param = _tcschr(param,_T(' '))))
{ {
bSkipText = TRUE; bSkipText = TRUE;
} }
@ -80,7 +80,7 @@ INT CommandScreen (LPTSTR param)
while(_istspace(*param)) while(_istspace(*param))
param++; param++;
if(!(*param)) if (!(*param))
{ {
bSkipText = TRUE; bSkipText = TRUE;
} }
@ -88,13 +88,13 @@ INT CommandScreen (LPTSTR param)
bIgnoreEcho = TRUE; bIgnoreEcho = TRUE;
if(bSkipText) if (bSkipText)
x=0; x=0;
SetCursorXY(x,y); SetCursorXY(x,y);
if(!(bSkipText)) if (!(bSkipText))
ConOutPuts(param); ConOutPuts(param);
return 0; return 0;

View file

@ -110,7 +110,7 @@ INT cmd_set (LPTSTR param)
BOOL Success; BOOL Success;
StripQuotes(param); StripQuotes(param);
Success = seta_eval ( skip_ws(param+2) ); Success = seta_eval ( skip_ws(param+2) );
if(!Success) if (!Success)
{ {
/* might seem random but this is what windows xp does */ /* might seem random but this is what windows xp does */
nErrorLevel = 9165; nErrorLevel = 9165;

View file

@ -185,7 +185,7 @@ INT cmd_start (LPTSTR Rest)
} }
SetLastError(0); SetLastError(0);
size = GetEnvironmentVariable (_T("COMSPEC"), comspec, MAX_PATH); size = GetEnvironmentVariable (_T("COMSPEC"), comspec, MAX_PATH);
if(GetLastError() == ERROR_ENVVAR_NOT_FOUND) if (GetLastError() == ERROR_ENVVAR_NOT_FOUND)
{ {
_tcscpy(comspec, _T("cmd")); _tcscpy(comspec, _T("cmd"));
} }

View file

@ -94,10 +94,10 @@ INT chop_blank(LPTSTR *arg_str)
{ {
LPTSTR str; LPTSTR str;
str = _tcschr(*arg_str,_T(' ')); str = _tcschr(*arg_str,_T(' '));
if(!str) if (!str)
{ {
str = _tcschr (*arg_str, _T('\0')); str = _tcschr (*arg_str, _T('\0'));
if(str != NULL) if (str != NULL)
*arg_str=str; *arg_str=str;
return CP_BLANK_NOT_FOUND; return CP_BLANK_NOT_FOUND;
} }
@ -129,13 +129,13 @@ WORD hex_clr(LPTSTR str)
ch = str[1]; ch = str[1];
if(_istdigit(ch)) if (_istdigit(ch))
ret = ch-_T('0'); ret = ch-_T('0');
else else
{ {
ch=_totupper(ch); ch=_totupper(ch);
if( ch >= _T('A') && ch <= _T('F') ) if ( ch >= _T('A') && ch <= _T('F') )
ret = ch-_T('A')+10; ret = ch-_T('A')+10;
else else
return (WORD)-1; return (WORD)-1;
@ -143,13 +143,13 @@ WORD hex_clr(LPTSTR str)
ch = str[0]; ch = str[0];
if(_istdigit(ch)) if (_istdigit(ch))
ret |= (ch-_T('0')) << 4; ret |= (ch-_T('0')) << 4;
else else
{ {
ch=_totupper(ch); ch=_totupper(ch);
if( ch >= _T('A') && ch <= _T('F') ) if ( ch >= _T('A') && ch <= _T('F') )
ret |= (ch-_T('A')+10) <<4; ret |= (ch-_T('A')+10) <<4;
else else
return (WORD)-1; return (WORD)-1;
@ -215,15 +215,15 @@ WORD str_to_color(LPTSTR* arg_str)
/* background */ /* background */
bBri = FALSE; bBri = FALSE;
if(_tcsnicmp(str,_T("bri"),3) == 0 ) if (_tcsnicmp(str,_T("bri"),3) == 0 )
{ {
bBri = TRUE; bBri = TRUE;
if(chop_blank(&str)) if (chop_blank(&str))
return (WORD)-1; return (WORD)-1;
} }
if( (tmp_clr = txt_clr(str)) == (WORD)-1 ) if ( (tmp_clr = txt_clr(str)) == (WORD)-1 )
return (WORD)-1; return (WORD)-1;
chop_blank(&str); chop_blank(&str);

View file

@ -143,7 +143,7 @@ INT CommandTimer (LPTSTR param)
} }
// do stuff (start/stop/read timer) // do stuff (start/stop/read timer)
if(NewClkStatus == NCS_ON) if (NewClkStatus == NCS_ON)
{ {
cT=GetTickCount(); cT=GetTickCount();
cS=TRUE; cS=TRUE;
@ -154,9 +154,9 @@ INT CommandTimer (LPTSTR param)
return 0; return 0;
} }
if(bS) if (bS)
{ {
if(cS) if (cS)
{ {
ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF")); ConOutResPrintf (STRING_TIMER_TIME,clk_n,cS?_T("ON"):_T("OFF"));
ConOutPrintf(_T("%s\n"), GetTimeString()); ConOutPrintf(_T("%s\n"), GetTimeString());

View file

@ -32,7 +32,7 @@ PrintVolumeHeader (LPTSTR pszRootPath)
DWORD dwSerialNr; DWORD dwSerialNr;
/* get the volume information of the drive */ /* get the volume information of the drive */
if(!GetVolumeInformation(pszRootPath, if (!GetVolumeInformation(pszRootPath,
szVolName, szVolName,
80, 80,
&dwSerialNr, &dwSerialNr,

View file

@ -85,7 +85,7 @@ static INT ServiceActivate (LPTSTR param, HWND hWnd)
tmp++; tmp++;
pos.left= _ttoi(tmp); pos.left= _ttoi(tmp);
if(!(tmp=_tcschr(tmp, _T(',')))) if (!(tmp=_tcschr(tmp, _T(','))))
{ {
error_invalid_parameter_format(p[i]); error_invalid_parameter_format(p[i]);
freep(p); freep(p);
@ -93,7 +93,7 @@ static INT ServiceActivate (LPTSTR param, HWND hWnd)
} }
pos.top = _ttoi (++tmp); pos.top = _ttoi (++tmp);
if(!(tmp=_tcschr(tmp, _T(',')))) if (!(tmp=_tcschr(tmp, _T(','))))
{ {
error_invalid_parameter_format(p[i]); error_invalid_parameter_format(p[i]);
freep(p); freep(p);
@ -198,25 +198,25 @@ INT CommandActivate (LPTSTR param)
return 0; return 0;
} }
if(!(*param)) if (!(*param))
return 1; return 1;
/* Split the user input into array */ /* Split the user input into array */
arg = split (param, &argc, FALSE); arg = split (param, &argc, FALSE);
if(argc < 2) if (argc < 2)
{ {
if(arg != NULL) if (arg != NULL)
freep(arg); freep(arg);
} }
hwnd = FindWindow(NULL, arg[0]); hwnd = FindWindow(NULL, arg[0]);
if (hwnd == NULL) if (hwnd == NULL)
{ {
if(arg != NULL) if (arg != NULL)
freep(arg); freep(arg);
ConErrResPuts(STRING_WINDOW_ERROR1); ConErrResPuts(STRING_WINDOW_ERROR1);
return 1; return 1;
} }
if(arg != NULL) if (arg != NULL)
freep(arg); freep(arg);
return ServiceActivate(param, hwnd); return ServiceActivate(param, hwnd);