From 479184e22636ff8067218fb244ba245111996d5d Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 10 Feb 2005 09:51:12 +0000 Subject: [PATCH] fix a/r/R commands when q is encountered 2005-02-10 Paolo Bonzini * testsuite/appquit.good, testsuite/appquit.inp, testsuite/appquit.sed: New testcase. * testsuite/readin.sed: Quit after the last r command. * testsuite/readin.good: Adjust. * sed/execute.c (execute_program): Dump the results of the a/r/R commands just before quitting. git-archimport-id: bonzini@gnu.org--2004b/sed--stable--4.1--patch-44 --- ChangeLog | 9 +++++++++ NEWS | 5 +++++ sed/execute.c | 1 + testsuite/Makefile.am | 3 ++- testsuite/Makefile.tests | 2 +- testsuite/appquit.good | 2 ++ testsuite/appquit.inp | 1 + testsuite/appquit.sed | 4 ++++ testsuite/readin.good | 2 -- testsuite/readin.sed | 1 + 10 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 testsuite/appquit.good create mode 100644 testsuite/appquit.inp create mode 100644 testsuite/appquit.sed diff --git a/ChangeLog b/ChangeLog index 57ce223..6499abc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2005-02-10 Paolo Bonzini + + * testsuite/appquit.good, testsuite/appquit.inp, + testsuite/appquit.sed: New testcase. + * testsuite/readin.sed: Quit after the last r command. + * testsuite/readin.good: Adjust. + * sed/execute.c (execute_program): Dump the results of the + a/r/R commands just before quitting. + 2005-02-10 Paolo Bonzini * sed/regexp.c: Fix off-by-one error in the "invalid reference diff --git a/NEWS b/NEWS index 7d864ee..725240d 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +Sed 4.1.5 + +* output the result of commands a, r, R when a q command is found. + +---------------------------------------------------------------------------- Sed 4.1.4 * \B correctly means "not on a word boundary" rather than "inside a word" diff --git a/sed/execute.c b/sed/execute.c index fb3f509..e05dbb9 100644 --- a/sed/execute.c +++ b/sed/execute.c @@ -1466,6 +1466,7 @@ execute_program(vec, input) case 'q': if (!no_default_output) output_line(line.active, line.length, line.chomped, &output_file); + dump_append_queue(); case 'Q': return cur_cmd->x.int_arg == -1 ? 0 : cur_cmd->x.int_arg; diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am index 38b58b7..febb928 100644 --- a/testsuite/Makefile.am +++ b/testsuite/Makefile.am @@ -17,7 +17,7 @@ SEDTESTS += space endif SEDTESTS += \ - enable sep inclib 8bit newjis xabcx dollar noeol noeolw \ + appquit enable sep inclib 8bit newjis xabcx dollar noeol noeolw \ numsub numsub2 numsub3 numsub4 numsub5 0range bkslashes \ head madding mac-mf empty xbxcx xbxcx3 recall recall2 xemacs \ fasts uniq manis khadafy linecnt eval distrib 8to7 \ @@ -35,6 +35,7 @@ EXTRA_DIST = \ 8bit.good 8bit.inp 8bit.sed \ 8to7.good 8to7.inp 8to7.sed \ allsub.good allsub.inp allsub.sed \ + appquit.good appquit.inp appquit.sed \ binary.good binary.inp binary.sed binary2.sed binary3.sed \ bkslashes.good bkslashes.inp bkslashes.sed \ bsd.good bsd.sh \ diff --git a/testsuite/Makefile.tests b/testsuite/Makefile.tests index 8a832cc..3ff8590 100644 --- a/testsuite/Makefile.tests +++ b/testsuite/Makefile.tests @@ -13,7 +13,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 \ -fasts uniq manis linecnt khadafy allsub flipcase space:: +appquit fasts uniq manis linecnt khadafy allsub flipcase space:: $(SEDENV) $(SED) -f $(srcdir)/$@.sed \ < $(srcdir)/$@.inp > $@.out $(CMP) $(srcdir)/$@.good $@.out diff --git a/testsuite/appquit.good b/testsuite/appquit.good new file mode 100644 index 0000000..0742c8e --- /dev/null +++ b/testsuite/appquit.good @@ -0,0 +1,2 @@ +doh +ok diff --git a/testsuite/appquit.inp b/testsuite/appquit.inp new file mode 100644 index 0000000..a2300c9 --- /dev/null +++ b/testsuite/appquit.inp @@ -0,0 +1 @@ +doh diff --git a/testsuite/appquit.sed b/testsuite/appquit.sed new file mode 100644 index 0000000..fc11774 --- /dev/null +++ b/testsuite/appquit.sed @@ -0,0 +1,4 @@ +# Test appending quit +a\ +ok +q diff --git a/testsuite/readin.good b/testsuite/readin.good index a3ba1b6..479a444 100644 --- a/testsuite/readin.good +++ b/testsuite/readin.good @@ -17,5 +17,3 @@ MOO MOO I live here, too. MOO - I want freedom just as you.'' - ``The Weary Blues'', Langston Hughes diff --git a/testsuite/readin.sed b/testsuite/readin.sed index adcc6bc..fac07a4 100644 --- a/testsuite/readin.sed +++ b/testsuite/readin.sed @@ -1 +1,2 @@ /\.$/r readin.in2 +/too\.$/q