aboutsummaryrefslogtreecommitdiff
path: root/coreutils/ls.c
diff options
context:
space:
mode:
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 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