mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
several changes to make cmd compile and link again
svn path=/trunk/; revision=384
This commit is contained in:
parent
ebb6fcbc30
commit
731f19e9b1
20 changed files with 94 additions and 50 deletions
|
@ -112,6 +112,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cmd.h"
|
||||
#include "batch.h"
|
||||
|
@ -199,7 +200,7 @@ Execute (LPTSTR first, LPTSTR rest)
|
|||
TCHAR szFullCmdLine [1024];
|
||||
PROCESS_INFORMATION prci;
|
||||
STARTUPINFO stui;
|
||||
DWORD dwError = 0;
|
||||
// DWORD dwError = 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
|
||||
|
@ -697,7 +698,7 @@ ProcessInput (BOOL bFlag)
|
|||
break;
|
||||
|
||||
case _T('?'):
|
||||
cp += wsprintf (cp, _T("%u"), nErrorLevel);
|
||||
cp += _stprintf (cp, _T("%u"), nErrorLevel);
|
||||
ip++;
|
||||
break;
|
||||
|
||||
|
@ -815,7 +816,7 @@ ShowCommands (VOID)
|
|||
#ifdef FEATURE_REDIRECTION
|
||||
ConOutPuts (" [redirections and piping]");
|
||||
#endif
|
||||
ConOutChar ('\n');
|
||||
ConOutChar ('\n');
|
||||
}
|
||||
|
||||
|
||||
|
@ -931,8 +932,10 @@ static VOID Initialize (int argc, char *argv[])
|
|||
ShowCommands ();
|
||||
|
||||
/* Set COMSPEC environment variable */
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
#ifndef __REACTOS__
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
#endif
|
||||
|
||||
/* add ctrl handler */
|
||||
#if 0
|
||||
|
@ -969,18 +972,23 @@ int main (int argc, char *argv[])
|
|||
|
||||
AllocConsole ();
|
||||
#ifndef __REACTOS__
|
||||
SetFileApisToOEM ();
|
||||
SetFileApisToOEM ();
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
SetCurrentDirectory (_T("C:\\"));
|
||||
#endif
|
||||
|
||||
/* check switches on command-line */
|
||||
Initialize (argc, argv);
|
||||
|
||||
/* call prompt routine */
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
|
||||
/* do the cleanup */
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
|
||||
return nExitCode;
|
||||
return nExitCode;
|
||||
// return 0;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#define D_OFF "off"
|
||||
|
||||
|
||||
#define CHECKPOINT ConErrPrintf("%s:%d\n",__FILE__,__LINE__);
|
||||
|
||||
|
||||
/* Prototypes for CMD.C */
|
||||
extern HANDLE hOut;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
/* JPP 20 Jul 1998 - define DEBUG to add debugging code */
|
||||
/*#define DEBUG */
|
||||
#define DEBUG
|
||||
|
||||
|
||||
/* Define to enable the alias command, and aliases.*/
|
||||
|
|
|
@ -37,7 +37,8 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
|
|||
_vstprintf (szOut, szFormat, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
|
||||
OutputDebugString (szOut);
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
|
||||
// OutputDebugString (szOut);
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
@ -124,7 +125,8 @@ VOID ConOutPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
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;
|
||||
|
||||
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.bVisible = bVisible;
|
||||
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
// SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ AddFiles (LPFILES f, char *arg, int *source, int *dest,
|
|||
static BOOL
|
||||
GetDestination (LPFILES f, LPFILES dest)
|
||||
{
|
||||
LPFILES p;
|
||||
LPFILES p = NULL;
|
||||
LPFILES start = f;
|
||||
|
||||
while (f->next != NULL)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <tchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
|
@ -92,6 +93,7 @@ static BOOL ConfirmDeleteAll (VOID)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static INT Prompt (LPTSTR str)
|
||||
{
|
||||
TCHAR inp[10];
|
||||
|
@ -118,7 +120,7 @@ static INT Prompt (LPTSTR str)
|
|||
|
||||
return PROMPT_NO;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static BOOL
|
||||
RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
#include <tchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.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.cAlternateFileName[0] == _T('\0'))
|
||||
wsprintf (buffer, _T("[%s]"), file.cFileName);
|
||||
_stprintf (buffer, _T("[%s]"), file.cFileName);
|
||||
else
|
||||
wsprintf (buffer, _T("[%s]"), file.cAlternateFileName);
|
||||
_stprintf (buffer, _T("[%s]"), file.cAlternateFileName);
|
||||
dircount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file.cAlternateFileName[0] == _T('\0'))
|
||||
wsprintf (buffer, _T("%s"), file.cFileName);
|
||||
_stprintf (buffer, _T("%s"), file.cFileName);
|
||||
else
|
||||
wsprintf (buffer, _T("%s"), file.cAlternateFileName);
|
||||
_stprintf (buffer, _T("%s"), file.cAlternateFileName);
|
||||
filecount++;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
|
@ -222,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
|
|||
continue;
|
||||
|
||||
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
wsprintf (fname,"[%s]", file.cFileName);
|
||||
_stprintf (fname, _T("[%s]"), file.cFileName);
|
||||
else
|
||||
_tcscpy (fname, file.cFileName);
|
||||
|
||||
|
|
|
@ -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 \
|
||||
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)
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// force input the next time around.
|
||||
/* force input the next time around. */
|
||||
nTimeString == -1;
|
||||
}
|
||||
ConErrPuts (_T("Invalid time."));
|
||||
|
|
|
@ -112,6 +112,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cmd.h"
|
||||
#include "batch.h"
|
||||
|
@ -199,7 +200,7 @@ Execute (LPTSTR first, LPTSTR rest)
|
|||
TCHAR szFullCmdLine [1024];
|
||||
PROCESS_INFORMATION prci;
|
||||
STARTUPINFO stui;
|
||||
DWORD dwError = 0;
|
||||
// DWORD dwError = 0;
|
||||
|
||||
#ifdef _DEBUG
|
||||
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
|
||||
|
@ -697,7 +698,7 @@ ProcessInput (BOOL bFlag)
|
|||
break;
|
||||
|
||||
case _T('?'):
|
||||
cp += wsprintf (cp, _T("%u"), nErrorLevel);
|
||||
cp += _stprintf (cp, _T("%u"), nErrorLevel);
|
||||
ip++;
|
||||
break;
|
||||
|
||||
|
@ -815,7 +816,7 @@ ShowCommands (VOID)
|
|||
#ifdef FEATURE_REDIRECTION
|
||||
ConOutPuts (" [redirections and piping]");
|
||||
#endif
|
||||
ConOutChar ('\n');
|
||||
ConOutChar ('\n');
|
||||
}
|
||||
|
||||
|
||||
|
@ -931,8 +932,10 @@ static VOID Initialize (int argc, char *argv[])
|
|||
ShowCommands ();
|
||||
|
||||
/* Set COMSPEC environment variable */
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
#ifndef __REACTOS__
|
||||
if (argv)
|
||||
SetEnvironmentVariable (_T("COMSPEC"), argv[0]);
|
||||
#endif
|
||||
|
||||
/* add ctrl handler */
|
||||
#if 0
|
||||
|
@ -969,18 +972,23 @@ int main (int argc, char *argv[])
|
|||
|
||||
AllocConsole ();
|
||||
#ifndef __REACTOS__
|
||||
SetFileApisToOEM ();
|
||||
SetFileApisToOEM ();
|
||||
#endif
|
||||
|
||||
#ifdef __REACTOS__
|
||||
SetCurrentDirectory (_T("C:\\"));
|
||||
#endif
|
||||
|
||||
/* check switches on command-line */
|
||||
Initialize (argc, argv);
|
||||
|
||||
/* call prompt routine */
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
nExitCode = ProcessInput (FALSE);
|
||||
|
||||
/* do the cleanup */
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
Cleanup ();
|
||||
FreeConsole ();
|
||||
|
||||
return nExitCode;
|
||||
return nExitCode;
|
||||
// return 0;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,8 @@
|
|||
#define D_OFF "off"
|
||||
|
||||
|
||||
#define CHECKPOINT ConErrPrintf("%s:%d\n",__FILE__,__LINE__);
|
||||
|
||||
|
||||
/* Prototypes for CMD.C */
|
||||
extern HANDLE hOut;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
|
||||
/* JPP 20 Jul 1998 - define DEBUG to add debugging code */
|
||||
/*#define DEBUG */
|
||||
#define DEBUG
|
||||
|
||||
|
||||
/* Define to enable the alias command, and aliases.*/
|
||||
|
|
|
@ -37,7 +37,8 @@ VOID DebugPrintf (LPTSTR szFormat, ...)
|
|||
_vstprintf (szOut, szFormat, arg_ptr);
|
||||
va_end (arg_ptr);
|
||||
|
||||
OutputDebugString (szOut);
|
||||
WriteFile (GetStdHandle (STD_OUTPUT_HANDLE), szOut, _tcslen(szOut), &dwWritten, NULL);
|
||||
// OutputDebugString (szOut);
|
||||
}
|
||||
#endif /* _DEBUG */
|
||||
|
||||
|
@ -124,7 +125,8 @@ VOID ConOutPuts (LPTSTR szText)
|
|||
DWORD dwWritten;
|
||||
|
||||
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;
|
||||
|
||||
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.bVisible = bVisible;
|
||||
|
||||
SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
// SetConsoleCursorInfo (GetStdHandle (STD_OUTPUT_HANDLE), &cci);
|
||||
}
|
||||
|
|
|
@ -205,7 +205,7 @@ AddFiles (LPFILES f, char *arg, int *source, int *dest,
|
|||
static BOOL
|
||||
GetDestination (LPFILES f, LPFILES dest)
|
||||
{
|
||||
LPFILES p;
|
||||
LPFILES p = NULL;
|
||||
LPFILES start = f;
|
||||
|
||||
while (f->next != NULL)
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <tchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
|
@ -92,6 +93,7 @@ static BOOL ConfirmDeleteAll (VOID)
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
static INT Prompt (LPTSTR str)
|
||||
{
|
||||
TCHAR inp[10];
|
||||
|
@ -118,7 +120,7 @@ static INT Prompt (LPTSTR str)
|
|||
|
||||
return PROMPT_NO;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static BOOL
|
||||
RemoveFile (LPTSTR lpFileName, DWORD dwFlags)
|
||||
|
|
|
@ -118,6 +118,7 @@
|
|||
#include <tchar.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.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.cAlternateFileName[0] == _T('\0'))
|
||||
wsprintf (buffer, _T("[%s]"), file.cFileName);
|
||||
_stprintf (buffer, _T("[%s]"), file.cFileName);
|
||||
else
|
||||
wsprintf (buffer, _T("[%s]"), file.cAlternateFileName);
|
||||
_stprintf (buffer, _T("[%s]"), file.cAlternateFileName);
|
||||
dircount++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (file.cAlternateFileName[0] == _T('\0'))
|
||||
wsprintf (buffer, _T("%s"), file.cFileName);
|
||||
_stprintf (buffer, _T("%s"), file.cFileName);
|
||||
else
|
||||
wsprintf (buffer, _T("%s"), file.cAlternateFileName);
|
||||
_stprintf (buffer, _T("%s"), file.cAlternateFileName);
|
||||
filecount++;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <ctype.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "cmd.h"
|
||||
|
||||
|
@ -222,7 +223,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount)
|
|||
continue;
|
||||
|
||||
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
wsprintf (fname,"[%s]", file.cFileName);
|
||||
_stprintf (fname, _T("[%s]"), file.cFileName);
|
||||
else
|
||||
_tcscpy (fname, file.cFileName);
|
||||
|
||||
|
|
|
@ -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 \
|
||||
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)
|
||||
|
||||
|
|
|
@ -237,7 +237,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
|
|||
return 0;
|
||||
}
|
||||
|
||||
// force input the next time around.
|
||||
/* force input the next time around. */
|
||||
nTimeString == -1;
|
||||
}
|
||||
ConErrPuts (_T("Invalid time."));
|
||||
|
|
Loading…
Reference in a new issue