diff options
author | Ron Yorston <rmy@pobox.com> | 2019-03-09 11:40:42 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-03-09 11:40:42 +0000 |
commit | 486582a7307cf845ee52fcb6f9ede2d92c69ed86 (patch) | |
tree | e2d071b981aae8fc33f1df22cc4c1a0d71a0f491 /shell | |
parent | 8fcbe777412b301e5dddd4931b2e1016802141b8 (diff) | |
download | busybox-w32-486582a7307cf845ee52fcb6f9ede2d92c69ed86.tar.gz busybox-w32-486582a7307cf845ee52fcb6f9ede2d92c69ed86.tar.bz2 busybox-w32-486582a7307cf845ee52fcb6f9ede2d92c69ed86.zip |
su: change title of console window
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 14 |
1 files changed, 13 insertions, 1 deletions
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) { |