debianmacno-cupsweb
|
Last change
on this file since 8120872 was
30beeab,
checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago
|
|
Remove "gutenbach-" from directory names and rename "gutenbach" to "gutenbach-server"
|
-
Property mode set to
100755
|
|
File size:
1003 bytes
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | # Written by Jessica Hamrick (C) 2010 |
|---|
| 4 | |
|---|
| 5 | use strict; |
|---|
| 6 | use warnings; |
|---|
| 7 | |
|---|
| 8 | use Net::CUPS; |
|---|
| 9 | use Net::CUPS::Destination; |
|---|
| 10 | |
|---|
| 11 | my $usage = "Usage: gbq QUEUE\n"; |
|---|
| 12 | |
|---|
| 13 | my $q = $ARGV[0]; |
|---|
| 14 | |
|---|
| 15 | if (!$q) { |
|---|
| 16 | print $usage; |
|---|
| 17 | exit 1 |
|---|
| 18 | } |
|---|
| 19 | |
|---|
| 20 | my $configpath = "$ENV{'HOME'}/.gutenbach/$q"; |
|---|
| 21 | if (! -e $configpath) { |
|---|
| 22 | print "Queue '$q' does not exist!\n"; |
|---|
| 23 | exit 1; |
|---|
| 24 | } |
|---|
| 25 | |
|---|
| 26 | my ($host, $queue); |
|---|
| 27 | |
|---|
| 28 | if (-r $configpath) { |
|---|
| 29 | local $/; |
|---|
| 30 | my $fh; |
|---|
| 31 | open $fh, $configpath; |
|---|
| 32 | eval <$fh>; |
|---|
| 33 | } |
|---|
| 34 | |
|---|
| 35 | my $cups = Net::CUPS->new(); |
|---|
| 36 | $cups->setServer("$host"); |
|---|
| 37 | my $printer = $cups->getDestination("$queue"); |
|---|
| 38 | |
|---|
| 39 | print "Queue listing for queue '$queue' on '$host'\n\n"; |
|---|
| 40 | print "Job ID\t\tOwner\t\tFile\n"; |
|---|
| 41 | print "-----------------------------------------------------------------\n"; |
|---|
| 42 | |
|---|
| 43 | my @jobs = $printer->getJobs(0, 0); |
|---|
| 44 | my ($job_ref, $jobid); |
|---|
| 45 | |
|---|
| 46 | foreach $jobid(@jobs) |
|---|
| 47 | { |
|---|
| 48 | $job_ref = $printer->getJob($jobid); |
|---|
| 49 | my $id = $job_ref->{'id'}; |
|---|
| 50 | my $user = $job_ref->{'user'}; |
|---|
| 51 | my $title = $job_ref->{'title'}; |
|---|
| 52 | |
|---|
| 53 | print "$id\t\t$user\t\t$title\n"; |
|---|
| 54 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.