Use crtdll instead of ntdll.

svn path=/trunk/; revision=453
This commit is contained in:
Eric Kohl 1999-05-11 16:08:21 +00:00
parent acd3d263c1
commit 5edb029d51
6 changed files with 37 additions and 43 deletions

View file

@ -47,7 +47,7 @@ INT cmd_beep (LPTSTR cmd, LPTSTR param)
return 1; return 1;
#endif #endif
#ifdef __REACTOS__ #ifdef __REACTOS__
Beep (440, 50); Beep (440, 50);
#else #else
MessageBeep (-1); MessageBeep (-1);
#endif #endif

View file

@ -221,9 +221,9 @@ Execute (LPTSTR first, LPTSTR rest)
#ifndef __REACTOS__ #ifndef __REACTOS__
if (CreateProcess (NULL, szFullCmdLine, NULL, NULL, FALSE, if (CreateProcess (NULL, szFullCmdLine, NULL, NULL, FALSE,
0, NULL, NULL, &stui, &prci)) 0, NULL, NULL, &stui, &prci))
#else #else
if (CreateProcess (szFullName, rest, NULL, NULL, FALSE, if (CreateProcess (szFullName, rest, NULL, NULL, FALSE,
0, NULL, NULL, &stui, &prci)) 0, NULL, NULL, &stui, &prci))
#endif #endif
{ {
@ -552,7 +552,7 @@ VOID ParseCommandLine (LPTSTR s)
CloseHandle (hErr); CloseHandle (hErr);
hOldConErr = INVALID_HANDLE_VALUE; hOldConErr = INVALID_HANDLE_VALUE;
} }
#endif #endif /* FEATURE_REDIRECTION */
/* process final command */ /* process final command */
DoCommand (s); DoCommand (s);
@ -615,7 +615,6 @@ VOID ParseCommandLine (LPTSTR s)
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf (_T("hFile[0] and hIn dont match!!!\n")); DebugPrintf (_T("hFile[0] and hIn dont match!!!\n"));
#endif #endif
} }
} }
} }
@ -706,7 +705,7 @@ ProcessInput (BOOL bFlag)
break; break;
case _T('?'): case _T('?'):
cp += _stprintf (cp, _T("%u"), nErrorLevel); cp += _stprintf (cp, _T("%u"), nErrorLevel);
ip++; ip++;
break; break;
@ -824,7 +823,7 @@ ShowCommands (VOID)
#ifdef FEATURE_REDIRECTION #ifdef FEATURE_REDIRECTION
ConOutPuts (" [redirections and piping]"); ConOutPuts (" [redirections and piping]");
#endif #endif
ConOutChar ('\n'); ConOutChar ('\n');
} }
@ -854,10 +853,10 @@ static VOID Initialize (int argc, char *argv[])
#endif #endif
/* get version information */ /* get version information */
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx (&osvi); GetVersionEx (&osvi);
InitLocale (); InitLocale ();
/* get default input and output console handles */ /* get default input and output console handles */
hOut = GetStdHandle (STD_OUTPUT_HANDLE); hOut = GetStdHandle (STD_OUTPUT_HANDLE);
@ -867,7 +866,7 @@ static VOID Initialize (int argc, char *argv[])
InitLastPath (); InitLastPath ();
#endif #endif
if (argc >= 2) if (argc >= 2)
{ {
if (!_tcsncmp (argv[1], _T("/?"), 2)) if (!_tcsncmp (argv[1], _T("/?"), 2))
{ {
@ -941,8 +940,8 @@ static VOID Initialize (int argc, char *argv[])
/* Set COMSPEC environment variable */ /* Set COMSPEC environment variable */
#ifndef __REACTOS__ #ifndef __REACTOS__
if (argv) if (argv)
SetEnvironmentVariable (_T("COMSPEC"), argv[0]); SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
#endif #endif
/* add ctrl handler */ /* add ctrl handler */
@ -966,7 +965,7 @@ static VOID Cleanup (VOID)
/* remove ctrl handler */ /* remove ctrl handler */
#if 0 #if 0
SetConsoleCtrlHandler ((PHANDLER_ROUTINE)&BreakHandler, FALSE); SetConsoleCtrlHandler ((PHANDLER_ROUTINE)&BreakHandler, FALSE);
#endif #endif
} }
@ -980,23 +979,22 @@ int main (int argc, char *argv[])
AllocConsole (); AllocConsole ();
#ifndef __REACTOS__ #ifndef __REACTOS__
SetFileApisToOEM (); SetFileApisToOEM ();
#endif #endif
#ifdef __REACTOS__ #ifdef __REACTOS__
SetCurrentDirectory (_T("C:\\")); SetCurrentDirectory (_T("C:\\"));
#endif #endif
/* check switches on command-line */ /* check switches on command-line */
Initialize (argc, argv); Initialize (argc, argv);
/* call prompt routine */ /* call prompt routine */
nExitCode = ProcessInput (FALSE); nExitCode = ProcessInput (FALSE);
/* do the cleanup */ /* do the cleanup */
Cleanup (); Cleanup ();
FreeConsole (); FreeConsole ();
return nExitCode; return nExitCode;
// return 0;
} }

