diff options
author | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
---|---|---|
committer | Mystery Man <unknown@mandriva.org> | 2005-10-20 14:05:54 +0000 |
commit | 9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5 (patch) | |
tree | f3ef7ada2ce82dafb6d41cc087b0cc7fdfc40a46 /perl-install/printer/cups.pm | |
parent | 3e4ad5e1b687f262a1d7cc39a0b905a595ac7f95 (diff) | |
download | drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.gz drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.bz2 drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.tar.xz drakx-backup-do-not-use-9b6a0d83d135fad376b4eadcb2bd7bd8c8a07aa5.zip |
This commit was manufactured by cvs2svn to create tagV10_34_11_100mdk
'V10_34_11_100mdk'.
Diffstat (limited to 'perl-install/printer/cups.pm')
-rw-r--r-- | perl-install/printer/cups.pm | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/perl-install/printer/cups.pm b/perl-install/printer/cups.pm index ab9e28b21..eb443482e 100644 --- a/perl-install/printer/cups.pm +++ b/perl-install/printer/cups.pm @@ -27,15 +27,17 @@ sub lpstat_lpv() { my $currentitem = -1; for my $line (@lpstat) { - chomp ($line); - if (!($line =~ m!^\s*$!)) { - if ($line =~ m!^printer\s+(\S+)\s+(\S.*)$!) { + chomp($line); + if ($line !~ m!^\s*$!) { + if ($line =~ m!^printer\s+(\S+)\s+.*\b(enabled|disabled)\b!) { # Beginning of new printer's entry my $name = $1; + my $state = $2; push(@items, {}); $currentitem = $#items; $itemshash->{$name} = $currentitem; $items[$currentitem]{queuename} ||= $name; + $items[$currentitem]{state} ||= $state; } elsif ($line =~ m!^\s+Description:\s+(\S.*)$!) { # Description field if ($currentitem != -1) { @@ -51,7 +53,7 @@ sub lpstat_lpv() { my $name = $1; my $uri = $2; if (defined($itemshash->{$name})) { - if ($uri !~ /:/) {$uri = "file:" . $uri}; + if ($uri !~ /:/) { $uri = "file:" . $uri } $currentitem = $itemshash->{$name}; if (($currentitem <= $#items) && ($items[$currentitem]{queuename} eq $name)) { @@ -114,10 +116,10 @@ sub get_formatted_remote_queues { map { join('!', if_($printer->{expert}, N("CUPS")), N("Configured on other machines"), $_); } map { - my $comment = N("On CUPS server \"%s\"", $_->{ipp}) . ($_->{queuename} eq $printer->{DEFAULT} ? N(" (Default)") : ""); + my $comment = N("On CUPS server \"%s\"", ($_->{ipp} ? $_->{ipp} : $printer->{remote_cups_server})) . ($_->{queuename} eq $printer->{DEFAULT} ? N(" (Default)") : ""); "$_->{queuename}: $comment"; } grep { - $_->{ipp} && !$printer->{configured}{$_->{queuename}}; + !$printer->{configured}{$_->{queuename}}; } lpstat_v(); } @@ -133,4 +135,13 @@ sub get_remote_queues { } lpstat_v(); } +sub queue_enabled { + my ($queue) = @_; + 0 != grep { + /\b$queue\b.*\benabled\b/i; + } run_program::rooted_get_stdout($::prefix, 'lpstat', '-p', $queue); +} + + + 1; |