From owner-freebsd-audit Sat Jul 6 1: 1: 1 2002 Delivered-To: freebsd-audit@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EAE7537B400 for ; Sat, 6 Jul 2002 01:00:55 -0700 (PDT) Received: from mail.rpi.edu (mail.rpi.edu [128.113.22.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4D5C843E3B for ; Sat, 6 Jul 2002 01:00:55 -0700 (PDT) (envelope-from drosih@rpi.edu) Received: from [128.113.24.47] (gilead.netel.rpi.edu [128.113.24.47]) by mail.rpi.edu (8.12.1/8.12.1) with ESMTP id g6680cdg108572; Sat, 6 Jul 2002 04:00:53 -0400 Mime-Version: 1.0 X-Sender: drosih@mail.rpi.edu Message-Id: Date: Sat, 6 Jul 2002 04:00:37 -0400 To: freebsd-print@bostonradio.org From: Garance A Drosihn Subject: Rewritten 'lpc topq', new 'lpc bottomq' Cc: freebsd-audit@freebsd.org Content-Type: text/plain; charset="us-ascii" ; format="flowed" X-Scanned-By: MIMEDefang 2.3 (www dot roaringpenguin dot com slash mimedefang) Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG During the semester crunch at RPI, we can easily get 50 or more jobs in a queue. Sometimes when operators want to re-order jobs in the queue, they just want to "move the top job to the end of the queue", as opposed to "move the bottom 49 jobs to the top". It seemed like it would be simple to look at lpc's topq command and duplicate it into a bottomq command. This turned out to be another thread-pulling exercise, and the result is a patch that's over 1,100 lines long. I suspect that is a bit too much to send in a message, but anyone interested in checking over the patch can find it at: http://people.freebsd.org/~gad/lpr/lpc-topq.diff Part of this update is meant to set the stage for later updates. So this rewrites the topq command, and adds a bottomq command, but I hope to soon add a "move" command (to move jobs from one queue to a different queue), and perhaps a "hold" command (to prevent a job from printing, without having to removing it). Not sure exactly *when* I'll get to those, but I hope it will be "soon". This also attempts to implement some generic routines for matching a bunch of jobs based on user criteria. The old 'lpc topq' command recognized (approximately): \d+ = a jobnumber (matching all jobs with that number) \w+ = a user name (matching all jobs from that user) \w+:\d+ = job number from a specific hostname (not documented) \d+\w+ = job number from a specific hostname (not documented) (no separator between the two) After picking up a number of good ideas from Garrett Wollman, the one I implemented will now recognize: \d+ = jobnumber \w+ = userid \d+-\d+ = jobrange (a range of job numbers) @\w+ = all jobs from the given hostname And the user can combine them: jobrange:userid userid:jobrange jobrange@hostname userid@hostname userid:jobrange@hostname etc... with two special-cases for compatibility: jobrangeHostname (ie, with no separator) hostname:jobnumber -- only if "hostname" includes a period. Garrett also encouraged me to look into the fnmatch routine, which turned out to be available on all the platforms I care about. Due to that, the "userid" and "hostname" can be specifed as a pattern, such as: topq lp @*freebsd.org or bottomq lp dros[ie]hn (for the operator who notices I have two accounts, one with an "e" and one with an "i"...) Right now this generic-job-matching stuff is only used in 'lpc topq' and 'lpc bottomq', but my intent is to change 'lpq' and 'lprm' to use it (after waiting to see how well it works...). The end-result of a topq command should be about the same after this patch, but the messages to the user will be printed in a different order (and IMO, less confusing). With the previous implementation, if you typed: topq lp 1 20 300 it would say: moved 300freefall.freebsd.org moved 020freefall.freebsd.org moved 001freefall.freebsd.org The new one says: moved 001freefall.freebsd.org moved 020freefall.freebsd.org moved 300freefall.freebsd.org Ie, it moves the jobs in the same order that you specified them. There's a number of other cosmetic improvements to the messages, and a variety of improvements to the code (less memory-leaking going on, some improved attention to security trivia, etc). The previous implementation of 'topq' is left as 'xtopq', in case anyone wants to do a side-by-side comparison of how they work. If you want to do that, I'd recommend that you 'lpc stop' two print queues. Put a bunch of jobs in one, then 'cp -p' them to the second queue. Then you can do a 'topq' on one queue and a 'xtopq' on the other, and do lpq's on the two to make sure the final result is the same. I do not expect to do any more work on this until Wednesday (which is why I'm posting it now), but then I'll look it over a few more times and will probably try to commit it to -current next weekend. -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message