[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gawk-devel] document bug: missing offset in script
From: |
Aharon Robbins |
Subject: |
Re: [gawk-devel] document bug: missing offset in script |
Date: |
Sat, 17 Jan 2009 20:40:32 +0200 |
Greetings. Thanks for this report. I have fixed it in the stable
tree and it will show up in the CVS shortly.
Arnold
> Date: Sat, 17 Jan 2009 02:06:39 +0100
> From: Steffen Schuler <address@hidden>
> To: address@hidden
> Subject: [gawk-devel] document bug: missing offset in script
>
> Greetings.
>
> I found the following bug in subsection 3.8.1 in gawk.texi of gawk-devel=20
> and earlier:
>
> If you apply the script to a text with a one-line C-comment, the closing
> comment-delimiter is not removed from the output.
>
> Fix: use an offset (marked by: # FIX)
>
> {
> t = index($0, "/*")
> if (t != 0) {
> # value of `tmpĀ“ will be "" if t is 1
> tmp = substr($0, 1, t - 1)
> u = index(substr($0, t + 2), "*/")
> offset = t + 2 # FIX
> while (u == 0) {
> if (getline <= 0) {
> m = "unexpected EOF or error"
> m = m ":" ERRNO
> print m > "/dev/stderr"
> exit
> }
> u = index($0, "*/")
> offset = 0 # FIX
> }
> # substr expression will be "" if */
> # occured at end of line
> $0 = tmp substr($0, offset + u + 2) # FIX
> }
> print
> }
>
> --
> Steffen Schuler (goedel) <address@hidden>