1. python_mirrors
  2. features/py3k-cdecimal

Commits

Guido van Rossum  committed abccb0f

Strip redundant -P from arguments; only print 'ahead' count
if other users present in queue.

  • Participants
  • Parent commits 7a35d98
  • Branches legacy-trunk

Comments (0)

Files changed (1)

File Demo/scripts/lpwatch.py

View file
  • Ignore whitespace
 	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:
 			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