diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2005-06-10 19:31:45 +0000 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2005-06-10 19:31:45 +0000 |
commit | 9756cac52fe32096eb9a84e18ac139c04b7b7f49 (patch) | |
tree | 01bac42b824dd006c92e5280394de7c35a05fbb2 | |
parent | 2de803d91b5b0f019e02af3f1d9e709bc0e36d9e (diff) | |
download | coreutils-9756cac52fe32096eb9a84e18ac139c04b7b7f49.tar.xz |
(any_has_acl): New var.
(clear_files): Clear it.
(gobble_file): Set it if a file has an ACL.
(print_long_format): Omit needless space unless some file has an ACL.
-rw-r--r-- | src/ls.c | 17 |
1 files changed, 15 insertions, 2 deletions
@@ -336,6 +336,15 @@ static struct pending *pending_dirs; static time_t current_time = TYPE_MINIMUM (time_t); static int current_time_ns = -1; +/* Whether any of the files has an ACL. This affects the width of the + mode column. */ + +#if HAVE_ACL +static bool any_has_acl; +#else +enum { any_has_acl = false }; +#endif + /* The number of columns to use for columns containing inode numbers, block sizes, link counts, owners, groups, authors, major device numbers, minor device numbers, and file sizes, respectively. */ @@ -2450,6 +2459,9 @@ clear_files (void) } files_index = 0; +#if HAVE_ACL + any_has_acl = false; +#endif inode_number_width = 0; block_size_width = 0; nlink_width = 0; @@ -2563,6 +2575,7 @@ gobble_file (char const *name, enum filetype type, bool command_line_arg, { int n = file_has_acl (absolute_name, &f->stat); f->have_acl = (0 < n); + any_has_acl |= f->have_acl; if (n < 0) error (0, errno, "%s", quotearg_colon (absolute_name)); } @@ -3219,7 +3232,7 @@ print_long_format (const struct fileinfo *f) mode_string (ST_DM_MODE (f->stat), modebuf); modebuf[10] = (FILE_HAS_ACL (f) ? '+' : ' '); - modebuf[11] = '\0'; + modebuf[10 + any_has_acl] = '\0'; switch (time_type) { @@ -3268,7 +3281,7 @@ print_long_format (const struct fileinfo *f) sprintf (p, "%s %*s ", modebuf, nlink_width, umaxtostr (f->stat.st_nlink, hbuf)); } - p += sizeof modebuf + nlink_width + 1; + p += sizeof modebuf - 2 + any_has_acl + 1 + nlink_width + 1; DIRED_INDENT (); |