summaryrefslogtreecommitdiff
path: root/bin/ksh/lex.c
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-09-11 18:02:28 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-09-11 18:02:28 +0000
commit5f2b641bd1b241c22edb6c493f472a4bb446a463 (patch)
tree43e370dd483fdcff55615b0a3d92782d75181f12 /bin/ksh/lex.c
parent17f93f987c477cb6765780b9c59e7b41af5740f1 (diff)
Fix " handling in here documents. POSIX says they are not special, so
cat << EOF \" EOF should print \" Fixes PR 4472; testing jmc@ and Adam Montague. ok millert@
Diffstat (limited to 'bin/ksh/lex.c')
-rw-r--r--bin/ksh/lex.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/ksh/lex.c b/bin/ksh/lex.c
index b06c590dd1f..5a5345a1903 100644
--- a/bin/ksh/lex.c
+++ b/bin/ksh/lex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lex.c,v 1.36 2005/03/30 17:16:37 deraadt Exp $ */
+/* $OpenBSD: lex.c,v 1.37 2005/09/11 18:02:27 otto Exp $ */
/*
* lexical analysis and source input
@@ -289,10 +289,16 @@ yylex(int cf)
case '\\':
c = getsc();
switch (c) {
- case '"': case '\\':
+ case '\\':
case '$': case '`':
*wp++ = QCHAR, *wp++ = c;
break;
+ case '"':
+ if ((cf & HEREDOC) == 0) {
+ *wp++ = QCHAR, *wp++ = c;
+ break;
+ }
+ /* FALLTROUGH */
default:
Xcheck(ws, wp);
if (c) { /* trailing \ is lost */