Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!decvax!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.unix,net.bugs.v7,net.bugs.2bsd,net.bugs.4bsd,net.bugs.usg Subject: Re: "sed" question - undocumented features like comments Message-ID: <3003@sun.uucp> Date: Sun, 17-Nov-85 15:37:51 EST Article-I.D.: sun.3003 Posted: Sun Nov 17 15:37:51 1985 Date-Received: Tue, 19-Nov-85 00:41:26 EST References: <1238@wucs.UUCP> <748@rtech.UUCP> Distribution: na Organization: Sun Microsystems, Inc. Lines: 24 Xref: sun net.unix:5951 net.bugs.v7:78 net.bugs.2bsd:191 net.bugs.4bsd:1686 net.bugs.usg:373 > The System V version of "sed" allows the first line of a > script to begin with a '#'; the line is treated as a comment. The > 4.2 BSD "sed" allows as many such lines as you care to sprinkle > throughout your script. Gee, I tried running a script with multiple lines of comments sprinkled throughout it on the 4.2 and S5 "sed"s and they both worked exactly the same... First *line*? I don't believe anybody'd be so sloppy as to require all comments to fit into *one* line. If you check the code, you see that the "fcomp" routine in "sed0.c" has two places where it checks for a '#'; one at the beginning of "fcomp" (the routine that parses the command list), which checks for "#n" at the front of the script (this causes "sed" to act as if you'd specified the "-n" flag), and one in the body of the loop that reads the script that checks whether *any* line in the script has a "#", possibly preceded by white space, in it. This code is essentially the same in both (probably all) versions of "sed", so their behavior will be identical. (Oh boy, another undocumented feature. Will the appropriate people please pick this up and document them? I've already mailed it to Berkeley and to our local documentation people.) Guy Harris