- Minor fixes to work more like WinXP's cmd

- Removed the now obsolete "seta_test.cmd"

svn path=/trunk/; revision=33561
This commit is contained in:
Colin Finck 2008-05-17 20:07:31 +00:00
parent b655fc4f5e
commit 92545f124e
7 changed files with 21 additions and 133 deletions

View file

@ -292,6 +292,9 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
return FALSE;
}
/* Don't print a newline for this command */
bIgnoreEcho = TRUE;
TRACE ("Batch: returns TRUE\n");
return TRUE;

View file

@ -54,8 +54,6 @@ INT cmd_cls (LPTSTR cmd, LPTSTR param)
coPos, &dwWritten);
SetConsoleCursorPosition(hConsole, coPos);
bIgnoreEcho = TRUE;
return 0;
}
#endif

View file

@ -154,7 +154,7 @@ typedef NTSTATUS (WINAPI *NtReadVirtualMemoryProc)(HANDLE, PVOID, PVOID, ULONG,
BOOL bExit = FALSE; /* indicates EXIT was typed */
BOOL bCanExit = TRUE; /* indicates if this shell is exitable */
BOOL bCtrlBreak = FALSE; /* Ctrl-Break or Ctrl-C hit */
BOOL bIgnoreEcho = FALSE; /* Ignore 'newline' before 'cls' */
BOOL bIgnoreEcho = FALSE; /* Set this to TRUE to prevent a newline, when executing a command */
INT nErrorLevel = 0; /* Errorlevel of last launched external program */
BOOL bChildProcessRunning = FALSE;
DWORD dwChildProcessId = 0;

View file

@ -157,6 +157,7 @@ VOID ConOutChar (TCHAR c)
VOID ConPuts(LPTSTR szText, DWORD nStdHandle)
{
DWORD dwWritten;
HANDLE hStdHandle;
PCHAR pBuf;
INT len;
@ -167,12 +168,14 @@ VOID ConPuts(LPTSTR szText, DWORD nStdHandle)
#else
pBuf = szText;
#endif
WriteFile (GetStdHandle (nStdHandle),
hStdHandle = GetStdHandle(nStdHandle);
WriteFile (hStdHandle,
pBuf,
len,
&dwWritten,
NULL);
WriteFile (GetStdHandle (nStdHandle),
WriteFile (hStdHandle,
_T("\n"),
1,
&dwWritten,

View file

@ -795,14 +795,14 @@ DirPrintFileDateTime(TCHAR *lpDate,
{
case 0: /* 12 hour format */
default:
_stprintf (szTime,_T(" %02d%c%02u%c"),
_stprintf (szTime,_T("%02d%c%02u%c"),
(dt.wHour == 0 ? 12 : (dt.wHour <= 12 ? dt.wHour : dt.wHour - 12)),
cTimeSeparator,
dt.wMinute, (dt.wHour <= 11 ? _T('a') : _T('p')));
break;
case 1: /* 24 hour format */
_stprintf (szTime, _T(" %02d%c%02u"),
_stprintf (szTime, _T("%02d%c%02u"),
dt.wHour, cTimeSeparator, dt.wMinute);
break;
}
@ -1024,7 +1024,7 @@ DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[], /* [IN]Files' Info */
/* Print the line */
if(lpFlags->bPause)
{
if (ConOutPrintfPaging(FALSE,_T("%10s %-8s %*s%s %s\n"),
if (ConOutPrintfPaging(FALSE,_T("%10s %-6s %*s%s %s\n"),
szDate,
szTime,
iSizeFormat,
@ -1034,7 +1034,7 @@ DirPrintNewList(LPWIN32_FIND_DATA ptrFiles[], /* [IN]Files' Info */
return ;
}
else
ConOutPrintf(_T("%10s %-8s %*s%s %s\n"),
ConOutPrintf(_T("%10s %-6s %*s%s %s\n"),
szDate,
szTime,
iSizeFormat,
@ -1656,7 +1656,7 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
}
}
}
}while(FindNextFile(hSearch, &wfdFileInfo));
} while(FindNextFile(hSearch, &wfdFileInfo));
FindClose(hSearch);
/* Terminate list */
@ -1692,7 +1692,7 @@ ULARGE_INTEGER u64Temp; /* A temporary counter */
/* Sort Data if requested*/
if (lpFlags->stOrderBy.sCriteriaCount > 0)
QsortFiles(ptrFileArray, 0, dwCount-1,lpFlags);
QsortFiles(ptrFileArray, 0, dwCount-1, lpFlags);
/* Print Data */
DirPrintFiles(ptrFileArray, dwCount, szFullPath, lpFlags);

View file

@ -196,12 +196,12 @@ Optionen k
""-"" vor einer Option setzt die Voreinstellung ausser Kraft, z.B. DIR /-W."
STRING_DIR_HELP2, " Datenträger in Laufwerk %c ist %s\n"
STRING_DIR_HELP3, " Datenträger in Laufwerk %c hat keinen Namen\n"
STRING_DIR_HELP4, " Datenträger-Seriennummer ist %04X-%04X\n"
STRING_DIR_HELP5, "\n Gelistete Dateien:\n%16i Datei(en)% 14s bytes\n"
STRING_DIR_HELP6, "%16i Verzeichnis(se)% 15s bytes\n"
STRING_DIR_HELP7, "\n Verzeichnisse %s\n\n"
STRING_DIR_HELP8, "%16i Datei(en)% 14s bytes\n"
STRING_DIR_HELP3, " Datenträger in Laufwerk %c hat keine Bezeichnung\n"
STRING_DIR_HELP4, " Volumeseriennummer: %04X-%04X\n"
STRING_DIR_HELP5, "\n Anzahl der angezeigten Dateien:\n%16i Datei(en)% 15s Bytes\n"
STRING_DIR_HELP6, "%16i Verzeichnis(se), % 15s Bytes frei\n"
STRING_DIR_HELP7, "\n Verzeichnis von %s\n\n"
STRING_DIR_HELP8, "%16i Datei(en)% 14s Bytes\n"
STRING_DIRSTACK_HELP1, "Speichert das aktuelle Verzeichnis für den POPD Befehl, und\n\
wechselt dann zu den festgelegten Verzeichnis.\n\n\

View file

@ -1,116 +0,0 @@
@echo off
@rem the next line reexecutes the script without params if it was called with params, else we'll get false failures
@if not "%1"=="" seta_test.cmd
@rem the next two lines illustrate bug in existing if code
if not "=="=="==" goto failure
if "=="=="==" goto next1
goto failure
:next1
if "1"=="2" goto failure
if not "1"=="1" goto failure
set /a a=1
echo.
if not "%a%"=="1" goto failure
set /a b=a
echo.
if not "%b%"=="1" goto failure
set /a a=!5
echo.
if not "%a%"=="0" goto failure
set /a a=!a
echo.
if not "%a%"=="1" goto failure
set /a a=~5
echo.
if not "%a%"=="-6" goto failure
set /a a=5,a=-a
echo.
if not "%a%"=="-5" goto failure
set /a a=5*7
echo.
if not "%a%"=="35" goto failure
set /a a=2000/10
echo.
if not "%a%"=="200" goto failure
set /a a=42%%9
echo.
if not "%a%"=="6" goto failure
set /a a=5%2
echo.
if not "%a%"=="5" goto failure
set /a a=42^%13
echo.
if not "%a%"=="423" goto failure
set /a a=7+9
echo.
if not "%a%"=="16" goto failure
set /a a=9-7
echo.
if not "%a%"=="2" goto failure
set /a a=9^<^<2
echo.
if not "%a%"=="36" goto failure
set /a a=36^>^>2
echo.
if not "%a%"=="9" goto failure
set /a a=42^&9
echo.
if not "%a%"=="8" goto failure
set /a a=32^9
echo.
if not "%a%"=="329" goto failure
set /a a=32^^9
echo.
if not "%a%"=="41" goto failure
set /a a=10^|22
echo.
if not "%a%"=="30" goto failure
set /a a=2,a*=3
echo.
if not "%a%"=="6" goto failure
set /a a=11,a/=2
echo.
if not "%a%"=="5" goto failure
set /a a=42,a%%=9
echo.
if not "%a%"=="6" goto failure
set /a a=7,a+=9
echo.
if not "%a%"=="16" goto failure
set /a a=9,a-=7
echo.
if not "%a%"=="2" goto failure
set /a a=42,a^&=9
echo.
if not "%a%"=="8" goto failure
set /a a=32,a^^=9
echo.
if not "%a%"=="41" goto failure
set /a a=10,a^|=22
echo.
if not "%a%"=="30" goto failure
set /a a=9,a^<^<=2
echo.
if not "%a%"=="36" goto failure
set /a a=36,a^>^>=2
echo.
if not "%a%"=="9" goto failure
set /a a=1,2
echo.
if not "%a%"=="1" goto failure
set /a a=(a=1,a+2)
echo.
if "%a%"=="3" goto success
goto failure
:success
echo SUCCESS!
echo.
goto done
:failure
echo FAILURE! remove the echo off and see the last formula that executed before this line
echo.
:done