commit 1ea4c1be38df8e3b5bee994012c9f3184bae6c6c Author: tony Date: Sat Aug 14 07:17:54 1999 +0000 Initial revision diff --git a/cows/beavis.zen.cow b/cows/beavis.zen.cow new file mode 100644 index 0000000..758ee80 --- /dev/null +++ b/cows/beavis.zen.cow @@ -0,0 +1,23 @@ +## +## Beavis, with Zen philosophy removed. +## +$the_cow = <> 5.4 +## +$the_cow = < \\ _ -~ `. ^-` ^-_ + ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~ + /.-~ +EOC diff --git a/cows/elephant-in-snake.cow b/cows/elephant-in-snake.cow new file mode 100644 index 0000000..1003cdf --- /dev/null +++ b/cows/elephant-in-snake.cow @@ -0,0 +1,14 @@ +## +## Do we need to explain this? +## +$the_cow = < + ---___ XXX__/ XXXXXX \\__ / + \\- --__/ ___/\\ XXXXXX / ___--/= + \\-\\ ___/ XXXXXX '--- XXXXXX + \\-\\/XXX\\ XXXXXX /XXXXX + \\XXXXXXXXX \\ /XXXXX/ + \\XXXXXX > _/XXXXX/ + \\XXXXX--__/ __-- XXXX/ + -XXXXXXXX--------------- XXXXXX- + \\XXXXXXXXXXXXXXXXXXXXXXXXXX/ + ""VXXXXXXXXXXXXXXXXXXV"" +EOC diff --git a/cows/head-in.cow b/cows/head-in.cow new file mode 100644 index 0000000..2e51774 --- /dev/null +++ b/cows/head-in.cow @@ -0,0 +1,12 @@ +## +## Go stick yer head in a cow. +## +$the_cow = < +EOC diff --git a/cows/moofasa.cow b/cows/moofasa.cow new file mode 100644 index 0000000..15119d6 --- /dev/null +++ b/cows/moofasa.cow @@ -0,0 +1,14 @@ +## +## MOOfasa. +## +$the_cow = <> +EOC diff --git a/cows/stegosaurus.cow b/cows/stegosaurus.cow new file mode 100644 index 0000000..2e0decd --- /dev/null +++ b/cows/stegosaurus.cow @@ -0,0 +1,19 @@ +## +## A stegosaur with a top hat? +## +$the_cow = < < > .---. + $thoughts | \\ \\ - ~ ~ - / / | + _____ ..-~ ~-..-~ + | | \\~~~\\.' `./~~~/ + --------- \\__/ \\__/ + .' O \\ / / \\ " + (_____, `._.' | } \\/~~~/ + `----. / } | / \\__/ + `-. | / | / `. ,~~| + ~-.__| /_ - ~ ^| /- _ `..-' + | / | / ~-. `-. _ _ _ + |_____| |_____| ~ - . _ _ _ _ _> +EOC diff --git a/cows/stimpy.cow b/cows/stimpy.cow new file mode 100644 index 0000000..4d61425 --- /dev/null +++ b/cows/stimpy.cow @@ -0,0 +1,19 @@ +## +## Stimpy! +## +$the_cow = <> +EOC diff --git a/cows/three-eyes.cow b/cows/three-eyes.cow new file mode 100644 index 0000000..0786462 --- /dev/null +++ b/cows/three-eyes.cow @@ -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 diff --git a/cows/turtle.cow b/cows/turtle.cow new file mode 100644 index 0000000..4286b09 --- /dev/null +++ b/cows/turtle.cow @@ -0,0 +1,20 @@ +## +## A mysterious turtle... +## +$the_cow = < '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 = ); + } 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 <