diff options
author | Bill Paul <wpaul@FreeBSD.org> | 1998-02-13 03:38:41 +0000 |
---|---|---|
committer | Bill Paul <wpaul@FreeBSD.org> | 1998-02-13 03:38:41 +0000 |
commit | f44298df594c9734102be41cce94945db23f007e (patch) | |
tree | 3d54e617559c8262b5b01fc80578a9f1f3145bd8 /usr.sbin/ypserv | |
parent | fb364c6d7d53daf922bd04859986e08e63f461ab (diff) | |
download | src-f44298df594c9734102be41cce94945db23f007e.tar.gz src-f44298df594c9734102be41cce94945db23f007e.zip |
Close PR #2206: fix the services.byname target so that it can handle
/etc/services entries with any protocol instead of just udp and tcp.
Rather thani having the awk script explicitly search for 'udp' or 'tcp'
in the second field using index(), use split() to break up the field
at the '/' character if it exists, which extracts the protocol from
the field no matter what it is.
PR: 2206
Notes
Notes:
svn path=/head/; revision=33300
Diffstat (limited to 'usr.sbin/ypserv')
-rw-r--r-- | usr.sbin/ypserv/Makefile.yp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/ypserv/Makefile.yp b/usr.sbin/ypserv/Makefile.yp index f18b5fe87b48..f7ef27eed59c 100644 --- a/usr.sbin/ypserv/Makefile.yp +++ b/usr.sbin/ypserv/Makefile.yp @@ -1,7 +1,7 @@ # # Makefile for the NIS databases # -# $Id: Makefile.yp,v 1.3 1998/02/04 16:07:20 wpaul Exp $ +# $Id: Makefile.yp,v 1.20 1998/02/04 16:16:58 wpaul Exp $ # # This Makefile should only be run on the NIS master server of a domain. # All updated maps will be pushed to all NIS slave servers listed in the @@ -436,10 +436,12 @@ services.byname: $(SERVICES) $(CAT) $(SERVICES) | \ $(AWK) \ '$$1 !~ "^#.*" { for (n=1; n<=NF && $$n !~ "^#.*"; n++) { \ - if (index($$2,"udp")) { printf("%s/udp",$$n) } \ - else { printf("%s/tcp",$$n) }; print "\t"$$0 ; \ - if (n == 1) n = 2; \ - } ; print $$2"\t"$$0 ; \ + if (split($$2, t, "/")) { \ + printf("%s/%s", $$n, t[2]) }; \ + print "\t"$$0; + if (n == 1) n = 2; \ + } + } ; print $$2"\t"$$0 ; \ }' $^ | $(DBLOAD) -i $(SERVICES) -o $(YPMAPDIR)/$@ - $(TMP); \ $(RMV) $(TMP) $@ @$(DBLOAD) -c |