Browse Source

Adds info/{*config,*templates} option --config and --templates.

master
freesource 23 years ago
parent
commit
c52a71c1fc
  1. 4
      SWIM/Ag.pm
  2. 87
      SWIM/Deb.pm
  3. 14
      SWIM/Findex.pm
  4. 65
      SWIM/Indexer.pm
  5. 67
      SWIM/Info.pm
  6. 8
      SWIM/Pn_print.pm

4
SWIM/Ag.pm

@ -40,7 +40,7 @@ sub description {
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands{"config"} || $commands{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -127,7 +127,7 @@ sub q_description {
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands{"config"} || $commands{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};

87
SWIM/Deb.pm

@ -567,7 +567,7 @@ sub printme {
if ($commands->{"p"} && !($commands->{"i"} || $commands->{"l"} ||
$commands->{"df"} || $commands->{"d"} || $commands->{"c"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -603,7 +603,7 @@ sub printme {
$commands{"c"})
&& !($commands->{"i"} || $commands->{"df"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -643,7 +643,7 @@ that there was a reason for doing it this way.
elsif ($commands->{"p"} && $commands {"c"} && !($commands->{"i"} ||
$commands->{"df"} || $commands->{"d"} || $commands->{"l"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} &&
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} &&
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -678,7 +678,7 @@ that there was a reason for doing it this way.
elsif ($commands->{"p"} && $commands {"c"} && $commands->{"d"} &&
!($commands->{"i"} || $commands->{"df"} || $commands->{"l"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -991,7 +991,7 @@ sub scripto {
# Give a title.
if ($commands->{"scripts"} && !($commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerem"} ||
$commands->{"postrm"})) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"})) {
if (defined $dpkg_deb) {
$real = system "$dpkg_deb -I $argument preinst >/dev/null 2>&1";
@ -1067,6 +1067,45 @@ sub scripto {
undef $real;
}
}
if (defined $dpkg_deb) {
$real = system "$dpkg_deb -I $argument config >/dev/null 2>&1";
if ($real == 0) {
print "#####$1.config#####\n";
$real = system "$dpkg_deb -I $argument config";
undef $real;
}
}
elsif (defined $ar) {
$real = system "$ar -p $argument control.tar.gz |\
$tar tOz config >/dev/null 2>&1";
if ($real == 0) {
print "#####$1.config#####\n";
$real = system "$ar -p $argument control.tar.gz |\
$tar xOz config";
undef $real;
}
}
if (defined $dpkg_deb) {
$real = system "$dpkg_deb -I $argument templates >/dev/null 2>&1";
if ($real == 0) {
print "#####$1.templates#####\n";
$real = system "$dpkg_deb -I $argument templates";
undef $real;
}
}
elsif (defined $ar) {
$real = system "$ar -p $argument control.tar.gz |\
$tar tOz templates >/dev/null 2>&1";
if ($real == 0) {
print "#####$1.templates#####\n";
$real = system "$ar -p $argument control.tar.gz |\
$tar xOz templates";
undef $real;
}
}
}
# no titles here
@ -1146,6 +1185,44 @@ sub scripto {
}
}
if ($commands->{"config"}) {
if (defined $dpkg_deb) {
$real = system "$dpkg_deb -I $argument config >/dev/null 2>&1";
if ($real == 0) {
$real = system "$dpkg_deb -I $argument config";
undef $real;
}
}
elsif (defined $ar) {
$real = system "$ar -p $argument control.tar.gz |\
$tar tOz config >/dev/null 2>&1";
if ($real == 0) {
$real = system "$ar -p $argument control.tar.gz |\
$tar xOz config";
undef $real;
}
}
}
if ($commands->{"templates"}) {
if (defined $dpkg_deb) {
$real = system "$dpkg_deb -I $argument templates >/dev/null 2>&1";
if ($real == 0) {
$real = system "$dpkg_deb -I $argument templates";
undef $real;
}
}
elsif (defined $ar) {
$real = system "$ar -p $argument control.tar.gz |\
$tar tOz templates >/dev/null 2>&1";
if ($real == 0) {
$real = system "$ar -p $argument control.tar.gz |\
$tar xOz templates";
undef $real;
}
}
}
} # end scripto
# this is the format for packages which provide shared libraries. The

14
SWIM/Findex.pm

@ -81,7 +81,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} ) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -103,7 +103,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -125,7 +125,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -160,7 +160,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -179,7 +179,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -200,7 +200,7 @@ sub findexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -266,7 +266,7 @@ sub qindexer {
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};

65
SWIM/Indexer.pm

@ -38,27 +38,32 @@ sub T_indexer {
my ($alot,$commands) = @_;
my %commands = %$commands;
foreach (@$alot) {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
copyright(\%commands) if $commands->{"copyright"};
changelog(\%commands) if $commands->{"changelog"};
# looks o.k.
print "$argument\n";
character(\%commands);
shlibs(\%commands) if $commands->{"shlibs"};
if ($commands->{"d"} && !$commands->{"c"}) {
require SWIM::File;
SWIM::File->import(qw(file));
file(\%commands);
}
print "\n";
}
foreach (@$alot) {
$argument = $_;
if ($commands->{"scripts"} ||
$commands->{"preinst"} ||
$commands->{"postinst"} ||
$commands->{"config"} ||
$commands->{"prerm"} ||
$commands->{"postrm"} ||
$commands->{"config"} ||
$commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
copyright(\%commands) if $commands->{"copyright"};
changelog(\%commands) if $commands->{"changelog"};
# looks o.k.
print "$argument\n";
character(\%commands);
shlibs(\%commands) if $commands->{"shlibs"};
if ($commands->{"d"} && !$commands->{"c"}) {
require SWIM::File;
SWIM::File->import(qw(file));
file(\%commands);
}
print "\n";
}
} # end sub T_indexer
@ -72,7 +77,7 @@ sub which_character_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -107,7 +112,7 @@ sub noT_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -136,7 +141,7 @@ sub nonoT_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -171,7 +176,7 @@ sub c_indexer {
# covers first argument, but not the rest.
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -194,7 +199,7 @@ sub c_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -219,7 +224,7 @@ sub c_indexer {
# no Ts.
else {
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postinst"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
scripts(\%commands);
}
@ -255,7 +260,7 @@ sub c_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -273,7 +278,7 @@ sub c_indexer {
$argument = $_;
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm" || $commands->{"config"} || $commands->{"templates"}}) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};
@ -294,7 +299,7 @@ sub c_indexer {
else {
if ($commands->{"scripts"} || $commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"}) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} ) {
scripts(\%commands);
}
menu(\%commands) if $commands->{"menu"} || $commands->{"m"};

67
SWIM/Info.pm

@ -40,7 +40,7 @@ sub scripts {
my %commands = %$commands;
my ($file, $preinst, $postinst, $prerm,
$postrm, $orig_argument);
$postrm, $config, $templates, $orig_argument);
if ($commands->{"n"}) {
@ -64,7 +64,7 @@ sub scripts {
# here we will print out whatever we find including the file name.
if ($commands->{"scripts"} && !($commands->{"preinst"} ||
$commands->{"postinst"} || $commands->{"prerm"} ||
$commands->{"postrm"})) {
$commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"})) {
if (defined "$parent$base/info/$argument.preinst") {
$preinst = "$parent$base/info/$argument.preinst";
}
@ -77,6 +77,12 @@ sub scripts {
if (defined "$parent$base/info/$argument.postrm") {
$postrm = "$parent$base/info/$argument.postrm";
}
if (defined "$parent$base/info/$argument.config") {
$config = "$parent$base/info/$argument.config";
}
if (defined "$parent$base/info/$argument.templates") {
$templates = "$parent$base/info/$argument.templates";
}
if (-e $preinst) {
print "#####$argument.preinst#####\n\n";
@ -106,6 +112,21 @@ sub scripts {
print $_;
}
}
if (-e $config) {
open (LIST,"$config");
print "#####$argument.config#####\n\n";
while (<LIST>) {
print $_;
}
}
if (-e $templates) {
open (LIST,"$templates");
print "#####$argument.templates#####\n\n";
while (<LIST>) {
print $_;
}
}
} # if scripts
@ -199,6 +220,48 @@ sub scripts {
}
}
if ($commands->{"config"}) {
if (defined "$parent$base/info/$argument.config") {
$config = "$parent$base/info/$argument.config";
}
if (-e $config) {
if ($commands->{"a"} || $commands->{"t"}) {
print "#####$argument.config#####\n\n";
open (LIST,"$config");
while (<LIST>) {
print $_;
}
}
else {
open (LIST,"$config");
while (<LIST>) {
print $_;
}
}
}
}
if ($commands->{"templates"}) {
if (defined "$parent$base/info/$argument.templates") {
$templates = "$parent$base/info/$argument.templates";
}
if (-e $templates) {
if ($commands->{"a"} || $commands->{"t"}) {
print "#####$argument.templates#####\n\n";
open (LIST,"$templates");
while (<LIST>) {
print $_;
}
}
else {
open (LIST,"$templates");
while (<LIST>) {
print $_;
}
}
}
}
if (!$commands->{"i"}) {
if (defined $orig_argument) {
$argument = $orig_argument;

8
SWIM/Pn_print.pm

@ -39,7 +39,7 @@ sub singular {
!($commands->{"i"} || $commands->{"l"} ||
$commands->{"df"} || $commands->{"d"} || $commands->{"c"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -53,7 +53,7 @@ sub singular {
$commands {"c"} && !($commands->{"i"} ||
$commands->{"df"} || $commands->{"d"} || $commands->{"l"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} &&
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} &&
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -67,7 +67,7 @@ sub singular {
$commands {"c"} && $commands->{"d"} &&
!($commands->{"i"} || $commands->{"df"} || $commands->{"l"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||
@ -81,7 +81,7 @@ sub singular {
$commands {"c"} && ($commands->{"d"} ||
$commands->{"l"}) && !($commands->{"i"} || $commands->{"df"} ||
$commands->{"scripts"} || $commands->{"preinst"} || $commands->{"postinst"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"T"} ||
$commands->{"prerm"} || $commands->{"postrm"} || $commands->{"config"} || $commands->{"templates"} || $commands->{"T"} ||
$commands->{"pre_depends"} || $commands->{"depends"} ||
$commands->{"recommends"} || $commands->{"suggests"} ||
$commands->{"provides"} || $commands->{"replaces"} ||

Loading…
Cancel
Save