aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2017-09-27 10:08:12 +0100
committerRon Yorston <rmy@pobox.com>2017-09-27 10:11:19 +0100
commitd9383e984da8de72e61e5094a3cf6404c5707ddc (patch)
treedd42825854fc42aea40d4f7a95548d53721d1733 /coreutils/ls.c
parent166b3e4e82799f87d3b002c7177891111eff079e (diff)
parent0c4dbd481aedb5d22c1048e7f7eb547a3b5e50a5 (diff)
downloadbusybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.tar.gz
busybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.tar.bz2
busybox-w32-d9383e984da8de72e61e5094a3cf6404c5707ddc.zip
Merge branch 'busybox' into merge
Diffstat (limited to 'coreutils/ls.c')
-rw-r--r--coreutils/ls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 9f0462936..22286d713 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -347,6 +347,8 @@ struct globals {
347 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \ 347 IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \
348} while (0) 348} while (0)
349 349
350#define ESC "\033"
351
350 352
351/*** Output code ***/ 353/*** Output code ***/
352 354
@@ -586,12 +588,12 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
586 if (!mode) 588 if (!mode)
587 if (lstat(dn->fullname, &statbuf) == 0) 589 if (lstat(dn->fullname, &statbuf) == 0)
588 mode = statbuf.st_mode; 590 mode = statbuf.st_mode;
589 printf("\033[%u;%um", bold(mode), fgcolor(mode)); 591 printf(ESC"[%u;%um", bold(mode), fgcolor(mode));
590 } 592 }
591#endif 593#endif
592 column += print_name(dn->name); 594 column += print_name(dn->name);
593 if (G_show_color) { 595 if (G_show_color) {
594 printf("\033[0m"); 596 printf(ESC"[m");
595 } 597 }
596 598
597 if (lpath) { 599 if (lpath) {
@@ -609,7 +611,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
609# endif 611# endif
610# if ENABLE_FEATURE_LS_COLOR 612# if ENABLE_FEATURE_LS_COLOR
611 if (G_show_color) { 613 if (G_show_color) {
612 printf("\033[%u;%um", bold(mode), fgcolor(mode)); 614 printf(ESC"[%u;%um", bold(mode), fgcolor(mode));
613 } 615 }
614# endif 616# endif
615 } 617 }
@@ -617,7 +619,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
617 column += print_name(lpath) + 4; 619 column += print_name(lpath) + 4;
618 free(lpath); 620 free(lpath);
619 if (G_show_color) { 621 if (G_show_color) {
620 printf("\033[0m"); 622 printf(ESC"[m");
621 } 623 }
622 } 624 }
623#if ENABLE_FEATURE_LS_FILETYPES 625#if ENABLE_FEATURE_LS_FILETYPES