diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2018-07-31 09:21:43 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2018-07-31 09:21:43 +0300 |
commit | 86b063b99d78df97fcd761073f437ce00b018712 (patch) | |
tree | 6f834ea3d46ecb541bd6a722e565a83aac0e2268 /main.c | |
parent | f856979d85ace61bfeb2d31146485ec668202ad8 (diff) | |
download | egawk-86b063b99d78df97fcd761073f437ce00b018712.tar.gz egawk-86b063b99d78df97fcd761073f437ce00b018712.tar.bz2 egawk-86b063b99d78df97fcd761073f437ce00b018712.zip |
Fix handling of physical newlines in -v arguments and related improvemnts.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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 /* |