From 8fe3eebc42c2bfd32a57bce11a9fab44e80218a1 Mon Sep 17 00:00:00 2001 From: wpaul Date: Fri, 13 Feb 1998 03:38:41 +0000 Subject: 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 --- usr.sbin/ypserv/Makefile.yp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'usr.sbin/ypserv') diff --git a/usr.sbin/ypserv/Makefile.yp b/usr.sbin/ypserv/Makefile.yp index f18b5fe..f7ef27e 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 -- cgit v1.1