diff options
-rw-r--r-- | include/mingw.h | 1 | ||||
-rw-r--r-- | loginutils/suw32.c | 4 | ||||
-rw-r--r-- | shell/ash.c | 14 | ||||
-rw-r--r-- | win32/winansi.c | 6 |
4 files changed, 23 insertions, 2 deletions
diff --git a/include/mingw.h b/include/mingw.h index 52759b7b1..ead07ae82 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -144,6 +144,7 @@ int mingw_pclose(FILE *fd); | |||
144 | * ANSI emulation wrappers | 144 | * ANSI emulation wrappers |
145 | */ | 145 | */ |
146 | 146 | ||
147 | void set_title(const char *str); | ||
147 | void move_cursor_row(int n); | 148 | void move_cursor_row(int n); |
148 | void reset_screen(void); | 149 | void reset_screen(void); |
149 | int winansi_putchar(int c); | 150 | int winansi_putchar(int c); |
diff --git a/loginutils/suw32.c b/loginutils/suw32.c index 93fd145f1..787bcbbef 100644 --- a/loginutils/suw32.c +++ b/loginutils/suw32.c | |||
@@ -49,7 +49,9 @@ int suw32_main(int argc UNUSED_PARAM, char **argv) | |||
49 | info.lpFile = bb_path; | 49 | info.lpFile = bb_path; |
50 | /* ShellExecuteEx() always runs system binaries in C:\Windows\System32. | 50 | /* ShellExecuteEx() always runs system binaries in C:\Windows\System32. |
51 | * Pass the directory we want to the shell. */ | 51 | * Pass the directory we want to the shell. */ |
52 | info.lpParameters = xasprintf("--busybox ash -d \"%s\"", getcwd(NULL, 0)); | 52 | info.lpParameters = |
53 | xasprintf("--busybox ash -d \"%s\" -t \"BusyBox ash (su)\" ", | ||
54 | getcwd(NULL, 0)); | ||
53 | if (opt_command) | 55 | if (opt_command) |
54 | info.lpParameters = | 56 | info.lpParameters = |
55 | xasprintf("%s -s -c \"%s\"", info.lpParameters, opt_command); | 57 | xasprintf("%s -s -c \"%s\"", info.lpParameters, opt_command); |
diff --git a/shell/ash.c b/shell/ash.c index b7fb29452..6b70dcde3 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -482,6 +482,7 @@ struct globals_misc { | |||
482 | char *minusc; /* argument to -c option */ | 482 | char *minusc; /* argument to -c option */ |
483 | #if ENABLE_PLATFORM_MINGW32 | 483 | #if ENABLE_PLATFORM_MINGW32 |
484 | char *dirarg; /* argument to -d option */ | 484 | char *dirarg; /* argument to -d option */ |
485 | char *title; /* argument to -t option */ | ||
485 | #endif | 486 | #endif |
486 | 487 | ||
487 | char *curdir; // = nullstr; /* current working directory */ | 488 | char *curdir; // = nullstr; /* current working directory */ |
@@ -578,6 +579,7 @@ extern struct globals_misc *BB_GLOBAL_CONST ash_ptr_to_globals_misc; | |||
578 | #define minusc (G_misc.minusc ) | 579 | #define minusc (G_misc.minusc ) |
579 | #if ENABLE_PLATFORM_MINGW32 | 580 | #if ENABLE_PLATFORM_MINGW32 |
580 | #define dirarg (G_misc.dirarg ) | 581 | #define dirarg (G_misc.dirarg ) |
582 | #define title (G_misc.title ) | ||
581 | #endif | 583 | #endif |
582 | #define curdir (G_misc.curdir ) | 584 | #define curdir (G_misc.curdir ) |
583 | #define physdir (G_misc.physdir ) | 585 | #define physdir (G_misc.physdir ) |
@@ -11682,6 +11684,7 @@ options(int cmdline, int *login_sh) | |||
11682 | minusc = NULL; | 11684 | minusc = NULL; |
11683 | #if ENABLE_PLATFORM_MINGW32 | 11685 | #if ENABLE_PLATFORM_MINGW32 |
11684 | dirarg = NULL; | 11686 | dirarg = NULL; |
11687 | title = NULL; | ||
11685 | #endif | 11688 | #endif |
11686 | } | 11689 | } |
11687 | while ((p = *argptr) != NULL) { | 11690 | while ((p = *argptr) != NULL) { |
@@ -11710,12 +11713,18 @@ options(int cmdline, int *login_sh) | |||
11710 | if (c == 'c' && cmdline) { | 11713 | if (c == 'c' && cmdline) { |
11711 | minusc = p; /* command is after shell args */ | 11714 | minusc = p; /* command is after shell args */ |
11712 | #if ENABLE_PLATFORM_MINGW32 | 11715 | #if ENABLE_PLATFORM_MINGW32 |
11713 | /* Undocumented -d option to force current directory. | 11716 | /* Undocumented flags; |
11717 | * -d force current directory | ||
11718 | * -t title to display in console window | ||
11714 | * Must appear before -s or -c. */ | 11719 | * Must appear before -s or -c. */ |
11715 | } else if (c == 'd' && cmdline && val == 1) { | 11720 | } else if (c == 'd' && cmdline && val == 1) { |
11716 | if (*argptr == NULL) | 11721 | if (*argptr == NULL) |
11717 | ash_msg_and_raise_error(bb_msg_requires_arg, "-d"); | 11722 | ash_msg_and_raise_error(bb_msg_requires_arg, "-d"); |
11718 | dirarg = *argptr++; | 11723 | dirarg = *argptr++; |
11724 | } else if (c == 't' && cmdline && val == 1) { | ||
11725 | if (*argptr == NULL) | ||
11726 | ash_msg_and_raise_error(bb_msg_requires_arg, "-t"); | ||
11727 | title = *argptr++; | ||
11719 | #endif | 11728 | #endif |
11720 | } else if (c == 'o') { | 11729 | } else if (c == 'o') { |
11721 | if (plus_minus_o(*argptr, val)) { | 11730 | if (plus_minus_o(*argptr, val)) { |
@@ -14979,6 +14988,9 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
14979 | chdir(dirarg); | 14988 | chdir(dirarg); |
14980 | setpwd(NULL, 0); | 14989 | setpwd(NULL, 0); |
14981 | } | 14990 | } |
14991 | |||
14992 | if (title) | ||
14993 | set_title(title); | ||
14982 | #endif | 14994 | #endif |
14983 | 14995 | ||
14984 | if (login_sh) { | 14996 | if (login_sh) { |
diff --git a/win32/winansi.c b/win32/winansi.c index e0ae38a91..08d37335b 100644 --- a/win32/winansi.c +++ b/win32/winansi.c | |||
@@ -85,6 +85,12 @@ static int skip_ansi_emulation(void) | |||
85 | return var != NULL; | 85 | return var != NULL; |
86 | } | 86 | } |
87 | 87 | ||
88 | void set_title(const char *str) | ||
89 | { | ||
90 | if (is_console(STDOUT_FILENO)) | ||
91 | SetConsoleTitle(str); | ||
92 | } | ||
93 | |||
88 | 94 | ||
89 | #define FOREGROUND_ALL (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) | 95 | #define FOREGROUND_ALL (FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE) |
90 | #define BACKGROUND_ALL (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) | 96 | #define BACKGROUND_ALL (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE) |