Fix expansion of \W in prompt strings when the working directory is "/".

The prompt string was truncated after \W when the working directory was "/".

PR:		bin/89410
Submitted by:	Dr Balwinder Singh Dheeman
MFC after:	1 week
This commit is contained in:
Jaakko Heinonen 2010-02-24 14:19:56 +00:00
parent 1d800a676e
commit 774ee54045

View File

@ -1641,7 +1641,7 @@ getprompt(void *unused __unused)
case 'w':
ps[i] = '\0';
getcwd(&ps[i], PROMPTLEN - i);
if (*fmt == 'W') {
if (*fmt == 'W' && ps[i + 1] != '\0') {
/* Final path component only. */
trim = 1;
for (j = i; ps[j] != '\0'; j++)