fix '/foo/i\'

2007-01-26  Paolo Bonzini  <bonzini@gnu.org>

	* sed/compile.c (check_final_program): Don't set text if the
	pending_text is initialized but empty.
	* sed/execute.c (output_line): Don't print text if it is NULL.
	* tests/Makefile.am (TESTS): Add insert.
	* tests/Makefile.tests (insert): New.
	* tests/insert.good, tests/insert.sed, tests/insert.inp: New
	testcase from Jonas Koelker.

git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-92
This commit is contained in:
Paolo Bonzini committed 2008-01-09 16:12:25 +01:00
1 parent 068afd076e
commit e022b2c87b
8 files changed
+24 -6

No files matched your search

+10
View File
@@ -1,3 +1,13 @@
2007-01-26 Paolo Bonzini <bonzini@gnu.org>
* sed/compile.c (check_final_program): Don't set text if the
pending_text is initialized but empty.
* sed/execute.c (output_line): Don't print text if it is NULL.
* tests/Makefile.am (TESTS): Add insert.
* tests/Makefile.tests (insert): New.
* tests/insert.good, tests/insert.sed, tests/insert.inp: New
testcase from Jonas Koelker.
2006-12-29 Paolo Bonzini <bonzini@gnu.org>
* sed/compile.c: Fix warnings.
+3 -2
View File
@@ -1621,8 +1621,9 @@ check_final_program(program)
if (pending_text)
{
old_text_buf->text_length = size_buffer(pending_text);
old_text_buf->text = MEMDUP(get_buffer(pending_text),
old_text_buf->text_length, char);
if (old_text_buf->text_length)
old_text_buf->text = MEMDUP(get_buffer(pending_text),
old_text_buf->text_length, char);
free_buffer(pending_text);
pending_text = NULL;
}
+3 -2
View File
@@ -559,11 +559,12 @@ output_line(text, length, nl, outf)
bool nl;
struct output *outf;
{
output_missing_newline(outf);
if (!text)
return;
output_missing_newline(outf);
if (length)
ck_fwrite(text, 1, length, outf->fp);
if (nl)
ck_fwrite("\n", 1, 1, outf->fp);
else
+1 -1
View File
@@ -22,7 +22,7 @@ SEDTESTS += \
head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \
fasts uniq manis khadafy linecnt eval distrib 8to7 y-bracket \
y-newline allsub cv-vars classes middle bsd stdin flipcase \
insens subwrite writeout readin \
insens subwrite writeout readin insert \
help version file quiet \
factor binary3 binary2 binary dc
+1 -1
View File
@@ -14,7 +14,7 @@ RM=rm -f
enable sep inclib 8bit 8to7 newjis xabcx dollar noeol bkslashes \
numsub head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \
appquit fasts uniq manis linecnt khadafy allsub flipcase space modulo \
y-bracket y-newline::
y-bracket y-newline insert::
$(SEDENV) $(SED) -f $(srcdir)/$@.sed \
< $(srcdir)/$@.inp > $@.out
$(CMP) $(srcdir)/$@.good $@.out
+3
View File
@@ -0,0 +1,3 @@
bar
foo
+2
View File
@@ -0,0 +1,2 @@
bar
foo
+1
View File
@@ -0,0 +1 @@
/foo/i\