source: gutenbach-client/debian/bin/gbr @ 85a1ac1

debianmacno-cupsweb
Last change on this file since 85a1ac1 was 85a1ac1, checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago

Create .gutenbach directory if it does not exist
Add more error checking for the gb* scripts

  • Property mode set to 100755
File size: 561 bytes
Line 
1#!/usr/bin/perl
2
3# Written by Jessica Hamrick (C) 2010
4
5use strict;
6use warnings;
7
8my $usage = "Usage: gbr QUEUE FILE\n";
9
10my $q = $ARGV[0];
11my $file = $ARGV[1];
12
13if (!$q or !$file) {
14    print $usage;
15    exit 1
16}
17
18my $configpath = "$ENV{'HOME'}/.gutenbach/$q";
19if (! -e $configpath) {
20    print "Queue '$q' does not exist!\n";
21    exit 1;
22}
23
24my ($host, $queue);
25
26if (-r $configpath) {
27    local $/;
28    my $fh;
29    open $fh, $configpath;
30    eval <$fh>;
31}
32
33my @args = ("lp", "-h$host", "-d$queue", "$file");
34exec (@args) or die "Couldn't execute lp command";
Note: See TracBrowser for help on using the repository browser.