summaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
authorDenys Vlasenko2017-09-13 22:48:30 +0200
committerDenys Vlasenko2017-09-13 22:48:30 +0200
commit8187e0143874e1bf0412263e716cf8c782a5aa16 (patch)
tree289b592b43a7226bbd355728798930c9ead45893 /coreutils/ls.c
parent136946c3ea6a14d391b5045b5eb71fa8ec207077 (diff)
downloadbusybox-8187e0143874e1bf0412263e716cf8c782a5aa16.zip
busybox-8187e0143874e1bf0412263e716cf8c782a5aa16.tar.gz
*: 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/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 af5e6cb..a4e324b 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