[git commit] reset: better --help text

Denys Vlasenko vda.linux at googlemail.com
Wed Jan 12 16:21:14 UTC 2022


commit: https://git.busybox.net/busybox/commit/?id=004cefa918483513a9eca13e7701c74dff160e95
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
packed_usage                                       34175   34233     +58

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 console-tools/reset.c | 2 +-
 shell/ash.c           | 9 ++++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/console-tools/reset.c b/console-tools/reset.c
index 113bb5c76..b3acf69f8 100644
--- a/console-tools/reset.c
+++ b/console-tools/reset.c
@@ -21,7 +21,7 @@
 //usage:#define reset_trivial_usage
 //usage:       ""
 //usage:#define reset_full_usage "\n\n"
-//usage:       "Reset the screen"
+//usage:       "Reset terminal (ESC codes) and termios (signals, buffering, echo)"
 
 /* "Standard" version of this tool is in ncurses package */
 
diff --git a/shell/ash.c b/shell/ash.c
index 4a8ec0c03..4c5dd1298 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -11358,7 +11358,7 @@ options(int *login_sh)
 	int val;
 	int c;
 
-	if (login_sh)
+	if (login_sh != NULL) /* if we came from startup code */
 		minusc = NULL;
 	while ((p = *argptr) != NULL) {
 		c = *p++;
@@ -11369,7 +11369,7 @@ options(int *login_sh)
 		if (c == '-') {
 			val = 1;
 			if (p[0] == '\0' || LONE_DASH(p)) {
-				if (!login_sh) {
+				if (login_sh == NULL) { /* we came from setcmd() */
 					/* "-" means turn off -x and -v */
 					if (p[0] == '\0')
 						xflag = vflag = 0;
@@ -11382,7 +11382,7 @@ options(int *login_sh)
 		}
 		/* first char was + or - */
 		while ((c = *p++) != '\0') {
-			if (login_sh) {
+			if (login_sh != NULL) { /* if we came from startup code */
 				/* bash 3.2 indeed handles -c CMD and +c CMD the same */
 				if (c == 'c') {
 					minusc = p; /* command is after shell args */
@@ -11406,6 +11406,9 @@ options(int *login_sh)
 					if (strcmp(p, "login") == 0) {
 						*login_sh = 1;
 					}
+/* TODO: --noprofile: e.g. if I want to run emergency shell from sulogin,
+ * I want minimal/no shell init scripts - but it insists on running it as "-ash"...
+ */
 					break;
 				}
 			}


More information about the busybox-cvs mailing list