several changes to make cmd compile and link again

svn path=/trunk/; revision=384
This commit is contained in:
Eric Kohl 1999-04-14 23:48:27 +00:00
parent ebb6fcbc30
commit 731f19e9b1
20 changed files with 94 additions and 50 deletions

View file

@ -112,6 +112,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include "cmd.h" #include "cmd.h"
#include "batch.h" #include "batch.h"
@ -199,7 +200,7 @@ Execute (LPTSTR first, LPTSTR rest)
TCHAR szFullCmdLine [1024]; TCHAR szFullCmdLine [1024];
PROCESS_INFORMATION prci; PROCESS_INFORMATION prci;
STARTUPINFO stui; STARTUPINFO stui;
DWORD dwError = 0; // DWORD dwError = 0;
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest); DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
@ -697,7 +698,7 @@ ProcessInput (BOOL bFlag)
break; break;
case _T('?'): case _T('?'):
cp += wsprintf (cp, _T("%u"), nErrorLevel); cp += _stprintf (cp, _T("%u"), nErrorLevel);
ip++; ip++;
break; break;
@ -931,8 +932,10 @@ static VOID Initialize (int argc, char *argv[])
ShowCommands (); ShowCommands ();
/* Set COMSPEC environment variable */ /* Set COMSPEC environment variable */
#ifndef __REACTOS__
if (argv) if (argv)
SetEnvironmentVariable (_T("COMSPEC"), argv[0]); SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
#endif
/* add ctrl handler */ /* add ctrl handler */
#if 0 #if 0
@ -972,6 +975,10 @@ int main (int argc, char *argv[])
SetFileApisToOEM (); SetFileApisToOEM ();
#endif #endif
#ifdef __REACTOS__
SetCurrentDirectory (_T("C:\\"));
#endif
/* check switches on command-line */ /* check switches on command-line */
Initialize (argc, argv); Initialize (argc, argv);
@ -983,4 +990,5 @@ int main (int argc, char *argv[])
FreeConsole (); FreeConsole ();
return nExitCode; return nExitCode;
// return 0;
} }

View file

@ -65,6 +65,8 @@
#define D_OFF "off" #define D_OFF "off"
#define CHECKPOINT ConErrPrintf("%s:%d\n",__FILE__,__LINE__);
/* Prototypes for CMD.C */ /* Prototypes for CMD.C */
extern HANDLE hOut; extern HANDLE hOut;

View file

@ -20,7 +20,7 @@
/* JPP 20 Jul 1998 - define DEBUG to add debugging code */ /* JPP 20 Jul 1998 - define DEBUG to add debugging code */
/*#define DEBUG */ #define DEBUG
/* Define to enable the alias command, and aliases.*/ /* Define to enable the alias command, and aliases.*/

View file

@ -37,7 +37,8 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
_vstprintf (szOut, szFormat, arg_ptr); _vstprintf (szOut, szFormat, arg_ptr);
va_end (arg_ptr); va_end (arg_ptr);
OutputDebugString (szOut); WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
// OutputDebugString (szOut);
} }
#endif /* _DEBUG */ #endif /* _DEBUG */
@ -124,7 +125,8 @@ VOID ConOutPuts (LPTSTR szText)
DWORD dwWritten; DWORD dwWritten;
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL); WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL); // WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
} }
@ -155,7 +157,8 @@ VOID ConErrPuts (LPTSTR szText)
DWORD dwWritten; DWORD dwWritten;
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL); WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL); // WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
} }
@ -236,5 +239,5 @@ VOID SetCursorType (BOOL bInsert, BOOL bVisible)
cci.dwSize = bInsert ? 10 : 100; cci.dwSize = bInsert ? 10 : 100;
cci.bVisible = bVisible; cci.bVisible = bVisible;
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci); // SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
} }

View file

