summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@engin.umich.edu>1996-12-08 14:58:32 -0500
committerChip Salzenberg <chip@atlantic.net>1996-12-19 16:44:00 +1200
commit35617a9ea5dfb088885c21ff0af766189f92eaa2 (patch)
tree5c5c8ec73abf52852d25cde8a191b49600db0439
parent6a3992aa749356d657a4c0e14be8c2f4c2f4f999 (diff)
downloadperl-35617a9ea5dfb088885c21ff0af766189f92eaa2.tar.gz
Re: Bug in formline
On Sun, 08 Dec 1996 19:06:42 +0100, Gary Howland wrote: >Is this a bug? > >The following program: > > #!/usr/local/bin/perl -w > > sub format_text > { > my $format = shift; > $^A = ""; > formline($format, @_); > return $^A; > } > > my $picture = ' > A: @<<< > B: @||| > C: @>>> > '; > > print format_text($picture, 1, 2, 3); > >gives this output: > > A: 1 > B: 2 > C: 3 > >when I would have expected: > > A: 1 > B: 2 > C: 3 > >it seems that the carriage returns are incorrectly placed. > > >If I change $picture to this: > > my $picture = ' > A: @<<< a > B: @||| b > C: @>>> c > '; > >I get a segmentation violation from perl. The latter should work flawlessly in 5.003_05 and later ("my" variables as formline picture arguments were broken before). The attached patch (against 5.00308, but should apply clean over 3_11 as well), should cure the first problem. - Sarathy. gsar@engin.umich.edu p5p-msgid: <199612081958.OAA26025@aatma.engin.umich.edu>
-rw-r--r--pp_ctl.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 962cf041c1..1e0825a85e 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -2362,13 +2362,12 @@ SV *sv;
skipspaces++;
arg -= skipspaces;
if (arg) {
- if (postspace) {
+ if (postspace)
*fpc++ = FF_SPACE;
- postspace = FALSE;
- }
*fpc++ = FF_LITERAL;
*fpc++ = arg;
}
+ postspace = FALSE;
if (s <= send)
skipspaces--;
if (skipspaces) {