diff options
author | Ron Yorston <rmy@pobox.com> | 2024-04-09 08:58:58 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2024-04-09 08:58:58 +0100 |
commit | fcf3ec2877f042c6957d808e562807089e23ebe6 (patch) | |
tree | 02fc4bf8d6fd8284564d3cf27cbd17482b8f5744 /win32 | |
parent | 55ecf3a746db5131ca078875168a59feab8b26f1 (diff) | |
download | busybox-w32-fcf3ec2877f042c6957d808e562807089e23ebe6.tar.gz busybox-w32-fcf3ec2877f042c6957d808e562807089e23ebe6.tar.bz2 busybox-w32-fcf3ec2877f042c6957d808e562807089e23ebe6.zip |
ash: add title built-in
Implement a 'title' built-in for ash. It's very simple-minded,
performs almost no error checking and is completely non-portable.
- With no arguments it prints the current console title.
- If arguments are provided the *first only* is set as the console
title.
Costs 88-116 bytes.
(GitHub issue #401)
Diffstat (limited to 'win32')
-rw-r--r-- | win32/winansi.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/win32/winansi.c b/win32/winansi.c index 0dd2e17f2..3b7744b39 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -179,8 +179,12 @@ int terminal_mode(int reset) | |||
179 | 179 | ||
180 | void set_title(const char *str) | 180 | void set_title(const char *str) |
181 | { | 181 | { |
182 | if (is_console(STDOUT_FILENO)) | 182 | SetConsoleTitle(str); |
183 | SetConsoleTitle(str); | 183 | } |
184 | |||
185 | int get_title(char *buf, int len) | ||
186 | { | ||
187 | return GetConsoleTitle(buf, len); | ||
184 | } | 188 | } |
185 | 189 | ||
186 | static HANDLE dup_handle(HANDLE h) | 190 | static HANDLE dup_handle(HANDLE h) |