├── ChangeLog ├── INSTALL ├── LICENSE ├── MANIFEST ├── README ├── Wrap.pm.diff ├── cows ├── beavis.zen.cow ├── bong.cow ├── bud-frogs.cow ├── bunny.cow ├── cheese.cow ├── cower.cow ├── daemon.cow ├── default.cow ├── dragon-and-cow.cow ├── dragon.cow ├── elephant-in-snake.cow ├── elephant.cow ├── eyes.cow ├── flaming-sheep.cow ├── ghostbusters.cow ├── head-in.cow ├── hellokitty.cow ├── kiss.cow ├── kitty.cow ├── koala.cow ├── kosh.cow ├── luke-koala.cow ├── mech-and-cow ├── meow.cow ├── milk.cow ├── moofasa.cow ├── moose.cow ├── mutilated.cow ├── ren.cow ├── satanic.cow ├── sheep.cow ├── skeleton.cow ├── small.cow ├── sodomized.cow ├── squirrel.cow ├── stegosaurus.cow ├── stimpy.cow ├── supermilker.cow ├── surgery.cow ├── telebears.cow ├── three-eyes.cow ├── turkey.cow ├── turtle.cow ├── tux.cow ├── udder.cow ├── vader-koala.cow ├── vader.cow └── www.cow ├── cowsay ├── cowsay.1 ├── install.sh └── pgp_public_key.txt /ChangeLog: -------------------------------------------------------------------------------- 1 | 3.03 28 May 1999 2 | - Added cows/tux.cow, as suggested by xmanoel@i.am 3 | - Compatibility with 5.6.0, due to a change in qw(). 4 | - Renamed devil.cow to daemon.cow, since I know better. :-) 5 | 6 | 3.02 04 November 1999 7 | - Fixed boneheaded code placement so that cowsay -l actually works. 8 | 9 | 3.01 01 November 1999 10 | - Fixed compatibility issues between the Text::Wrap module 11 | that changed between 5.005_02 and 5.005_03. 12 | - Fixed tab expansion issues with Text::Tabs. 13 | 14 | 3.0 13 April 1999, released 14 August 1999 15 | - Rewritten into Perl 5 and presented to the world. 16 | 17 | -- Not present in CVS from here on down -- 18 | 19 | 2.x Date? 20 | - Arbitrary messages. 21 | - Figlet support (-n). 22 | - Line wrap length (-w). 23 | - Multiple pre-set expressions. 24 | - Better arg parsing loop. 25 | - Message from stdin or command line. 26 | 27 | 1.0 Date? 28 | - SUBJECT is VERB OBJECT 29 | 30 | $Id: ChangeLog,v 1.4 2000/05/29 17:55:24 tony Exp $ 31 | This file is part of cowsay. (c) 1999-2000 Tony Monroe. 32 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | ================= 2 | Installing cowsay 3 | ================= 4 | 5 | If you really want to get things installed a nice and pretty way, 6 | 7 | sh install.sh 8 | 9 | It will ask approximately one question. If you can't answer it, 10 | you need serious help. 11 | 12 | If the install goes well, you can start cowing immediately! Just 13 | be sure to read the manual page first... 14 | 15 | $Id: INSTALL,v 1.1 1999/08/14 08:03:17 tony Exp $ 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | ============== 2 | cowsay License 3 | ============== 4 | 5 | cowsay is distributed under the same licensing terms as Perl: the 6 | Artistic License or the GNU General Public License. If you don't 7 | want to track down these licenses and read them for yourself, use 8 | the parts that I'd prefer: 9 | 10 | (0) I wrote it and you didn't. 11 | 12 | (1) Give credit where credit is due if you borrow the code for some 13 | other purpose. 14 | 15 | (2) If you have any bugfixes or suggestions, please notify me so 16 | that I may incorporate them. 17 | 18 | (3) If you try to make money off of cowsay, you suck. 19 | 20 | =============== 21 | cowsay Legalese 22 | =============== 23 | 24 | (0) Copyright (c) 1999 Tony Monroe. All rights reserved. All 25 | lefts may or may not be reversed at my discretion. 26 | 27 | (1) This software package can be freely redistributed or modified 28 | under the terms described above in the "cowsay License" section 29 | of this file. 30 | 31 | (2) cowsay is provided "as is," with no warranties whatsoever, 32 | expressed or implied. If you want some implied warranty about 33 | merchantability and/or fitness for a particular purpose, you will 34 | not find it here, because there is no such thing here. 35 | 36 | (3) I hate legalese. 37 | -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | ChangeLog Changes to recent versions. 2 | INSTALL Instructions for installing cowsay. 3 | LICENSE The license for use and redistribution of cowsay. 4 | MANIFEST This file. 5 | README Read this first. Really. 6 | Wrap.pm.diff Diff for Text/Wrap.pm. 7 | cows/* Support files used by cowsay. 8 | cowsay Main cowsay executable. 9 | cowsay.1 Main cowsay manual page. 10 | install.sh cowsay installation script. 11 | pgp_public_key.txt Verify the signature file with this key. 12 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | =========== 2 | cowsay 3.03 3 | =========== 4 | 5 | cowsay is a configurable talking cow, written in Perl. It operates 6 | much as the figlet program does, and it written in the same spirit 7 | of silliness. 8 | 9 | cowsay is actually a pretty old program. It has not really been 10 | released before, and I am releasing it in the hope that someone 11 | other than myself will be amused by it. 12 | 13 | The first major version of cowsay had one cow and one message 14 | template: $foo is $verb $bar. Not very flexible, but people managed 15 | to do pretty interesting things with it. The second major version 16 | scrapped many of the limitations of the first, by allowing arbitrary 17 | messages, multiple cowfiles, and even support for cows talking in 18 | figlet. The third version was a rewrite of the second into Perl 19 | 5, whereupon the code got a lot smaller and more manageable. :-) 20 | 21 | If you are using Perl 5.004, you may have problems with Text::Wrap. 22 | (Yeesh, this module changes more than it should...) I've included 23 | a diff for the Text::Wrap (version 97.011701) that is shipped with 24 | 5.004_04; the concept is simple enough that even older Perls can 25 | take advantage of this silly little patch; if there is a "sub fill" 26 | in the documentation for the module, copy it to a more useful 27 | section of that file. If not, just take "sub fill" wholesale from 28 | the patch. Oh, and consider upgrading to 5.005_03 or later. 29 | Please. You'll like it, I promise. 30 | 31 | To install cowsay, consult the INSTALL file in this directory. 32 | 33 | For the terms and conditions of use, consult the LICENSE file in 34 | this directory. 35 | 36 | -- Tony Monroe (tony@nog.net) 37 | 38 | $Id: README,v 1.3 2000/05/28 06:24:46 tony Exp $ 39 | -------------------------------------------------------------------------------- /Wrap.pm.diff: -------------------------------------------------------------------------------- 1 | *** Wrap.pm.in Thu May 22 00:21:42 1997 2 | --- Wrap.pm Fri Nov 12 10:00:15 1999 3 | *************** 4 | *** 3,9 **** 5 | require Exporter; 6 | 7 | @ISA = (Exporter); 8 | ! @EXPORT = qw(wrap); 9 | @EXPORT_OK = qw($columns); 10 | 11 | $VERSION = 97.011701; 12 | --- 3,9 ---- 13 | require Exporter; 14 | 15 | @ISA = (Exporter); 16 | ! @EXPORT = qw(wrap fill); 17 | @EXPORT_OK = qw($columns); 18 | 19 | $VERSION = 97.011701; 20 | *************** 21 | *** 66,71 **** 22 | --- 66,90 ---- 23 | 24 | print "-----------$r---------\n" if $debug;; 25 | return $r; 26 | + } 27 | + 28 | + ## Copied up from below. 29 | + sub fill 30 | + { 31 | + my ($ip, $xp, @raw) = @_; 32 | + my @para; 33 | + my $pp; 34 | + 35 | + for $pp (split(/\n\s+/, join("\n",@raw))) { 36 | + $pp =~ s/\s+/ /g; 37 | + my $x = wrap($ip, $xp, $pp); 38 | + push(@para, $x); 39 | + } 40 | + 41 | + # if paragraph_indent is the same as line_indent, 42 | + # separate paragraphs with blank lines 43 | + 44 | + return join ($ip eq $xp ? "\n\n" : "\n", @para); 45 | } 46 | 47 | 1; 48 | -------------------------------------------------------------------------------- /cows/beavis.zen.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Beavis, with Zen philosophy removed. 3 | ## 4 | $the_cow = <> 5.4 3 | ## 4 | $the_cow = < \\ _ -~ `. ^-` ^-_ 19 | ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ 20 | /.-~ 21 | EOC 22 | -------------------------------------------------------------------------------- /cows/elephant-in-snake.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Do we need to explain this? 3 | ## 4 | $the_cow = < 16 | ---___ XXX__/ XXXXXX \\__ / 17 | \\- --__/ ___/\\ XXXXXX / ___--/= 18 | \\-\\ ___/ XXXXXX '--- XXXXXX 19 | \\-\\/XXX\\ XXXXXX /XXXXX 20 | \\XXXXXXXXX \\ /XXXXX/ 21 | \\XXXXXX > _/XXXXX/ 22 | \\XXXXX--__/ __-- XXXX/ 23 | -XXXXXXXX--------------- XXXXXX- 24 | \\XXXXXXXXXXXXXXXXXXXXXXXXXX/ 25 | ""VXXXXXXXXXXXXXXXXXXV"" 26 | EOC 27 | -------------------------------------------------------------------------------- /cows/head-in.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Go stick yer head in a cow. 3 | ## 4 | $the_cow = < 21 | EOC 22 | -------------------------------------------------------------------------------- /cows/moofasa.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## MOOfasa. 3 | ## 4 | $the_cow = <> 12 | EOC 13 | -------------------------------------------------------------------------------- /cows/squirrel.cow: -------------------------------------------------------------------------------- 1 | $the_cow = < < > .---. 8 | $thoughts | \\ \\ - ~ ~ - / / | 9 | _____ ..-~ ~-..-~ 10 | | | \\~~~\\.' `./~~~/ 11 | --------- \\__/ \\__/ 12 | .' O \\ / / \\ " 13 | (_____, `._.' | } \\/~~~/ 14 | `----. / } | / \\__/ 15 | `-. | / | / `. ,~~| 16 | ~-.__| /_ - ~ ^| /- _ `..-' 17 | | / | / ~-. `-. _ _ _ 18 | |_____| |_____| ~ - . _ _ _ _ _> 19 | EOC 20 | -------------------------------------------------------------------------------- /cows/stimpy.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## Stimpy! 3 | ## 4 | $the_cow = <> 12 | EOC 13 | -------------------------------------------------------------------------------- /cows/three-eyes.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## A cow with three eyes, brought to you by dpetrou@csua.berkeley.edu 3 | ## 4 | $extra = chop($eyes); 5 | $eyes .= ($extra x 2); 6 | $the_cow = <____) >___ ^\\_\\_\\_\\_\\_\\_\\) 24 | ^^^//\\\\_^^//\\\\_^ ^(\\_\\_\\_\\) 25 | ^^^ ^^ ^^^ ^ 26 | EOC 27 | -------------------------------------------------------------------------------- /cows/turtle.cow: -------------------------------------------------------------------------------- 1 | ## 2 | ## A mysterious turtle... 3 | ## 4 | $the_cow = < 'oo', 40 | 'f' => 'default.cow', 41 | 'n' => 0, 42 | 'T' => ' ', 43 | 'W' => 40, 44 | ); 45 | 46 | getopts('bde:f:ghlLnNpstT:wW:y', \%opts); 47 | 48 | &display_usage if $opts{'h'}; 49 | &list_cowfiles if $opts{'l'}; 50 | 51 | $borg = $opts{'b'}; 52 | $dead = $opts{'d'}; 53 | $greedy = $opts{'g'}; 54 | $paranoid = $opts{'p'}; 55 | $stoned = $opts{'s'}; 56 | $tired = $opts{'t'}; 57 | $wired = $opts{'w'}; 58 | $young = $opts{'y'}; 59 | $eyes = substr($opts{'e'}, 0, 2); 60 | $tongue = substr($opts{'T'}, 0, 2); 61 | $the_cow = ""; 62 | 63 | &slurp_input; 64 | $Text::Wrap::columns = $opts{'W'}; 65 | @message = ($opts{'n'} ? expand(@message) : 66 | split("\n", fill("", "", @message))); 67 | &construct_balloon; 68 | &construct_face; 69 | &get_cow; 70 | print @balloon_lines; 71 | print $the_cow; 72 | 73 | sub list_cowfiles { 74 | my $basedir; 75 | my @dirfiles; 76 | chop($basedir = cwd); 77 | for my $d (split(/$pathsep/, $cowpath)) { 78 | print "Cow files in $d:\n"; 79 | opendir(COWDIR, $d) || die "$0: Cannot open $d\n"; 80 | for my $file (readdir COWDIR) { 81 | if ($file =~ s/\.cow$//) { 82 | push(@dirfiles, $file); 83 | } 84 | } 85 | closedir(COWDIR); 86 | print wrap("", "", sort @dirfiles), "\n"; 87 | @dirfiles = (); 88 | chdir($basedir); 89 | } 90 | exit(0); 91 | } 92 | 93 | sub slurp_input { 94 | unless ($ARGV[0]) { 95 | chomp(@message = ); 96 | } else { 97 | &display_usage if $opts{'n'}; 98 | @message = join(' ', @ARGV); 99 | } 100 | } 101 | 102 | sub maxlength { 103 | my ($l, $m); 104 | $m = -1; 105 | for my $i (@_) { 106 | $l = length $i; 107 | $m = $l if ($l > $m); 108 | } 109 | return $m; 110 | } 111 | 112 | sub construct_balloon { 113 | my $max = &maxlength(@message); 114 | my $max2 = $max + 2; ## border space fudge. 115 | my $format = "%s %-${max}s %s\n"; 116 | my @border; ## up-left, up-right, down-left, down-right, left, right 117 | if ($0 =~ /think/i) { 118 | $thoughts = 'o'; 119 | @border = qw[ ( ) ( ) ( ) ]; 120 | } elsif (@message < 2) { 121 | $thoughts = '\\'; 122 | @border = qw[ < > ]; 123 | } else { 124 | $thoughts = '\\'; 125 | if ($V and $V gt v5.6.0) { # Thanks, perldelta. 126 | @border = qw[ / \\ \\ / | | ]; 127 | } else { 128 | @border = qw[ / \ \ / | | ]; 129 | } 130 | } 131 | push(@balloon_lines, 132 | " " . ("_" x $max2) . " \n" , 133 | sprintf($format, $border[0], $message[0], $border[1]), 134 | (@message < 2 ? "" : 135 | map { sprintf($format, $border[4], $_, $border[5]) } 136 | @message[1 .. $#message - 1]), 137 | (@message < 2 ? "" : 138 | sprintf($format, $border[2], $message[$#message], $border[3])), 139 | " " . ("-" x $max2) . " \n" 140 | ); 141 | } 142 | 143 | sub construct_face { 144 | if ($borg) { $eyes = "=="; } 145 | if ($dead) { $eyes = "xx"; $tongue = "U "; } 146 | if ($greedy) { $eyes = "\$\$"; } 147 | if ($paranoid) { $eyes = "@@"; } 148 | if ($stoned) { $eyes = "**"; $tongue = "U "; } 149 | if ($tired) { $eyes = "--"; } 150 | if ($wired) { $eyes = "OO"; } 151 | if ($young) { $eyes = ".."; } 152 | } 153 | 154 | sub get_cow { 155 | ## 156 | ## Get a cow from the specified cowfile; otherwise use the default cow 157 | ## which was defined above in $the_cow. 158 | ## 159 | my $f = $opts{'f'}; 160 | my $full = ""; 161 | if ($opts{'f'} =~ m,/,) { 162 | $full = $opts{'f'}; 163 | } else { 164 | for my $d (split(/:/, $cowpath)) { 165 | if (-f "$d/$f") { 166 | $full = "$d/$f"; 167 | last; 168 | } elsif (-f "$d/$f.cow") { 169 | $full = "$d/$f.cow"; 170 | last; 171 | } 172 | } 173 | if ($full eq "") { 174 | die "$progname: Could not find $f cowfile!\n"; 175 | } 176 | } 177 | do $full; 178 | die "$progname: $@\n" if $@; 179 | } 180 | 181 | sub display_usage { 182 | die </dev/null 2>&1; then 40 | echo Found a good perl in $perl 41 | goodperls="$goodperls $perl" 42 | fi 43 | done 44 | echo The following perl executables will run cowsay: 45 | echo $goodperls 46 | echo I recommend the latest stable perl you can find. 47 | set $goodperls 48 | if [ -z "$1" ]; then 49 | echo Ack! You do not have Perl 5 installed correctly! 50 | echo Get thee to CPAN! 51 | exit 1 52 | fi 53 | usethisperl=$1 54 | echo I will be using $1 because I know it will work. 55 | 56 | echo Now I need an installation prefix. I will use /usr/local unless 57 | printf "you give me a better idea here: " 58 | if [ -n "$backdoor" ]; then 59 | prefix=$backdoor 60 | printf "%s (specified on command line)\n" $prefix 61 | else 62 | read prefix 63 | fi 64 | 65 | PREFIX=${prefix:-/usr/local} 66 | 67 | echo Okay, time to install this puppy. 68 | 69 | echo s,%BANGPERL%,!$usethisperl,\; > install.pl 70 | echo s,%PREFIX%,$PREFIX,\; >> install.pl 71 | set -x 72 | mkdir -p $PREFIX/bin || (mkdir $PREFIX; mkdir $PREFIX/bin) 73 | $usethisperl -p install.pl cowsay > $PREFIX/bin/cowsay 74 | chmod a+x $PREFIX/bin/cowsay 75 | ln -s cowsay $PREFIX/bin/cowthink 76 | mkdir -p $PREFIX/man/man1 || ($mkdir $PREFIX; mkdir $PREFIX/man; mkdir $PREFIX/man/man1) 77 | $usethisperl -p install.pl cowsay.1 > $PREFIX/man/man1/cowsay.1 78 | chmod a+r $PREFIX/man/man1/cowsay.1 79 | ln -s cowsay.1 $PREFIX/man/man1/cowthink.1 80 | mkdir -p $PREFIX/share/cows || (mkdir $PREFIX; mkdir $PREFIX/share; mkdir $PREFIX/share/cows) 81 | tar -cf - $filelist | (cd $PREFIX/share && tar -xvf -) 82 | set +x 83 | 84 | echo Okay, let us see if the install actually worked. 85 | 86 | if [ ! -f $PREFIX/share/cows/default.cow ]; then 87 | echo The default cow file did not make it across! 88 | echo Ooops, it failed...sorry! 89 | exit 1 90 | fi 91 | 92 | echo Installation complete! Enjoy the cows! 93 | -------------------------------------------------------------------------------- /pgp_public_key.txt: -------------------------------------------------------------------------------- 1 | -----BEGIN PGP PUBLIC KEY BLOCK----- 2 | Version: 2.6.2 3 | 4 | mQCNAzNS+H4AAAEEAMilCcxLMIqMNXhZoeHjbeJGnHoKP0JpKDejz66qBlDwP+du 5 | FvVBHkyNIuU3orKe7l/aXIR8TcpjrxdcmrjjzwuB1aV48V4swT7v9UXvv9YP41Pd 6 | 1pXYXNelXHmE0eKSfcnkkFmYTJBXPaPNTJ3rpZpZOEW3SfgrrheqQm6w/6IJAAUR 7 | tBpUb255IE1vbnJvZSA8dG9ueUBub2cubmV0PrQdVG9ueSBNb25yb2UgPHRtb25y 8 | b2VAbm9nLm5ldD6JAJUDBRA2bDA5F6pCbrD/ogkBASOZA/9XtYSpcPjpi62MTEZl 9 | l+wV1svtlUlPvKkDE7FB9bwnMbF1FgGhTe/H4/8qDu20m5eGxMX58Ri7HPXWjjJ/ 10 | CrUWMzGVbg1JBkgh+d9QvEywmR0j4WezaifW1nCbxk0GrW1PjJyGb3kx7vrIF1Km 11 | xt6VwxTgfJzjIioBJFb4EiDyaLQnVG9ueSBNb25yb2UgPHRtb25yb2VAQ1NVQS5C 12 | ZXJrZWxleS5FRFU+ 13 | =WpM4 14 | -----END PGP PUBLIC KEY BLOCK----- 15 | --------------------------------------------------------------------------------