Initial revision

This commit is contained in:
tony 1999-08-14 07:17:54 +00:00
commit 1ea4c1be38
48 changed files with 1033 additions and 0 deletions

23
cows/beavis.zen.cow Normal file
View File

@ -0,0 +1,23 @@
##
## Beavis, with Zen philosophy removed.
##
$the_cow = <<EOC;
$thoughts __------~~-,
$thoughts ,' ,
/ \\
/ :
| '
| |
| |
| _-- |
_| =-. .-. ||
o|/o/ _. |
/ ~ \\ |
(____\@) ___~ |
|_===~~~.` |
_______.--~ |
\\________ |
\\ |
__/-___-- -__
/ _ \\
EOC

16
cows/bong.cow Normal file
View File

@ -0,0 +1,16 @@
##
## A cow with a bong, from lars@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts
$thoughts
^__^
_______/($eyes)
/\\/( /(__)
| W----|| |~|
|| || |~| ~~
|~| ~
|_| o
|#|/
_+#+_
EOC

12
cows/bud-frogs.cow Normal file
View File

@ -0,0 +1,12 @@
##
## The Budweiser frogs
##
$the_cow = <<EOC;
$thoughts
$thoughts
oO)-. .-(Oo
/__ _\\ /_ __\\
\\ \\( | ()~() | )/ /
\\__|\\ | (-___-) | /|__/
' '--' ==`-'== '--' '
EOC

10
cows/bunny.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A cute little wabbit
##
$the_cow = <<EOC;
$thoughts
$thoughts \\
\\ /\\
( )
.( o ).
EOC

23
cows/cheese.cow Normal file
View File

@ -0,0 +1,23 @@
##
## The cheese from milk & cheese
##
$the_cow = <<EOC;
$thoughts
$thoughts
_____ _________
/ \\_/ |
| ||
| ||
| ###\\ /### | |
| 0 \\/ 0 | |
/| | |
/ | < |\\ \\
| /| | | |
| | \\_______/ | | |
| | | / /
/|| /|||
----------------|
| | | |
*** ***
/___\\ /___\\
EOC

14
cows/cower.cow Normal file
View File

@ -0,0 +1,14 @@
##
## A cowering cow
##
$the_cow = <<EOC;
$thoughts
$thoughts
,__, | |
(oo)\\| |___
(__)\\| | )\\_
| |_w | \\
| | || *
Cower....
EOC

7
cows/default.cow Normal file
View File

@ -0,0 +1,7 @@
$the_cow = <<"EOC";
$thoughts ^__^
$thoughts ($eyes)\\_______
(__)\\ )\\/\\
$tongue ||----w |
|| ||
EOC

24
cows/devil.cow Normal file
View File