@ -205,7 +205,7 @@ AddFiles (LPFILES f, char *arg, int *source, int *dest,
static BOOL static BOOL
GetDestination (LPFILES f, LPFILES dest) GetDestination (LPFILES f, LPFILES dest)
{ {
LPFILES p; LPFILES p = NULL;
LPFILES start = f; LPFILES start = f;
while (f->next != NULL) while (f->next != NULL)

View file

@ -36,6 +36,7 @@
#include <tchar.h> #include <tchar.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "cmd.h" #include "cmd.h"
@ -92,6 +93,7 @@ static BOOL ConfirmDeleteAll (VOID)
} }
#if 0
static INT Prompt (LPTSTR str) static INT Prompt (LPTSTR str)
{ {
TCHAR inp[10]; TCHAR inp[10];
@ -118,7 +120,7 @@ static INT Prompt (LPTSTR str)
return PROMPT_NO; return PROMPT_NO;
} }
#endif
static BOOL static BOOL
RemoveFile (LPTSTR lpFileName, DWORD dwFlags) RemoveFile (LPTSTR lpFileName, DWORD dwFlags)

View file

@ -118,6 +118,7 @@
#include <tchar.h> #include <tchar.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "cmd.h" #include "cmd.h"
@ -786,17 +787,17 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
if (file.cAlternateFileName[0] == _T('\0')) if (file.cAlternateFileName[0] == _T('\0'))
wsprintf (buffer, _T("[%s]"), file.cFileName); _stprintf (buffer, _T("[%s]"), file.cFileName);
else else
wsprintf (buffer, _T("[%s]"), file.cAlternateFileName); _stprintf (buffer, _T("[%s]"), file.cAlternateFileName);
dircount++; dircount++;
} }
else else
{ {
if (file.cAlternateFileName[0] == _T('\0')) if (file.cAlternateFileName[0] == _T('\0'))
wsprintf (buffer, _T("%s"), file.cFileName); _stprintf (buffer, _T("%s"), file.cFileName);
else else
wsprintf (buffer, _T("%s"), file.cAlternateFileName); _stprintf (buffer, _T("%s"), file.cAlternateFileName);
filecount++; filecount++;
} }

View file

@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include "cmd.h" #include "cmd.h"
@ -222,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
continue; continue;
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
wsprintf (fname,"[%s]", file.cFileName); _stprintf (fname, _T("[%s]"), file.cFileName);
else else
_tcscpy (fname, file.cFileName); _tcscpy (fname, file.cFileName);

View file

@ -15,9 +15,14 @@ OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
pause.o prompt.o redir.o ren.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 = $(OBJECTS) cmd.exe cmd.sym CLEAN_FILES = 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 \
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 \
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 cmd.exe cmd.sym
clean: $(CLEAN_FILES:%=%_clean) clean: $(CLEAN_FILES:%=%_clean)

View file

@ -237,7 +237,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
return 0; return 0;
} }
// force input the next time around. /* force input the next time around. */
nTimeString == -1; nTimeString == -1;
} }
ConErrPuts (_T("Invalid time.")); ConErrPuts (_T("Invalid time."));

View file

@ -112,6 +112,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include "cmd.h" #include "cmd.h"
#include "batch.h" #include "batch.h"
@ -199,7 +200,7 @@ Execute (LPTSTR first, LPTSTR rest)
TCHAR szFullCmdLine [1024]; TCHAR szFullCmdLine [1024];
PROCESS_INFORMATION prci; PROCESS_INFORMATION prci;
STARTUPINFO stui; STARTUPINFO stui;
DWORD dwError = 0; // DWORD dwError = 0;
#ifdef _DEBUG #ifdef _DEBUG
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest); DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
@ -697,7 +698,7 @@ ProcessInput (BOOL bFlag)
break; break;
case _T('?'): case _T('?'):
cp += wsprintf (cp, _T("%u"), nErrorLevel); cp += _stprintf (cp, _T("%u"), nErrorLevel);
ip++; ip++;
break; break;
@ -931,8 +932,10 @@ static VOID Initialize (int argc, char *argv[])
ShowCommands (); ShowCommands ();
/* Set COMSPEC environment variable */ /* Set COMSPEC environment variable */
#ifndef __REACTOS__
if (argv) if (argv)
SetEnvironmentVariable (_T("COMSPEC"), argv[0]); SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
#endif
/* add ctrl handler */ /* add ctrl handler */
#if 0 #if 0
@ -972,6 +975,10 @@ int main (int argc, char *argv[])
SetFileApisToOEM (); SetFileApisToOEM ();
#endif #endif
#ifdef __REACTOS__
SetCurrentDirectory (_T("C:\\"));
#endif
/* check switches on command-line */ /* check switches on command-line */
Initialize (argc, argv); Initialize (argc, argv);
@ -983,4 +990,5 @@ int main (int argc, char *argv[])
FreeConsole (); FreeConsole ();
return nExitCode; return nExitCode;
// return 0;
} }

View file

@ -65,6 +65,8 @@
#define D_OFF "off" #define D_OFF "off"
#define CHECKPOINT ConErrPrintf("%s:%d\n",__FILE__,__LINE__);
/* Prototypes for CMD.C */ /* Prototypes for CMD.C */
extern HANDLE hOut; extern HANDLE hOut;

View file

@ -20,7 +20,7 @@
/* JPP 20 Jul 1998 - define DEBUG to add debugging code */ /* JPP 20 Jul 1998 - define DEBUG to add debugging code */
/*#define DEBUG */ #define DEBUG
/* Define to enable the alias command, and aliases.*/ /* Define to enable the alias command, and aliases.*/

