- Fixed some type problems if cmd is compiled as unicode.

svn path=/trunk/; revision=5456
This commit is contained in:
Hartmut Birr 2003-08-07 09:27:42 +00:00
parent 5d1c88be8a
commit 84c6569f84
29 changed files with 184 additions and 185 deletions

View file

@ -1,4 +1,4 @@
/* $Id: batch.c,v 1.1 2003/03/20 19:19:22 rcampbell Exp $
/* $Id: batch.c,v 1.2 2003/08/07 09:27:42 hbirr Exp $
*
* BATCH.C - batch file processor for CMD.EXE.
*
@ -93,7 +93,7 @@ LPTSTR FindArg (INT n)
LPTSTR pp;
#ifdef _DEBUG
DebugPrintf ("FindArg: (%d)\n", n);
DebugPrintf (_T("FindArg: (%d)\n"), n);
#endif
if (bc == NULL)
@ -180,7 +180,7 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
VOID ExitBatch (LPTSTR msg)
{
#ifdef _DEBUG
DebugPrintf ("ExitBatch: (\'%s\')\n", msg);
DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
#endif
if (bc != NULL)
@ -210,7 +210,7 @@ VOID ExitBatch (LPTSTR msg)
}
if (msg && *msg)
ConOutPrintf ("%s\n", msg);
ConOutPrintf (_T("%s\n"), msg);
}
@ -230,7 +230,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
#ifdef _DEBUG
DebugPrintf ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n",
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
fullname, firstword, param, hFile);
#endif
@ -276,7 +276,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
bc->params = BatchParams (firstword, param);
#ifdef _DEBUG
DebugPrintf ("Batch: returns TRUE\n");
DebugPrintf (_T("Batch: returns TRUE\n"));
#endif
return TRUE;
@ -305,7 +305,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
return NULL;
#ifdef _DEBUG
DebugPrintf ("ReadBatchLine ()\n");
DebugPrintf (_T("ReadBatchLine ()\n"));
#endif
while (1)

View file

@ -1,4 +1,4 @@
/* $Id: call.c,v 1.1 2003/03/20 19:19:22 rcampbell Exp $
/* $Id: call.c,v 1.2 2003/08/07 09:27:42 hbirr Exp $
*
* CALL.C - call internal batch command.
*
@ -52,7 +52,7 @@ INT cmd_call (LPTSTR cmd, LPTSTR param)
LPBATCH_CONTEXT n = NULL;
#ifdef _DEBUG
DebugPrintf ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{

View file

@ -41,14 +41,14 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
if (args == 0)
{
/* display active code page number */
ConOutPrintf ("Active code page: %u\n", GetConsoleCP ());
ConOutPrintf (_T("Active code page: %u\n"), GetConsoleCP ());
return 0;
}
if (args >= 2)
{
/* too many parameters */
ConErrPrintf ("Invalid parameter format - %s\n", param);
ConErrPrintf (_T("Invalid parameter format - %s\n"), param);
return 1;
}
@ -62,14 +62,14 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
if (uNewCodePage == 0)
{
ConErrPrintf ("Parameter format incorrect - %s\n", arg[0]);
ConErrPrintf (_T("Parameter format incorrect - %s\n"), arg[0]);
freep (arg);
return 1;
}
if (!SetConsoleCP (uNewCodePage))
{
ConErrPrintf ("Invalid code page\n");
ConErrPrintf (_T("Invalid code page\n"));
}
else
{

View file

@ -106,7 +106,7 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
INT
CommandChoice (LPTSTR cmd, LPTSTR param)
{
LPTSTR lpOptions = "YN";
LPTSTR lpOptions = _T("YN");
LPTSTR lpText = NULL;
BOOL bNoPrompt = FALSE;
BOOL bCaseSensitive = FALSE;

View file

@ -1,4 +1,4 @@
/* $Id: cmd.h,v 1.2 2003/06/01 17:06:22 hbirr Exp $
/* $Id: cmd.h,v 1.3 2003/08/07 09:27:42 hbirr Exp $
*
* CMD.H - header file for the modules in CMD.EXE
*
@ -49,20 +49,20 @@
#define BREAK_IGNORE 4
/* define some error messages */
#define NOENVERR "ERROR: no environment"
#define INVALIDDRIVE "ERROR: invalid drive"
#define INVALIDFUNCTION "ERROR: invalid function"
#define ACCESSDENIED "ERROR: access denied"
#define BADENVIROMENT "ERROR: bad enviroment"
#define BADFORMAT "ERROR: bad format"
#define ERROR_E2BIG "ERROR: Argument list too long"
#define ERROR_EINVAL "ERROR: Invalid argument"
#define NOENVERR _T("ERROR: no environment")
#define INVALIDDRIVE _T("ERROR: invalid drive")
#define INVALIDFUNCTION _T("ERROR: invalid function")
#define ACCESSDENIED _T("ERROR: access denied")
#define BADENVIROMENT _T("ERROR: bad enviroment")
#define BADFORMAT _T("ERROR: bad format")
#define ERROR_E2BIG _T("ERROR: Argument list too long")
#define ERROR_EINVAL _T("ERROR: Invalid argument")
#define SHELLINFO "ReactOS Command Line Interpreter"
#define D_ON "on"
#define D_OFF "off"
#define D_ON _T("on")
#define D_OFF _T("off")
/* command line buffer length */
@ -409,8 +409,8 @@ INT CommandWindow (LPTSTR, LPTSTR);
/* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
int cmd_if(char *, char *);
int cmd_pause(char *, char *);
int cmd_shift(char *, char *);
int cmd_if(TCHAR *, TCHAR *);
int cmd_pause(TCHAR *, TCHAR *);
int cmd_shift(TCHAR *, TCHAR *);
#endif /* _CMD_H_INCLUDED_ */

View file

@ -221,7 +221,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
str[current - 1] = _T('\0');
if (GetCursorX () != 0)
{
ConOutPrintf ("\b \b");
ConOutPrintf (_T("\b \b"));
}
else
{

View file

@ -1,4 +1,4 @@
/* $Id: color.c,v 1.2 2003/06/01 17:06:22 hbirr Exp $
/* $Id: color.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $
*
* COLOR.C - color internal command.
*
@ -107,11 +107,11 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
if (StringToColor (&wColor, &rest) == FALSE)
{
ConErrPuts("error in color specification");
ConErrPuts(_T("error in color specification"));
return 1;
}
ConErrPrintf ("Color %x\n", wColor);
ConErrPrintf (_T("Color %x\n"), wColor);
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
{
@ -121,7 +121,7 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
/* set color */
SetScreenColor (wColor,
(_tcsstr (rest,"/F") || _tcsstr (rest,"/f")));
(_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f"))));
return 0;
}

View file

@ -1,4 +1,4 @@
/* $Id: copy.c,v 1.2 2003/08/05 23:48:51 jimtabor Exp $
/* $Id: copy.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $
*
* COPY.C -- copy internal command.
*
@ -54,10 +54,10 @@ typedef struct tagFILES
static BOOL DoSwitches (LPTSTR, LPDWORD);
static BOOL AddFile (LPFILES, char *, int *, int *, LPDWORD);
static BOOL AddFiles (LPFILES, char *, int *, int *, int *, LPDWORD);
static BOOL AddFile (LPFILES, TCHAR *, int *, int *, LPDWORD);
static BOOL AddFiles (LPFILES, TCHAR *, int *, int *, int *, LPDWORD);
static BOOL GetDestination (LPFILES, LPFILES);
static INT ParseCommand (LPFILES, int, char **, LPDWORD);
static INT ParseCommand (LPFILES, int, TCHAR **, LPDWORD);
static VOID DeleteFileList (LPFILES);
static INT Overwrite (LPTSTR);
@ -83,7 +83,7 @@ DoSwitches (LPTSTR arg, LPDWORD lpdwFlags)
}
else if (_tcslen (arg) > 2)
{
error_too_many_parameters ("");
error_too_many_parameters (_T(""));
return FALSE;
}
@ -117,11 +117,11 @@ DoSwitches (LPTSTR arg, LPDWORD lpdwFlags)
static BOOL
AddFile (LPFILES f, char *arg, int *source, int *dest, LPDWORD flags)
AddFile (LPFILES f, TCHAR *arg, int *source, int *dest, LPDWORD flags)
{
if (*dest)
{
error_too_many_parameters ("");
error_too_many_parameters (_T(""));
return FALSE;
}
if (*source)
@ -149,16 +149,16 @@ AddFile (LPFILES f, char *arg, int *source, int *dest, LPDWORD flags)
static BOOL
AddFiles (LPFILES f, char *arg, int *source, int *dest,
AddFiles (LPFILES f, TCHAR *arg, int *source, int *dest,
int *count, LPDWORD flags)
{
char t[128];
TCHAR t[128];
int j;
int k;
if (*dest)
{
error_too_many_parameters ("");
error_too_many_parameters (_T(""));
return FALSE;
}
@ -237,13 +237,13 @@ GetDestination (LPFILES f, LPFILES dest)
static INT
ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
ParseCommand (LPFILES f, int argc, TCHAR **arg, LPDWORD lpdwFlags)
{
INT i;
INT dest;
INT source;
INT count;
char temp[128];
TCHAR temp[128];
dest = 0;
source = 0;
count = 0;
@ -264,10 +264,10 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
// Make sure we have a clean workable path
GetFullPathNameA( arg[i], 128, (LPSTR) &temp, NULL);
GetFullPathName( arg[i], 128, (LPTSTR) &temp, NULL);
// printf("A Input %s, Output %s\n", arg[i], temp);
if (!AddFile(f, (char *) &temp, &source, &dest, lpdwFlags))
if (!AddFile(f, (TCHAR *) &temp, &source, &dest, lpdwFlags))
return -1;
f = f->next;
count++;
@ -275,10 +275,10 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
else
{
GetFullPathNameA( arg[i], 128, (LPSTR) &temp, NULL);
GetFullPathName( arg[i], 128, (LPTSTR) &temp, NULL);
// printf("B Input %s, Output %s\n", arg[i], temp);
if (!AddFiles(f, (char *) &temp, &source, &dest, &count, lpdwFlags))
if (!AddFiles(f, (TCHAR *) &temp, &source, &dest, &count, lpdwFlags))
return -1;
while (f->next != NULL)
f = f->next;
@ -287,8 +287,8 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
}
#ifdef _DEBUG
DebugPrintf ("ParseCommand: flags has %s\n",
*lpdwFlags & ASCII ? "ASCII" : "BINARY");
DebugPrintf (_T("ParseCommand: flags has %s\n"),
*lpdwFlags & ASCII ? _T("ASCII") : _T("BINARY"));
#endif
return count;
}
@ -347,7 +347,7 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
BOOL bEof = FALSE;
#ifdef _DEBUG
DebugPrintf ("checking mode\n");
DebugPrintf (_T("checking mode\n"));
#endif
dwAttrib = GetFileAttributes (source);
@ -495,16 +495,16 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
static INT
SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
char *drive_d, char *dir_d, char *file_d,
char *ext_d, int *append, LPDWORD lpdwFlags)
SetupCopy (LPFILES sources, TCHAR **p, BOOL bMultiple,
TCHAR *drive_d, TCHAR *dir_d, TCHAR *file_d,
TCHAR *ext_d, int *append, LPDWORD lpdwFlags)
{
WIN32_FIND_DATAA find;
char drive_s[_MAX_DRIVE];
CHAR dir_s[_MAX_DIR];
char file_s[_MAX_FNAME];
char ext_s[_MAX_EXT];
char from_merge[_MAX_PATH];
WIN32_FIND_DATA find;
TCHAR drive_s[_MAX_DRIVE];
TCHAR dir_s[_MAX_DIR];
TCHAR file_s[_MAX_FNAME];
TCHAR ext_s[_MAX_EXT];
TCHAR from_merge[_MAX_PATH];
LPTSTR real_source;
LPTSTR real_dest;
@ -513,14 +513,14 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
BOOL bAll = FALSE;
BOOL bDone;
HANDLE hFind;
char temp[128];
TCHAR temp[128];
#ifdef _DEBUG
DebugPrintf (_T("SetupCopy\n"));
#endif
real_source = (LPTSTR)malloc (MAX_PATH);
real_dest = (LPTSTR)malloc (MAX_PATH);
real_source = (LPTSTR)malloc (MAX_PATH * sizeof(TCHAR));
real_dest = (LPTSTR)malloc (MAX_PATH * sizeof(TCHAR));
if (!real_source || !real_dest)
{
@ -537,11 +537,11 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
/* Force a clean full path
*/
GetFullPathNameA( sources->szFile, 128, (LPSTR) &temp, NULL);
GetFullPathName( sources->szFile, 128, (LPTSTR) &temp, NULL);
_splitpath (sources->szFile, drive_s, dir_s, file_s, ext_s);
_tsplitpath (sources->szFile, drive_s, dir_s, file_s, ext_s);
hFind = FindFirstFile ((char*)&temp, &find);
hFind = FindFirstFile ((TCHAR*)&temp, &find);
if (hFind == INVALID_HANDLE_VALUE)
{
error_file_not_found();
@ -556,7 +556,7 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
goto next;
_makepath(from_merge, drive_d, dir_d, file_d, ext_d);
_tmakepath(from_merge, drive_d, dir_d, file_d, ext_d);
if (from_merge[_tcslen(from_merge) - 1] == _T('\\'))
from_merge[_tcslen(from_merge) - 1] = 0;
@ -576,13 +576,13 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
bMultiple = TRUE;
_tcscpy (real_dest, from_merge);
_makepath (real_source, drive_s, dir_s, find.cFileName, NULL);
_tmakepath (real_source, drive_s, dir_s, find.cFileName, NULL);
#ifdef _DEBUG
printf (_T("copying %s -> %s (%sappending%s)\n"),
DebugPrintf(_T("copying %S -> %S (%Sappending%S)\n"),
real_source, real_dest,
*append ? "" : "not ",
sources->dwFlag & ASCII ? ", ASCII" : ", BINARY");
*append ? _T("") : _T("not "),
sources->dwFlag & ASCII ? _T(", ASCII") : _T(", BINARY"));
#endif
if (IsValidFileName (real_dest) && !bAll)
@ -628,11 +628,11 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
INT cmd_copy (LPTSTR first, LPTSTR rest)
{
char **p;
char drive_d[_MAX_DRIVE];
char dir_d[_MAX_DIR];
char file_d[_MAX_FNAME];
char ext_d[_MAX_EXT];
TCHAR **p;
TCHAR drive_d[_MAX_DRIVE];
TCHAR dir_d[_MAX_DIR];
TCHAR file_d[_MAX_FNAME];
TCHAR ext_d[_MAX_EXT];
int argc;
int append;
@ -704,7 +704,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
bDestFound = GetDestination (sources, &dest);
if (bDestFound)
{
_splitpath (dest.szFile, drive_d, dir_d, file_d, ext_d);
_tsplitpath (dest.szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (dest.szFile))
{
// printf("A szFile= %s, Dir = %s, File = %s, Ext = %s\n", dest.szFile, dir_d, file_d, ext_d);
@ -720,7 +720,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
else
bWildcards = FALSE;
if (strchr(rest, '+'))
if (_tcschr(rest, _T('+')))
bMultiple = TRUE;
else
bMultiple = FALSE;
@ -744,7 +744,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
}
else if (!bDestFound && !bMultiple)
{
_splitpath (sources->szFile, drive_d, dir_d, file_d, ext_d);
_tsplitpath (sources->szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (sources->szFile))
{
// printf("B File = %s, Ext = %s\n", file_d, ext_d);
@ -754,11 +754,11 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
file_d[0] = _T('\0');
ext_d[0] = _T('\0');
}
copied = SetupCopy (sources, p, FALSE, "", "", file_d, ext_d, &append, &dwFlags);
copied = SetupCopy (sources, p, FALSE, _T(""), _T(""), file_d, ext_d, &append, &dwFlags);
}
else
{
_splitpath(sources->szFile, drive_d, dir_d, file_d, ext_d);
_tsplitpath(sources->szFile, drive_d, dir_d, file_d, ext_d);
if (IsDirectory (sources->szFile))
{
// printf("C File = %s, Ext = %s\n", file_d, ext_d);
@ -775,7 +775,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
}
DeleteFileList (sources);
freep (p);
freep ((VOID*)p);
ConOutPrintf (_T(" %d file(s) copied\n"), copied);
return 1;

View file

@ -231,16 +231,16 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
PrintDateString ();
ConInString (s, 40);
#ifdef _DEBUG
DebugPrintf ("\'%s\'\n", s);
DebugPrintf (_T("\'%s\'\n"), s);
#endif
while (*s && s[_tcslen (s) - 1] < ' ')
s[_tcslen (s) - 1] = '\0';
while (*s && s[_tcslen (s) - 1] < _T(' '))
s[_tcslen (s) - 1] = _T('\0');
if (ParseDate (s))
{
freep (arg);
return 0;
}
ConErrPuts ("Invalid date.");
ConErrPuts (_T("Invalid date."));
}
}
else
@ -250,7 +250,7 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
freep (arg);
return 0;
}
ConErrPuts ("Invalid date.");
ConErrPuts (_T("Invalid date."));
}
freep (arg);

View file

@ -13,8 +13,8 @@
#ifdef INCLUDE_CMD_DELAY
#include <tchar.h>
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include "cmd.h"
@ -43,13 +43,13 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param)
return 1;
}
if (_tcsnicmp(param,"/m",2) == 0)
if (_tcsnicmp(param,_T("/m"),2) == 0)
{
mul = 1;
param += 2;
}
val = atoi(param);
val = _ttoi(param);
Sleep(val*mul);
return 0;

View file

@ -1,4 +1,4 @@
/* $Id: dir.c,v 1.2 2003/05/09 21:58:05 ekohl Exp $
/* $Id: dir.c,v 1.3 2003/08/07 09:27:42 hbirr Exp $
*
* DIR.C - dir internal command.
*
@ -703,12 +703,11 @@ GetUserDiskFreeSpace(LPCTSTR lpRoot,
hInstance = LoadLibrary(_T("KERNEL32"));
if (hInstance != NULL)
{
#ifndef UNICODE
pGetFreeDiskSpaceEx = GetProcAddress(hInstance,
"GetDiskFreeSpaceExA");
pGetFreeDiskSpaceEx = (PGETFREEDISKSPACEEX)GetProcAddress(hInstance,
#ifdef _UNICODE
_T("GetDiskFreeSpaceExW"));
#else
pGetFreeDiskSpaceEx = GetProcAddress(hInstance,
"GetDiskFreeSpaceExW");
_T("GetDiskFreeSpaceExA"));
#endif
if (pGetFreeDiskSpaceEx != NULL)
{
@ -990,7 +989,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
/* print file size */
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
ConOutPrintf ("%-14s", "<DIR>");
ConOutPrintf (_T("%-14s"), _T("<DIR>"));
dircount++;
}
else
@ -1013,7 +1012,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
}
/* print long filename */
ConOutPrintf (" %s\n", file.cFileName);
ConOutPrintf (_T(" %s\n"), file.cFileName);
}
if (IncLine (pLine, dwFlags))
@ -1093,10 +1092,10 @@ DirRead (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
if ((dwFlags & DIR_BARE) == 0)
{
ConOutPrintf ("\n");
ConOutPrintf (_T("\n"));
if (IncLine (pLine, dwFlags) != 0)
return 1;
ConOutPrintf ("\n");
ConOutPrintf (_T("\n"));
if (IncLine (pLine, dwFlags) != 0)
return 1;
}
@ -1191,7 +1190,7 @@ INT CommandDir (LPTSTR first, LPTSTR rest)
/* default to current directory */
if (!param)
param = ".";
param = _T(".");
/* parse the directory info */
if (DirParsePathspec (param, szPath, szFilespec))

View file

@ -1,4 +1,4 @@
/* $Id: echo.c,v 1.1 2003/03/20 19:19:22 rcampbell Exp $
/* $Id: echo.c,v 1.2 2003/08/07 09:27:42 hbirr Exp $
*
* ECHO.C - internal echo commands.
*
@ -37,7 +37,7 @@
INT CommandEcho (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("CommandEcho '%s' : '%s'\n", cmd, param);
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
@ -77,19 +77,19 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
INT CommandEchos (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("CommandEchos '%s' : '%s'\n", cmd, param);
DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
"\n"
" ECHOS message");
ConOutPuts (_T("Display a messages without trailing carridge return and line feed.\n"
"\n"
" ECHOS message"));
return 0;
}
if (*param)
ConOutPrintf ("%s", param);
ConOutPrintf (_T("%s"), param);
return 0;
}
@ -98,15 +98,15 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("CommandEchoerr '%s' : '%s'\n", cmd, param);
DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts ("Displays a message to the standard error.\n"
"\n"
" ECHOERR message\n"
" ECHOERR. prints an empty line");
ConOutPuts (_T("Displays a message to the standard error.\n"
"\n"
" ECHOERR message\n"
" ECHOERR. prints an empty line"));
return 0;
}
@ -128,14 +128,14 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("CommandEchoserr '%s' : '%s'\n", cmd, param);
DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))
{
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
"\n"
" ECHOSERR message");
ConOutPuts (_T("Prints a messages to standard error output without trailing carridge return and line feed.\n"
"\n"
" ECHOSERR message"));
return 0;
}

View file

@ -60,7 +60,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
TCHAR var;
#ifdef _DEBUG
DebugPrintf ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))

View file

@ -62,8 +62,8 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
static VOID
PrintDiskInfo (LPTSTR szDisk)
{
TCHAR szRootPath[4] = "A:\\";
TCHAR szDrive[2] = "A";
TCHAR szRootPath[4] = _T("A:\\");
TCHAR szDrive[2] = _T("A");
TCHAR szVolume[64];
TCHAR szSerial[10];
TCHAR szTotal[40];

View file

@ -47,7 +47,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
LONG lNewPosHigh;
#ifdef _DEBUG
DebugPrintf ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))

View file

@ -217,9 +217,9 @@ VOID del(LPHIST_ENTRY item)
if( item==NULL || item==Top || item==Bottom )
{
#ifdef _DEBUG
DebugPrintf("del in " __FILE__ ": retrning\n"
"item is 0x%08x (Bottom is0x%08x)\n",
item, Bottom);
DebugPrintf(_T("del in " __FILE__ ": retrning\n"
"item is 0x%08x (Bottom is0x%08x)\n"),
item, Bottom);
#endif
return;
@ -267,7 +267,7 @@ VOID add_before_last(LPTSTR string)
/*allocte entry and string*/
tmp=malloc(sizeof(HIST_ENTRY));
tmp->string=malloc(_tcslen(string)+1);
tmp->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
_tcscpy(tmp->string,string);
@ -320,7 +320,7 @@ VOID add_at_bottom(LPTSTR string)
/*fill bottom with string, it will become Bottom->next*/
Bottom->string=malloc(_tcslen(string)+1);
Bottom->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
_tcscpy(Bottom->string,string);
/*save Bottom value*/

View file

@ -46,7 +46,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
LPTSTR pp;
#ifdef _DEBUG
DebugPrintf ("cmd_if: (\'%s\', \'%s\'\n", cmd, param);
DebugPrintf (_T("cmd_if: (\'%S\', \'%S\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))

View file

@ -187,7 +187,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
dir=param;
endofstring=dir+_tcslen(dir);
while ((lastquote = _tcsrchr(dir,'\"')))
while ((lastquote = _tcsrchr(dir, _T('\"'))))
{
endofstring--;
memmove(lastquote,lastquote+1,endofstring-lastquote);

View file

@ -61,7 +61,7 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
ConErrPrintf ("CMD: Not in environment \"PATH\"\n");
ConErrPrintf (_T("CMD: Not in environment \"PATH\"\n"));
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)

View file

@ -42,7 +42,7 @@
INT cmd_pause (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("cmd_pause: \'%s\' : \'%s\'\n", cmd, param);
DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))

View file

@ -13,8 +13,8 @@
#ifdef INCLUDE_CMD_SCREEN
#include <tchar.h>
#include <windows.h>
#include <tchar.h>
#include <stdlib.h>
#include <ctype.h>
@ -48,10 +48,10 @@ INT CommandScreen (LPTSTR cmd, LPTSTR param)
return 1;
}
y = atoi(param);
y = _ttoi(param);
if (y<0 || y>(maxy-1))
{
ConOutPrintf("invalid value for row");
ConOutPrintf(_T("invalid value for row"));
return 1;
}
@ -71,7 +71,7 @@ INT CommandScreen (LPTSTR cmd, LPTSTR param)
return 1;
}
x = atoi(param);
x = _ttoi(param);
if (x<0 || x>(maxx-1))
{
ConErrPuts(_T("invalid value for col"));

View file

@ -107,16 +107,16 @@ INT cmd_set (LPTSTR cmd, LPTSTR param)
dwBuffer = GetEnvironmentVariable (param, pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
ConErrPrintf ("CMD: Not in environment \"%s\"\n", param);
ConErrPrintf (_T("CMD: Not in environment \"%s\"\n"), param);
return 0;
}
else if (dwBuffer > ENV_BUFFER_SIZE)
{
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (param, pszBuffer, dwBuffer * sizeof (TCHAR));
GetEnvironmentVariable (param, pszBuffer, dwBuffer);
}
ConOutPrintf (_T("%s\n"), pszBuffer);
ConOutPrintf ("%s\n", pszBuffer);
free (pszBuffer);
return 0;

View file

@ -42,7 +42,7 @@
INT cmd_shift (LPTSTR cmd, LPTSTR param)
{
#ifdef _DEBUG
DebugPrintf ("cmd_shift: (\'%s\', \'%s\'\n", cmd, param);
DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
#endif
if (!_tcsncmp (param, _T("/?"), 2))

View file

@ -53,11 +53,11 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
if( !*rest )
{
// FIXME: use comspec instead
rest = "cmd";
rest = _T("cmd");
}
/* get the PATH environment variable and parse it */
/* search the PATH environment variable for the binary */
param = strchr( rest, ' ' ); // skip program name to reach parameters
param = _tcschr( rest, _T(' ') ); // skip program name to reach parameters
if( param )
{
*param = 0;
@ -73,7 +73,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
{
#ifdef _DEBUG
DebugPrintf ("[BATCH: %s %s]\n", szFullName, rest);
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
#endif
ConErrPuts (_T("No batch support at the moment!"));
}
@ -85,13 +85,13 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
STARTUPINFO stui;
#ifdef _DEBUG
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
#endif
/* build command line for CreateProcess() */
_tcscpy (szFullCmdLine, first);
if( param )
{
_tcscat(szFullCmdLine, " " );
_tcscat(szFullCmdLine, _T(" ") );
_tcscat (szFullCmdLine, param);
}
@ -117,7 +117,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
else
{
ErrorMessage (GetLastError (),
"Error executing CreateProcess()!!\n");
_T("Error executing CreateProcess()!!\n"));
}
}

View file

@ -47,46 +47,46 @@ typedef struct _CLRTABLE
CLRTABLE clrtable[] =
{
{"bla" ,0 },
{"blu" ,_B },
{"gre" ,_G },
{"cya" ,_B|_G },
{"red" ,_R },
{"mag" ,_B|_R },
{"yel" ,_R|_G },
{"whi" ,_R|_G|_B },
{"gra" ,_I },
{_T("bla") ,0 },
{_T("blu") ,_B },
{_T("gre") ,_G },
{_T("cya") ,_B|_G },
{_T("red") ,_R },
{_T("mag") ,_B|_R },
{_T("yel") ,_R|_G },
{_T("whi") ,_R|_G|_B },
{_T("gra") ,_I },
{"0" ,0 },
{"2" ,_G },
{"3" ,_B|_G },
{"4" ,_R },
{"5" ,_B|_R },
{"6" ,_R|_G },
{"7" ,_R|_G|_B },
{_T("0") ,0 },
{_T("2") ,_G },
{_T("3") ,_B|_G },
{_T("4") ,_R },
{_T("5") ,_B|_R },
{_T("6") ,_R|_G },
{_T("7") ,_R|_G|_B },
{"8" ,_I },
{"9" ,_I|_B },
{"10" ,_I|_G },
{"11" ,_I|_B|_G },
{"12" ,_I|_R },
{"13" ,_I|_B|_R },
{"14" ,_I|_R|_G },
{"15" ,_I|_R|_G|_B},
{_T("8") ,_I },
{_T("9") ,_I|_B },
{_T("10") ,_I|_G },
{_T("11") ,_I|_B|_G },
{_T("12") ,_I|_R },
{_T("13") ,_I|_B|_R },
{_T("14") ,_I|_R|_G },
{_T("15") ,_I|_R|_G|_B },
/* note that 1 is at the end of list
to avoid to confuse it with 10-15*/
{"1" ,_B },
{_T("1") ,_B },
/*cyan synonimous*/
{"aqu" ,_B|_G },
{_T("aqu") ,_B|_G },
/*magenta synonimous*/
{"pur" ,_B|_R },
{_T("pur") ,_B|_R },
{"" ,0},
{_T("") ,0},
};
@ -208,7 +208,7 @@ WORD str_to_color(LPTSTR* arg_str)
/*foreground*/
bBri = FALSE;
if(_tcsnicmp(str,"bri",3) == 0 )
if(_tcsnicmp(str,_T("bri"),3) == 0 )
{
bBri = TRUE;
@ -230,7 +230,7 @@ WORD str_to_color(LPTSTR* arg_str)
/*background*/
bBri = FALSE;
if(_tcsnicmp(str,"bri",3) == 0 )
if(_tcsnicmp(str,_T("bri"),3) == 0 )
{
bBri = TRUE;

View file

@ -187,7 +187,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
ConInString (s, 40);
#ifdef _DEBUG
DebugPrintf ("\'%s\'\n", s);
DebugPrintf (_T("\'%s\'\n"), s);
#endif
while (*s && s[_tcslen (s) - 1] < _T(' '))

View file

@ -25,7 +25,7 @@
//print timer status
#define PS ConOutPrintf("Timer %d is %s: ",clk_n,cS?"ON":"OFF"); \
#define PS ConOutPrintf(_T("Timer %d is %s: "),clk_n,cS?_T("ON"):_T("OFF")); \
PrintTime()
//print timer value
@ -46,13 +46,13 @@ PrintElapsedTime (DWORD time,INT format)
DWORD h,m,s,ms;
#ifdef _DEBUG
DebugPrintf("PrintTime(%d,%d)",time,format);
DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
#endif
switch (format)
{
case 0:
ConOutPrintf("Elapsed %d msecs\n",time);
ConOutPrintf(_T("Elapsed %d msecs\n"),time);
break;
case 1:
@ -62,7 +62,7 @@ PrintElapsedTime (DWORD time,INT format)
time /=60;
m = time % 60;
h = time / 60;
ConOutPrintf("Elapsed %02d%c%02d%c%02d%c%02d\n",
ConOutPrintf(_T("Elapsed %02d%c%02d%c%02d%c%02d\n"),
h,cTimeSeparator,
m,cTimeSeparator,
s,cDecimalSeparator,ms/10);
@ -138,14 +138,14 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
for (i = 0; i < argc; i++)
{
//set timer on
if (!(_tcsicmp(&p[i][0],"on")) && NewClkStatus == NCS_NOT_SPECIFIED)
if (!(_tcsicmp(&p[i][0],_T("on"))) && NewClkStatus == NCS_NOT_SPECIFIED)
{
NewClkStatus = NCS_ON;
continue;
}
//set timer off
if (!(_tcsicmp(&p[i][0],"off")) && NewClkStatus == NCS_NOT_SPECIFIED)
if (!(_tcsicmp(&p[i][0],_T("off"))) && NewClkStatus == NCS_NOT_SPECIFIED)
{
NewClkStatus = NCS_OFF;
continue;

View file

@ -66,7 +66,7 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
{
if (_T('/') == argv[i][0])
{
ConErrPrintf("Invalid option \"%s\"\n", argv[i] + 1);
ConErrPrintf(_T("Invalid option \"%S\"\n"), argv[i] + 1);
continue;
}
hFile = CreateFile(argv[i],
@ -86,7 +86,7 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
(LPTSTR) &errmsg,
0,
NULL);
ConErrPrintf ("%s - %s", argv[i], errmsg);
ConErrPrintf (_T("%s - %s"), argv[i], errmsg);
LocalFree (errmsg);
continue;
}

View file

@ -82,7 +82,7 @@
#define ENV_BUFFER_SIZE 1024
static LPTSTR ext[] = {".bat", ".cmd", ".com", ".exe"};
static LPTSTR ext[] = {_T(".bat"), _T(".cmd"), _T(".com"), _T(".exe")};
static INT nExtCount = sizeof(ext) / sizeof(LPTSTR);