Diego Pettenò complained that "ls -l" doesn't use the UTF-8 arrow character to show where symlinks point to. This tiny patch fixes that. With this applied the character is used when the CODESET is UTF-8 otherwise we fall back to the traditional "->" arrow.
Ah, "ls -l" is so much prettier now with this oh-so-important patch! For verification: http://pastie.org/573270 This will of course break scripts that try to parse the output of "ls -l" and look for "->". But quite frankly those scripts are broken anyway and should be using "LC_MESSAGES=C" or suchlike. One could argue this breakage might even be desirable. --- src/ls.c | 16 ++++++++++++++++ 1 files changed, 16 insertions(+), 0 deletions(-) diff --git a/src/ls.c b/src/ls.c index 07e9cf1..f7a838f 100644 --- a/src/ls.c +++ b/src/ls.c @@ -3749,7 +3749,23 @@ print_long_format (const struct fileinfo *f) { if (f->linkname) { +#ifdef HAVE_NL_LANGINFO + static const char *arrow = NULL; + + if (!arrow) + { + const char *cs; + cs = nl_langinfo(CODESET); + + if (cs && strcmp(cs, "UTF-8") == 0) + arrow = " \xe2\x86\x92 "; + else + arrow = " -> "; + } + DIRED_FPUTS_LITERAL (arrow, stdout); +#else DIRED_FPUTS_LITERAL (" -> ", stdout); +#endif print_name_with_quoting (f->linkname, f->linkmode, f->linkok - 1, f->stat_ok, f->filetype, NULL, f->stat.st_nlink, (p - buf) + w + 4); -- 1.6.4 Lennart -- Lennart Poettering Red Hat, Inc. lennart [at] poettering [dot] net ICQ# 11060553 http://0pointer.net/lennart/ GnuPG 0x1A015CC4