1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
|
#!/usr/bin/perl -w
# Copyright (c)2001-2002 Joe Wreschnig, Moritz Muehlenhoff
# Feta plugin for viewing changelogs.
# Licensed under the GNU GPL.
use Getopt::Std;
use strict;
my %opts; getopts('tyqV', \%opts);
if (!$opts{'q'}) { open(QUIET, ">&STDOUT"); }
else { open(QUIET, ">>/dev/null"); }
if ($opts{'V'}) { open(VERBOSE, ">&STDOUT"); }
else { open(VERBOSE, ">>/dev/null"); }
if (!@ARGV) {
print STDERR "E: You must give a least one package name to read its changelog.\n";
exit 1;
}
foreach my $package (@ARGV) {
my $found = 0;
my @files = ("changelog.Debian", "changelog", "NEWS");
foreach my $file (@files) {
my $filename = "/usr/share/doc/$package/$file";
if (-r "$filename.gz") {
system("zcat $filename | sensible-pager");
$found = 1;
last;
} elsif (-r $filename ) {
system('sensible-pager', $filename);
$found = 1;
last;
}
}
if (!$found) {
print STDERR "W: $package does not appear to be installed, or have a changelog.\n";
}
}
exit 0;
|