[net.unix] putting comments in nroff/troff--var

mab@druxp.UUCP (BlandMA) (09/07/84)

>
>	In particular, it would be *really nice* to be able to put comments in
>	/etc/passwd, and in L.sys, and in sed(1) scripts (any sed scripts).

I've written some non-trivial programs using sed(1), and my technique
for including "comments" is by including them as patterns that will
never match, effectively making them nops.  Example:

	/-- this is a sed "comment" --/d
	/### here is another comment/p

Of course, if the input happens to contain the text between slashes,
the command following the slash will get executed.  Thus, it's not foolproof,
but it can be used for commenting sed scripts when you know enough about
the input to choose your comments wisely.  This technique also wastes cpu
cycles, since the comments are scanned as patterns, but if I were that
concerned about cycles, I wouldn't use sed for some jobs.
--
	Alan Bland (ihnp4!druxp!mab)
	AT&T-ISL Denver

adm@cbneb.UUCP (09/10/84)

#R:ucbtopaz:-53600:cbnap:27300006:000:391
cbnap!whp    Sep  9 22:07:00 1984

An interesting bug in n/troff regarding comments is that a comment following
a command must be preceeded by spaces and not tabs!  That is,

.xx	\" this comment preceeded by a tab, and may cause n/troff to blow up.
.xx     \" this comment is preceeded by 5 blanks, and will work ok.

The reason for this is obscure, but the bug was reported and will be fixed
(hopefully) in a future release.

ajs@hpfcla.UUCP (ajs) (09/17/84)

>> Subject: putting comments in nroff/troff--various ways

All this talk of how to put comments in documents  leads me to espousing
what I think is a good general principle, too often overlooked:

"When  designing a program  that reads input  data,  design a way to put
comments into the input data."

There are about ten  well-known  UN*X  configuration  files.  Some, like
/etc/termcap,  were  designed  "right".  Some, like  /etc/rc, are really
shell  scripts,  so you are  home  free.  Some,  like  /etc/inittab  and
/usr/lib/crontab,  allow comments by accident -- unrecognized  lines are
ignored (in AT&T versions  anyway), so you can insert comments and blank
lines;  commands are passed through  /bin/sh, so you can comment them on
the right  side with "#".  Most,  however,  just  don't let you get away
with it, and it's a shame.

In particular, it would be *really nice* to be able to put comments in
/etc/passwd, and in L.sys, and in sed(1) scripts (any sed scripts).

Alan Silverstein, Hewlett-Packard Fort Collins Systems Division, Colorado
{ihnp4 | hplabs}!hpfcla!ajs, 303-226-3800 x3053, N 40 31'31" W 105 00'43"