summaryrefslogtreecommitdiff
path: root/test/waitjobs.sh
diff options
context:
space:
mode:
authormsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-02-25 23:37:25 +0000
committermsweet <msweet@a1ca3aef-8c08-0410-bb20-df032aa958be>2009-02-25 23:37:25 +0000
commitb9faaae17cfc7cd8dfd6e82cf607c05b2f4def68 (patch)
tree11ae14d6d1fc0cd6d834e8c819b74167dbe2a413 /test/waitjobs.sh
parentede613e028030f6b2b5871b5e40682806ee1acd0 (diff)
downloadcups-b9faaae17cfc7cd8dfd6e82cf607c05b2f4def68.tar.gz
Merge changes from CUPS 1.4svn-r8394.
git-svn-id: svn+ssh://src.apple.com/svn/cups/easysw/current@1253 a1ca3aef-8c08-0410-bb20-df032aa958be
Diffstat (limited to 'test/waitjobs.sh')
-rwxr-xr-xtest/waitjobs.sh33
1 files changed, 28 insertions, 5 deletions
diff --git a/test/waitjobs.sh b/test/waitjobs.sh
index d69e44080..7a79fb69b 100755
--- a/test/waitjobs.sh
+++ b/test/waitjobs.sh
@@ -4,7 +4,7 @@
#
# Script to wait for jobs to complete.
#
-# Copyright 2008 by Apple Inc.
+# Copyright 2008-2009 by Apple Inc.
#
# These coded instructions, statements, and computer programs are the
# property of Apple Inc. and are protected by Federal copyright
@@ -13,25 +13,48 @@
# file is missing or damaged, see the license at "http://www.cups.org/".
#
+#
# Get timeout from command-line
+#
+
if test $# = 1; then
timeout=$1
else
- timeout=60
+ timeout=360
+fi
+
+#
+# Figure out the proper echo options...
+#
+
+if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
+ ac_n=-n
+ ac_c=
+else
+ ac_n=
+ ac_c='\c'
fi
-echo "Waiting for jobs to complete..."
+echo $ac_n "Waiting for jobs to complete...$ac_c"
+oldjobs=0
while test $timeout -gt 0; do
- jobs=`../systemv/lpstat 2>/dev/null`
- if test "x$jobs" = "x"; then
+ jobs=`../systemv/lpstat 2>/dev/null | wc -l | tr -d ' '`
+ if test $jobs = 0; then
break
fi
+ if test $jobs != $oldjobs; then
+ echo $ac_n "$jobs...$ac_c"
+ oldjobs=$jobs
+ fi
+
sleep 5
timeout=`expr $timeout - 5`
done
+echo ""
+
#
# End of "$Id$".
#