[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: $HOME does not get abbreviated in prompt \w output when there is a t
From: |
Eric Blake |
Subject: |
Re: $HOME does not get abbreviated in prompt \w output when there is a trailing slash |
Date: |
Fri, 23 May 2014 06:13:13 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 |
On 05/23/2014 02:32 AM, Libor Pechacek wrote:
> +++ b/general.c
> @@ -699,7 +699,10 @@ polite_directory_format (name)
> int l;
>
> home = get_string_value ("HOME");
> - l = home ? strlen (home) : 0;
> +
> + /* remove trailing slashes from $HOME before comparisons */
> + for (l = home ? strlen (home) : 0; l > 1 && home[l-1] == '/'; l--);
> +
Does this still work correctly on systems where / and // are distinct
(as allowed by POSIX) and someone has set $HOME to //?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature