aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-02-28 12:38:08 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-02-28 12:38:08 +0100
commit26d11b8133b3ba71e6e94ff525e45984ddeaef72 (patch)
treee4ee2c004dfeeedb5a2967464fdd835ba8ac6d08
parent9f368e38fbd165144a7398d3e6d8ae68ea97a3e6 (diff)
downloadbusybox-w32-26d11b8133b3ba71e6e94ff525e45984ddeaef72.tar.gz
busybox-w32-26d11b8133b3ba71e6e94ff525e45984ddeaef72.tar.bz2
busybox-w32-26d11b8133b3ba71e6e94ff525e45984ddeaef72.zip
ls: -g implies -l
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/ls.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 8d25b5d5f..da370c74b 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -192,6 +192,8 @@ LIST_LONG = LIST_MODEBITS | LIST_NLINKS | LIST_ID_NAME | LIST_SIZE | \
192/* -KZ SELinux mandated options, busybox optionally supports */ 192/* -KZ SELinux mandated options, busybox optionally supports */
193/* (coreutils 8.4 has no -K, remove it?) */ 193/* (coreutils 8.4 has no -K, remove it?) */
194/* -e I think we made this one up (looks similar to GNU --full-time) */ 194/* -e I think we made this one up (looks similar to GNU --full-time) */
195/* We already used up all 32 bits, if we need to add more, candidates for removal: */
196/* -K, -T, -e (add --full-time instead) */
195static const char ls_options[] ALIGN1 = 197static const char ls_options[] ALIGN1 =
196 "Cadil1gnsxQAk" /* 13 opts, total 13 */ 198 "Cadil1gnsxQAk" /* 13 opts, total 13 */
197 IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */ 199 IF_FEATURE_LS_TIMESTAMPS("cetu") /* 4, 17 */
@@ -202,7 +204,7 @@ static const char ls_options[] ALIGN1 =
202 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */ 204 IF_FEATURE_LS_FOLLOWLINKS("LH") /* 2, 28 */
203 IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */ 205 IF_FEATURE_HUMAN_READABLE("h") /* 1, 29 */
204 IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 31 */ 206 IF_FEATURE_AUTOWIDTH("T:w:") /* 2, 31 */
205 ; 207 /* with --color, we use all 32 bits */;
206enum { 208enum {
207 //OPT_C = (1 << 0), 209 //OPT_C = (1 << 0),
208 //OPT_a = (1 << 1), 210 //OPT_a = (1 << 1),
@@ -267,7 +269,7 @@ static const uint32_t opt_flags[] = {
267 LIST_INO, /* i */ 269 LIST_INO, /* i */
268 LIST_LONG | STYLE_LONG, /* l */ 270 LIST_LONG | STYLE_LONG, /* l */
269 STYLE_SINGLE, /* 1 */ 271 STYLE_SINGLE, /* 1 */
270 0, /* g (don't show owner) - handled via OPT_g */ 272 LIST_LONG | STYLE_LONG, /* g (don't show owner) - handled via OPT_g. assumes l */
271 LIST_ID_NUMERIC | LIST_LONG | STYLE_LONG, /* n (assumes l) */ 273 LIST_ID_NUMERIC | LIST_LONG | STYLE_LONG, /* n (assumes l) */
272 LIST_BLOCKS, /* s */ 274 LIST_BLOCKS, /* s */
273 DISP_ROWS | STYLE_COLUMNAR, /* x */ 275 DISP_ROWS | STYLE_COLUMNAR, /* x */
@@ -733,9 +735,12 @@ static NOINLINE unsigned list_single(const struct dnode *dn)
733 ttime = dn->dstat.st_ctime; 735 ttime = dn->dstat.st_ctime;
734 filetime = ctime(&ttime); 736 filetime = ctime(&ttime);
735 /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */ 737 /* filetime's format: "Wed Jun 30 21:49:08 1993\n" */
736 if (all_fmt & LIST_FULLTIME) 738 if (all_fmt & LIST_FULLTIME) { /* -e */
739 /* Note: coreutils 8.4 ls --full-time prints:
740 * 2009-07-13 17:49:27.000000000 +0200
741 */
737 column += printf("%.24s ", filetime); 742 column += printf("%.24s ", filetime);
738 else { /* LIST_DATE_TIME */ 743 } else { /* LIST_DATE_TIME */
739 /* current_time_t ~== time(NULL) */ 744 /* current_time_t ~== time(NULL) */
740 time_t age = current_time_t - ttime; 745 time_t age = current_time_t - ttime;
741 printf("%.6s ", filetime + 4); /* "Jun 30" */ 746 printf("%.6s ", filetime + 4); /* "Jun 30" */
@@ -1086,7 +1091,7 @@ int ls_main(int argc UNUSED_PARAM, char **argv)
1086 } 1091 }
1087 1092
1088#if ENABLE_FEATURE_LS_COLOR 1093#if ENABLE_FEATURE_LS_COLOR
1089 /* find color bit value - last position for short getopt */ 1094 /* set show_color = 1/0 */
1090 if (ENABLE_FEATURE_LS_COLOR_IS_DEFAULT && isatty(STDOUT_FILENO)) { 1095 if (ENABLE_FEATURE_LS_COLOR_IS_DEFAULT && isatty(STDOUT_FILENO)) {
1091 char *p = getenv("LS_COLORS"); 1096 char *p = getenv("LS_COLORS");
1092 /* LS_COLORS is unset, or (not empty && not "none") ? */ 1097 /* LS_COLORS is unset, or (not empty && not "none") ? */