aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2017-04-12 13:41:10 -0500
committerRob Landley <rob@landley.net>2017-04-12 13:41:10 -0500
commit007af3537d18c15de1e632e5731ee57b5b817067 (patch)
tree16f97912a09674dab23352f94552f65d81982dae
parenta9c20a4ad92199b1c67e09d6e4d5b9e1cc9609e1 (diff)
downloadtoybox-007af3537d18c15de1e632e5731ee57b5b817067.tar.gz
Default to -b rather than -q when output is to a tty.
-rw-r--r--toys/posix/ls.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/toys/posix/ls.c b/toys/posix/ls.c
index 8dc5536e..35a7266a 100644
--- a/toys/posix/ls.c
+++ b/toys/posix/ls.c
@@ -524,14 +524,9 @@ void ls_main(void)
char **s, *noargs[] = {".", 0};
struct dirtree *dt;
- TT.screen_width = 80;
- terminal_size(&TT.screen_width, NULL);
- if (TT.screen_width<2) TT.screen_width = 2;
- if (toys.optflags&FLAG_b) TT.escmore = " \\";
-
// Do we have an implied -1
if (isatty(1)) {
- if (!(toys.optflags&FLAG_show_control_chars)) toys.optflags |= FLAG_q;
+ if (!(toys.optflags&FLAG_show_control_chars)) toys.optflags |= FLAG_b;
if (toys.optflags&(FLAG_l|FLAG_o|FLAG_n|FLAG_g)) toys.optflags |= FLAG_1;
else if (!(toys.optflags&(FLAG_1|FLAG_x|FLAG_m))) toys.optflags |= FLAG_C;
} else {
@@ -539,6 +534,11 @@ void ls_main(void)
if (TT.color) toys.optflags ^= FLAG_color;
}
+ TT.screen_width = 80;
+ terminal_size(&TT.screen_width, NULL);
+ if (TT.screen_width<2) TT.screen_width = 2;
+ if (toys.optflags&FLAG_b) TT.escmore = " \\";
+
// The optflags parsing infrastructure should really do this for us,
// but currently it has "switch off when this is set", so "-dR" and "-Rd"
// behave differently