summary refs log tree commit diff
path: root/bin/catsh/var.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2019-04-19 20:00:31 -0400
committerJune McEnroe <june@causal.agency>2019-04-19 20:00:31 -0400
commitbcdb7dddd78f94fd835908574b8661e58e40f5d8 (patch)
tree57f054912f0ab8d8e4f377646960a59669a90912 /bin/catsh/var.c
parentSimplify ENV default value in catsh.1 (diff)
downloadsrc-bcdb7dddd78f94fd835908574b8661e58e40f5d8.tar.gz
src-bcdb7dddd78f94fd835908574b8661e58e40f5d8.zip
Set PS1 to \$ by default
Just a simplification of presumably old behavior.
Diffstat (limited to 'bin/catsh/var.c')
-rw-r--r--bin/catsh/var.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/bin/catsh/var.c b/bin/catsh/var.c
index f11ff8b7..435d3307 100644
--- a/bin/catsh/var.c
+++ b/bin/catsh/var.c
@@ -129,9 +129,8 @@ static const struct varinit varinit[] = {
 	  changepath },
 	{ &vps0,	VUNSET,				"PS0=",
 	  NULL },
-	/*
-	 * vps1 depends on uid
-	 */
+	{ &vps1,	0,				"PS1=\\$ ",
+	  NULL },
 	{ &vps2,	0,				"PS2=> ",
 	  NULL },
 	{ &vps4,	0,				"PS4=+ ",
@@ -194,15 +193,6 @@ initvar(void)
 		vp->flags = ip->flags | VSTRFIXED | VTEXTFIXED;
 		vp->func = ip->func;
 	}
-	/*
-	 * PS1 depends on uid
-	 */
-	if (find_var("PS1", &vpp, &vps1.name_len) == NULL) {
-		vps1.next = *vpp;
-		*vpp = &vps1;
-		vps1.text = __DECONST(char *, geteuid() ? "PS1=$ " : "PS1=# ");
-		vps1.flags = VSTRFIXED|VTEXTFIXED;
-	}
 	fmtstr(ppid, sizeof(ppid), "%d", (int)getppid());
 	setvarsafe("PPID", ppid, 0);
 	for (envp = environ ; *envp ; envp++) {