View file

@ -52,7 +52,7 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
return; return;
va_start (arg_ptr, szFormat); va_start (arg_ptr, szFormat);
_vstprintf (szMessage, szFormat, arg_ptr); _vstprintf (szMessage, szFormat, arg_ptr);
va_end (arg_ptr); va_end (arg_ptr);
#ifndef __REACTOS__ #ifndef __REACTOS__
@ -83,6 +83,10 @@ VOID ErrorMessage (DWORD dwErrorCode, LPTSTR szFormat, ...)
szError = _T("Path not found --"); szError = _T("Path not found --");
break; break;
case ERROR_BAD_PATHNAME: /* a1 */
szError = _T("Invalid path");
break;
default: default:
ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode); ConErrPrintf (_T("Unknown error! Error code: 0x%lx\n"), dwErrorCode);
return; return;

View file

@ -223,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
continue; continue;
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
_stprintf (fname, _T("[%s]"), file.cFileName); _stprintf (fname, _T("[%s]"), file.cFileName);
else else
_tcscpy (fname, file.cFileName); _tcscpy (fname, file.cFileName);

View file

@ -2,20 +2,16 @@
# ReactOS makefile for CMD # ReactOS makefile for CMD
# #
# target: raw binary (does not work right now)
#all: cmd.bin
# target: executable (not tested/experimental)
all: cmd.exe all: cmd.exe
OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \ OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \ chcp.o cls.o cmdinput.o cmdtable.o color.o console.o copy.o date.o \
del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \ del.o dir.o dirstack.o echo.o error.o filecomp.o for.o goto.o \
history.o if.o internal.o label.o locale.o misc.o move.o path.o \ history.o if.o internal.o label.o locale.o misc.o move.o path.o \
pause.o prompt.o redir.o ren.o ros.o set.o shift.o time.o title.o type.o \ pause.o prompt.o redir.o ren.o set.o shift.o time.o title.o type.o \
ver.o verify.o vol.o where.o ver.o verify.o vol.o where.o
LIBS= ../../lib/kernel32/kernel32.a ../../lib/ntdll/ntdll.a LIBS= ../../lib/kernel32/kernel32.a ../../lib/crtdll/crtdll.a
CLEAN_FILES = *.o cmd.exe cmd.sym CLEAN_FILES = *.o cmd.exe cmd.sym
@ -26,10 +22,6 @@ $(CLEAN_FILES:%=%_clean): %_clean:
.phony: clean $(CLEAN_FILES:%=%_clean) .phony: clean $(CLEAN_FILES:%=%_clean)
cmd.bin: $(OBJECTS)
$(LD) -Ttext 0x10000 $(OBJECTS) $(LIBS) -o cmd.exe
$(OBJCOPY) -O binary cmd.exe cmd.bin
cmd.exe: $(OBJECTS) $(LIBS) cmd.exe: $(OBJECTS) $(LIBS)
$(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o cmd.exe $(CC) -specs=../../specs $(OBJECTS) $(LIBS) -lgcc -o cmd.exe
$(NM) --numeric-sort cmd.exe > cmd.sym $(NM) --numeric-sort cmd.exe > cmd.sym

View file

@ -65,17 +65,17 @@ static VOID PrintDate (VOID)
{ {
case 0: /* mmddyy */ case 0: /* mmddyy */
default: default:
ConOutPrintf (_T("%s %02d%c%02d%c%04d"), ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear); aszDayNames[st.wDayOfWeek], st.wMonth, cDateSeparator, st.wDay, cDateSeparator, st.wYear);
break; break;
case 1: /* ddmmyy */ case 1: /* ddmmyy */
ConOutPrintf (_T("%s %02d%c%02d%c%04d"), ConOutPrintf (_T("%s %02d%c%02d%c%04d"),
aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear); aszDayNames[st.wDayOfWeek], st.wDay, cDateSeparator, st.wMonth, cDateSeparator, st.wYear);
break; break;
case 2: /* yymmdd */ case 2: /* yymmdd */
ConOutPrintf (_T("%s %04d%c%02d%c%02d"), ConOutPrintf (_T("%s %04d%c%02d%c%02d"),
aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay); aszDayNames[st.wDayOfWeek], st.wYear, cDateSeparator, st.wMonth, cDateSeparator, st.wDay);
break; break;
} }
@ -84,7 +84,7 @@ static VOID PrintDate (VOID)
GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL, GetDateFormat (LOCALE_USER_DEFAULT, DATE_SHORTDATE, NULL, NULL,
szDate, sizeof (szDate)); szDate, sizeof (szDate));
ConOutPrintf (_T("%s"), szDate); ConOutPrintf (_T("%s"), szDate);
#endif #endif
} }
@ -101,24 +101,24 @@ PrintTime (VOID)
{ {
case 0: /* 12 hour format */ case 0: /* 12 hour format */
default: default:
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d%c"), ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d%c"),
(st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)), (st.wHour == 0 ? 12 : (st.wHour <= 12 ? st.wHour : st.wHour - 12)),
cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator, cTimeSeparator, st.wMinute, cTimeSeparator, st.wSecond, cDecimalSeparator,
st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p')); st.wMilliseconds / 10, (st.wHour <= 11 ? 'a' : 'p'));
break; break;
case 1: /* 24 hour format */ case 1: /* 24 hour format */
ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d"), ConOutPrintf (_T("%2d%c%02d%c%02d%c%02d"),
st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator, st.wHour, cTimeSeparator, st.wMinute, cTimeSeparator,
st.wSecond, cDecimalSeparator, st.wMilliseconds / 10); st.wSecond, cDecimalSeparator, st.wMilliseconds / 10);
break; break;
} }
#else #else
TCHAR szTime[32]; TCHAR szTime[32];
GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL, GetTimeFormat (LOCALE_USER_DEFAULT, 0, NULL, NULL,
szTime, sizeof (szTime)); szTime, sizeof (szTime));
ConOutPrintf (_T("%s"), szTime); ConOutPrintf (_T("%s"), szTime);
#endif #endif
} }
@ -163,7 +163,7 @@ VOID PrintPrompt(VOID)
break; break;
case _T('D'): case _T('D'):
PrintDate (); PrintDate ();
break; break;
case _T('E'): case _T('E'):
@ -207,7 +207,7 @@ VOID PrintPrompt(VOID)
break; break;
case _T('T'): case _T('T'):
PrintTime (); PrintTime ();
break; break;
case _T('V'): case _T('V'):