From 007af3537d18c15de1e632e5731ee57b5b817067 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 12 Apr 2017 13:41:10 -0500 Subject: Default to -b rather than -q when output is to a tty. --- toys/posix/ls.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'toys/posix/ls.c') 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 -- cgit v1.2.3