Allow multiple directory command-line arguments

This commit is contained in:
Michael Kerrisk 2006-07-18 16:00:24 +00:00
parent 4291b3e4c4
commit 4fef468eb1
1 changed files with 44 additions and 41 deletions

View File

@ -29,48 +29,51 @@ if test $# -eq 0; then
echo "Usage: $0 [-a] pathname" 1>&2 echo "Usage: $0 [-a] pathname" 1>&2
exit 1; exit 1;
fi fi
for dir in "$@";
for page in $(find $1 -type f -name '*.[1-9]' \
-exec grep -l FIXME {} \; | sort)
do do
cat $page | awk -v SHOW_ALL=$show_all -v PAGE_NAME=$page ' for page in $(find "$dir" -type f -name '*.[1-9]' \
BEGIN { -exec grep -l FIXME {} \; | sort)
page_FIXME_cnt = 0; do
} cat "$page" | awk -v SHOW_ALL=$show_all -v PAGE_NAME="$page" \
'
/FIXME/ { BEGIN {
page_FIXME_cnt = 0;
# /.\" FIXME . / ==> do not display this FIXME, unless }
# -a command-line option was supplied
/FIXME/ {
if (!($0 ~ /^\.\\\" FIXME \./ ) || SHOW_ALL == "y") {
if (page_FIXME_cnt == 0) { # /.\" FIXME . / ==> do not display this FIXME, unless
print "=========="; # -a command-line option was supplied
print PAGE_NAME;
} if (!($0 ~ /^\.\\\" FIXME \./ ) || SHOW_ALL == "y") {
page_FIXME_cnt++; if (page_FIXME_cnt == 0) {
print "==========";
finished = 0; print PAGE_NAME;
do { }
print $0; page_FIXME_cnt++;
# Implicit end of FIXME is end-of-file or a line finished = 0;
# that is not a comment do {
print $0;
if (getline == 0)
finished = 1; # Implicit end of FIXME is end-of-file or a line
# that is not a comment
if (!($0 ~ /^.\\\"/))
finished = 1;
# /.\" .$/ ==> Explicit end of FIXME if (getline == 0)
finished = 1;
if ($0 ~ /^.\\\" \.$/) if (!($0 ~ /^.\\\"/))
finished = 1; finished = 1;
} while (!finished);
# /.\" .$/ ==> Explicit end of FIXME
print "";
} if ($0 ~ /^.\\\" \.$/)
} finished = 1;
' } while (!finished);
done | sed -e 's/^\.\\"/ /' | sed -e 's/ *$//' | cat -s
print "";
}
}
'
done | sed -e 's/^\.\\"/ /' | sed -e 's/ *$//' | cat -s
done