summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ypserv
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1998-02-13 03:38:41 +0000
committerwpaul <wpaul@FreeBSD.org>1998-02-13 03:38:41 +0000
commit8fe3eebc42c2bfd32a57bce11a9fab44e80218a1 (patch)
tree1c2bdde4f2883903dde88e1480a38c0d60e29d98 /usr.sbin/ypserv
parent9a445ed5d65023062d97db0ed5d31d9b647ca407 (diff)
downloadFreeBSD-src-8fe3eebc42c2bfd32a57bce11a9fab44e80218a1.zip
FreeBSD-src-8fe3eebc42c2bfd32a57bce11a9fab44e80218a1.tar.gz
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
Diffstat (limited to 'usr.sbin/ypserv')
-rw-r--r--usr.sbin/ypserv/Makefile.yp12
1 files changed, 7 insertions, 5 deletions
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
OpenPOWER on IntegriCloud