From 8187e0143874e1bf0412263e716cf8c782a5aa16 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 13 Sep 2017 22:48:30 +0200 Subject: *: 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 --- coreutils/ls.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'coreutils') 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 { IF_FEATURE_LS_TIMESTAMPS(time(&G.current_time_t);) \ } while (0) +#define ESC "\033" + /*** Output code ***/ @@ -586,12 +588,12 @@ static NOINLINE unsigned display_single(const struct dnode *dn) if (!mode) if (lstat(dn->fullname, &statbuf) == 0) mode = statbuf.st_mode; - printf("\033[%u;%um", bold(mode), fgcolor(mode)); + printf(ESC"[%u;%um", bold(mode), fgcolor(mode)); } #endif column += print_name(dn->name); if (G_show_color) { - printf("\033[0m"); + printf(ESC"[m"); } if (lpath) { @@ -609,7 +611,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) # endif # if ENABLE_FEATURE_LS_COLOR if (G_show_color) { - printf("\033[%u;%um", bold(mode), fgcolor(mode)); + printf(ESC"[%u;%um", bold(mode), fgcolor(mode)); } # endif } @@ -617,7 +619,7 @@ static NOINLINE unsigned display_single(const struct dnode *dn) column += print_name(lpath) + 4; free(lpath); if (G_show_color) { - printf("\033[0m"); + printf(ESC"[m"); } } #if ENABLE_FEATURE_LS_FILETYPES -- cgit v1.2.3