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
This commit is contained in:
parent
9a445ed5d6
commit
8fe3eebc42
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user