Attempted cross-version compatibility and fixing a little nuisance

in the installer.
This commit is contained in:
tony 1999-11-01 20:19:20 +00:00
parent 7f755e175e
commit 5e36334173
3 changed files with 23 additions and 9 deletions

View File

@ -6,7 +6,7 @@
FILES= Files.base FILES= Files.base
PRODUCT= cowsay PRODUCT= cowsay
VER= 3.0 VER= 3.01
BASE= ${PRODUCT}-${VER} BASE= ${PRODUCT}-${VER}
TARZ= ${BASE}.tar.Z TARZ= ${BASE}.tar.Z
TARGZ= ${BASE}.tar.gz TARGZ= ${BASE}.tar.gz

26
cowsay
View File

@ -6,7 +6,8 @@
## This file is part of cowsay. (c) 1999 Tony Monroe. ## This file is part of cowsay. (c) 1999 Tony Monroe.
## ##
use Text::Wrap qw(wrap fill $columns $tabstop); use Text::Tabs qw(expand);
use Text::Wrap qw(wrap fill $columns);
use File::Basename; use File::Basename;
use Getopt::Std; use Getopt::Std;
use Cwd; use Cwd;
@ -15,10 +16,17 @@ $version = "3.0";
$progname = basename($0); $progname = basename($0);
$eyes = "oo"; $eyes = "oo";
$tongue = " "; $tongue = " ";
$wrap = 40;
$cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows'; $cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows';
@message = (); @message = ();
$thoughts = ""; $thoughts = "";
## Yeah, this is rude, I know. But hopefully it gets around a nasty
## little version dependency.
$Text::Wrap::initial_tab = 8;
$Text::Wrap::subsequent_tab = 8;
$Text::Wrap::tabstop = 8;
%opts = ( %opts = (
'e' => 'oo', 'e' => 'oo',
'f' => 'default.cow', 'f' => 'default.cow',
@ -44,10 +52,16 @@ $eyes = substr($opts{'e'}, 0, 2);
$tongue = substr($opts{'T'}, 0, 2); $tongue = substr($opts{'T'}, 0, 2);
$the_cow = ""; $the_cow = "";
if (($^O eq "MSWin32") or ($^O eq "Windows_NT")) { ## Many perls, eek!
$pathsep = ';';
} else {
$pathsep = ':';
}
&slurp_input; &slurp_input;
$columns = $opts{'W'}; $Text::Wrap::columns = $opts{'W'};
$tabstop = 8; @message = ($opts{'n'} ? expand(@message) :
@message = ($opts{'n'} ? @message : split("\n", fill("", "", @message))); split("\n", fill("", "", @message)));
&construct_balloon; &construct_balloon;
&construct_face; &construct_face;
&get_cow; &get_cow;
@ -58,7 +72,7 @@ sub list_cowfiles {
my $basedir; my $basedir;
my @dirfiles; my @dirfiles;
chop($basedir = cwd); chop($basedir = cwd);
for my $d (split(/:/, $cowpath)) { for my $d (split(/$pathsep/, $cowpath)) {
print "Cow files in $d:\n"; print "Cow files in $d:\n";
opendir(COWDIR, $d) || die "$0: Cannot open $d\n"; opendir(COWDIR, $d) || die "$0: Cannot open $d\n";
for my $file (readdir COWDIR) { for my $file (readdir COWDIR) {

View File

@ -27,8 +27,8 @@ backdoor=$1
pathdirs=`echo $PATH | tr : " "` pathdirs=`echo $PATH | tr : " "`
for p in $pathdirs; do for p in $pathdirs; do
set $p/perl $p/perl5* set $p/perl $p/perl5*
while [ ! -z $1 ]; do while [ ! -z "$1" ]; do
if [ -x $1 ]; then if [ -x "$1" ]; then
echo Found perl in $1 echo Found perl in $1
perls="$perls $1" perls="$perls $1"
fi fi