Page MenuHomeFreeBSD

D18663.id52339.diff
No OneTemporary

D18663.id52339.diff

Index: bin/sh/parser.c
===================================================================
--- bin/sh/parser.c
+++ bin/sh/parser.c
@@ -1978,6 +1978,7 @@
{
static char ps[PROMPTLEN];
const char *fmt;
+ const char *home;
const char *pwd;
int i, trim;
static char internal_error[] = "??";
@@ -2039,8 +2040,19 @@
*pwd == '/' && pwd[1] != '\0')
strlcpy(&ps[i], strrchr(pwd, '/') + 1,
PROMPTLEN - i);
- else
- strlcpy(&ps[i], pwd, PROMPTLEN - i);
+ else {
+ home = lookupvar("HOME");
+ if (home != NULL && strncmp(pwd, home,
+ strlen(home)) == 0) {
+ strlcpy(&ps[i], "~",
+ PROMPTLEN - i);
+ strlcpy(&ps[i + 1],
+ pwd + strlen(home),
+ PROMPTLEN - i);
+ } else {
+ strlcpy(&ps[i], pwd, PROMPTLEN - i);
+ }
+ }
/* Skip to end of path. */
while (ps[i + 1] != '\0')
i++;

File Metadata

Mime Type
text/plain
Expires
Sun, Sep 6, 5:38 PM (15 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38392785
Default Alt Text
D18663.id52339.diff (893 B)

Event Timeline