From owner-p4-projects@FreeBSD.ORG Wed Aug 30 20:55:25 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 8CCED16A4DF; Wed, 30 Aug 2006 20:55:25 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3AFC016A4DA for ; Wed, 30 Aug 2006 20:55:25 +0000 (UTC) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id F066043D5C for ; Wed, 30 Aug 2006 20:55:24 +0000 (GMT) (envelope-from millert@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k7UKtOB8033324 for ; Wed, 30 Aug 2006 20:55:24 GMT (envelope-from millert@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k7UKtOMr033321 for perforce@freebsd.org; Wed, 30 Aug 2006 20:55:24 GMT (envelope-from millert@freebsd.org) Date: Wed, 30 Aug 2006 20:55:24 GMT Message-Id: <200608302055.k7UKtOMr033321@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to millert@freebsd.org using -f From: Todd Miller To: Perforce Change Reviews Cc: Subject: PERFORCE change 105360 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Aug 2006 20:55:25 -0000 http://perforce.freebsd.org/chv.cgi?CH=105360 Change 105360 by millert@millert_g4tower on 2006/08/30 20:55:04 Simplify the awk and grep calls further and make it a bit more bullet-proof. Affected files ... .. //depot/projects/trustedbsd/sedarwin8/policies/count/Makefile#3 edit .. //depot/projects/trustedbsd/sedarwin8/policies/stacktrace/module/Makefile#3 edit .. //depot/projects/trustedbsd/sedarwin8/policies/stub/Makefile#3 edit Differences ... ==== //depot/projects/trustedbsd/sedarwin8/policies/count/Makefile#3 (text+ko) ==== @@ -15,44 +15,27 @@ policy.in: $(EXPORT_HDRS)/security/security/mac_policy.h @cpp $(DARWIN_HDRS) -P $< \ - | grep -v ^\$ \ - | awk 'RS=";" { if ($$1 == "typedef" && $$0 ~ /\(/) { print $$0";" } }' \ - | tr -d "\n\t" \ - | tr ";" "\n" \ - | sed -e 's/typedef //g' \ - -e 's/,/, /g' \ - -e 's/_t(/ (/g' \ - -e 's/ mpo_/ /g' \ + | awk 'BEGIN {RS=";"} /typedef.*mpo_.*_t/ { \ + gsub("[\n\t]", ""); sub("typedef *", ""); \ + gsub(", *", ", "); sub("_t *\\\( *", " \("); \ + sub(" *mpo_", " "); print }' \ > $@ count_decls.h: policy.in - @cat $< \ - | grep -v \ - -e ' destroy ' \ - -e ' init_bsd ' \ - -e ' init ' \ + @egrep -v ' (destroy|init(_bsd)?) ' $< \ | awk -f mk_count_decls.awk \ > $@ count_reg.h: policy.in - @cat $< \ - | grep -v \ - -e ' destroy ' \ - -e ' init_bsd ' \ - -e ' init ' \ + @egrep -v ' (destroy|init(_bsd)?) ' $< \ | awk -f mk_count_reg.awk \ > $@ count_funcs.h: policy.in - @cat $< \ - | grep -v \ - -e ' destroy ' \ - -e ' init_bsd ' \ - -e ' init ' \ + @egrep -v ' (destroy|init(_bsd)?) ' $< \ | awk -f mk_count_funcs.awk \ > $@ count_policy_ops.h: policy.in - @cat $< \ - | awk -f mk_count_policy_ops.awk \ + @awk -f mk_count_policy_ops.awk < $< \ > $@ ==== //depot/projects/trustedbsd/sedarwin8/policies/stacktrace/module/Makefile#3 (text+ko) ==== @@ -17,36 +17,27 @@ policy.in: $(EXPORT_HDRS)/security/security/mac_policy.h @cpp $(DARWIN_HDRS) -P $< \ - | grep -v ^\$ \ - | awk 'RS=";" { if ($$1 == "typedef" && $$0 ~ /\(/) { print $$0";" } }' \ - | tr -d "\n\t" \ - | tr ";" "\n" \ - | sed -e 's/typedef //g' \ - -e 's/,/, /g' \ - -e 's/_t(/ (/g' \ - -e 's/ mpo_/ /g' \ + | awk 'BEGIN {RS=";"} /typedef.*mpo_.*_t/ { \ + gsub("[\n\t]", ""); sub("typedef *", ""); \ + gsub(", *", ", "); sub("_t *\\\( *", " \("); \ + sub(" *mpo_", " "); print }' \ > $@ stubs.in: policy.in - @cat $< \ - | grep -v init_bsd \ - | grep -v syscall \ + @egrep -v ' (init_bsd|syscall) ' $< \ | awk -f mk_stubs.awk \ > $@ trace.in: policy.in - @cat $< \ - | grep -v syscall \ + @grep -v ' syscall ' $< \ | awk -f mk_trace.awk \ > $@ funcnames.in: policy.in - @cat $< \ - | grep -v syscall \ + @grep -v ' syscall ' $< \ | awk '{if (NR != 1) { printf ",\n" } printf "\t\"" $$2 "\""}' \ > $@ policy_ops.in: policy.in - @cat $< \ - | awk -f mk_policy_ops.awk \ + @awk -f mk_policy_ops.awk < $< \ > $@ ==== //depot/projects/trustedbsd/sedarwin8/policies/stub/Makefile#3 (text+ko) ==== @@ -14,22 +14,16 @@ policy.in: $(EXPORT_HDRS)/security/security/mac_policy.h @cpp $(DARWIN_HDRS) -P $< \ - | grep -v ^\$ \ - | awk 'RS=";" { if ($$1 == "typedef" && $$0 ~ /\(/) { print $$0";" } }' \ - | tr -d "\n\t" \ - | tr ";" "\n" \ - | sed -e 's/typedef //g' \ - -e 's/,/, /g' \ - -e 's/_t(/ (/g' \ - -e 's/ mpo_/ /g' \ + | awk 'BEGIN {RS=";"} /typedef.*mpo_.*_t/ { \ + gsub("[\n\t]", ""); sub("typedef *", ""); \ + gsub(", *", ", "); sub("_t *\\\( *", " \("); \ + sub(" *mpo_", " "); print }' \ > $@ stub_funcs.h: policy.in - @cat $< \ - | awk -f mk_stub_funcs.awk \ + @awk -f mk_stub_funcs.awk < $< \ > $@ stub_policy_ops.h: policy.in - @cat $< \ - | awk -f mk_stub_policy_ops.awk \ + @awk -f mk_stub_policy_ops.awk < $< \ > $@