mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 15:46:13 +00:00
- Fixed some type problems if cmd is compiled as unicode.
svn path=/trunk/; revision=5456
This commit is contained in:
parent
5d1c88be8a
commit
84c6569f84
29 changed files with 184 additions and 185 deletions
|
@ -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.
|
* BATCH.C - batch file processor for CMD.EXE.
|
||||||
*
|
*
|
||||||
|
@ -93,7 +93,7 @@ LPTSTR FindArg (INT n)
|
||||||
LPTSTR pp;
|
LPTSTR pp;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("FindArg: (%d)\n", n);
|
DebugPrintf (_T("FindArg: (%d)\n"), n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bc == NULL)
|
if (bc == NULL)
|
||||||
|
@ -180,7 +180,7 @@ LPTSTR BatchParams (LPTSTR s1, LPTSTR s2)
|
||||||
VOID ExitBatch (LPTSTR msg)
|
VOID ExitBatch (LPTSTR msg)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("ExitBatch: (\'%s\')\n", msg);
|
DebugPrintf (_T("ExitBatch: (\'%s\')\n"), msg);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bc != NULL)
|
if (bc != NULL)
|
||||||
|
@ -210,7 +210,7 @@ VOID ExitBatch (LPTSTR msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg && *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);
|
FILE_FLAG_SEQUENTIAL_SCAN, NULL);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n",
|
DebugPrintf (_T("Batch: (\'%s\', \'%s\', \'%s\') hFile = %x\n"),
|
||||||
fullname, firstword, param, hFile);
|
fullname, firstword, param, hFile);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ BOOL Batch (LPTSTR fullname, LPTSTR firstword, LPTSTR param)
|
||||||
bc->params = BatchParams (firstword, param);
|
bc->params = BatchParams (firstword, param);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("Batch: returns TRUE\n");
|
DebugPrintf (_T("Batch: returns TRUE\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -305,7 +305,7 @@ LPTSTR ReadBatchLine (LPBOOL bLocalEcho)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("ReadBatchLine ()\n");
|
DebugPrintf (_T("ReadBatchLine ()\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
|
|
|
@ -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.
|
* CALL.C - call internal batch command.
|
||||||
*
|
*
|
||||||
|
@ -52,7 +52,7 @@ INT cmd_call (LPTSTR cmd, LPTSTR param)
|
||||||
LPBATCH_CONTEXT n = NULL;
|
LPBATCH_CONTEXT n = NULL;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_call: (\'%s\',\'%s\')\n", cmd, param);
|
DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,14 +41,14 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
||||||
if (args == 0)
|
if (args == 0)
|
||||||
{
|
{
|
||||||
/* display active code page number */
|
/* display active code page number */
|
||||||
ConOutPrintf ("Active code page: %u\n", GetConsoleCP ());
|
ConOutPrintf (_T("Active code page: %u\n"), GetConsoleCP ());
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args >= 2)
|
if (args >= 2)
|
||||||
{
|
{
|
||||||
/* too many parameters */
|
/* too many parameters */
|
||||||
ConErrPrintf ("Invalid parameter format - %s\n", param);
|
ConErrPrintf (_T("Invalid parameter format - %s\n"), param);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,14 +62,14 @@ INT CommandChcp (LPTSTR cmd, LPTSTR param)
|
||||||
|
|
||||||
if (uNewCodePage == 0)
|
if (uNewCodePage == 0)
|
||||||
{
|
{
|
||||||
ConErrPrintf ("Parameter format incorrect - %s\n", arg[0]);
|
ConErrPrintf (_T("Parameter format incorrect - %s\n"), arg[0]);
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!SetConsoleCP (uNewCodePage))
|
if (!SetConsoleCP (uNewCodePage))
|
||||||
{
|
{
|
||||||
ConErrPrintf ("Invalid code page\n");
|
ConErrPrintf (_T("Invalid code page\n"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -106,7 +106,7 @@ IsKeyInString (LPTSTR lpString, TCHAR cKey, BOOL bCaseSensitive)
|
||||||
INT
|
INT
|
||||||
CommandChoice (LPTSTR cmd, LPTSTR param)
|
CommandChoice (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
LPTSTR lpOptions = "YN";
|
LPTSTR lpOptions = _T("YN");
|
||||||
LPTSTR lpText = NULL;
|
LPTSTR lpText = NULL;
|
||||||
BOOL bNoPrompt = FALSE;
|
BOOL bNoPrompt = FALSE;
|
||||||
BOOL bCaseSensitive = FALSE;
|
BOOL bCaseSensitive = FALSE;
|
||||||
|
|
|
@ -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
|
* CMD.H - header file for the modules in CMD.EXE
|
||||||
*
|
*
|
||||||
|
@ -49,20 +49,20 @@
|
||||||
#define BREAK_IGNORE 4
|
#define BREAK_IGNORE 4
|
||||||
|
|
||||||
/* define some error messages */
|
/* define some error messages */
|
||||||
#define NOENVERR "ERROR: no environment"
|
#define NOENVERR _T("ERROR: no environment")
|
||||||
#define INVALIDDRIVE "ERROR: invalid drive"
|
#define INVALIDDRIVE _T("ERROR: invalid drive")
|
||||||
#define INVALIDFUNCTION "ERROR: invalid function"
|
#define INVALIDFUNCTION _T("ERROR: invalid function")
|
||||||
#define ACCESSDENIED "ERROR: access denied"
|
#define ACCESSDENIED _T("ERROR: access denied")
|
||||||
#define BADENVIROMENT "ERROR: bad enviroment"
|
#define BADENVIROMENT _T("ERROR: bad enviroment")
|
||||||
#define BADFORMAT "ERROR: bad format"
|
#define BADFORMAT _T("ERROR: bad format")
|
||||||
#define ERROR_E2BIG "ERROR: Argument list too long"
|
#define ERROR_E2BIG _T("ERROR: Argument list too long")
|
||||||
#define ERROR_EINVAL "ERROR: Invalid argument"
|
#define ERROR_EINVAL _T("ERROR: Invalid argument")
|
||||||
|
|
||||||
#define SHELLINFO "ReactOS Command Line Interpreter"
|
#define SHELLINFO "ReactOS Command Line Interpreter"
|
||||||
|
|
||||||
|
|
||||||
#define D_ON "on"
|
#define D_ON _T("on")
|
||||||
#define D_OFF "off"
|
#define D_OFF _T("off")
|
||||||
|
|
||||||
|
|
||||||
/* command line buffer length */
|
/* 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] */
|
/* The MSDOS Batch Commands [MS-DOS 5.0 User's Guide and Reference p359] */
|
||||||
int cmd_if(char *, char *);
|
int cmd_if(TCHAR *, TCHAR *);
|
||||||
int cmd_pause(char *, char *);
|
int cmd_pause(TCHAR *, TCHAR *);
|
||||||
int cmd_shift(char *, char *);
|
int cmd_shift(TCHAR *, TCHAR *);
|
||||||
|
|
||||||
#endif /* _CMD_H_INCLUDED_ */
|
#endif /* _CMD_H_INCLUDED_ */
|
||||||
|
|
|
@ -221,7 +221,7 @@ VOID ReadCommand (LPTSTR str, INT maxlen)
|
||||||
str[current - 1] = _T('\0');
|
str[current - 1] = _T('\0');
|
||||||
if (GetCursorX () != 0)
|
if (GetCursorX () != 0)
|
||||||
{
|
{
|
||||||
ConOutPrintf ("\b \b");
|
ConOutPrintf (_T("\b \b"));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -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.
|
* COLOR.C - color internal command.
|
||||||
*
|
*
|
||||||
|
@ -107,11 +107,11 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
|
||||||
|
|
||||||
if (StringToColor (&wColor, &rest) == FALSE)
|
if (StringToColor (&wColor, &rest) == FALSE)
|
||||||
{
|
{
|
||||||
ConErrPuts("error in color specification");
|
ConErrPuts(_T("error in color specification"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConErrPrintf ("Color %x\n", wColor);
|
ConErrPrintf (_T("Color %x\n"), wColor);
|
||||||
|
|
||||||
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
|
if ((wColor & 0xF) == (wColor &0xF0) >> 4)
|
||||||
{
|
{
|
||||||
|
@ -121,7 +121,7 @@ INT CommandColor (LPTSTR first, LPTSTR rest)
|
||||||
|
|
||||||
/* set color */
|
/* set color */
|
||||||
SetScreenColor (wColor,
|
SetScreenColor (wColor,
|
||||||
(_tcsstr (rest,"/F") || _tcsstr (rest,"/f")));
|
(_tcsstr (rest,_T("/F")) || _tcsstr (rest,_T("/f"))));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
* COPY.C -- copy internal command.
|
||||||
*
|
*
|
||||||
|
@ -54,10 +54,10 @@ typedef struct tagFILES
|
||||||
|
|
||||||
|
|
||||||
static BOOL DoSwitches (LPTSTR, LPDWORD);
|
static BOOL DoSwitches (LPTSTR, LPDWORD);
|
||||||
static BOOL AddFile (LPFILES, char *, int *, int *, LPDWORD);
|
static BOOL AddFile (LPFILES, TCHAR *, int *, int *, LPDWORD);
|
||||||
static BOOL AddFiles (LPFILES, char *, int *, int *, int *, LPDWORD);
|
static BOOL AddFiles (LPFILES, TCHAR *, int *, int *, int *, LPDWORD);
|
||||||
static BOOL GetDestination (LPFILES, LPFILES);
|
static BOOL GetDestination (LPFILES, LPFILES);
|
||||||
static INT ParseCommand (LPFILES, int, char **, LPDWORD);
|
static INT ParseCommand (LPFILES, int, TCHAR **, LPDWORD);
|
||||||
static VOID DeleteFileList (LPFILES);
|
static VOID DeleteFileList (LPFILES);
|
||||||
static INT Overwrite (LPTSTR);
|
static INT Overwrite (LPTSTR);
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ DoSwitches (LPTSTR arg, LPDWORD lpdwFlags)
|
||||||
}
|
}
|
||||||
else if (_tcslen (arg) > 2)
|
else if (_tcslen (arg) > 2)
|
||||||
{
|
{
|
||||||
error_too_many_parameters ("");
|
error_too_many_parameters (_T(""));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,11 +117,11 @@ DoSwitches (LPTSTR arg, LPDWORD lpdwFlags)
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
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)
|
if (*dest)
|
||||||
{
|
{
|
||||||
error_too_many_parameters ("");
|
error_too_many_parameters (_T(""));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (*source)
|
if (*source)
|
||||||
|
@ -149,16 +149,16 @@ AddFile (LPFILES f, char *arg, int *source, int *dest, LPDWORD flags)
|
||||||
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
AddFiles (LPFILES f, char *arg, int *source, int *dest,
|
AddFiles (LPFILES f, TCHAR *arg, int *source, int *dest,
|
||||||
int *count, LPDWORD flags)
|
int *count, LPDWORD flags)
|
||||||
{
|
{
|
||||||
char t[128];
|
TCHAR t[128];
|
||||||
int j;
|
int j;
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
if (*dest)
|
if (*dest)
|
||||||
{
|
{
|
||||||
error_too_many_parameters ("");
|
error_too_many_parameters (_T(""));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,13 +237,13 @@ GetDestination (LPFILES f, LPFILES dest)
|
||||||
|
|
||||||
|
|
||||||
static INT
|
static INT
|
||||||
ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
|
ParseCommand (LPFILES f, int argc, TCHAR **arg, LPDWORD lpdwFlags)
|
||||||
{
|
{
|
||||||
INT i;
|
INT i;
|
||||||
INT dest;
|
INT dest;
|
||||||
INT source;
|
INT source;
|
||||||
INT count;
|
INT count;
|
||||||
char temp[128];
|
TCHAR temp[128];
|
||||||
dest = 0;
|
dest = 0;
|
||||||
source = 0;
|
source = 0;
|
||||||
count = 0;
|
count = 0;
|
||||||
|
@ -264,10 +264,10 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
|
||||||
|
|
||||||
// Make sure we have a clean workable path
|
// 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);
|
// 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;
|
return -1;
|
||||||
f = f->next;
|
f = f->next;
|
||||||
count++;
|
count++;
|
||||||
|
@ -275,10 +275,10 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
|
||||||
else
|
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);
|
// 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;
|
return -1;
|
||||||
while (f->next != NULL)
|
while (f->next != NULL)
|
||||||
f = f->next;
|
f = f->next;
|
||||||
|
@ -287,8 +287,8 @@ ParseCommand (LPFILES f, int argc, char **arg, LPDWORD lpdwFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("ParseCommand: flags has %s\n",
|
DebugPrintf (_T("ParseCommand: flags has %s\n"),
|
||||||
*lpdwFlags & ASCII ? "ASCII" : "BINARY");
|
*lpdwFlags & ASCII ? _T("ASCII") : _T("BINARY"));
|
||||||
#endif
|
#endif
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
|
||||||
BOOL bEof = FALSE;
|
BOOL bEof = FALSE;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("checking mode\n");
|
DebugPrintf (_T("checking mode\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dwAttrib = GetFileAttributes (source);
|
dwAttrib = GetFileAttributes (source);
|
||||||
|
@ -495,16 +495,16 @@ int copy (LPTSTR source, LPTSTR dest, int append, LPDWORD lpdwFlags)
|
||||||
|
|
||||||
|
|
||||||
static INT
|
static INT
|
||||||
SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
SetupCopy (LPFILES sources, TCHAR **p, BOOL bMultiple,
|
||||||
char *drive_d, char *dir_d, char *file_d,
|
TCHAR *drive_d, TCHAR *dir_d, TCHAR *file_d,
|
||||||
char *ext_d, int *append, LPDWORD lpdwFlags)
|
TCHAR *ext_d, int *append, LPDWORD lpdwFlags)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATAA find;
|
WIN32_FIND_DATA find;
|
||||||
char drive_s[_MAX_DRIVE];
|
TCHAR drive_s[_MAX_DRIVE];
|
||||||
CHAR dir_s[_MAX_DIR];
|
TCHAR dir_s[_MAX_DIR];
|
||||||
char file_s[_MAX_FNAME];
|
TCHAR file_s[_MAX_FNAME];
|
||||||
char ext_s[_MAX_EXT];
|
TCHAR ext_s[_MAX_EXT];
|
||||||
char from_merge[_MAX_PATH];
|
TCHAR from_merge[_MAX_PATH];
|
||||||
|
|
||||||
LPTSTR real_source;
|
LPTSTR real_source;
|
||||||
LPTSTR real_dest;
|
LPTSTR real_dest;
|
||||||
|
@ -513,14 +513,14 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
||||||
BOOL bAll = FALSE;
|
BOOL bAll = FALSE;
|
||||||
BOOL bDone;
|
BOOL bDone;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
char temp[128];
|
TCHAR temp[128];
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf (_T("SetupCopy\n"));
|
DebugPrintf (_T("SetupCopy\n"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
real_source = (LPTSTR)malloc (MAX_PATH);
|
real_source = (LPTSTR)malloc (MAX_PATH * sizeof(TCHAR));
|
||||||
real_dest = (LPTSTR)malloc (MAX_PATH);
|
real_dest = (LPTSTR)malloc (MAX_PATH * sizeof(TCHAR));
|
||||||
|
|
||||||
if (!real_source || !real_dest)
|
if (!real_source || !real_dest)
|
||||||
{
|
{
|
||||||
|
@ -537,11 +537,11 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
||||||
|
|
||||||
/* Force a clean full path
|
/* 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)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
error_file_not_found();
|
error_file_not_found();
|
||||||
|
@ -556,7 +556,7 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
||||||
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (find.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
goto next;
|
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('\\'))
|
if (from_merge[_tcslen(from_merge) - 1] == _T('\\'))
|
||||||
from_merge[_tcslen(from_merge) - 1] = 0;
|
from_merge[_tcslen(from_merge) - 1] = 0;
|
||||||
|
@ -576,13 +576,13 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
||||||
bMultiple = TRUE;
|
bMultiple = TRUE;
|
||||||
|
|
||||||
_tcscpy (real_dest, from_merge);
|
_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
|
#ifdef _DEBUG
|
||||||
printf (_T("copying %s -> %s (%sappending%s)\n"),
|
DebugPrintf(_T("copying %S -> %S (%Sappending%S)\n"),
|
||||||
real_source, real_dest,
|
real_source, real_dest,
|
||||||
*append ? "" : "not ",
|
*append ? _T("") : _T("not "),
|
||||||
sources->dwFlag & ASCII ? ", ASCII" : ", BINARY");
|
sources->dwFlag & ASCII ? _T(", ASCII") : _T(", BINARY"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (IsValidFileName (real_dest) && !bAll)
|
if (IsValidFileName (real_dest) && !bAll)
|
||||||
|
@ -628,11 +628,11 @@ SetupCopy (LPFILES sources, char **p, BOOL bMultiple,
|
||||||
|
|
||||||
INT cmd_copy (LPTSTR first, LPTSTR rest)
|
INT cmd_copy (LPTSTR first, LPTSTR rest)
|
||||||
{
|
{
|
||||||
char **p;
|
TCHAR **p;
|
||||||
char drive_d[_MAX_DRIVE];
|
TCHAR drive_d[_MAX_DRIVE];
|
||||||
char dir_d[_MAX_DIR];
|
TCHAR dir_d[_MAX_DIR];
|
||||||
char file_d[_MAX_FNAME];
|
TCHAR file_d[_MAX_FNAME];
|
||||||
char ext_d[_MAX_EXT];
|
TCHAR ext_d[_MAX_EXT];
|
||||||
|
|
||||||
int argc;
|
int argc;
|
||||||
int append;
|
int append;
|
||||||
|
@ -704,7 +704,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
|
||||||
bDestFound = GetDestination (sources, &dest);
|
bDestFound = GetDestination (sources, &dest);
|
||||||
if (bDestFound)
|
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))
|
if (IsDirectory (dest.szFile))
|
||||||
{
|
{
|
||||||
// printf("A szFile= %s, Dir = %s, File = %s, Ext = %s\n", dest.szFile, dir_d, file_d, ext_d);
|
// 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
|
else
|
||||||
bWildcards = FALSE;
|
bWildcards = FALSE;
|
||||||
|
|
||||||
if (strchr(rest, '+'))
|
if (_tcschr(rest, _T('+')))
|
||||||
bMultiple = TRUE;
|
bMultiple = TRUE;
|
||||||
else
|
else
|
||||||
bMultiple = FALSE;
|
bMultiple = FALSE;
|
||||||
|
@ -744,7 +744,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
|
||||||
}
|
}
|
||||||
else if (!bDestFound && !bMultiple)
|
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))
|
if (IsDirectory (sources->szFile))
|
||||||
{
|
{
|
||||||
// printf("B File = %s, Ext = %s\n", file_d, ext_d);
|
// 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');
|
file_d[0] = _T('\0');
|
||||||
ext_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
|
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))
|
if (IsDirectory (sources->szFile))
|
||||||
{
|
{
|
||||||
// printf("C File = %s, Ext = %s\n", file_d, ext_d);
|
// printf("C File = %s, Ext = %s\n", file_d, ext_d);
|
||||||
|
@ -775,7 +775,7 @@ INT cmd_copy (LPTSTR first, LPTSTR rest)
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteFileList (sources);
|
DeleteFileList (sources);
|
||||||
freep (p);
|
freep ((VOID*)p);
|
||||||
ConOutPrintf (_T(" %d file(s) copied\n"), copied);
|
ConOutPrintf (_T(" %d file(s) copied\n"), copied);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -231,16 +231,16 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
|
||||||
PrintDateString ();
|
PrintDateString ();
|
||||||
ConInString (s, 40);
|
ConInString (s, 40);
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("\'%s\'\n", s);
|
DebugPrintf (_T("\'%s\'\n"), s);
|
||||||
#endif
|
#endif
|
||||||
while (*s && s[_tcslen (s) - 1] < ' ')
|
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||||
s[_tcslen (s) - 1] = '\0';
|
s[_tcslen (s) - 1] = _T('\0');
|
||||||
if (ParseDate (s))
|
if (ParseDate (s))
|
||||||
{
|
{
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ConErrPuts ("Invalid date.");
|
ConErrPuts (_T("Invalid date."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -250,7 +250,7 @@ INT cmd_date (LPTSTR cmd, LPTSTR param)
|
||||||
freep (arg);
|
freep (arg);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
ConErrPuts ("Invalid date.");
|
ConErrPuts (_T("Invalid date."));
|
||||||
}
|
}
|
||||||
|
|
||||||
freep (arg);
|
freep (arg);
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_DELAY
|
#ifdef INCLUDE_CMD_DELAY
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
@ -43,13 +43,13 @@ INT CommandDelay (LPTSTR cmd, LPTSTR param)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_tcsnicmp(param,"/m",2) == 0)
|
if (_tcsnicmp(param,_T("/m"),2) == 0)
|
||||||
{
|
{
|
||||||
mul = 1;
|
mul = 1;
|
||||||
param += 2;
|
param += 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
val = atoi(param);
|
val = _ttoi(param);
|
||||||
Sleep(val*mul);
|
Sleep(val*mul);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -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.
|
* DIR.C - dir internal command.
|
||||||
*
|
*
|
||||||
|
@ -703,12 +703,11 @@ GetUserDiskFreeSpace(LPCTSTR lpRoot,
|
||||||
hInstance = LoadLibrary(_T("KERNEL32"));
|
hInstance = LoadLibrary(_T("KERNEL32"));
|
||||||
if (hInstance != NULL)
|
if (hInstance != NULL)
|
||||||
{
|
{
|
||||||
#ifndef UNICODE
|
pGetFreeDiskSpaceEx = (PGETFREEDISKSPACEEX)GetProcAddress(hInstance,
|
||||||
pGetFreeDiskSpaceEx = GetProcAddress(hInstance,
|
#ifdef _UNICODE
|
||||||
"GetDiskFreeSpaceExA");
|
_T("GetDiskFreeSpaceExW"));
|
||||||
#else
|
#else
|
||||||
pGetFreeDiskSpaceEx = GetProcAddress(hInstance,
|
_T("GetDiskFreeSpaceExA"));
|
||||||
"GetDiskFreeSpaceExW");
|
|
||||||
#endif
|
#endif
|
||||||
if (pGetFreeDiskSpaceEx != NULL)
|
if (pGetFreeDiskSpaceEx != NULL)
|
||||||
{
|
{
|
||||||
|
@ -990,7 +989,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
/* print file size */
|
/* print file size */
|
||||||
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
if (file.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||||
{
|
{
|
||||||
ConOutPrintf ("%-14s", "<DIR>");
|
ConOutPrintf (_T("%-14s"), _T("<DIR>"));
|
||||||
dircount++;
|
dircount++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1013,7 +1012,7 @@ DirList (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* print long filename */
|
/* print long filename */
|
||||||
ConOutPrintf (" %s\n", file.cFileName);
|
ConOutPrintf (_T(" %s\n"), file.cFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IncLine (pLine, dwFlags))
|
if (IncLine (pLine, dwFlags))
|
||||||
|
@ -1093,10 +1092,10 @@ DirRead (LPTSTR szPath, LPTSTR szFilespec, LPINT pLine, DWORD dwFlags)
|
||||||
|
|
||||||
if ((dwFlags & DIR_BARE) == 0)
|
if ((dwFlags & DIR_BARE) == 0)
|
||||||
{
|
{
|
||||||
ConOutPrintf ("\n");
|
ConOutPrintf (_T("\n"));
|
||||||
if (IncLine (pLine, dwFlags) != 0)
|
if (IncLine (pLine, dwFlags) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
ConOutPrintf ("\n");
|
ConOutPrintf (_T("\n"));
|
||||||
if (IncLine (pLine, dwFlags) != 0)
|
if (IncLine (pLine, dwFlags) != 0)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -1191,7 +1190,7 @@ INT CommandDir (LPTSTR first, LPTSTR rest)
|
||||||
|
|
||||||
/* default to current directory */
|
/* default to current directory */
|
||||||
if (!param)
|
if (!param)
|
||||||
param = ".";
|
param = _T(".");
|
||||||
|
|
||||||
/* parse the directory info */
|
/* parse the directory info */
|
||||||
if (DirParsePathspec (param, szPath, szFilespec))
|
if (DirParsePathspec (param, szPath, szFilespec))
|
||||||
|
|
|
@ -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.
|
* ECHO.C - internal echo commands.
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("CommandEcho '%s' : '%s'\n", cmd, param);
|
DebugPrintf (_T("CommandEcho '%s' : '%s'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
@ -77,19 +77,19 @@ INT CommandEcho (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("CommandEchos '%s' : '%s'\n", cmd, param);
|
DebugPrintf (_T("CommandEchos '%s' : '%s'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts ("Display a messages without trailing carridge return and line feed.\n"
|
ConOutPuts (_T("Display a messages without trailing carridge return and line feed.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" ECHOS message");
|
" ECHOS message"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*param)
|
if (*param)
|
||||||
ConOutPrintf ("%s", param);
|
ConOutPrintf (_T("%s"), param);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -98,15 +98,15 @@ INT CommandEchos (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("CommandEchoerr '%s' : '%s'\n", cmd, param);
|
DebugPrintf (_T("CommandEchoerr '%s' : '%s'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts ("Displays a message to the standard error.\n"
|
ConOutPuts (_T("Displays a message to the standard error.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" ECHOERR message\n"
|
" ECHOERR message\n"
|
||||||
" ECHOERR. prints an empty line");
|
" ECHOERR. prints an empty line"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,14 +128,14 @@ INT CommandEchoerr (LPTSTR cmd, LPTSTR param)
|
||||||
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
INT CommandEchoserr (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("CommandEchoserr '%s' : '%s'\n", cmd, param);
|
DebugPrintf (_T("CommandEchoserr '%s' : '%s'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
{
|
{
|
||||||
ConOutPuts ("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
ConOutPuts (_T("Prints a messages to standard error output without trailing carridge return and line feed.\n"
|
||||||
"\n"
|
"\n"
|
||||||
" ECHOSERR message");
|
" ECHOSERR message"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ INT cmd_for (LPTSTR cmd, LPTSTR param)
|
||||||
TCHAR var;
|
TCHAR var;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_for (\'%s\', \'%s\'\n", cmd, param);
|
DebugPrintf (_T("cmd_for (\'%s\', \'%s\'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
|
@ -62,8 +62,8 @@ ConvertULargeInteger (ULARGE_INTEGER num, LPTSTR des, INT len)
|
||||||
static VOID
|
static VOID
|
||||||
PrintDiskInfo (LPTSTR szDisk)
|
PrintDiskInfo (LPTSTR szDisk)
|
||||||
{
|
{
|
||||||
TCHAR szRootPath[4] = "A:\\";
|
TCHAR szRootPath[4] = _T("A:\\");
|
||||||
TCHAR szDrive[2] = "A";
|
TCHAR szDrive[2] = _T("A");
|
||||||
TCHAR szVolume[64];
|
TCHAR szVolume[64];
|
||||||
TCHAR szSerial[10];
|
TCHAR szSerial[10];
|
||||||
TCHAR szTotal[40];
|
TCHAR szTotal[40];
|
||||||
|
|
|
@ -47,7 +47,7 @@ INT cmd_goto (LPTSTR cmd, LPTSTR param)
|
||||||
LONG lNewPosHigh;
|
LONG lNewPosHigh;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_goto (\'%s\', \'%s\'\n", cmd, param);
|
DebugPrintf (_T("cmd_goto (\'%s\', \'%s\'\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
|
@ -217,9 +217,9 @@ VOID del(LPHIST_ENTRY item)
|
||||||
if( item==NULL || item==Top || item==Bottom )
|
if( item==NULL || item==Top || item==Bottom )
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf("del in " __FILE__ ": retrning\n"
|
DebugPrintf(_T("del in " __FILE__ ": retrning\n"
|
||||||
"item is 0x%08x (Bottom is0x%08x)\n",
|
"item is 0x%08x (Bottom is0x%08x)\n"),
|
||||||
item, Bottom);
|
item, Bottom);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
|
@ -267,7 +267,7 @@ VOID add_before_last(LPTSTR string)
|
||||||
|
|
||||||
/*allocte entry and string*/
|
/*allocte entry and string*/
|
||||||
tmp=malloc(sizeof(HIST_ENTRY));
|
tmp=malloc(sizeof(HIST_ENTRY));
|
||||||
tmp->string=malloc(_tcslen(string)+1);
|
tmp->string=malloc((_tcslen(string)+1)*sizeof(TCHAR));
|
||||||
_tcscpy(tmp->string,string);
|
_tcscpy(tmp->string,string);
|
||||||
|
|
||||||
|
|
||||||
|
@ -320,7 +320,7 @@ VOID add_at_bottom(LPTSTR string)
|
||||||
|
|
||||||
|
|
||||||
/*fill bottom with string, it will become Bottom->next*/
|
/*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);
|
_tcscpy(Bottom->string,string);
|
||||||
|
|
||||||
/*save Bottom value*/
|
/*save Bottom value*/
|
||||||
|
|
|
@ -46,7 +46,7 @@ INT cmd_if (LPTSTR cmd, LPTSTR param)
|
||||||
LPTSTR pp;
|
LPTSTR pp;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_if: (\'%s\', \'%s\'\n", cmd, param);
|
DebugPrintf (_T("cmd_if: (\'%S\', \'%S\')\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
|
@ -187,7 +187,7 @@ INT cmd_chdir (LPTSTR cmd, LPTSTR param)
|
||||||
dir=param;
|
dir=param;
|
||||||
endofstring=dir+_tcslen(dir);
|
endofstring=dir+_tcslen(dir);
|
||||||
|
|
||||||
while ((lastquote = _tcsrchr(dir,'\"')))
|
while ((lastquote = _tcsrchr(dir, _T('\"'))))
|
||||||
{
|
{
|
||||||
endofstring--;
|
endofstring--;
|
||||||
memmove(lastquote,lastquote+1,endofstring-lastquote);
|
memmove(lastquote,lastquote+1,endofstring-lastquote);
|
||||||
|
|
|
@ -61,7 +61,7 @@ INT cmd_path (LPTSTR cmd, LPTSTR param)
|
||||||
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
|
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
|
||||||
if (dwBuffer == 0)
|
if (dwBuffer == 0)
|
||||||
{
|
{
|
||||||
ConErrPrintf ("CMD: Not in environment \"PATH\"\n");
|
ConErrPrintf (_T("CMD: Not in environment \"PATH\"\n"));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
INT cmd_pause (LPTSTR cmd, LPTSTR param)
|
INT cmd_pause (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_pause: \'%s\' : \'%s\'\n", cmd, param);
|
DebugPrintf (_T("cmd_pause: \'%s\' : \'%s\')\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
|
|
||||||
#ifdef INCLUDE_CMD_SCREEN
|
#ifdef INCLUDE_CMD_SCREEN
|
||||||
|
|
||||||
#include <tchar.h>
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <tchar.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
@ -48,10 +48,10 @@ INT CommandScreen (LPTSTR cmd, LPTSTR param)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
y = atoi(param);
|
y = _ttoi(param);
|
||||||
if (y<0 || y>(maxy-1))
|
if (y<0 || y>(maxy-1))
|
||||||
{
|
{
|
||||||
ConOutPrintf("invalid value for row");
|
ConOutPrintf(_T("invalid value for row"));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ INT CommandScreen (LPTSTR cmd, LPTSTR param)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
x = atoi(param);
|
x = _ttoi(param);
|
||||||
if (x<0 || x>(maxx-1))
|
if (x<0 || x>(maxx-1))
|
||||||
{
|
{
|
||||||
ConErrPuts(_T("invalid value for col"));
|
ConErrPuts(_T("invalid value for col"));
|
||||||
|
|
|
@ -107,16 +107,16 @@ INT cmd_set (LPTSTR cmd, LPTSTR param)
|
||||||
dwBuffer = GetEnvironmentVariable (param, pszBuffer, ENV_BUFFER_SIZE);
|
dwBuffer = GetEnvironmentVariable (param, pszBuffer, ENV_BUFFER_SIZE);
|
||||||
if (dwBuffer == 0)
|
if (dwBuffer == 0)
|
||||||
{
|
{
|
||||||
ConErrPrintf ("CMD: Not in environment \"%s\"\n", param);
|
ConErrPrintf (_T("CMD: Not in environment \"%s\"\n"), param);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
else if (dwBuffer > ENV_BUFFER_SIZE)
|
else if (dwBuffer > ENV_BUFFER_SIZE)
|
||||||
{
|
{
|
||||||
pszBuffer = (LPTSTR)realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
|
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);
|
free (pszBuffer);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -42,7 +42,7 @@
|
||||||
INT cmd_shift (LPTSTR cmd, LPTSTR param)
|
INT cmd_shift (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("cmd_shift: (\'%s\', \'%s\'\n", cmd, param);
|
DebugPrintf (_T("cmd_shift: (\'%s\', \'%s\')\n"), cmd, param);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!_tcsncmp (param, _T("/?"), 2))
|
if (!_tcsncmp (param, _T("/?"), 2))
|
||||||
|
|
|
@ -53,11 +53,11 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
|
||||||
if( !*rest )
|
if( !*rest )
|
||||||
{
|
{
|
||||||
// FIXME: use comspec instead
|
// FIXME: use comspec instead
|
||||||
rest = "cmd";
|
rest = _T("cmd");
|
||||||
}
|
}
|
||||||
/* get the PATH environment variable and parse it */
|
/* get the PATH environment variable and parse it */
|
||||||
/* search the PATH environment variable for the binary */
|
/* 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 )
|
if( param )
|
||||||
{
|
{
|
||||||
*param = 0;
|
*param = 0;
|
||||||
|
@ -73,7 +73,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
|
||||||
!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
|
!_tcsicmp (_tcsrchr (szFullName, _T('.')), _T(".cmd")))
|
||||||
{
|
{
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("[BATCH: %s %s]\n", szFullName, rest);
|
DebugPrintf (_T("[BATCH: %s %s]\n"), szFullName, rest);
|
||||||
#endif
|
#endif
|
||||||
ConErrPuts (_T("No batch support at the moment!"));
|
ConErrPuts (_T("No batch support at the moment!"));
|
||||||
}
|
}
|
||||||
|
@ -85,13 +85,13 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
|
||||||
STARTUPINFO stui;
|
STARTUPINFO stui;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("[EXEC: %s %s]\n", szFullName, rest);
|
DebugPrintf (_T("[EXEC: %s %s]\n"), szFullName, rest);
|
||||||
#endif
|
#endif
|
||||||
/* build command line for CreateProcess() */
|
/* build command line for CreateProcess() */
|
||||||
_tcscpy (szFullCmdLine, first);
|
_tcscpy (szFullCmdLine, first);
|
||||||
if( param )
|
if( param )
|
||||||
{
|
{
|
||||||
_tcscat(szFullCmdLine, " " );
|
_tcscat(szFullCmdLine, _T(" ") );
|
||||||
_tcscat (szFullCmdLine, param);
|
_tcscat (szFullCmdLine, param);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ INT cmd_start (LPTSTR first, LPTSTR rest)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ErrorMessage (GetLastError (),
|
ErrorMessage (GetLastError (),
|
||||||
"Error executing CreateProcess()!!\n");
|
_T("Error executing CreateProcess()!!\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,46 +47,46 @@ typedef struct _CLRTABLE
|
||||||
|
|
||||||
CLRTABLE clrtable[] =
|
CLRTABLE clrtable[] =
|
||||||
{
|
{
|
||||||
{"bla" ,0 },
|
{_T("bla") ,0 },
|
||||||
{"blu" ,_B },
|
{_T("blu") ,_B },
|
||||||
{"gre" ,_G },
|
{_T("gre") ,_G },
|
||||||
{"cya" ,_B|_G },
|
{_T("cya") ,_B|_G },
|
||||||
{"red" ,_R },
|
{_T("red") ,_R },
|
||||||
{"mag" ,_B|_R },
|
{_T("mag") ,_B|_R },
|
||||||
{"yel" ,_R|_G },
|
{_T("yel") ,_R|_G },
|
||||||
{"whi" ,_R|_G|_B },
|
{_T("whi") ,_R|_G|_B },
|
||||||
{"gra" ,_I },
|
{_T("gra") ,_I },
|
||||||
|
|
||||||
|
|
||||||
{"0" ,0 },
|
{_T("0") ,0 },
|
||||||
{"2" ,_G },
|
{_T("2") ,_G },
|
||||||
{"3" ,_B|_G },
|
{_T("3") ,_B|_G },
|
||||||
{"4" ,_R },
|
{_T("4") ,_R },
|
||||||
{"5" ,_B|_R },
|
{_T("5") ,_B|_R },
|
||||||
{"6" ,_R|_G },
|
{_T("6") ,_R|_G },
|
||||||
{"7" ,_R|_G|_B },
|
{_T("7") ,_R|_G|_B },
|
||||||
|
|
||||||
{"8" ,_I },
|
{_T("8") ,_I },
|
||||||
{"9" ,_I|_B },
|
{_T("9") ,_I|_B },
|
||||||
{"10" ,_I|_G },
|
{_T("10") ,_I|_G },
|
||||||
{"11" ,_I|_B|_G },
|
{_T("11") ,_I|_B|_G },
|
||||||
{"12" ,_I|_R },
|
{_T("12") ,_I|_R },
|
||||||
{"13" ,_I|_B|_R },
|
{_T("13") ,_I|_B|_R },
|
||||||
{"14" ,_I|_R|_G },
|
{_T("14") ,_I|_R|_G },
|
||||||
{"15" ,_I|_R|_G|_B},
|
{_T("15") ,_I|_R|_G|_B },
|
||||||
|
|
||||||
|
|
||||||
/* note that 1 is at the end of list
|
/* note that 1 is at the end of list
|
||||||
to avoid to confuse it with 10-15*/
|
to avoid to confuse it with 10-15*/
|
||||||
{"1" ,_B },
|
{_T("1") ,_B },
|
||||||
|
|
||||||
/*cyan synonimous*/
|
/*cyan synonimous*/
|
||||||
{"aqu" ,_B|_G },
|
{_T("aqu") ,_B|_G },
|
||||||
/*magenta synonimous*/
|
/*magenta synonimous*/
|
||||||
{"pur" ,_B|_R },
|
{_T("pur") ,_B|_R },
|
||||||
|
|
||||||
|
|
||||||
{"" ,0},
|
{_T("") ,0},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,7 +208,7 @@ WORD str_to_color(LPTSTR* arg_str)
|
||||||
/*foreground*/
|
/*foreground*/
|
||||||
bBri = FALSE;
|
bBri = FALSE;
|
||||||
|
|
||||||
if(_tcsnicmp(str,"bri",3) == 0 )
|
if(_tcsnicmp(str,_T("bri"),3) == 0 )
|
||||||
{
|
{
|
||||||
bBri = TRUE;
|
bBri = TRUE;
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ WORD str_to_color(LPTSTR* arg_str)
|
||||||
/*background*/
|
/*background*/
|
||||||
bBri = FALSE;
|
bBri = FALSE;
|
||||||
|
|
||||||
if(_tcsnicmp(str,"bri",3) == 0 )
|
if(_tcsnicmp(str,_T("bri"),3) == 0 )
|
||||||
{
|
{
|
||||||
bBri = TRUE;
|
bBri = TRUE;
|
||||||
|
|
||||||
|
|
|
@ -187,7 +187,7 @@ INT cmd_time (LPTSTR cmd, LPTSTR param)
|
||||||
ConInString (s, 40);
|
ConInString (s, 40);
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf ("\'%s\'\n", s);
|
DebugPrintf (_T("\'%s\'\n"), s);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
while (*s && s[_tcslen (s) - 1] < _T(' '))
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
|
|
||||||
//print timer status
|
//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()
|
PrintTime()
|
||||||
|
|
||||||
//print timer value
|
//print timer value
|
||||||
|
@ -46,13 +46,13 @@ PrintElapsedTime (DWORD time,INT format)
|
||||||
DWORD h,m,s,ms;
|
DWORD h,m,s,ms;
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
DebugPrintf("PrintTime(%d,%d)",time,format);
|
DebugPrintf(_T("PrintTime(%d,%d)"),time,format);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
switch (format)
|
switch (format)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
ConOutPrintf("Elapsed %d msecs\n",time);
|
ConOutPrintf(_T("Elapsed %d msecs\n"),time);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -62,7 +62,7 @@ PrintElapsedTime (DWORD time,INT format)
|
||||||
time /=60;
|
time /=60;
|
||||||
m = time % 60;
|
m = time % 60;
|
||||||
h = 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,
|
h,cTimeSeparator,
|
||||||
m,cTimeSeparator,
|
m,cTimeSeparator,
|
||||||
s,cDecimalSeparator,ms/10);
|
s,cDecimalSeparator,ms/10);
|
||||||
|
@ -138,14 +138,14 @@ INT CommandTimer (LPTSTR cmd, LPTSTR param)
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
//set timer on
|
//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;
|
NewClkStatus = NCS_ON;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//set timer off
|
//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;
|
NewClkStatus = NCS_OFF;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -66,7 +66,7 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
|
||||||
{
|
{
|
||||||
if (_T('/') == argv[i][0])
|
if (_T('/') == argv[i][0])
|
||||||
{
|
{
|
||||||
ConErrPrintf("Invalid option \"%s\"\n", argv[i] + 1);
|
ConErrPrintf(_T("Invalid option \"%S\"\n"), argv[i] + 1);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
hFile = CreateFile(argv[i],
|
hFile = CreateFile(argv[i],
|
||||||
|
@ -86,7 +86,7 @@ INT cmd_type (LPTSTR cmd, LPTSTR param)
|
||||||
(LPTSTR) &errmsg,
|
(LPTSTR) &errmsg,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
ConErrPrintf ("%s - %s", argv[i], errmsg);
|
ConErrPrintf (_T("%s - %s"), argv[i], errmsg);
|
||||||
LocalFree (errmsg);
|
LocalFree (errmsg);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@
|
||||||
#define ENV_BUFFER_SIZE 1024
|
#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);
|
static INT nExtCount = sizeof(ext) / sizeof(LPTSTR);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue