rad@puffin.USS.TEK.COM (Richard Doty) (12/17/87)
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.