summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorSatoshi Asami <asami@FreeBSD.org>2000-08-29 08:18:44 +0000
committerSatoshi Asami <asami@FreeBSD.org>2000-08-29 08:18:44 +0000
commita88f6b297c5f238363a73ea77f0ea5fc707a5c95 (patch)
treeed616e1594671a53c4a0f9a6f5bee6ec2d93fb82 /Tools
parentIgnore empty loads files -- it seems scp in OpenSSH sometimes leaves (diff)
Handle arbitrary number of log directories instead of just two.
Diffstat (limited to 'Tools')
-rwxr-xr-xTools/portbuild/scripts/bothlogs59
1 files changed, 37 insertions, 22 deletions
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 "<html><head><title>Logs that are in both $dir1 and $dir2</title>" >$of
-echo "<h1>Logs that are in both $dir1 and $dir2</h1>" >>$of
+of=$here/$plus.html
+
+echo "<html><head><title>Logs that are in all of \"$concat\"</title>" >$of
+echo "<h1>Logs that are in all of \"$concat\"</h1>" >>$of
echo "</head><body>" >>$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 "<table border=1>" >>$of
- echo "<tr><th>Log</th></tr>" >>$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 "<table border=1>" >>$of
+ echo "<tr><th>Log</th></tr>" >>$of
+ set $newlogs
+ while [ $# -gt 0 ]; do
echo -n "<tr><td>" >>$of
echo -n "<a href=\"$dir1/index.html#$1\">" >>$of
echo -n $(basename $1 .log) >>$of
echo -n "</a>" >>$of
echo "</td></tr>" >>$of
- num=$(($num + 1))
- fi
- shift
- done
- echo "</table><br>" >> $of
- echo "$num errors<br>" >> $of
+ shift
+ done
+ echo "</table><br>" >> $of
+ echo "$num errors<br>" >> $of
+ fi
fi
echo "<hr>" >> $of