Article View: comp.bugs.sys5
Article #656long lines confuse sdiff
From: Richard Doty
Date: Thu, 17 Dec 1987 00:04
Date: Thu, 17 Dec 1987 00:04
30 lines
1815 bytes
1815 bytes
Index: cmd/sdiff.c Sys5
Description:
Sdiff gets confused if input lines are longer than its
input buffer. (this is version 1.2 of sdiff)
Repeat-By:
Consider these two files, sd1 & sd2, each 3 lines long
and each containing a line from nroff output with many backspaces.
sd1:
111111......222222 SSSSSSeeeeeeccccccoooooonnnnnndddddd ssssssuuuuuubbbbbb hhhhhheeeeeeaaaaaaddddddiiiiiinnnnnngggggg
Still more stuff.
sd2:
type it.
x1111....2222 SSSSeeeeccccoooonnnndddd ssssuuuubbbb hhhheeeeaaaaddddiiiinnnngggg
Still more stuff.
The command "sdiff sd1 sd2" it loops producing and endless
stream of blank lines.
Fix:
Sdiff makes decisions based on what is at the beginning of each
line, but in this case the input line was longer than sdiff's
input buffer. When the next "line" was input, sdiff actually
read the last part of the present line, and made a bad choice (the
specific problem with looping could have been fixed differently,
but that would still leave the general problem of finding
command text in the middle of a line rather than at the beginning).
My fix is to look at each line as it is input. If the last
character is not a newline, discard subsequent input characters
until a newline is encountered.
Technical Details
Message-ID:
<141@puffin.USS.TEK.COM>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tektronix!tekgen!puffin!radShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!tektronix!tekgen!puffin!rad From: rad@puffin.USS.TEK.COM (Richard Doty) Newsgroups: comp.bugs.sys5 Subject: long lines confuse sdiff Message-ID: <141@puffin.USS.TEK.COM> Date: 17 Dec 87 00:04:31 GMT Reply-To: rad@puffin.uss.tek.com (Richard Doty) Organization: Unix Systems Support, Tektronix, Inc., Beaverton, OR Lines: 30