summary refs log tree commit diff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/cash/parser.c6
-rw-r--r--bin/cash/var.c3
-rw-r--r--bin/cash/var.h2
3 files changed, 11 insertions, 0 deletions
diff --git a/bin/cash/parser.c b/bin/cash/parser.c
index 86c09776..91771e81 100644
--- a/bin/cash/parser.c
+++ b/bin/cash/parser.c
@@ -129,6 +129,7 @@ static void consumetoken(int);
 static void synexpect(int) __dead2;
 static void synerror(const char *) __dead2;
 static void setprompt(int);
+static char *expandprompt(const char *);
 static int pgetc_linecont(void);
 
 
@@ -1937,6 +1938,11 @@ setprompt(int which)
 	if (which == 0)
 		return;
 
+	if (which == 1 && *ps0val()) {
+		out2str(expandprompt(ps0val()));
+		flushout(out2);
+	}
+
 #ifndef NO_HISTORY
 	if (!el)
 #endif
diff --git a/bin/cash/var.c b/bin/cash/var.c
index 18e5de62..d0c01bb7 100644
--- a/bin/cash/var.c
+++ b/bin/cash/var.c
@@ -94,6 +94,7 @@ struct var vifs;
 struct var vmail;
 struct var vmpath;
 struct var vpath;
+struct var vps0;
 struct var vps1;
 struct var vps2;
 struct var vps4;
@@ -119,6 +120,8 @@ static const struct varinit varinit[] = {
 	  NULL },
 	{ &vpath,	0,				"PATH=" _PATH_DEFPATH,
 	  changepath },
+	{ &vps0,	VUNSET,				"PS0=",
+	  NULL },
 	/*
 	 * vps1 depends on uid
 	 */
diff --git a/bin/cash/var.h b/bin/cash/var.h
index 9ebb7765..31f9dcc7 100644
--- a/bin/cash/var.h
+++ b/bin/cash/var.h
@@ -77,6 +77,7 @@ extern struct var vifs;
 extern struct var vmail;
 extern struct var vmpath;
 extern struct var vpath;
+extern struct var vps0;
 extern struct var vps1;
 extern struct var vps2;
 extern struct var vps4;
@@ -103,6 +104,7 @@ extern int initial_localeisutf8;
 #define mailval()	(vmail.text + 5)
 #define mpathval()	(vmpath.text + 9)
 #define pathval()	(vpath.text + 5)
+#define ps0val()	(vps0.text + 4)
 #define ps1val()	(vps1.text + 4)
 #define ps2val()	(vps2.text + 4)
 #define ps4val()	(vps4.text + 4)