Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/bin/ksh The following should print \"; from OpenBSD
details: https://anonhg.NetBSD.org/src/rev/92b11b077319
branches: trunk
changeset: 584229:92b11b077319
user: christos <christos%NetBSD.org@localhost>
date: Sun Sep 11 22:16:00 2005 +0000
description:
The following should print \"; from OpenBSD
$ cat << EOF
\"
EOF
diffstat:
bin/ksh/exec.c | 6 +++---
bin/ksh/lex.c | 12 +++++++++---
bin/ksh/lex.h | 5 +++--
3 files changed, 15 insertions(+), 8 deletions(-)
diffs (87 lines):
diff -r ecc2c4846c42 -r 92b11b077319 bin/ksh/exec.c
--- a/bin/ksh/exec.c Sun Sep 11 22:15:19 2005 +0000
+++ b/bin/ksh/exec.c Sun Sep 11 22:16:00 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.11 2005/06/26 19:09:00 christos Exp $ */
+/* $NetBSD: exec.c,v 1.12 2005/09/11 22:16:00 christos Exp $ */
/*
* execute command tree
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: exec.c,v 1.11 2005/06/26 19:09:00 christos Exp $");
+__RCSID("$NetBSD: exec.c,v 1.12 2005/09/11 22:16:00 christos Exp $");
#endif
@@ -1484,7 +1484,7 @@
s = pushs(SSTRING, ATEMP);
s->start = s->str = content;
source = s;
- if (yylex(ONEWORD) != LWORD)
+ if (yylex(ONEWORD|HEREDOC) != LWORD)
internal_errorf(1, "herein: yylex");
source = osource;
shf_puts(evalstr(yylval.cp, 0), shf);
diff -r ecc2c4846c42 -r 92b11b077319 bin/ksh/lex.c
--- a/bin/ksh/lex.c Sun Sep 11 22:15:19 2005 +0000
+++ b/bin/ksh/lex.c Sun Sep 11 22:16:00 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lex.c,v 1.11 2005/04/19 20:14:29 rillig Exp $ */
+/* $NetBSD: lex.c,v 1.12 2005/09/11 22:16:00 christos Exp $ */
/*
* lexical analysis and source input
@@ -6,7 +6,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lex.c,v 1.11 2005/04/19 20:14:29 rillig Exp $");
+__RCSID("$NetBSD: lex.c,v 1.12 2005/09/11 22:16:00 christos Exp $");
#endif
@@ -248,10 +248,16 @@
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 */
diff -r ecc2c4846c42 -r 92b11b077319 bin/ksh/lex.h
--- a/bin/ksh/lex.h Sun Sep 11 22:15:19 2005 +0000
+++ b/bin/ksh/lex.h Sun Sep 11 22:16:00 2005 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: lex.h,v 1.6 2004/07/07 19:20:09 mycroft Exp $ */
+/* $NetBSD: lex.h,v 1.7 2005/09/11 22:16:00 christos Exp $ */
/*
* Source input, lexer and parser
*/
-/* $Id: lex.h,v 1.6 2004/07/07 19:20:09 mycroft Exp $ */
+/* $Id: lex.h,v 1.7 2005/09/11 22:16:00 christos Exp $ */
#define IDENT 64
@@ -115,6 +115,7 @@
#define ESACONLY BIT(7) /* only accept esac keyword */
#define CMDWORD BIT(8) /* parsing simple command (alias related) */
#define HEREDELIM BIT(9) /* parsing <<,<<- delimiter */
+#define HEREDOC BIT(10) /* parsing heredoc */
#define HERES 10 /* max << in line */
Home |
Main Index |
Thread Index |
Old Index