Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
5fc25686
Commit
5fc25686
authored
Nov 12, 2011
by
Frédéric Delanoy
Committed by
Alexandre Julliard
Nov 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd: Avoid duplication of commonly used strings.
parent
e8d8df3c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
25 deletions
+22
-25
batch.c
programs/cmd/batch.c
+0
-1
builtins.c
programs/cmd/builtins.c
+6
-6
directory.c
programs/cmd/directory.c
+5
-12
wcmd.h
programs/cmd/wcmd.h
+7
-0
wcmdmain.c
programs/cmd/wcmdmain.c
+4
-6
No files found.
programs/cmd/batch.c
View file @
5fc25686
...
@@ -317,7 +317,6 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
...
@@ -317,7 +317,6 @@ void WCMD_HandleTildaModifiers(WCHAR **start, const WCHAR *forVariable,
static
const
WCHAR
validmodifiers
[
NUMMODIFIERS
]
=
{
static
const
WCHAR
validmodifiers
[
NUMMODIFIERS
]
=
{
'~'
,
'f'
,
'd'
,
'p'
,
'n'
,
'x'
,
's'
,
'a'
,
't'
,
'z'
,
'$'
'~'
,
'f'
,
'd'
,
'p'
,
'n'
,
'x'
,
's'
,
'a'
,
't'
,
'z'
,
'$'
};
};
static
const
WCHAR
space
[]
=
{
' '
,
'\0'
};
WIN32_FILE_ATTRIBUTE_DATA
fileInfo
;
WIN32_FILE_ATTRIBUTE_DATA
fileInfo
;
WCHAR
outputparam
[
MAX_PATH
];
WCHAR
outputparam
[
MAX_PATH
];
...
...
programs/cmd/builtins.c
View file @
5fc25686
...
@@ -58,17 +58,17 @@ extern DWORD errorlevel;
...
@@ -58,17 +58,17 @@ extern DWORD errorlevel;
static
BOOL
verify_mode
=
FALSE
;
static
BOOL
verify_mode
=
FALSE
;
static
const
WCHAR
dotW
[]
=
{
'.'
,
'\0'
};
const
WCHAR
dotW
[]
=
{
'.'
,
'\0'
};
static
const
WCHAR
dotdotW
[]
=
{
'.'
,
'.'
,
'\0'
};
const
WCHAR
dotdotW
[]
=
{
'.'
,
'.'
,
'\0'
};
static
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
const
WCHAR
nullW
[]
=
{
'\0'
};
static
const
WCHAR
starW
[]
=
{
'*'
,
'\0'
};
const
WCHAR
starW
[]
=
{
'*'
,
'\0'
};
static
const
WCHAR
equalW
[]
=
{
'='
,
'\0'
};
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
const
WCHAR
equalW
[]
=
{
'='
,
'\0'
};
static
const
WCHAR
fslashW
[]
=
{
'/'
,
'\0'
};
static
const
WCHAR
fslashW
[]
=
{
'/'
,
'\0'
};
static
const
WCHAR
onW
[]
=
{
'O'
,
'N'
,
'\0'
};
static
const
WCHAR
onW
[]
=
{
'O'
,
'N'
,
'\0'
};
static
const
WCHAR
offW
[]
=
{
'O'
,
'F'
,
'F'
,
'\0'
};
static
const
WCHAR
offW
[]
=
{
'O'
,
'F'
,
'F'
,
'\0'
};
static
const
WCHAR
parmY
[]
=
{
'/'
,
'Y'
,
'\0'
};
static
const
WCHAR
parmY
[]
=
{
'/'
,
'Y'
,
'\0'
};
static
const
WCHAR
parmNoY
[]
=
{
'/'
,
'-'
,
'Y'
,
'\0'
};
static
const
WCHAR
parmNoY
[]
=
{
'/'
,
'-'
,
'Y'
,
'\0'
};
static
const
WCHAR
nullW
[]
=
{
'\0'
};
/**************************************************************************
/**************************************************************************
* WCMD_ask_confirm
* WCMD_ask_confirm
...
...
programs/cmd/directory.c
View file @
5fc25686
...
@@ -59,13 +59,6 @@ static BOOL orderReverse, orderGroupDirs, orderGroupDirsReverse, orderByCol;
...
@@ -59,13 +59,6 @@ static BOOL orderReverse, orderGroupDirs, orderGroupDirsReverse, orderByCol;
static
BOOL
paged_mode
,
recurse
,
wide
,
bare
,
lower
,
shortname
,
usernames
,
separator
;
static
BOOL
paged_mode
,
recurse
,
wide
,
bare
,
lower
,
shortname
,
usernames
,
separator
;
static
ULONG
showattrs
,
attrsbits
;
static
ULONG
showattrs
,
attrsbits
;
static
const
WCHAR
dotW
[]
=
{
'.'
,
'\0'
};
static
const
WCHAR
dotdotW
[]
=
{
'.'
,
'.'
,
'\0'
};
static
const
WCHAR
starW
[]
=
{
'*'
,
'\0'
};
static
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
static
const
WCHAR
emptyW
[]
=
{
'\0'
};
static
const
WCHAR
spaceW
[]
=
{
' '
,
'\0'
};
/*****************************************************************************
/*****************************************************************************
* WCMD_strrev
* WCMD_strrev
*
*
...
@@ -432,14 +425,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
...
@@ -432,14 +425,14 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
/* Note: WCMD_output uses wvsprintf which does not allow %*
/* Note: WCMD_output uses wvsprintf which does not allow %*
so manually pad with spaces to appropriate width */
so manually pad with spaces to appropriate width */
strcpyW
(
temp
,
empty
W
);
strcpyW
(
temp
,
null
W
);
while
(
padding
>
0
)
{
while
(
padding
>
0
)
{
strcatW
(
&
temp
[
toWrite
],
space
W
);
strcatW
(
&
temp
[
toWrite
],
space
);
toWrite
++
;
toWrite
++
;
if
(
toWrite
>
99
)
{
if
(
toWrite
>
99
)
{
WCMD_output
(
temp
);
WCMD_output
(
temp
);
toWrite
=
0
;
toWrite
=
0
;
strcpyW
(
temp
,
empty
W
);
strcpyW
(
temp
,
null
W
);
}
}
padding
--
;
padding
--
;
}
}
...
@@ -457,7 +450,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
...
@@ -457,7 +450,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
}
else
{
}
else
{
if
(
!
((
strcmpW
((
fd
+
i
)
->
cFileName
,
dotW
)
==
0
)
||
if
(
!
((
strcmpW
((
fd
+
i
)
->
cFileName
,
dotW
)
==
0
)
||
(
strcmpW
((
fd
+
i
)
->
cFileName
,
dotdotW
)
==
0
)))
{
(
strcmpW
((
fd
+
i
)
->
cFileName
,
dotdotW
)
==
0
)))
{
WCMD_output
(
fmt5
,
recurse
?
inputparms
->
dirName
:
empty
W
,
(
fd
+
i
)
->
cFileName
);
WCMD_output
(
fmt5
,
recurse
?
inputparms
->
dirName
:
null
W
,
(
fd
+
i
)
->
cFileName
);
}
else
{
}
else
{
addNewLine
=
FALSE
;
addNewLine
=
FALSE
;
}
}
...
@@ -475,7 +468,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
...
@@ -475,7 +468,7 @@ static DIRECTORY_STACK *WCMD_list_directory (DIRECTORY_STACK *inputparms, int le
if
(
usernames
)
WCMD_output
(
fmt3
,
username
);
if
(
usernames
)
WCMD_output
(
fmt3
,
username
);
WCMD_output
(
fmt4
,(
fd
+
i
)
->
cFileName
);
WCMD_output
(
fmt4
,(
fd
+
i
)
->
cFileName
);
}
else
{
}
else
{
WCMD_output
(
fmt5
,
recurse
?
inputparms
->
dirName
:
empty
W
,
(
fd
+
i
)
->
cFileName
);
WCMD_output
(
fmt5
,
recurse
?
inputparms
->
dirName
:
null
W
,
(
fd
+
i
)
->
cFileName
);
}
}
}
}
}
}
...
...
programs/cmd/wcmd.h
View file @
5fc25686
...
@@ -220,6 +220,13 @@ extern const WCHAR externals[NUM_EXTERNALS][10];
...
@@ -220,6 +220,13 @@ extern const WCHAR externals[NUM_EXTERNALS][10];
/* Some standard messages */
/* Some standard messages */
extern
const
WCHAR
newline
[];
extern
const
WCHAR
newline
[];
extern
const
WCHAR
space
[];
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
anykey
[];
extern
WCHAR
version_string
[];
extern
WCHAR
version_string
[];
...
...
programs/cmd/wcmdmain.c
View file @
5fc25686
...
@@ -90,7 +90,7 @@ int defaultColor = 7;
...
@@ -90,7 +90,7 @@ int defaultColor = 7;
BOOL
echo_mode
=
TRUE
;
BOOL
echo_mode
=
TRUE
;
static
int
opt_c
,
opt_k
,
opt_s
;
static
int
opt_c
,
opt_k
,
opt_s
;
const
WCHAR
newline
[]
=
{
'\r'
,
'\n'
,
'\0'
};
const
WCHAR
newline
[]
=
{
'\r'
,
'\n'
,
'\0'
};
static
const
WCHAR
equalsW
[]
=
{
'=
'
,
'\0'
};
const
WCHAR
space
[]
=
{
'
'
,
'\0'
};
static
const
WCHAR
closeBW
[]
=
{
')'
,
'\0'
};
static
const
WCHAR
closeBW
[]
=
{
')'
,
'\0'
};
WCHAR
anykey
[
100
];
WCHAR
anykey
[
100
];
WCHAR
version_string
[
100
];
WCHAR
version_string
[
100
];
...
@@ -747,7 +747,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start,
...
@@ -747,7 +747,7 @@ static WCHAR *WCMD_expand_envvar(WCHAR *start,
/* search and replace manipulation */
/* search and replace manipulation */
}
else
{
}
else
{
WCHAR
*
equalspos
=
strstrW
(
colonpos
,
equal
s
W
);
WCHAR
*
equalspos
=
strstrW
(
colonpos
,
equalW
);
WCHAR
*
replacewith
=
equalspos
+
1
;
WCHAR
*
replacewith
=
equalspos
+
1
;
WCHAR
*
found
=
NULL
;
WCHAR
*
found
=
NULL
;
WCHAR
*
searchIn
;
WCHAR
*
searchIn
;
...
@@ -1084,7 +1084,6 @@ void WCMD_run_program (WCHAR *command, int called) {
...
@@ -1084,7 +1084,6 @@ void WCMD_run_program (WCHAR *command, int called) {
WCHAR
thisDir
[
MAX_PATH
]
=
{
'\0'
};
WCHAR
thisDir
[
MAX_PATH
]
=
{
'\0'
};
WCHAR
*
pos
=
NULL
;
WCHAR
*
pos
=
NULL
;
BOOL
found
=
FALSE
;
BOOL
found
=
FALSE
;
static
const
WCHAR
slashW
[]
=
{
'\\'
,
'\0'
};
/* Work on the first directory on the search path */
/* Work on the first directory on the search path */
pos
=
strchrW
(
pathposn
,
';'
);
pos
=
strchrW
(
pathposn
,
';'
);
...
@@ -1332,7 +1331,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
...
@@ -1332,7 +1331,7 @@ void WCMD_execute (const WCHAR *command, const WCHAR *redirects,
/* According to MSDN CreateProcess docs, special env vars record
/* According to MSDN CreateProcess docs, special env vars record
the current directory on each drive, in the form =C:
the current directory on each drive, in the form =C:
so see if one specified, and if so go back to it */
so see if one specified, and if so go back to it */
strcpyW
(
envvar
,
equal
s
W
);
strcpyW
(
envvar
,
equalW
);
strcatW
(
envvar
,
cmd
);
strcatW
(
envvar
,
cmd
);
if
(
GetEnvironmentVariableW
(
envvar
,
dir
,
MAX_PATH
)
==
0
)
{
if
(
GetEnvironmentVariableW
(
envvar
,
dir
,
MAX_PATH
)
==
0
)
{
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'\0'
};
static
const
WCHAR
fmt
[]
=
{
'%'
,
's'
,
'\\'
,
'\0'
};
...
@@ -1835,7 +1834,6 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
...
@@ -1835,7 +1834,6 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
if
(
context
)
handleExpansion
(
extraSpace
,
FALSE
,
NULL
,
NULL
);
if
(
context
)
handleExpansion
(
extraSpace
,
FALSE
,
NULL
,
NULL
);
/* Show prompt before batch line IF echo is on and in batch program */
/* Show prompt before batch line IF echo is on and in batch program */
if
(
context
&&
echo_mode
&&
extraSpace
[
0
]
&&
(
extraSpace
[
0
]
!=
'@'
))
{
if
(
context
&&
echo_mode
&&
extraSpace
[
0
]
&&
(
extraSpace
[
0
]
!=
'@'
))
{
static
const
WCHAR
spc
[]
=
{
' '
,
'\0'
};
static
const
WCHAR
echoDot
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
'.'
};
static
const
WCHAR
echoDot
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
'.'
};
static
const
WCHAR
echoCol
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
':'
};
static
const
WCHAR
echoCol
[]
=
{
'e'
,
'c'
,
'h'
,
'o'
,
':'
};
const
DWORD
len
=
sizeof
(
echoDot
)
/
sizeof
(
echoDot
[
0
]);
const
DWORD
len
=
sizeof
(
echoDot
)
/
sizeof
(
echoDot
[
0
]);
...
@@ -1850,7 +1848,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
...
@@ -1850,7 +1848,7 @@ WCHAR *WCMD_ReadAndParseLine(const WCHAR *optionalcmd, CMD_LIST **output, HANDLE
&&
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
&&
CompareStringW
(
LOCALE_SYSTEM_DEFAULT
,
NORM_IGNORECASE
,
extraSpace
,
min_len
,
echoCol
,
len
)
!=
CSTR_EQUAL
)
extraSpace
,
min_len
,
echoCol
,
len
)
!=
CSTR_EQUAL
)
{
{
WCMD_output_asis
(
sp
c
);
WCMD_output_asis
(
sp
ace
);
}
}
WCMD_output_asis
(
newline
);
WCMD_output_asis
(
newline
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment