Date: Wed, 30 Aug 2006 20:55:24 GMT From: Todd Miller <millert@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 105360 for review Message-ID: <200608302055.k7UKtOMr033321@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 < $< \ > $@
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608302055.k7UKtOMr033321>