summaryrefslogtreecommitdiffstats
path: root/Demo
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-07-01 18:21:32 (GMT)
committerGuido van Rossum <guido@python.org>1991-07-01 18:21:32 (GMT)
commitc3f2a3bf93a851686c6690f8ffac09102620493a (patch)
tree3987a8aa7cc63969f8fea6d586eccb63a9dd8493 /Demo
parentbcf50128874cf934e3f48a77b1d1da2e60b8b6aa (diff)
downloadcpython-c3f2a3bf93a851686c6690f8ffac09102620493a.zip
cpython-c3f2a3bf93a851686c6690f8ffac09102620493a.tar.gz
cpython-c3f2a3bf93a851686c6690f8ffac09102620493a.tar.bz2
Strip redundant -P from arguments; only print 'ahead' count
if other users present in queue.
Diffstat (limited to 'Demo')
-rwxr-xr-xDemo/scripts/lpwatch.py20
1 files changed, 13 insertions, 7 deletions
diff --git a/Demo/scripts/lpwatch.py b/Demo/scripts/lpwatch.py
index 294028f..b2e4769 100755
--- a/Demo/scripts/lpwatch.py
+++ b/Demo/scripts/lpwatch.py
@@ -19,7 +19,13 @@ def main():
except:
thisuser = posix.environ['USER']
printers = sys.argv[1:]
- if not printers:
+ if printers:
+ # Strip '-P' from printer names just in case
+ # the user specified it...
+ for i in range(len(printers)):
+ if printers[i][:2] = '-P':
+ printers[i] = printers[i][2:]
+ else:
if posix.environ.has_key('PRINTER'):
printers = [posix.environ['PRINTER']]
else:
@@ -96,12 +102,12 @@ def showstatus(name, pipe, thisuser):
print 'for', users.keys()[0],
else:
print 'for', len(users), 'users',
- if userseen:
- if aheadjobs = 0:
- print '(' + thisuser + ' first)',
- else:
- print '(' + `(aheadbytes+1023)/1024`,
- print 'K before', thisuser + ')'
+ if userseen:
+ if aheadjobs = 0:
+ print '(' + thisuser + ' first)',
+ else:
+ print '(' + `(aheadbytes+1023)/1024`,
+ print 'K before', thisuser + ')'
if lines:
print