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
1c632cd0
Commit
1c632cd0
authored
Feb 26, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Feb 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Make 'set t' show all vars starting with 't'.
parent
69194ce0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
18 deletions
+16
-18
builtins.c
programs/cmd/builtins.c
+16
-18
No files found.
programs/cmd/builtins.c
View file @
1c632cd0
...
@@ -939,12 +939,16 @@ static int WCMD_compare( const void *a, const void *b )
...
@@ -939,12 +939,16 @@ static int WCMD_compare( const void *a, const void *b )
* WCMD_setshow_sortenv
* WCMD_setshow_sortenv
*
*
* sort variables into order for display
* sort variables into order for display
* Optionally only display those who start with a stub
* returns the count displayed
*/
*/
static
void
WCMD_setshow_sortenv
(
const
char
*
s
)
static
int
WCMD_setshow_sortenv
(
const
char
*
s
,
const
char
*
stub
)
{
{
UINT
count
=
0
,
len
=
0
,
i
;
UINT
count
=
0
,
len
=
0
,
i
,
displayedcount
=
0
,
stublen
=
0
;
const
char
**
str
;
const
char
**
str
;
if
(
stub
)
stublen
=
strlen
(
stub
);
/* count the number of strings, and the total length */
/* count the number of strings, and the total length */
while
(
s
[
len
]
)
{
while
(
s
[
len
]
)
{
len
+=
(
lstrlen
(
&
s
[
len
])
+
1
);
len
+=
(
lstrlen
(
&
s
[
len
])
+
1
);
...
@@ -954,7 +958,7 @@ static void WCMD_setshow_sortenv(const char *s)
...
@@ -954,7 +958,7 @@ static void WCMD_setshow_sortenv(const char *s)
/* add the strings to an array */
/* add the strings to an array */
str
=
LocalAlloc
(
LMEM_FIXED
|
LMEM_ZEROINIT
,
count
*
sizeof
(
char
*
)
);
str
=
LocalAlloc
(
LMEM_FIXED
|
LMEM_ZEROINIT
,
count
*
sizeof
(
char
*
)
);
if
(
!
str
)
if
(
!
str
)
return
;
return
0
;
str
[
0
]
=
s
;
str
[
0
]
=
s
;
for
(
i
=
1
;
i
<
count
;
i
++
)
for
(
i
=
1
;
i
<
count
;
i
++
)
str
[
i
]
=
str
[
i
-
1
]
+
lstrlen
(
str
[
i
-
1
])
+
1
;
str
[
i
]
=
str
[
i
-
1
]
+
lstrlen
(
str
[
i
-
1
])
+
1
;
...
@@ -964,11 +968,17 @@ static void WCMD_setshow_sortenv(const char *s)
...
@@ -964,11 +968,17 @@ static void WCMD_setshow_sortenv(const char *s)
/* print it */
/* print it */
for
(
i
=
0
;
i
<
count
;
i
++
)
{
for
(
i
=
0
;
i
<
count
;
i
++
)
{
if
(
!
stub
||
CompareString
(
LOCALE_USER_DEFAULT
,
NORM_IGNORECASE
|
SORT_STRINGSORT
,
str
[
i
],
stublen
,
stub
,
-
1
)
==
2
)
{
WCMD_output_asis
(
str
[
i
]);
WCMD_output_asis
(
str
[
i
]);
WCMD_output_asis
(
"
\n
"
);
WCMD_output_asis
(
"
\n
"
);
displayedcount
++
;
}
}
}
LocalFree
(
str
);
LocalFree
(
str
);
return
displayedcount
;
}
}
/****************************************************************************
/****************************************************************************
...
@@ -982,27 +992,16 @@ void WCMD_setshow_env (char *s) {
...
@@ -982,27 +992,16 @@ void WCMD_setshow_env (char *s) {
LPVOID
env
;
LPVOID
env
;
char
*
p
;
char
*
p
;
int
status
;
int
status
;
char
buffer
[
1048
];
if
(
strlen
(
param1
)
==
0
)
{
if
(
strlen
(
param1
)
==
0
)
{
env
=
GetEnvironmentStrings
();
env
=
GetEnvironmentStrings
();
WCMD_setshow_sortenv
(
env
);
WCMD_setshow_sortenv
(
env
,
NULL
);
}
}
else
{
else
{
p
=
strchr
(
s
,
'='
);
p
=
strchr
(
s
,
'='
);
if
(
p
==
NULL
)
{
if
(
p
==
NULL
)
{
env
=
GetEnvironmentStrings
();
/* FIXME: Emulate Win98 for now, ie "SET C" looks ONLY for an
if
(
WCMD_setshow_sortenv
(
env
,
s
)
==
0
)
{
environment variable C, whereas on NT it shows ALL variables
starting with C.
*/
status
=
GetEnvironmentVariable
(
s
,
buffer
,
sizeof
(
buffer
));
if
(
status
)
{
WCMD_output_asis
(
s
);
WCMD_output_asis
(
"="
);
WCMD_output_asis
(
buffer
);
WCMD_output_asis
(
"
\n
"
);
}
else
{
WCMD_output
(
"Environment variable %s not defined
\n
"
,
s
);
WCMD_output
(
"Environment variable %s not defined
\n
"
,
s
);
}
}
return
;
return
;
...
@@ -1013,7 +1012,6 @@ char buffer[1048];
...
@@ -1013,7 +1012,6 @@ char buffer[1048];
status
=
SetEnvironmentVariable
(
s
,
p
);
status
=
SetEnvironmentVariable
(
s
,
p
);
if
((
!
status
)
&
(
GetLastError
()
!=
ERROR_ENVVAR_NOT_FOUND
))
WCMD_print_error
();
if
((
!
status
)
&
(
GetLastError
()
!=
ERROR_ENVVAR_NOT_FOUND
))
WCMD_print_error
();
}
}
/* WCMD_output (newline); @JED*/
}
}
/****************************************************************************
/****************************************************************************
...
...
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