SUMMARY: Comments and blank lines in netgroup file?

From: Manavendra K. Thakur (thakur@zerkalo.harvard.edu)
Date: Mon Jul 01 1991 - 19:39:17 CDT


I recently asked:

> What is a valid comment character in the ASCII netgroup file that
> defines the NIS netgroup map?
>
> And can you have blank lines in the ASCII netgroup file?

Just about everyone who responded said that no, there isn't any real
comment character for makedbm but that one can simply run sed to
truncate lines at pound signs and to strip out blank lines.

Duhhh... what else could be simpler? I should have figured this
without bothering the net. Sorry folks; I should have remembered that
there's no documentation like the code itself!

Here is the way I ended up modifying my /var/yp/Makefile such that it
does the right thing with empty lines and pound signs:

netgroup.time: $(DIR)/netgroup
        @(sed -e "/^#/d" -e s/#.*$$// -e /^$/d -e 's/[ ][ ]*$$//' \
            -e '/^$$/d' -e '/\\$$/s/\\$$/ /' $(DIR)/netgroup $(CHKPIPE)) | \
            $(MAKEDBM) $(DIR)/netgroup $(YPDBDIR)/$(DOM)/netgroup
        @($(REVNETGROUP) < $(DIR)/netgroup -u $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/netgroup.byuser
        @($(REVNETGROUP) < $(DIR)/netgroup -h $(CHKPIPE))| $(MAKEDBM) - $(YPDBDIR)/$(DOM)/netgroup.byhost
                .
                . (etc)
                .

Note that you don't need to run sed before the invocation of
$(REVNETGROUP) in the next lines, since /usr/etc/yp/revnetgroup seems
smart enough to automatically skip over blank lines and pound signs.
This is true as of at least SunOS 4.1.1.

Note also that you can use similar lines for any other target in
/var/yp/Makefile.

(Why makedbm can't take care of this for all its input and make
everyone's life easier, I don't understand.)

Thanks to the following people for guiding me out of my confusion:

Claus Assmann <ca@idefix.informatik.uni-kiel.dbp.de>
era@niwot.scd.ucar.EDU (Ed Arnold)
Hannu Visti <visti@cs.hut.fi>
lee@sq.com (Liam Quin)
stern@sunne.East.Sun.COM (Hal Stern - Consultant)
roberto@minerva.phyast.pitt.edu (Roberto Gomez)
kevin@fourx.Aus.Sun.COM (Kevin Sheehan {Consulting Poster Child})
birger@vest.sdata.no ( Birger Wathne)
randy@ncbi.nlm.nih.gov (Rand S. Huntzinger)
sheryl@seas.gwu.edu (Sheryl Coppenger)

Manavendra K. Thakur Internet: thakur@zerkalo.harvard.edu
Systems Programmer, High Energy Division BITNET: thakur@cfa.BITNET
Harvard-Smithsonian Center for DECNET: CFA::thakur
Astrophysics UUCP: ...!uunet!mit-eddie!thakur



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:21 CDT