GNU bug report logs -
#22460
'y' command doesn't allow a comment after it one the same line
Previous Next
Full log
View this message in rfc822 format
Unlike other commands, the current implementation of the 'y' command does not allow a comment on the same line if the command is not "terminated" by a ';'
For example (the comments are part of the program):
s/1/a/g # Substitute 1's by a's
x # Swapping hold and pattern buffer
1d # Deleting the first line
...
works, but
y/1/a/ # Substitute 1's by a's
produces:
sed: -e expression #1, char 8: extra characters after command
This patch fixes this.
Greets,
Thorsten
---
sed/compile.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sed/compile.c b/sed/compile.c
index 270caaf..442aeb5 100644
--- a/sed/compile.c
+++ b/sed/compile.c
@@ -1329,7 +1329,10 @@ compile_program(struct vector *vector)
cur_cmd->x.translate = translate;
}
- if ((ch = in_nonblank()) != EOF && ch != '\n' && ch != ';')
+ ch = in_nonblank();
+ if (ch == CLOSE_BRACE || ch == '#')
+ savchar(ch);
+ else if (ch != EOF && ch != '\n' && ch != ';')
bad_prog(_(EXCESS_JUNK));
free_buffer(b);
--
2.4.10
This bug report was last modified 8 years and 98 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.