Commit 9fcb2b09 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

cmd: Inline some simple extern WCHAR strings.

parent 77fc01d3
......@@ -516,13 +516,13 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
/* Format the time */
FileTimeToSystemTime(&fileInfo.ftLastWriteTime, &systime);
GetDateFormatW(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &systime,
NULL, thisoutput, MAX_PATH);
lstrcatW(thisoutput, spaceW);
lstrcatW(thisoutput, L" ");
datelen = lstrlenW(thisoutput);
GetTimeFormatW(LOCALE_USER_DEFAULT, TIME_NOSECONDS, &systime,
NULL, (thisoutput+datelen), MAX_PATH-datelen);
......@@ -538,7 +538,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
doneModifier = TRUE;
if (exists) {
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
wsprintfW(thisoutput, L"%u", fullsize);
lstrcatW(finaloutput, thisoutput);
}
......@@ -546,7 +546,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 4. Handle 's' : Use short paths (File doesn't have to exist) */
if (wmemchr(firstModifier, 's', modifierLen) != NULL) {
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
/* Convert fullfilename's path to a short path - Save filename away as
only path is valid, name may not exist which causes GetShortPathName
......@@ -563,7 +563,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* Note this overrides d,p,n,x */
if (wmemchr(firstModifier, 'f', modifierLen) != NULL) {
doneModifier = TRUE;
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
lstrcatW(finaloutput, fullfilename);
} else {
......@@ -580,7 +580,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 5. Handle 'd' : Drive Letter */
if (wmemchr(firstModifier, 'd', modifierLen) != NULL) {
if (addSpace) {
lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
......@@ -592,7 +592,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 6. Handle 'p' : Path */
if (wmemchr(firstModifier, 'p', modifierLen) != NULL) {
if (addSpace) {
lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
......@@ -604,7 +604,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 7. Handle 'n' : Name */
if (wmemchr(firstModifier, 'n', modifierLen) != NULL) {
if (addSpace) {
lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
......@@ -616,7 +616,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
/* 8. Handle 'x' : Ext */
if (wmemchr(firstModifier, 'x', modifierLen) != NULL) {
if (addSpace) {
lstrcatW(finaloutput, spaceW);
lstrcatW(finaloutput, L" ");
addSpace = FALSE;
}
......@@ -629,7 +629,7 @@ void WCMD_HandleTildeModifiers(WCHAR **start, BOOL atExecute)
if (!doneFileModifier &&
wmemchr(firstModifier, 's', modifierLen) != NULL) {
doneModifier = TRUE;
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, spaceW);
if (finaloutput[0] != 0x00) lstrcatW(finaloutput, L" ");
lstrcatW(finaloutput, fullfilename);
}
}
......
......@@ -310,7 +310,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Output the results */
if (!bare) {
if (level != 0 && (entry_count > 0)) WCMD_output_asis (newlineW);
if (level != 0 && (entry_count > 0)) WCMD_output_asis(L"\r\n");
if (!recurse || ((entry_count > 0) && done_header==FALSE)) {
WCMD_output (L"Directory of %1\n\n", real_path);
done_header = TRUE;
......@@ -397,7 +397,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if ((cur_width + widest) > max_width) {
cur_width = 0;
} else {
WCMD_output(L"%1!*s!", cur_width - tmp_width, nullW);
WCMD_output(L"%1!*s!", cur_width - tmp_width, L"");
}
} else if (fd[i].dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
......@@ -409,9 +409,9 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (usernames) WCMD_output (fmt3, username);
WCMD_output(fmt4,fd[i].cFileName);
} else {
if (!((lstrcmpW(fd[i].cFileName, dotW) == 0) ||
(lstrcmpW(fd[i].cFileName, dotdotW) == 0))) {
WCMD_output (fmt5, recurse?inputparms->dirName:nullW, fd[i].cFileName);
if (!((lstrcmpW(fd[i].cFileName, L".") == 0) ||
(lstrcmpW(fd[i].cFileName, L"..") == 0))) {
WCMD_output(fmt5, recurse?inputparms->dirName:L"", fd[i].cFileName);
} else {
addNewLine = FALSE;
}
......@@ -429,11 +429,11 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if (usernames) WCMD_output (fmt3, username);
WCMD_output(fmt4,fd[i].cFileName);
} else {
WCMD_output (fmt5, recurse?inputparms->dirName:nullW, fd[i].cFileName);
WCMD_output(fmt5, recurse ? inputparms->dirName : L"", fd[i].cFileName);
}
}
}
if (addNewLine) WCMD_output_asis (newlineW);
if (addNewLine) WCMD_output_asis(L"\r\n");
cur_width = 0;
}
......@@ -467,15 +467,15 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Build path to search */
lstrcpyW(string, inputparms->dirName);
lstrcatW(string, starW);
lstrcatW(string, L"*");
WINE_TRACE("Recursive, looking for '%s'\n", wine_dbgstr_w(string));
hff = FindFirstFileW(string, &finddata);
if (hff != INVALID_HANDLE_VALUE) {
do {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
(lstrcmpW(finddata.cFileName, dotdotW) != 0) &&
(lstrcmpW(finddata.cFileName, dotW) != 0)) {
(lstrcmpW(finddata.cFileName, L"..") != 0) &&
(lstrcmpW(finddata.cFileName, L".") != 0)) {
DIRECTORY_STACK *thisDir;
int dirsToCopy = concurrentDirs;
......@@ -488,7 +488,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Work out search parameter in sub dir */
lstrcpyW (string, inputparms->dirName);
lstrcatW (string, finddata.cFileName);
lstrcatW (string, slashW);
lstrcatW(string, L"\\");
WINE_TRACE("Recursive, Adding to search list '%s'\n", wine_dbgstr_w(string));
/* Allocate memory, add to list */
......@@ -762,7 +762,7 @@ void WCMD_directory (WCHAR *args)
argno = 0;
argN = args;
GetCurrentDirectoryW(MAX_PATH, cwd);
lstrcatW(cwd, slashW);
lstrcatW(cwd, L"\\");
/* Loop through all args, calculating full effective directory */
fullParms = NULL;
......@@ -781,7 +781,7 @@ void WCMD_directory (WCHAR *args)
if (!GetEnvironmentVariableW(envvar, fullname, MAX_PATH)) {
wsprintfW(fullname, L"%c:", thisArg[0]);
}
lstrcatW(fullname, slashW);
lstrcatW(fullname, L"\\");
lstrcatW(fullname, &thisArg[2]);
} else if (thisArg[0] == '\\') {
memcpy(fullname, cwd, 2 * sizeof(WCHAR));
......@@ -802,13 +802,13 @@ void WCMD_directory (WCHAR *args)
if ((wcschr(path, '*') == NULL) && (wcschr(path, '%') == NULL)) {
status = GetFileAttributesW(path);
if ((status != INVALID_FILE_ATTRIBUTES) && (status & FILE_ATTRIBUTE_DIRECTORY)) {
if (!ends_with_backslash( path )) lstrcatW( path, slashW );
lstrcatW (path, starW);
if (!ends_with_backslash(path)) lstrcatW(path, L"\\");
lstrcatW(path, L"*");
}
} else {
/* Special case wildcard search with no extension (ie parameters ending in '.') as
GetFullPathName strips off the additional '.' */
if (fullname[lstrlenW(fullname)-1] == '.') lstrcatW(path, dotW);
if (fullname[lstrlenW(fullname)-1] == '.') lstrcatW(path, L".");
}
WINE_TRACE("Using path '%s'\n", wine_dbgstr_w(path));
......@@ -841,7 +841,7 @@ void WCMD_directory (WCHAR *args)
fullParms = heap_xalloc(sizeof(DIRECTORY_STACK));
fullParms->next = NULL;
fullParms->dirName = heap_strdupW(cwd);
fullParms->fileName = heap_strdupW(starW);
fullParms->fileName = heap_strdupW(L"*");
}
lastDrive = '?';
......
......@@ -271,14 +271,6 @@ extern BOOL delayedsubst;
#define WCMD_EXIT 46
/* Some standard messages */
extern const WCHAR newlineW[];
extern const WCHAR spaceW[];
extern const WCHAR nullW[];
extern const WCHAR dotW[];
extern const WCHAR dotdotW[];
extern const WCHAR starW[];
extern const WCHAR slashW[];
extern const WCHAR equalW[];
extern WCHAR anykey[];
extern WCHAR version_string[];
......
......@@ -46,8 +46,6 @@ int defaultColor = 7;
BOOL echo_mode = TRUE;
WCHAR anykey[100], version_string[100];
const WCHAR newlineW[] = {'\r','\n','\0'};
const WCHAR spaceW[] = {' ','\0'};
static const WCHAR envPathExt[] = {'P','A','T','H','E','X','T','\0'};
static const WCHAR dfltPathExt[] = {'.','b','a','t',';',
'.','c','o','m',';',
......@@ -319,8 +317,7 @@ void WCMD_print_error (void) {
WCMD_output_asis_len(lpMsgBuf, lstrlenW(lpMsgBuf),
GetStdHandle(STD_ERROR_HANDLE));
LocalFree (lpMsgBuf);
WCMD_output_asis_len (newlineW, lstrlenW(newlineW),
GetStdHandle(STD_ERROR_HANDLE));
WCMD_output_asis_len(L"\r\n", lstrlenW(L"\r\n"), GetStdHandle(STD_ERROR_HANDLE));
return;
}
......@@ -731,7 +728,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start, WCHAR startchar)
/* search and replace manipulation */
} else {
WCHAR *equalspos = wcsstr(colonpos, equalW);
WCHAR *equalspos = wcsstr(colonpos, L"=");
WCHAR *replacewith = equalspos+1;
WCHAR *found = NULL;
WCHAR *searchIn;
......@@ -1151,7 +1148,7 @@ void WCMD_run_program (WCHAR *command, BOOL called)
}
/* 1. If extension supplied, see if that file exists */
lstrcatW(thisDir, slashW);
lstrcatW(thisDir, L"\\");
lstrcatW(thisDir, stemofsearch);
pos = &thisDir[lstrlenW(thisDir)]; /* Pos = end of name */
......@@ -1395,7 +1392,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* According to MSDN CreateProcess docs, special env vars record
the current directory on each drive, in the form =C:
so see if one specified, and if so go back to it */
lstrcpyW(envvar, equalW);
lstrcpyW(envvar, L"=");
lstrcatW(envvar, cmd);
if (GetEnvironmentVariableW(envvar, dir, MAX_PATH) == 0) {
static const WCHAR fmt[] = {'%','s','\\','\0'};
......@@ -1607,7 +1604,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
WCMD_type (parms_start);
break;
case WCMD_VER:
WCMD_output_asis(newlineW);
WCMD_output_asis(L"\r\n");
WCMD_version ();
break;
case WCMD_VERIFY:
......@@ -1886,7 +1883,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if (lstrlenW(extraSpace) == MAXSTRING -1) {
WCMD_output_asis_stderr(WCMD_LoadMessage(WCMD_TRUNCATEDLINE));
WCMD_output_asis_stderr(extraSpace);
WCMD_output_asis_stderr(newlineW);
WCMD_output_asis_stderr(L"\r\n");
}
/* Replace env vars if in a batch context */
......@@ -1914,9 +1911,9 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
&& CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE,
curPos, min_len, echoSlash, len) != CSTR_EQUAL)
{
WCMD_output_asis(spaceW);
WCMD_output_asis(L" ");
}
WCMD_output_asis(newlineW);
WCMD_output_asis(L"\r\n");
}
/* Skip repeated 'no echo' characters */
......@@ -2354,7 +2351,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
/* Continue to echo commands IF echo is on and in batch program */
if (context && echo_mode && *curPos && *curPos != '@') {
WCMD_output_asis(extraSpace);
WCMD_output_asis(newlineW);
WCMD_output_asis(L"\r\n");
}
/* Skip repeated 'no echo' characters and whitespace */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment