coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] ls: allow stat-free use of --color


From: Pádraig Brady
Subject: Re: [PATCH] ls: allow stat-free use of --color
Date: Wed, 11 May 2011 18:00:40 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

On 11/05/11 16:52, Jim Meyering wrote:
> diff --git a/src/ls.c b/src/ls.c
> index 4262923..54876ce 100644
> --- a/src/ls.c
> +++ b/src/ls.c
> @@ -2740,7 +2740,10 @@ gobble_file (char const *name, enum filetype type, 
> ino_t inode,
>        /* When coloring a directory (we may know the type from
>           direct.d_type), we have to stat it in order to indicate
>           sticky and/or other-writable attributes.  */
> -      || (type == directory && print_with_color)
> +      || (type == directory && print_with_color
> +          && (is_colored (C_OTHER_WRITABLE)
> +              || is_colored (C_STICKY)
> +              || is_colored (C_STICKY_OTHER_WRITABLE)))
>        /* When dereferencing symlinks, the inode and type must come from
>           stat, but readdir provides the inode and type of lstat.  */
>        || ((print_inode || format_needs_type)

Looks good.

Cool, my `l`¹ script will no longer stat dirs now,
as it disables these colors in preference to highlighting
the pertinent bit of the permissions string.

cheers,
Pádraig.

¹ http://www.pixelbeat.org/scripts/l



reply via email to

[Prev in Thread] Current Thread [Next in Thread]