Arent Storm writes: | From: "John Chambers" <[EMAIL PROTECTED]> | | > Another fringe case is what happens when a line ends with '\', a | > space, and a newline. It's common for many implementations to not | > recognize this as a continuation. This one is really baffling to a | > user, who usually can't see the space. The right way to handle this | > is to strip off the trailing spaces (and tabs), and then check for | > the final '\'. The input routine is now not quite as trivial (though | > it's still pretty trivial).
| is not so straightforward Actually, it's fairly easy. What I did with my (jcabc2ps) clone was to put code in the getline() routine that does this: First, replace all trailing whitespace chars with NULs. Trailing whitespace chars are never significant in abc. Wiping them out during input slightly simplifies later parsing. Next, if there's a '\' at the end of the line, read another line, overwriting the '\' with the first input char. Repeat until there isn't a '\' at the end (or realloc() fails). I did have to change the input buffer from a fixed-size buffer to one that could be realloc'd, plus a variable saying how big it is. This was fairly easy. I did check all the references to see if there was anything that would break. I didn't find anything. This wasn't surprising, since the program obviously shouldn't keep any info about the input from one line to the next. Also, there's one bit of trickiness: abc2ps has an option to ignore final '\' and use the line breaks in the abc. If this option is set, the first step should just treat '\' as whitespace and NUL it out. The second step then never sees a '\'. To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html
