From 5e36334173bcf7c27dabdb2a05be08343a8e48c2 Mon Sep 17 00:00:00 2001 From: tony Date: Mon, 1 Nov 1999 20:19:20 +0000 Subject: [PATCH] Attempted cross-version compatibility and fixing a little nuisance in the installer. --- Makefile | 2 +- cowsay | 26 ++++++++++++++++++++------ install.sh | 4 ++-- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 85b3cb1..1674ab6 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ FILES= Files.base PRODUCT= cowsay -VER= 3.0 +VER= 3.01 BASE= ${PRODUCT}-${VER} TARZ= ${BASE}.tar.Z TARGZ= ${BASE}.tar.gz diff --git a/cowsay b/cowsay index dbe0e7f..127b832 100755 --- a/cowsay +++ b/cowsay @@ -6,7 +6,8 @@ ## 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 Getopt::Std; use Cwd; @@ -15,10 +16,17 @@ $version = "3.0"; $progname = basename($0); $eyes = "oo"; $tongue = " "; -$wrap = 40; $cowpath = $ENV{'COWPATH'} || '%PREFIX%/share/cows'; @message = (); $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 = ( 'e' => 'oo', 'f' => 'default.cow', @@ -44,10 +52,16 @@ $eyes = substr($opts{'e'}, 0, 2); $tongue = substr($opts{'T'}, 0, 2); $the_cow = ""; +if (($^O eq "MSWin32") or ($^O eq "Windows_NT")) { ## Many perls, eek! + $pathsep = ';'; +} else { + $pathsep = ':'; +} + &slurp_input; -$columns = $opts{'W'}; -$tabstop = 8; -@message = ($opts{'n'} ? @message : split("\n", fill("", "", @message))); +$Text::Wrap::columns = $opts{'W'}; +@message = ($opts{'n'} ? expand(@message) : + split("\n", fill("", "", @message))); &construct_balloon; &construct_face; &get_cow; @@ -58,7 +72,7 @@ sub list_cowfiles { my $basedir; my @dirfiles; chop($basedir = cwd); - for my $d (split(/:/, $cowpath)) { + for my $d (split(/$pathsep/, $cowpath)) { print "Cow files in $d:\n"; opendir(COWDIR, $d) || die "$0: Cannot open $d\n"; for my $file (readdir COWDIR) { diff --git a/install.sh b/install.sh index 1278cac..0b6f2fa 100755 --- a/install.sh +++ b/install.sh @@ -27,8 +27,8 @@ backdoor=$1 pathdirs=`echo $PATH | tr : " "` for p in $pathdirs; do set $p/perl $p/perl5* - while [ ! -z $1 ]; do - if [ -x $1 ]; then + while [ ! -z "$1" ]; do + if [ -x "$1" ]; then echo Found perl in $1 perls="$perls $1" fi