source: client/bin/gbq @ c5a98db

debianmacno-cupsweb
Last change on this file since c5a98db was 30beeab, checked in by Jessica B. Hamrick <jhamrick@…>, 14 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
5use strict;
6use warnings;
7
8use Net::CUPS;
9use Net::CUPS::Destination;
10
11my $usage = "Usage: gbq QUEUE\n";
12
13my $q = $ARGV[0];
14
15if (!$q) {
16    print $usage;
17    exit 1
18}
19
20my $configpath = "$ENV{'HOME'}/.gutenbach/$q";
21if (! -e $configpath) {
22    print "Queue '$q' does not exist!\n";
23    exit 1;
24}
25
26my ($host, $queue);
27
28if (-r $configpath) {
29    local $/;
30    my $fh;
31    open $fh, $configpath;
32    eval <$fh>;
33}
34
35my $cups = Net::CUPS->new();
36$cups->setServer("$host");
37my $printer = $cups->getDestination("$queue");
38
39print "Queue listing for queue '$queue' on '$host'\n\n";
40print "Job ID\t\tOwner\t\tFile\n";
41print "-----------------------------------------------------------------\n";
42
43my @jobs = $printer->getJobs(0, 0);
44my ($job_ref, $jobid);
45
46foreach $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.