aboutsummaryrefslogtreecommitdiffstats
path: root/main.c
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2018-08-02 20:43:56 +0300
committerArnold D. Robbins <arnold@skeeve.com>2018-08-02 20:43:56 +0300
commitb32c67e0f99672ad4104cee4695b5eb040df16f4 (patch)
treef59c2329e2183fb12e4496306bb7893620bb966c /main.c
parentb98257919b20bdfc14f363761cc6215c1ad8bcee (diff)
parent3998ed059bbcfc189cd0d6c5762913fbd4ff4e77 (diff)
downloadegawk-b32c67e0f99672ad4104cee4695b5eb040df16f4.tar.gz
egawk-b32c67e0f99672ad4104cee4695b5eb040df16f4.tar.bz2
egawk-b32c67e0f99672ad4104cee4695b5eb040df16f4.zip
Merge branch 'gawk-4.2-stable' into feature/gnulib-regex
Diffstat (limited to 'main.c')
-rw-r--r--main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.c b/main.c
index 25a628ba..4e94bddd 100644
--- a/main.c
+++ b/main.c
@@ -1165,11 +1165,18 @@ arg_assign(char *arg, bool initing)
fatal(_("cannot use function `%s' as variable name"), arg);
}
+ // POSIX disallows any newlines inside strings
+ // The scanner handles that for program files.
+ // We have to check here for strings passed to -v.
+ if (do_posix && strchr(cp, '\n') != NULL)
+ fatal(_("POSIX does not allow physical newlines in string values"));
+
/*
* BWK awk expands escapes inside assignments.
* This makes sense, so we do it too.
+ * In addition, remove \-<newline> as in scanning.
*/
- it = make_str_node(cp, strlen(cp), SCAN);
+ it = make_str_node(cp, strlen(cp), SCAN | ELIDE_BACK_NL);
it->flags |= USER_INPUT;
#ifdef LC_NUMERIC
/*