summaryrefslogtreecommitdiff
path: root/src/echo.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2009-10-27 10:04:34 +0000
committerPádraig Brady <P@draigBrady.com>2009-10-28 16:37:07 +0000
commit2904d675a49cdd7cb2372f50592a6823106aa0f7 (patch)
tree4ec374f8d26b4f1ac3e7454233ab0adc732cc2b8 /src/echo.c
parent54491d275184428be6e28e3f22f04859b7288105 (diff)
downloadcoreutils-2904d675a49cdd7cb2372f50592a6823106aa0f7.tar.xz
echo, printf: interpret \e as the Escape character
Match gcc, perl, bash, ksh, tcsh, ... in supporting \e. * src/printf.c (print_escape_char): Output \x1B when \e encountered. * src/echo.c (main): Likewise. * src/stat.c (print_escape_char): Likewise. * doc/coreutils.texi (echo invocation): Add \e to the list. * tests/misc/printf: Verify that \e outputs \x1B. * NEWS: Mention the change in behaviour.
Diffstat (limited to 'src/echo.c')
-rw-r--r--src/echo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/echo.c b/src/echo.c
index 90b978646..65e8c80e4 100644
--- a/src/echo.c
+++ b/src/echo.c
@@ -70,6 +70,7 @@ If -e is in effect, the following sequences are recognized:\n\
"), stdout);
fputs (_("\
\\c produce no further output\n\
+ \\e escape\n\
\\f form feed\n\
\\n new line\n\
\\r carriage return\n\
@@ -203,6 +204,7 @@ just_echo:
case 'a': c = '\a'; break;
case 'b': c = '\b'; break;
case 'c': exit (EXIT_SUCCESS);
+ case 'e': c = '\x1B'; break;
case 'f': c = '\f'; break;
case 'n': c = '\n'; break;
case 'r': c = '\r'; break;