diff options
author | Gurusamy Sarathy <gsar@engin.umich.edu> | 1996-12-08 14:58:32 -0500 |
---|---|---|
committer | Chip Salzenberg <chip@atlantic.net> | 1996-12-19 16:44:00 +1200 |
commit | 35617a9ea5dfb088885c21ff0af766189f92eaa2 (patch) | |
tree | 5c5c8ec73abf52852d25cde8a191b49600db0439 | |
parent | 6a3992aa749356d657a4c0e14be8c2f4c2f4f999 (diff) | |
download | perl-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.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -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) { |