@ -0,0 +1,24 @@
##
## 4.4 >> 5.4
##
$the_cow = <<EOC;
$thoughts , ,
$thoughts /( )`
$thoughts \\ \\___ / |
/- _ `-/ '
(/\\/ \\ \\ /\\
/ / | ` \\
O O ) / |
`-^--'`< '
(_.) _ ) /
`.___/` /
`-----' /
<----. __ / __ \\
<----|====O)))==) \\) /====
<----' `--' `.__,' \\
| |
\\ /
______( (_ / \\______
,' ,-----' | \\
`--{__________) \\/
EOC

21
cows/dragon-and-cow.cow Normal file
View File

@ -0,0 +1,21 @@
##
## A dragon smiting a cow, possible credit to kube@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts ^ /^
$thoughts / \\ // \\
$thoughts |\\___/| / \\// .\\
$thoughts /O O \\__ / // | \\ \\ *----*
/ / \\/_/ // | \\ \\ \\ |
@___@` \\/_ // | \\ \\ \\/\\ \\
0/0/| \\/_ // | \\ \\ \\ \\
0/0/0/0/| \\/// | \\ \\ | |
0/0/0/0/0/_|_ / ( // | \\ _\\ | /
0/0/0/0/0/0/`/,_ _ _/ ) ; -. | _ _\\.-~ / /
,-} _ *-.|.-~-. .~ ~
\\ \\__/ `/\\ / ~-. _ .-~ /
\\____($eyes) *. } { /
( (--) .----~-.\\ \\-` .~
//__\\\\ \\__ Ack! ///.----..< \\ _ -~
// \\\\ ///-._ _ _ _ _ _ _{^ - - - - ~
EOC

21
cows/dragon.cow Normal file
View File

@ -0,0 +1,21 @@
##
## The Whitespace Dragon
##
$the_cow = <<EOC;
$thoughts / \\ //\\
$thoughts |\\___/| / \\// \\\\
/0 0 \\__ / // | \\ \\
/ / \\/_/ // | \\ \\
\@_^_\@'/ \\/_ // | \\ \\
//_^_/ \\/_ // | \\ \\
( //) | \\/// | \\ \\
( / /) _|_ / ) // | \\ _\\
( // /) '/,_ _ _/ ( ; -. | _ _\\.-~ .-~~~^-.
(( / / )) ,-{ _ `-.|.-~-. .~ `.
(( // / )) '/\\ / ~-. _ .-~ .-~^-. \\
(( /// )) `. { } / \\ \\
(( / )) .----~-.\\ \\-' .~ \\ `. \\^-.
///.----..> \\ _ -~ `. ^-` ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
/.-~
EOC

View File

@ -0,0 +1,14 @@
##
## Do we need to explain this?
##
$the_cow = <<EOC;
$thoughts
$thoughts ....
........ .
. .
. .
......... .......
..............................
Elephant inside ASCII snake
EOC

15
cows/elephant.cow Normal file
View File

@ -0,0 +1,15 @@
##
## An elephant out and about
##
$the_cow = <<EOC;
$thoughts /\\ ___ /\\
$thoughts // \\/ \\/ \\\\
(( O O ))
\\\\ / \\ //
\\/ | | \\/
| | | |
| | | |
| o |
| | | |
|m| |m|
EOC

16
cows/eyes.cow Normal file
View File

@ -0,0 +1,16 @@
##
## Evil-looking eyes
##
$the_cow = <<EOC;
$thoughts
$thoughts
.::!!!!!!!:.
.!!!!!:. .:!!!!!!!!!!!!
~~~~!!!!!!. .:!!!!!!!!!UWWW\$\$\$
:\$\$NWX!!: .:!!!!!!XUWW\$\$\$\$\$\$\$\$\$P
\$\$\$\$\$##WX!: .<!!!!UW\$\$\$\$" \$\$\$\$\$\$\$\$#
\$\$\$\$\$ \$\$\$UX :!!UW\$\$\$\$\$\$\$\$\$ 4\$\$\$\$\$*
^\$\$\$B \$\$\$\$\\ \$\$\$\$\$\$\$\$\$\$\$\$ d\$\$R"
"*\$bd\$\$\$\$ '*\$\$\$\$\$\$\$\$\$\$\$o+#"
"""" """""""
EOC

15
cows/flaming-sheep.cow Normal file
View File

@ -0,0 +1,15 @@
##
## The flaming sheep, contributed by Geordan Rosario (geordan@csua.berkeley.edu)
##
$the_cow = <<EOC;
$thoughts . . .
$thoughts . . . ` ,
$thoughts .; . : .' : : : .
$thoughts i..`: i` i.i.,i i .
$thoughts `,--.|i |i|ii|ii|i:
U${eyes}U\\.'\@\@\@\@\@\@`.||'
\\__/(\@\@\@\@\@\@\@\@\@\@)'
(\@\@\@\@\@\@\@\@)
`YY~~~~YY'
|| ||
EOC

26
cows/ghostbusters.cow Normal file
View File

@ -0,0 +1,26 @@
##
## Ghostbusters!
##
$the_cow = <<EOC;
$thoughts
$thoughts
$thoughts __---__
_- /--______
__--( / \\ )XXXXXXXXXXX\\v.
.-XXX( O O )XXXXXXXXXXXXXXX-
/XXX( U ) XXXXXXX\\
/XXXXX( )--_ XXXXXXXXXXX\\
/XXXXX/ ( O ) XXXXXX \\XXXXX\\
XXXXX/ / XXXXXX \\__ \\XXXXX
XXXXXX__/ XXXXXX \\__---->
---___ XXX__/ XXXXXX \\__ /
\\- --__/ ___/\\ XXXXXX / ___--/=
\\-\\ ___/ XXXXXX '--- XXXXXX
\\-\\/XXX\\ XXXXXX /XXXXX
\\XXXXXXXXX \\ /XXXXX/
\\XXXXXX > _/XXXXX/
\\XXXXX--__/ __-- XXXX/
-XXXXXXXX--------------- XXXXXX-
\\XXXXXXXXXXXXXXXXXXXXXXXXXX/
""VXXXXXXXXXXXXXXXXXXV""
EOC

12
cows/head-in.cow Normal file
View File

@ -0,0 +1,12 @@
##
## Go stick yer head in a cow.
##
$the_cow = <<EOC;
$thoughts
$thoughts
^__^ /
($eyes)\\_______/ _________
(__)\\ )=( ____|_ \\_____
$tongue ||----w | \\ \\ \\_____ |
|| || || ||
EOC

11
cows/hellokitty.cow Normal file
View File

@ -0,0 +1,11 @@
##
## Hello Kitty
##
$the_cow = <<EOC;
$thoughts
$thoughts
/\\_)o<
| \\
| O . O|
\\_____/
EOC

26
cows/kiss.cow Normal file
View File

@ -0,0 +1,26 @@
##
## A lovers' empbrace
##
$the_cow = <<EOC;
$thoughts
$thoughts
,;;;;;;;,
;;;;;;;;;;;,
;;;;;'_____;'
;;;(/))))|((\\
_;;((((((|))))
/ |_\\\\\\\\\\\\\\\\\\\\\\\\
.--~( \\ ~))))))))))))
/ \\ `\\-(((((((((((\\\\
| | `\\ ) |\\ /|)
| | `. _/ \\_____/ |
| , `\\~ /
| \\ \\ /
| `. `\\| /
| ~- `\\ /
\\____~._/~ -_, (\\
|-----|\\ \\ ';;
| | :;;;' \\
| / | |
| | |
EOC

12
cows/kitty.cow Normal file
View File

@ -0,0 +1,12 @@
##
## A kitten of sorts, I think
##
$the_cow = <<EOC;
$thoughts
$thoughts
("`-' '-/") .___..--' ' "`-._
` *_ * ) `-. ( ) .`-.__. `)
(_Y_.) ' ._ ) `._` ; `` -. .-'
_.. `--'_..-_/ /--' _ .' ,4
( i l ),-'' ( l i),' ( ( ! .-'
EOC

12
cows/koala.cow Normal file
View File

@ -0,0 +1,12 @@
##
## From the canonical koala collection
##
$the_cow = <<EOC;
$thoughts
$thoughts
___
{~._.~}
( Y )
()~*~()
(_)-(_)
EOC

19
cows/kosh.cow Normal file
View File

@ -0,0 +1,19 @@
##
## It's a Kosh Cow!
##
$the_cow = <<EOC;
$thoughts
$thoughts
$thoughts
___ _____ ___
/ \\ / /| / \\
| | / / | | |
| | /____/ | | |
| | | | | | |
| | | {} | / | |
| | |____|/ | |
| | |==| | |
| \\___________/ |
| |
| |
EOC

15
cows/luke-koala.cow Normal file
View File

@ -0,0 +1,15 @@
##
## From the canonical koala collection
##
$the_cow = <<EOC;
$thoughts
$thoughts .
___ //
{~._.~}//
( Y )K/
()~*~()
(_)-(_)
Luke
Sywalker
koala
EOC

21
cows/mech-and-cow Normal file
View File

@ -0,0 +1,21 @@
,-----.
| |
,--| |-.
__,----| | | |
,;:: | `_____' |
`._______| i^i |
`----| |---'| .
,-------._| |== ||//
| |_|P`. /'/
`-------' 'Y Y/'/'
.==\ /_\
^__^ / /'| `i
(oo)\_______ /' / | |
(__)\ )\/\ /' / | `i
||----w | ___,;`----'.___L_,-'`\__
|| || i_____;----\.____i""\____\

15
cows/meow.cow Normal file
View File

@ -0,0 +1,15 @@
##
## A meowing tiger?
##
$the_cow = <<EOC;
$thoughts
$thoughts , _ ___.--'''`--''//-,-_--_.
\\`"' ` || \\\\ \\ \\\\/ / // / ,-\\\\`,_
/'` \\ \\ || Y | \\|/ / // / - |__ `-,
/\@"\\ ` \\ `\\ | | ||/ // | \\/ \\ `-._`-,_.,
/ _.-. `.-\\,___/\\ _/|_/_\\_\\/|_/ | `-._._)
`-'``/ / | // \\__/\\__ / \\__/ \\
`-' /-\\/ | -| \\__ \\ |-' |
__/\\ / _/ \\/ __,-' ) ,' _|'
(((__/(((_.' ((___..-'((__,'
EOC

21
cows/milk.cow Normal file
View File

@ -0,0 +1,21 @@
##
## Milk from Milk and Cheese
##
$the_cow = <<EOC;
$thoughts ____________
$thoughts |__________|
/ /\\
/ / \\
/___________/___/|
| | |
| ==\\ /== | |
| O O | \\ \\ |
| < | \\ \\|
/| | \\ \\
/ | \\_____/ | / /
/ /| | / /|
/||\\| | /||\\/
-------------|
| | | |
<__/ \\__>
EOC

14
cows/moofasa.cow Normal file
View File

@ -0,0 +1,14 @@
##
## MOOfasa.
##
$the_cow = <<EOC;
$thoughts ____
$thoughts / \\
| ^__^ |
| ($eyes) |______
| (__) | )\\/\\
\\____/|----w |
|| ||
Moofasa
EOC

9
cows/moose.cow Normal file
View File

@ -0,0 +1,9 @@
$the_cow = <<EOC;
$thoughts
$thoughts \\_\\_ _/_/
$thoughts \\__/
($eyes)\\_______
(__)\\ )\\/\\
$tongue ||----w |
|| ||
EOC

10
cows/mutilated.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A mutilated cow, from aspolito@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts \\_______
v__v $thoughts \\ O )
($eyes) ||----w |
(__) || || \\/\\
$tongue
EOC

22
cows/ren.cow Normal file
View File

@ -0,0 +1,22 @@
##
## Ren
##
$the_cow = <<EOC;
$thoughts
$thoughts
____
/# /_\\_
| |/o\\o\\
| \\\\_/_/
/ |_ |
| ||\\_ ~|
| ||| \\/
| |||_
\\// |
|| |
||_ \\
\\_| o|
/\\___/
/ ||||__
(___)_)
EOC

12
cows/satanic.cow Normal file
View File

@ -0,0 +1,12 @@
##
## Satanic cow, source unknown.
##
$the_cow = <<EOC;
$thoughts
$thoughts (__)
(\\/)
/-------\\/
/ | 666 ||
* ||----||
~~ ~~
EOC

13
cows/sheep.cow Normal file
View File

@ -0,0 +1,13 @@
##
## The non-flaming sheep.
##
$the_cow = <<EOC
$thoughts
$thoughts
__
U${eyes}U\\.'\@\@\@\@\@\@`.
\\__/(\@\@\@\@\@\@\@\@\@\@)
(\@\@\@\@\@\@\@\@)
`YY~~~~YY'
|| ||
EOC

15
cows/skeleton.cow Normal file
View File

@ -0,0 +1,15 @@
##
## This 'Scowleton' brought to you by one of
## {appel,kube,rowe}@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts (__)
$thoughts /$eyes|
$thoughts (_"_)*+++++++++*
//I#\\\\\\\\\\\\\\\\I\\
I[I|I|||||I I `
I`I'///'' I I
I I I I
~ ~ ~ ~
Scowleton
EOC

10
cows/small.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A small cow, artist unknown
##
$eyes = ".." unless ($eyes);
$the_cow = <<EOC;
$thoughts ,__,
$thoughts ($eyes)____
(__) )\\
$tongue||--|| *
EOC

12
cows/sodomized.cow Normal file
View File

@ -0,0 +1,12 @@
##
## A cow performing an unnatural act, artist unknown.
##
$the_cow = <<EOC;
$thoughts _
$thoughts (_)
$thoughts ^__^ / \\
$thoughts ($eyes)\\_____/_\\ \\
(__)\\ ) /
$tongue ||----w ((
|| ||>>
EOC

19
cows/stegosaurus.cow Normal file
View File

@ -0,0 +1,19 @@
##
## A stegosaur with a top hat?
##
$the_cow = <<EOC;
$thoughts . .
$thoughts / `. .' "
$thoughts .---. < > < > .---.
$thoughts | \\ \\ - ~ ~ - / / |
_____ ..-~ ~-..-~
| | \\~~~\\.' `./~~~/
--------- \\__/ \\__/
.' O \\ / / \\ "
(_____, `._.' | } \\/~~~/
`----. / } | / \\__/
`-. | / | / `. ,~~|
~-.__| /_ - ~ ^| /- _ `..-'
| / | / ~-. `-. _ _ _
|_____| |_____| ~ - . _ _ _ _ _>
EOC

19
cows/stimpy.cow Normal file
View File

@ -0,0 +1,19 @@
##
## Stimpy!
##
$the_cow = <<EOC;
$thoughts . _ .
$thoughts |\\_|/__/|
/ / \\/ \\ \\
/__|O||O|__ \\
|/_ \\_/\\_/ _\\ |
| | (____) | ||
\\/\\___/\\__/ //
(_/ ||
| ||
| ||\\
\\ //_/
\\______//
__ || __||
(____(____)
EOC

10
cows/supermilker.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A cow being milked, probably from Lars Smith (lars@csua.berkeley.edu)
##
$the_cow = <<EOC;
$thoughts ^__^
$thoughts ($eyes)\\_______ ________
(__)\\ )\\/\\ |Super |
$tongue ||----W | |Milker|
|| UDDDDDDDDD|______|
EOC

24
cows/surgery.cow Normal file
View File

@ -0,0 +1,24 @@
##
## A cow operation, artist unknown
##
$the_cow = <<EOC;
$thoughts \\ /
$thoughts \\/
(__) /\\
($eyes) O O
_\\/_ //
* ( ) //
\\ (\\\\ //
\\( \\\\ )
( \\\\ ) /\\
___[\\______/^^^^^^^\\__/) o-)__
|\\__[=======______//________)__\\
\\|_______________//____________|
||| || //|| |||
||| || @.|| |||
|| \\/ .\\/ ||
. .
'.'.`
COW-OPERATION
EOC

12
cows/telebears.cow Normal file
View File

@ -0,0 +1,12 @@
##
## A cow performing an unnatural act, artist unknown.
##
$the_cow = <<EOC;
$thoughts _
$thoughts (_) <-- TeleBEARS
$thoughts ^__^ / \\
$thoughts ($eyes)\\_____/_\\ \\
(__)\\ you ) /
$tongue ||----w ((
|| ||>>
EOC

12
cows/three-eyes.cow Normal file
View File

@ -0,0 +1,12 @@
##
## A cow with three eyes, brought to you by dpetrou@csua.berkeley.edu
##
$extra = chop($eyes);
$eyes .= ($extra x 2);
$the_cow = <<EOC;
$thoughts ^___^
$thoughts ($eyes)\\_______
(___)\\ )\\/\\
$tongue ||----w |
|| ||
EOC

26
cows/turkey.cow Normal file
View File

@ -0,0 +1,26 @@
##
## Turkey!
##
$the_cow = <<EOC;
$thoughts ,+*^^*+___+++_
$thoughts ,*^^^^ )
$thoughts _+* ^**+_
$thoughts +^ _ _++*+_+++_, )
_+^^*+_ ( ,+*^ ^ \\+_ )
{ ) ( ,( ,_+--+--, ^) ^\\
{ (\@) } f ,( ,+-^ __*_*_ ^^\\_ ^\\ )
{:;-/ (_+*-+^^^^^+*+*<_ _++_)_ ) ) /
( / ( ( ,___ ^*+_+* ) < < \\
U _/ ) *--< ) ^\\-----++__) ) ) )
( ) _(^)^^)) ) )\\^^^^^))^*+/ / /
( / (_))_^)) ) ) ))^^^^^))^^^)__/ +^^
( ,/ (^))^)) ) ) ))^^^^^^^))^^) _)
*+__+* (_))^) ) ) ))^^^^^^))^^^^^)____*^
\\ \\_)^)_)) ))^^^^^^^^^^))^^^^)
(_ ^\\__^^^^^^^^^^^^))^^^^^^^)
^\\___ ^\\__^^^^^^))^^^^^^^^)\\\\
^^^^^\\uuu/^^\\uuu/^^^^\\^\\^\\^\\^\\^\\^\\^\\
___) >____) >___ ^\\_\\_\\_\\_\\_\\_\\)
^^^//\\\\_^^//\\\\_^ ^(\\_\\_\\_\\)
^^^ ^^ ^^^ ^
EOC

20
cows/turtle.cow Normal file
View File

@ -0,0 +1,20 @@
##
## A mysterious turtle...
##
$the_cow = <<EOC;
$thoughts ___-------___
$thoughts _-~~ ~~-_
$thoughts _-~ /~-_
/^\\__/^\\ /~ \\ / \\
/| O|| O| / \\_______________/ \\
| |___||__| / / \\ \\
| \\ / / \\ \\
| (_______) /______/ \\_________ \\
| / / \\ / \\
\\ \\^\\\\ \\ / \\ /
\\ || \\______________/ _-_ //\\__//
\\ ||------_-~~-_ ------------- \\ --/~ ~\\ || __/
~-----||====/~ |==================| |/~~~~~
(_(__/ ./ / \\_\\ \\.
(_(___/ \\_____)_)
EOC

16
cows/udder.cow Normal file
View File

@ -0,0 +1,16 @@
##
## The cow from a file called cow-n-horn, artist unknown.
##
$other_eye = chop($eyes);
$eyes .= " $other_eye";
$the_cow = <<EOC;
$thoughts
$thoughts (__)
$eyes\\
('') \\---------
$tongue\\ \\
| |\\
||---( )_|| *
|| UU ||
== ==
EOC

16
cows/vader-koala.cow Normal file
View File

@ -0,0 +1,16 @@
##
## Another canonical koala?
##
$the_cow = <<EOC;
$thoughts
$thoughts .
.---. //
Y|o o|Y//
/_(i=i)K/
~()~*~()~
(_)-(_)
Darth
Vader
koala
EOC

13
cows/vader.cow Normal file
View File

@ -0,0 +1,13 @@
##
## Cowth Vader, from geordan@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts ,-^-.
$thoughts !oYo!
$thoughts /./=\\.\\______
## )\\/\\
||-----w||
|| ||
Cowth Vader
EOC

10
cows/www.cow Normal file
View File

@ -0,0 +1,10 @@
##
## A cow wadvertising the World Wide Web, from lim@csua.berkeley.edu
##
$the_cow = <<EOC;
$thoughts ^__^
$thoughts ($eyes)\\_______
(__)\\ )\\/\\
$tongue ||--WWW |
|| ||
EOC

166
cowsay Executable file
View File

@ -0,0 +1,166 @@
#!/usr/bin/perl -w
##
## Cowsay 3.0
## Tony Monroe, 13 April 1999
##
use Text::Wrap qw(wrap fill $columns $tabstop);
use File::Basename;
use Getopt::Std;
use Cwd;
$version = "3.0";
$progname = basename($0);
$eyes = "oo";
$tongue = " ";
$wrap = 40;
$cowpath = $ENV{'COWPATH'} || '/usr/local/share/cows';
@message = ();
$thoughts = "";
%opts = (
'e' => 'oo',
'f' => 'default.cow',
'n' => 0,
'T' => ' ',
'W' => 40,
);
getopts('bde:f:ghlLnNpstT:wW:y', \%opts);
&display_usage if $opts{'h'};
&list_cowfiles if $opts{'l'};
$borg = $opts{'b'};
$dead = $opts{'d'};
$greedy = $opts{'g'};
$paranoid = $opts{'p'};
$stoned = $opts{'s'};
$tired = $opts{'t'};
$wired = $opts{'w'};
$young = $opts{'y'};
$eyes = substr($opts{'e'}, 0, 2);
$tongue = substr($opts{'T'}, 0, 2);
$the_cow = "";
&slurp_input;
$columns = $opts{'W'};
$tabstop = 8;
@message = ($opts{'n'} ? @message : split("\n", fill("", "", @message)));
&construct_balloon;
&construct_face;
&get_cow;
print @balloon_lines;
print $the_cow;
sub list_cowfiles {
my $basedir;
my @dirfiles;
chop($basedir = cwd);
for my $d (split(/:/, $cowpath)) {
print "Cow files in $d:\n";
opendir(COWDIR, $d) || die "$0: Cannot open $d\n";
for my $file (readdir COWDIR) {
if ($file =~ s/\.cow$//) {
push(@dirfiles, $file);
}
}
closedir(COWDIR);
print wrap("", "", sort @dirfiles), "\n";
@dirfiles = ();
chdir($basedir);
}
exit(0);
}
sub slurp_input {
unless ($ARGV[0]) {
chomp(@message = <STDIN>);
} else {
&display_usage if $opts{'n'};
@message = join(' ', @ARGV);
}
}
sub maxlength {
my ($l, $m);
$m = -1;
for my $i (@_) {
$l = length $i;
$m = $l if ($l > $m);
}
return $m;
}
sub construct_balloon {
my $max = &maxlength(@message);
my $max2 = $max + 2; ## border space fudge.
my $format = "%s %-${max}s %s\n";
my @border; ## up-left, up-right, down-left, down-right, left, right
if ($0 =~ /think/i) {
$thoughts = 'o';
@border = qw[ ( ) ( ) ( ) ];
} elsif (@message < 2) {
$thoughts = '\\';
@border = qw[ < > ];
} else {
$thoughts = '\\';
@border = qw[ / \\ \\ / | | ];
}
push(@balloon_lines,
" " . ("_" x $max2) . " \n" ,
sprintf($format, $border[0], $message[0], $border[1]),
(@message < 2 ? "" :
map { sprintf($format, $border[4], $_, $border[5]) }
@message[1 .. $#message - 1]),
(@message < 2 ? "" :
sprintf($format, $border[2], $message[$#message], $border[3])),
" " . ("-" x $max2) . " \n"
);
}
sub construct_face {
if ($borg) { $eyes = "=="; }
if ($dead) { $eyes = "xx"; $tongue = "U "; }
if ($greedy) { $eyes = "\$\$"; }
if ($paranoid) { $eyes = "@@"; }
if ($stoned) { $eyes = "**"; $tongue = "U "; }
if ($tired) { $eyes = "--"; }
if ($wired) { $eyes = "OO"; }
if ($young) { $eyes = ".."; }
}
sub get_cow {
##
## Get a cow from the specified cowfile; otherwise use the default cow
## which was defined above in $the_cow.
##
my $f = $opts{'f'};
my $full = "";
if ($opts{'f'} =~ m,/,) {
$full = $opts{'f'};
} else {
for my $d (split(/:/, $cowpath)) {
if (-f "$d/$f") {
$full = "$d/$f";
last;
} elsif (-f "$d/$f.cow") {
$full = "$d/$f.cow";
last;
}
}
if ($full eq "") {
die "$progname: Could not find $f cowfile!\n";
}
}
do $full;
die "$progname: $@\n" if $@;
}
sub display_usage {
die <<EOF;
cow{say,think} version $version, (c) 1999 Tony's SquidWarez
Usage: $progname [-bdgpstwy] [-h] [-e eyes] [-f cowfile]
[-l] [-n] [-T tongue] [-W wrapcolumn] [message]
EOF
}

132
cowsay.1 Normal file
View File

@ -0,0 +1,132 @@
.so /usr/local/etc/nmh/tmac.h
.TH COWSAY 1 "Barnyard Animal Management"
.SH NAME
cowsay, cowthink \- configurable speaking/thinking cow
.SH SYNOPSIS
cowsay
\%[\-e eye_string]
\%[\-f cowfile]
\%[\-h]
\%[\-l]
\%[\-n]
\%[\-T tongue_string]
\%[\-W column]
\%[\-bdgpstwy]
.SH DESCRIPTION
.I Cowsay
generates an ASCII picture of a cow saying something provided by the
user. If run with no arguments, it accepts standard input, word-wraps
the message given at about 40 columns, and prints the cow saying the
given message on standard output.
To aid in the use of arbitrary messages with arbitrary whitespace, use the
.B -n
option. If it is specified, the given message will not
be word-wrapped. This is possibly useful if you want to make the cow
think or speak in figlet(6). If
.B -n
is specified, there must not be any command-line arguments left after
all the switches have been processed.
The
.B -W
specifies roughly (where the message should be wrapped. The default is
equivalent to
.B -W 40
i.e. wrap words at or before the 40th column.
If any command-line arguments are left over after all switches have
been processed, they become the cow\'s message. The program will not
accept standard input for a message in this case.
There are several provided modes which change the appearance of the
cow depending on its particular emotional/physical state. The
.B \-b
option initiates Borg mode;
.B \-d
causes the cow to appear dead;
.B \-g
invokes greedy mode;
.B \-p
causes a state of paranoia to come over the cow;
.B \-s
makes the cow appear thoroughly stoned;
.B \-t
yields a tired cow;
.B \-w
is somewhat the opposite of \-t, and initiates wired mode;
.B \-y
brings on the cow's youthful appearance.
The user may specify the
.B -e
option to select the appearance of the cow's eyes, in which
case the first two characters of the argument string
.B eye_string
will be used. The default eyes are 'oo'. The tongue is similarly
configurable through
.B -T
and
.B tongue_string;
it must be two characters and does not appear by
default. However, it does appear in the 'dead' and 'stoned' modes.
Any configuration done by
.B -e
and
.B -T
will be lost if one of the provided modes is used.
The
.B -f
option specifies a particular cow picture file (``cowfile'') to
use. If the cowfile spec contains / then it will be interpreted
as a path relative to the current directory. Otherwise, cowsay
will search the path specified in the COWPATH environment variable.
To list all cowfiles on the current $COWPATH, invoke
.B cowsay
with the
.B -l
switch.
If the program is invoked as
.B cowthink
then the cow will think its message instead of saying it.
.SH COWFILE FORMAT
A cowfile is made up of a simple block of perl(1) code, which
assigns a picture of a cow to the variable ``$the_cow''. Should
you wish to customize the eyes or the tongue of the cow, then the
variables ``$eyes'' and ``$tongue'' may be used. The trail leading
up to the cow\'s message balloon is composed of the character(s)
in the ``$thoughts'' variable. Any backslashes must be reduplicated
to prevent interpolation. The name of a cowfile should end with
``.cow'', otherwise it is assumed not to be a cowfile. Also,
at-signs (``@'') must be backslashed because that is what Perl 5
expects.
.SH COMPATIBILITY WITH OLDER VERSIONS
Version 3.0 is fully backward-compatible with 2.x versions. If
you're still using a 1.x version, consider upgrading.
.SH ENVIRONMENT
The COWPATH environment variable, if present, will be used to search
for cowfiles. It contains a colon-separated list of directories,
much like PATH or MANPATH. It should always contain the
/usr/local/share/cows directory, or at least a directory with a
file called ``default.cow'' in it.
.SH FILES
/usr/local/share/cows holds a sample set of cowfiles. If your
COWPATH is not explicitly set, it automatically contains this directory.
.SH BUGS
If there are any left, please notify the author at the address below.
.SH AUTHOR
Tony Monroe (tmonroe@csua.berkeley.edu), with suggestions from Shannon
Appel (appel@csua.berkeley.edu) and contributions from Anthony Polito
(aspolito@csua.berkeley.edu).
.SH SEE ALSO
perl(1), wall(1), nwrite(1), figlet(6), /csua/bin/rootcow