diff options
author | Guido van Rossum <guido@python.org> | 1991-07-01 18:21:32 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1991-07-01 18:21:32 (GMT) |
commit | c3f2a3bf93a851686c6690f8ffac09102620493a (patch) | |
tree | 3987a8aa7cc63969f8fea6d586eccb63a9dd8493 /Demo | |
parent | bcf50128874cf934e3f48a77b1d1da2e60b8b6aa (diff) | |
download | cpython-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-x | Demo/scripts/lpwatch.py | 20 |
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 |