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
e37463fa
Commit
e37463fa
authored
Mar 08, 2007
by
Jason Edmeades
Committed by
Alexandre Julliard
Mar 08, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd.exe: Add COLOR command.
parent
a4b6ee36
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
4 deletions
+58
-4
builtins.c
programs/cmd/builtins.c
+50
-1
wcmd.h
programs/cmd/wcmd.h
+3
-1
wcmdmain.c
programs/cmd/wcmdmain.c
+5
-2
No files found.
programs/cmd/builtins.c
View file @
e37463fa
...
...
@@ -47,7 +47,7 @@ struct env_stack *pushd_directories;
extern
HINSTANCE
hinst
;
extern
char
*
inbuilt
[];
extern
int
echo_mode
,
verify_mode
;
extern
int
echo_mode
,
verify_mode
,
defaultColor
;
extern
char
quals
[
MAX_PATH
],
param1
[
MAX_PATH
],
param2
[
MAX_PATH
];
extern
BATCH_CONTEXT
*
context
;
extern
DWORD
errorlevel
;
...
...
@@ -1631,3 +1631,52 @@ void WCMD_assoc (char *command) {
/* Clean up */
RegCloseKey
(
key
);
}
/****************************************************************************
* WCMD_color
*
* Clear the terminal screen.
*/
void
WCMD_color
(
void
)
{
/* Emulate by filling the screen from the top left to bottom right with
spaces, then moving the cursor to the top left afterwards */
CONSOLE_SCREEN_BUFFER_INFO
consoleInfo
;
HANDLE
hStdOut
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
if
(
param1
[
0
]
!=
0x00
&&
strlen
(
param1
)
>
2
)
{
WCMD_output
(
"Argument invalid
\n
"
);
return
;
}
if
(
GetConsoleScreenBufferInfo
(
hStdOut
,
&
consoleInfo
))
{
COORD
topLeft
;
DWORD
screenSize
;
DWORD
color
=
0
;
screenSize
=
consoleInfo
.
dwSize
.
X
*
(
consoleInfo
.
dwSize
.
Y
+
1
);
topLeft
.
X
=
0
;
topLeft
.
Y
=
0
;
/* Convert the color hex digits */
if
(
param1
[
0
]
==
0x00
)
{
color
=
defaultColor
;
}
else
{
color
=
strtoul
(
param1
,
NULL
,
16
);
}
/* Fail if fg == bg color */
if
(((
color
&
0xF0
)
>>
4
)
==
(
color
&
0x0F
))
{
errorlevel
=
1
;
return
;
}
/* Set the current screen contents and ensure all future writes
remain this color */
FillConsoleOutputAttribute
(
hStdOut
,
color
,
screenSize
,
topLeft
,
&
screenSize
);
SetConsoleTextAttribute
(
hStdOut
,
color
);
}
}
programs/cmd/wcmd.h
View file @
e37463fa
...
...
@@ -32,6 +32,7 @@ void WCMD_batch (char *, char *, int, char *, HANDLE);
void
WCMD_call
(
char
*
command
);
void
WCMD_change_tty
(
void
);
void
WCMD_clear_screen
(
void
);
void
WCMD_color
(
void
);
void
WCMD_copy
(
void
);
void
WCMD_create_dir
(
void
);
void
WCMD_delete
(
char
*
);
...
...
@@ -157,9 +158,10 @@ struct env_stack
#define WCMD_PUSHD 38
#define WCMD_POPD 39
#define WCMD_ASSOC 40
#define WCMD_COLOR 41
/* Must be last in list */
#define WCMD_EXIT 4
1
#define WCMD_EXIT 4
2
/* Some standard messages */
extern
const
char
nyi
[];
...
...
programs/cmd/wcmdmain.c
View file @
e37463fa
...
...
@@ -35,11 +35,11 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY",
"HELP"
,
"IF"
,
"LABEL"
,
"MD"
,
"MKDIR"
,
"MOVE"
,
"PATH"
,
"PAUSE"
,
"PROMPT"
,
"REM"
,
"REN"
,
"RENAME"
,
"RD"
,
"RMDIR"
,
"SET"
,
"SHIFT"
,
"TIME"
,
"TITLE"
,
"TYPE"
,
"VERIFY"
,
"VER"
,
"VOL"
,
"ENDLOCAL"
,
"SETLOCAL"
,
"PUSHD"
,
"POPD"
,
"ASSOC"
,
"EXIT"
};
"ENDLOCAL"
,
"SETLOCAL"
,
"PUSHD"
,
"POPD"
,
"ASSOC"
,
"
COLOR"
,
"
EXIT"
};
HINSTANCE
hinst
;
DWORD
errorlevel
;
int
echo_mode
=
1
,
verify_mode
=
0
;
int
echo_mode
=
1
,
verify_mode
=
0
,
defaultColor
=
7
;
static
int
opt_c
,
opt_k
,
opt_s
;
const
char
nyi
[]
=
"Not Yet Implemented
\n\n
"
;
const
char
newline
[]
=
"
\n
"
;
...
...
@@ -578,6 +578,9 @@ void WCMD_process_command (char *command)
case
WCMD_ASSOC
:
WCMD_assoc
(
p
);
break
;
case
WCMD_COLOR
:
WCMD_color
();
break
;
case
WCMD_EXIT
:
WCMD_exit
();
break
;
...
...
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