summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-09-13 22:48:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2017-09-13 22:48:30 +0200
commit8187e0143874e1bf0412263e716cf8c782a5aa16 (patch)
tree289b592b43a7226bbd355728798930c9ead45893 /coreutils
parent136946c3ea6a14d391b5045b5eb71fa8ec207077 (diff)
downloadbusybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.tar.gz
busybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.tar.bz2
busybox-w32-8187e0143874e1bf0412263e716cf8c782a5aa16.zip
*: use ESC define instead of "\033"; use ESC[m instead of ESC[0m
text data bss dec hex filename 922535 481 6832 929848 e3038 busybox_old 922534 481 6832 929847 e3037 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/ls.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/coreutils/ls.c b/coreutils/ls.c
index af5e6cb51..a4e324b00 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