View file

@ -37,7 +37,8 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
_vstprintf (szOut, szFormat, arg_ptr); _vstprintf (szOut, szFormat, arg_ptr);
va_end (arg_ptr); va_end (arg_ptr);
OutputDebugString (szOut); WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
// OutputDebugString (szOut);
} }
#endif /* _DEBUG */ #endif /* _DEBUG */
@ -124,7 +125,8 @@ VOID ConOutPuts (LPTSTR szText)
DWORD dwWritten; DWORD dwWritten;
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL); WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL); // WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), "\n", 1, &dwWritten, NULL);
} }
@ -155,7 +157,8 @@ VOID ConErrPuts (LPTSTR szText)
DWORD dwWritten; DWORD dwWritten;
WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL); WriteFile (GetStdHandle (STD_ERROR_HANDLE), szText, _tcslen(szText), &dwWritten, NULL);
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL); // WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\x0a\x0d", 2, &dwWritten, NULL);
WriteFile (GetStdHandle (STD_ERROR_HANDLE), "\n", 1, &dwWritten, NULL);
} }
@ -236,5 +239,5 @@ VOID SetCursorType (BOOL bInsert, BOOL bVisible)
cci.dwSize = bInsert ? 10 : 100; cci.dwSize = bInsert ? 10 : 100;
cci.bVisible = bVisible; cci.bVisible = bVisible;
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci); // SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
} }

View file

@ -205,7 +205,7 @@ AddFiles (LPFILES f, char *arg, int *source, int *dest,
static BOOL static BOOL
GetDestination (LPFILES f, LPFILES dest) GetDestination (LPFILES f, LPFILES dest)
{ {
LPFILES p; LPFILES p = NULL;
LPFILES start = f; LPFILES start = f;
while (f->next != NULL) while (f->next != NULL)

View file

@ -36,6 +36,7 @@
#include <tchar.h> #include <tchar.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h>
#include "cmd.h" #include "cmd.h"
@ -92,6 +93,7 @@ static BOOL ConfirmDeleteAll (VOID)
} }
#if 0
static INT Prompt (LPTSTR str) static INT Prompt (LPTSTR str)
{ {
TCHAR inp[10]; TCHAR inp[10];
@ -118,7 +120,7 @@ static INT Prompt (LPTSTR str)
return PROMPT_NO; return PROMPT_NO;
} }
#endif
static BOOL static BOOL
RemoveFile (LPTSTR lpFileName, DWORD dwFlags) RemoveFile (LPTSTR lpFileName, DWORD dwFlags)

View file

@ -118,6 +118,7 @@
#include <tchar.h> #include <tchar.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include "cmd.h" #include "cmd.h"
@ -786,17 +787,17 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{ {
if (file.cAlternateFileName[0] == _T('\0')) if (file.cAlternateFileName[0] == _T('\0'))
wsprintf (buffer, _T("[%s]"), file.cFileName); _stprintf (buffer, _T("[%s]"), file.cFileName);
else else
wsprintf (buffer, _T("[%s]"), file.cAlternateFileName); _stprintf (buffer, _T("[%s]"), file.cAlternateFileName);
dircount++; dircount++;
} }
else else
{ {
if (file.cAlternateFileName[0] == _T('\0')) if (file.cAlternateFileName[0] == _T('\0'))
wsprintf (buffer, _T("%s"), file.cFileName); _stprintf (buffer, _T("%s"), file.cFileName);
else else
wsprintf (buffer, _T("%s"), file.cAlternateFileName); _stprintf (buffer, _T("%s"), file.cAlternateFileName);
filecount++; filecount++;
} }

View file

@ -20,6 +20,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include <stdio.h>
#include "cmd.h" #include "cmd.h"
@ -222,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
continue; continue;
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
wsprintf (fname,"[%s]", file.cFileName); _stprintf (fname, _T("[%s]"), file.cFileName);
else else
_tcscpy (fname, file.cFileName); _tcscpy (fname, file.cFileName);

View file

@ -15,9 +15,14 @@ OBJECTS = ../common/crt0.o cmd.o attrib.o alias.o batch.o beep.o call.o \
pause.o prompt.o redir.o ren.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 = $(OBJECTS) cmd.exe cmd.sym CLEAN_FILES = 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 \
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 \
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 cmd.exe cmd.sym
clean: $(CLEAN_FILES:%=%_clean) clean: $(CLEAN_FILES:%=%_clean)

View file

@ -237,7 +237,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
return 0; return 0;
} }
// force input the next time around. /* force input the next time around. */
nTimeString == -1; nTimeString == -1;
} }
ConErrPuts (_T("Invalid time.")); ConErrPuts (_T("Invalid time."));