From d00f04ffa36d116787cdf8ca774dfd64d5281a66 Mon Sep 17 00:00:00 2001 From: Werner Almesberger Date: Sun, 5 Jan 2014 13:49:06 -0300 Subject: [PATCH] scripts/missing-in-tree: new option "-x lib" to exclude libraries --- scripts/missing-in-tree | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/scripts/missing-in-tree b/scripts/missing-in-tree index e4e29e0..6ae284a 100755 --- a/scripts/missing-in-tree +++ b/scripts/missing-in-tree @@ -13,15 +13,22 @@ usage() { - echo "usage: $0 [-F] [-L libdir ...] [-l lib ...] hierarchy" 1>&2 - echo " $0 -Q [-L libdir ...] [-l lib ...] project.pro" 1>&2 + echo "usage: $0 [-F] [-x lib ...] [-L libdir ...] [-l lib ...] hierarchy" 1>&2 + echo " $0 -Q [-x lib ...] [-L libdir ...] [-l lib ...] project.pro" 1>&2 exit 1 } +excluded() +{ + [ "`eval echo \\\$exclude_\`sanitize \"$1\"\``" ] +} + + scan_comp() { for n in "$@"; do + excluded "$n" && continue sed '/^DEF ~\?/{s///;s/ .*//;p;};d' <$n >>_tmp2 done } @@ -30,6 +37,7 @@ scan_comp() scan_fped() { for n in "$@"; do + excluded "$n" && continue fped -k $n - | sed '/^\$MODULE /s///p;d' >>_tmp2 done } @@ -42,6 +50,13 @@ scan_pro() done } + +sanitize() +{ + basename "$1" .$ext | tr -d '\n' | tr -c 'A-Za-z0-9_[-]' _ +} + + trap "rm -f _tmp1 _tmp2" 0 if [ "$1" = -Q ]; then @@ -72,6 +87,8 @@ while [ "$1" ]; do else scan_fped "$1" fi;; + -x) shift + eval exclude_`sanitize "$1"`=y;; -*) usage;; *) break;; esac