From a88f6b297c5f238363a73ea77f0ea5fc707a5c95 Mon Sep 17 00:00:00 2001 From: Satoshi Asami Date: Tue, 29 Aug 2000 08:18:44 +0000 Subject: Handle arbitrary number of log directories instead of just two. --- Tools/portbuild/scripts/bothlogs | 59 +++++++++++++++++++++++++--------------- 1 file changed, 37 insertions(+), 22 deletions(-) (limited to 'Tools') diff --git a/Tools/portbuild/scripts/bothlogs b/Tools/portbuild/scripts/bothlogs index 84ea372cb3bf..55121bce8505 100755 --- a/Tools/portbuild/scripts/bothlogs +++ b/Tools/portbuild/scripts/bothlogs @@ -1,47 +1,62 @@ #!/bin/sh -# prints out logs that are in dir1 and in dir2 +# prints out logs that are in all directories -if [ $# != 2 ]; then - echo "usage: $0 dir1 dir2" +if [ $# -lt 2 ]; then + echo "usage: $0 dir1 dir2 [dir3...]" exit 1 fi here=$(pwd) dir1=$1 -dir2=$2 -fdir1=$here/$dir1 -fdir2=$here/$dir2 -of=$here/$dir1+$dir2.html +concat="$(echo $*)" +plus="$(echo $* | sed -e 's/ /+/g')" -echo "Logs that are in both $dir1 and $dir2" >$of -echo "

Logs that are in both $dir1 and $dir2

" >>$of +of=$here/$plus.html + +echo "Logs that are in all of \"$concat\"" >$of +echo "

Logs that are in all of \"$concat\"

" >>$of echo "" >>$of -cd $fdir1 +cd $here/$1 -set *.log +logs="$(echo *.log)" -if [ $# = 1 -a "x$1" = "x*.log" ]; then +if [ "x$logs" = "x*.log" ]; then echo "No errors" >>$of else - num=0 - echo "" >>$of - echo "" >>$of + shift while [ $# -gt 0 ]; do - if [ -f ${fdir2}/$1 ]; then + num=0 + newlogs="" + cd $here/$1 + for log in *.log; do + if echo $logs | grep -Fwq $log; then + newlogs="$newlogs $log" + num=$(($num + 1)) + fi + done + logs=$newlogs + shift + done + if [ $num = 0 ]; then + echo "No errors" >>$of + else + echo "
Log
" >>$of + echo "" >>$of + set $newlogs + while [ $# -gt 0 ]; do echo -n "" >>$of - num=$(($num + 1)) - fi - shift - done - echo "
Log
" >>$of echo -n "" >>$of echo -n $(basename $1 .log) >>$of echo -n "" >>$of echo "

" >> $of - echo "$num errors
" >> $of + shift + done + echo "
" >> $of + echo "$num errors
" >> $of + fi fi echo "
" >> $of -- cgit v1.2.3