source:
client/bin/gbrm
@
c5a98db
| Last change on this file since c5a98db was c5a98db, checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago | |
|---|---|
|
|
| File size: 658 bytes | |
| Rev | Line | |
|---|---|---|
| [2a2f76c] | 1 | #!/usr/bin/perl |
| 2 | ||
| 3 | # Written by Jessica Hamrick (C) 2010 | |
| 4 | ||
| 5 | use strict; | |
| 6 | use warnings; | |
| 7 | ||
| 8 | my $usage = "Usage: gbq QUEUE ID\n"; | |
| 9 | ||
| 10 | my $q = $ARGV[0]; | |
| 11 | my $id = $ARGV[1]; | |
| 12 | ||
| 13 | if (!$q or !$id) { | |
| 14 | print $usage; | |
| 15 | exit 1 | |
| 16 | } | |
| 17 | ||
| 18 | my $configpath = "$ENV{'HOME'}/.gutenbach/$q"; | |
| [85a1ac1] | 19 | if (! -e $configpath) { |
| 20 | print "Queue '$q' does not exist!\n"; | |
| 21 | exit 1; | |
| 22 | } | |
| 23 | ||
| [2a2f76c] | 24 | my ($host, $queue); |
| 25 | ||
| 26 | if (-r $configpath) { | |
| 27 | local $/; | |
| 28 | my $fh; | |
| 29 | open $fh, $configpath; | |
| 30 | eval <$fh>; | |
| 31 | } | |
| 32 | ||
| 33 | my @args; | |
| 34 | ||
| 35 | if ($id eq "all") { | |
| [c5a98db] | 36 | @args = ("cancel", "-a", "$queue"); |
| [2a2f76c] | 37 | } |
| 38 | else { | |
| [c5a98db] | 39 | @args = ("cancel", "$id", "$queue"); |
| [2a2f76c] | 40 | } |
| [c5a98db] | 41 | $ENV{CUPS_SERVER}="$host"; |
| [2a2f76c] | 42 | exec (@args) or die "Couldn't execute cancel command"; |
Note: See TracBrowser
for help on using the repository browser.
