Re patch sent yesterday, my apologies, one bit crept in there by mistake which breaks long listings of orphaned links. Here is revised patch (tested on Intel linux and Compaq TRU64). Alan =========================================================================== diff -r -u fileutils-4.0-ORIG/src/dircolors.h fileutils-4.0-NEW/src/dircolors.h --- fileutils-4.0-ORIG/src/dircolors.h Wed Nov 11 04:53:07 1998 +++ fileutils-4.0-NEW/src/dircolors.h Tue Mar 7 14:19:16 2000 @@ -1,12 +1,12 @@ -#define G_N_LINES 76 +#define G_N_LINES 77 const size_t G_line_length[G_N_LINES] = { - 65, 72, 0, 59, 61, 0, 77, 10, 12, 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, - 10, 10, 0, 73, 64, 18, 64, 19, 72, 25, 72, 68, 22, 22, 27, 17, 19, 34, - 39, 45, 0, 44, 10, 0, 70, 75, 48, 0, 73, 40, 11, 11, 11, 11, 0, 48, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 26, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 9, 9 + 65, 72, 0, 59, 61, 0, 77, 10, 12, 14, 14, 14, 14, 13, 13, 13, 13, 13, + 13, 10, 10, 0, 73, 64, 18, 64, 19, 72, 25, 72, 68, 22, 22, 71, 73, 17, + 19, 34, 39, 45, 0, 44, 10, 0, 70, 75, 48, 0, 73, 40, 11, 11, 11, 11, 0, + 48, 10, 10, 10, 10, 10, 10, 10, 10, 10, 26, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 9, 9 }; const char *const G_line[G_N_LINES] = @@ -44,7 +44,8 @@ "NORMAL 00 # global default, although everything should be something.", "FILE 00 # normal file", "DIR 01;34 # directory", - "LINK 01;36 # symbolic link", + "LINK 01;36 # symbolic link. (If you set this to \"target\" instead of a", + " # numerical value, the color is as for the file pointed to.)", "FIFO 40;33 # pipe", "SOCK 01;35 # socket", "BLK 40;33;01 # block device driver", diff -r -u fileutils-4.0-ORIG/src/ls.c fileutils-4.0-NEW/src/ls.c --- fileutils-4.0-ORIG/src/ls.c Sat Sep 19 18:09:23 1998 +++ fileutils-4.0-NEW/src/ls.c Tue Mar 7 14:19:11 2000 @@ -225,6 +225,17 @@ static int files_index; +/* Nonzero means in a color listing don't treat symlinks (non-orphaned) + specially. Gets set when ":ln=target:" appears in LS_COLORS. */ + +static int no_special_link_color; + +/* mode of appropriate file for colorization */ +#define FILE_OR_LINK_MODE(file) \ + ((no_special_link_color && (file)->linkok) \ + ? (file)->linkmode: (file)->stat.st_mode) + + /* Record of one pending directory waiting to be listed. */ struct pending @@ -1508,6 +1519,9 @@ } } + if (!strncmp(color_indicator[C_LINK].string,"target",6)) + no_special_link_color=1; + if (state < 0) { struct col_ext_type *e; @@ -2329,7 +2343,7 @@ DIRED_INDENT (); DIRED_FPUTS (buf, stdout, p - buf); - print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, + print_name_with_quoting (f->name,FILE_OR_LINK_MODE(f),f->linkok, &dired_obstack); if (f->filetype == symbolic_link) @@ -2428,7 +2442,7 @@ human_readable ((uintmax_t) ST_NBLOCKS (f->stat), buf, ST_NBLOCKSIZE, output_block_size)); - print_name_with_quoting (f->name, f->stat.st_mode, f->linkok, NULL); + print_name_with_quoting (f->name, FILE_OR_LINK_MODE(f), f->linkok, NULL); if (indicator_style != none) print_type_indicator (f->stat.st_mode);