This was rejected as it was thought that this would introduce forward compatibility issues. I.E. scripts would rely on this new functionality which would cause portability issues if they were ported to systems without this functionality. From 0d9130e0bd8b4f09be181e8e7afabdacfb872482 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?P=C3=A1draig=20Brady?= Date: Fri, 7 Mar 2008 15:44:34 +0000 Subject: [PATCH] Ensure du outputs a trailing / for directories. * src/du.c: This allows one to distinguish directories in `du -a` output. Suggestion from Thomas Guettler Signed-off-by: Pádraig Brady --- ChangeLog-2008 | 5 +++++ src/du.c | 11 +++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog-2008 b/ChangeLog-2008 index aac9feb..279530a 100644 --- a/ChangeLog-2008 +++ b/ChangeLog-2008 @@ -1,3 +1,8 @@ +2008-03-07 Pádraig Brady + + * src/du.c: Ensure the directories output by du + have a trailing '/' so that they can be distinguished in `du -a` output + 2008-02-07 Jim Meyering We *do* need two different version files. diff --git a/src/du.c b/src/du.c index 6681079..25aaa99 100644 --- a/src/du.c +++ b/src/du.c @@ -437,7 +437,7 @@ print_only_size (uintmax_t n_bytes) /* Print size (and optionally time) indicated by *PDUI, followed by STRING. */ static void -print_size (const struct duinfo *pdui, const char *string) +print_size (const struct duinfo *pdui, const char *string, const struct stat *sb) { print_only_size (pdui->size); if (opt_time) @@ -445,7 +445,10 @@ print_size (const struct duinfo *pdui, const char *string) putchar ('\t'); show_date (time_format, pdui->tmax); } - printf ("\t%s%c", string, opt_nul_terminate_output ? '\0' : '\n'); + printf ("\t%s%s%c", + string, + sb && S_ISDIR(sb->st_mode) ? "/" : "", + opt_nul_terminate_output ? '\0' : '\n'); fflush (stdout); } @@ -607,7 +610,7 @@ process_file (FTS *fts, FTSENT *ent) if ((IS_DIR_TYPE (ent->fts_info) && level <= max_depth) || ((opt_all && level <= max_depth) || level == 0)) - print_size (&dui_to_print, file); + print_size (&dui_to_print, file, sb); return ok; } @@ -653,7 +656,7 @@ du_files (char **files, int bit_flags) } if (print_grand_total) - print_size (&tot_dui, _("total")); + print_size (&tot_dui, _("total"), NULL); return ok; } -- 1.5.3.6