Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/ypserv/ypinit Fix bogus awk + sed combination to ha...
details: https://anonhg.NetBSD.org/src/rev/400ffb1d8471
branches: trunk
changeset: 512033:400ffb1d8471
user: christos <christos%NetBSD.org@localhost>
date: Tue Jul 03 18:15:06 2001 +0000
description:
Fix bogus awk + sed combination to handle continuations and empty lines.
It broke a sequence of:
key1 \
value1 \
value2 \
value3 \
key2 \
value4 \
etc.
Handle both the netgroup rule and the amd.home rule using a .USEBEFORE
macro rule, since they contain the same code.
XXX: Needs new make(1)
diffstat:
usr.sbin/ypserv/ypinit/Makefile.yp | 58 ++++++++++++++++---------------------
1 files changed, 25 insertions(+), 33 deletions(-)
diffs (88 lines):
diff -r 8ef3d6009944 -r 400ffb1d8471 usr.sbin/ypserv/ypinit/Makefile.yp
--- a/usr.sbin/ypserv/ypinit/Makefile.yp Tue Jul 03 18:08:50 2001 +0000
+++ b/usr.sbin/ypserv/ypinit/Makefile.yp Tue Jul 03 18:15:06 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.yp,v 1.15 2001/06/19 12:59:18 wiz Exp $
+# $NetBSD: Makefile.yp,v 1.16 2001/07/03 18:15:06 christos Exp $
#
# This is the YP Makefile, used to create and push YP maps.
#
@@ -50,6 +50,28 @@
all: passwd aliases amd.home ethers group hosts ipnodes netgroup networks rpc services protocols netid
+__makedbmesc: .USEBEFORE
+ if [ -f ${.ALLSRC} ]; then \
+ ${SED} -e "s/#.*$$//" ${.ALLSRC} | \
+ ${AWK} '{ \
+ if (NF == 0) \
+ printf("\n"); \
+ else { \
+ for (i = 1; i <= NF; i++) { \
+ if (i == NF) { \
+ if (substr($$i, length($$i), 1) == "\\") { \
+ printf("%s", substr($$i, 1, \
+ length($$i) - 1)); \
+ } else \
+ printf("%s\n", $$i); \
+ } else \
+ printf("%s ", $$i); \
+ } \
+ } \
+ }' | \
+ ${SED} -e "/^[ \t]*$$/d" | \
+ ${SORT} | ${MAKEDBM} - ${.ALLSRC:T}; \
+ fi
passwd.time: ${DIR}/master.passwd
-@if [ -f ${.ALLSRC} ]; then \
@@ -138,23 +160,8 @@
fi
-amd.home.time: ${AMDDIR}/amd.home
+amd.home.time: ${AMDDIR}/amd.home __makedbmesc
-@if [ -f ${.ALLSRC} ]; then \
- ${SED} -e "s/#.*$$//" -e "/^$$/d" ${.ALLSRC} | \
- ${AWK} '{ \
- for (i = 1; i <= NF; i++) \
- if (i == NF) { \
- if (substr($$i, length($$i), 1) == "\\") { \
- printf("%s", \
- substr($$i, 1, length($$i) - 1)); \
- } \
- else \
- printf("%s\n", $$i); \
- } \
- else \
- printf("%s ", $$i); \
- }' | \
- ${SORT} | ${MAKEDBM} - amd.home; \
${TOUCH} ${.TARGET}; \
${ECHO} "updated amd.home"; \
if [ ! ${NOPUSH} ]; then \
@@ -269,23 +276,8 @@
fi
-netgroup.time: ${DIR}/netgroup
+netgroup.time: ${DIR}/netgroup __makedbmesc
-@if [ -f ${.ALLSRC} ]; then \
- ${SED} -e "s/#.*$$//" -e "/^$$/d" ${.ALLSRC} | \
- ${AWK} '{ \
- for (i = 1; i <= NF; i++) \
- if (i == NF) { \
- if (substr($$i, length($$i), 1) == "\\") { \
- printf("%s", \
- substr($$i, 1, length($$i) - 1)); \
- } \
- else \
- printf("%s\n", $$i); \
- } \
- else \
- printf("%s ", $$i); \
- }' | \
- ${SORT} | ${MAKEDBM} - netgroup; \
${CAT} ${.ALLSRC} | ${REVNETGROUP} -u -f - | \
${SORT} | ${MAKEDBM} - netgroup.byuser; \
${CAT} ${.ALLSRC} | ${REVNETGROUP} -h -f - | \
Home |
Main Index |
Thread Index |
Old Index