A brief history of Pepe
Kent Paul Dolan
xanthian at zorch.SF-Bay.ORG
Mon Dec 31 15:43:56 AEST 1990
This is absolute drivel of no redeeming value whatsoever; it is
dependent on csh, uses pre-ANSI C, contains five C programs that should
have been one and differ among themselves in only a few lines, has a
shell script instead of a makefile, is tediously slow, displays a
bubblesort in a loop that would gag a maggot, and produces a product of
limited if any value, a poor attempt at a joke. That's why I let the net
pay for transporting it all around the world. The pathetic excuse for
doing this, and another copy of the same boring code, along with the
nauseatingly repetitious ASCII graphic output, is in talk.bizarre.
Notice how nicely Rich Salz' cshar packed it up, though.
Kent, the man from xanth.
<xanthian at Zorch.SF-Bay.ORG> <xanthian at well.sf.ca.us>
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: MANIFEST README lookoutpepe makepepe pepebacksort.c
# pepebarezap.c pepedata pepesort.c pepeunsort.c pepezap.c
# Wrapped by xanthian at zorch on Sun Dec 30 20:12:36 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'MANIFEST' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(424 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X File Name Archive # Description
X-----------------------------------------------------------
X MANIFEST 1 This shipping list
X README 1
X lookoutpepe 1
X makepepe 1
X pepebacksort.c 1
X pepebarezap.c 1
X pepedata 1
X pepesort.c 1
X pepeunsort.c 1
X pepezap.c 1
END_OF_FILE
if test 424 -ne `wc -c <'MANIFEST'`; then
echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(399 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThis stuff is ugly as sin, and lookoutpepe is csh dependent besides,
Xbut if you insist, unpack it and type makepepe. The C code is
Xnothing to write home to Mom about; it's pre-ANSI C, and it's
Xrepetitive as hell. Still, if you're into pain, take a look.
XYep, that's a bubblesort in there; sue me for your money back.
X
XKent, the man from xanth.
X<xanthian at Zorch.SF-Bay.ORG> <xanthian at well.sf.ca.us>
END_OF_FILE
if test 399 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'lookoutpepe' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'lookoutpepe'\"
else
echo shar: Extracting \"'lookoutpepe'\" \(1205 characters\)
sed "s/^X//" >'lookoutpepe' <<'END_OF_FILE'
X#! /bin/csh
Xcp /dev/null pepehistory
Xecho "-----" >> pepehistory
Xecho "Pepe\! Look out\!" >> pepehistory
Xecho "Oops\!" >> pepehistory
Xecho "-----" >> pepehistory
Xpepezap 512 < pepedata >> pepehistory
Xecho "Could we see that on slo-mo replay, please?" >> pepehistory
Xecho "-----" >> pepehistory
Xforeach i (1 2 4 8 16 32 64 128 256 512)
Xpepezap $i < pepedata >> pepehistory
Xend
Xecho "Don't despair Pepe, we can sort that right out\!" >> pepehistory
Xecho "-----" >> pepehistory
Xpepesort 63 < pepedata >> pepehistory
Xecho "Damn\! That didn't work; have to try it the hard way\!" >> pepehistory
Xecho "Zzzzzzt\!" >> pepehistory
Xecho "-----" >> pepehistory
Xpepezap 512 < pepedata >> pepehistory
Xecho "Shuffle to the left\!" >> pepehistory
Xecho "Shuffle to the right\!" >> pepehistory
Xecho "Shuffle poor Pepe\!" >> pepehistory
Xecho "Fight\! Fight\! Fight\!" >> pepehistory
Xecho "-----" >> pepehistory
Xforeach i (9 18 27 36 45 54)
Xpepebarezap 512 < pepedata | pepebacksort $i >> pepehistory
Xend
Xecho "Now the other way\!" >> pepehistory
Xecho "-----" >> pepehistory
Xforeach i (63 60 57 54 51 48 45 42 39 36 27 18 9 0)
Xpepeunsort $i < pepedata >> pepehistory
Xend
Xecho "All better\!" >> pepehistory
Xcat pepehistory
END_OF_FILE
if test 1205 -ne `wc -c <'lookoutpepe'`; then
echo shar: \"'lookoutpepe'\" unpacked with wrong size!
fi
chmod +x 'lookoutpepe'
# end of 'lookoutpepe'
fi
if test -f 'makepepe' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'makepepe'\"
else
echo shar: Extracting \"'makepepe'\" \(211 characters\)
sed "s/^X//" >'makepepe' <<'END_OF_FILE'
X#!/bin/sh
X#
X# you try living with a broken "make"!
X#
Xcc -o pepezap pepezap.c
Xcc -o pepesort pepesort.c
Xcc -o pepebarezap pepebarezap.c
Xcc -o pepebacksort pepebacksort.c
Xcc -o pepeunsort pepeunsort.c
Xlookoutpepe
END_OF_FILE
if test 211 -ne `wc -c <'makepepe'`; then
echo shar: \"'makepepe'\" unpacked with wrong size!
fi
chmod +x 'makepepe'
# end of 'makepepe'
fi
if test -f 'pepebacksort.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepebacksort.c'\"
else
echo shar: Extracting \"'pepebacksort.c'\" \(888 characters\)
sed "s/^X//" >'pepebacksort.c' <<'END_OF_FILE'
X#include <stdio.h>
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X int c,pepeindex,swaptemp,i,j,sortpasses;
X int pepebuffer[81];
X int line = 0;
X if (argc != 2)
X {
X printf("usage: pepebacksort sortpasses < pepefile > sortedpepefile\n");
X exit(1);
X }
X sscanf(argv[1],"%d",&sortpasses);
X pepeindex=0;
X printf("pepebacksort after %3d sort passes\n",sortpasses);
X while ((c = getchar()) != EOF)
X {
X pepebuffer[pepeindex++] = c;
X if (c == (int)'\n')
X {
X for (i=0;i<sortpasses;i++)
X {
X for (j=0;j<pepeindex-2;j++)
X {
X if (pepebuffer[j] < pepebuffer[j+1])
X {
X swaptemp = pepebuffer[j+1];
X pepebuffer[j+1] = pepebuffer[j];
X pepebuffer[j] = swaptemp;
X }
X }
X }
X for (i=0;i<pepeindex;i++) putchar(pepebuffer[i]);
X pepeindex = 0;
X }
X }
X printf("-----\n");
X exit(0);
X}
END_OF_FILE
if test 888 -ne `wc -c <'pepebacksort.c'`; then
echo shar: \"'pepebacksort.c'\" unpacked with wrong size!
fi
# end of 'pepebacksort.c'
fi
if test -f 'pepebarezap.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepebarezap.c'\"
else
echo shar: Extracting \"'pepebarezap.c'\" \(844 characters\)
sed "s/^X//" >'pepebarezap.c' <<'END_OF_FILE'
X#include <stdio.h>
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X int c,pepeindex,swaptemp,swapfrom,swapto,i,nanoseconds;
X int pepebuffer[81];
X int line = 0;
X if (argc != 2)
X {
X printf("usage: pepebarezap nanoseconds < pepefile > zappedpepefile\n");
X exit(1);
X }
X sscanf(argv[1],"%d",&nanoseconds);
X pepeindex=0;
X while ((c = getchar()) != EOF)
X {
X pepebuffer[pepeindex++] = c;
X if (c == (int)'\n')
X {
X srandom(1+((line++)*42));
X for (i=0;i<nanoseconds;i++)
X {
X swapfrom = (int)(random() % (pepeindex - 1));
X swapto = (int)(random() % (pepeindex - 1));
X swaptemp = pepebuffer[swapto];
X pepebuffer[swapto] = pepebuffer[swapfrom];
X pepebuffer[swapfrom] = swaptemp;
X }
X for (i=0;i<pepeindex;i++) putchar(pepebuffer[i]);
X pepeindex = 0;
X }
X }
X exit(0);
X}
END_OF_FILE
if test 844 -ne `wc -c <'pepebarezap.c'`; then
echo shar: \"'pepebarezap.c'\" unpacked with wrong size!
fi
# end of 'pepebarezap.c'
fi
if test -f 'pepedata' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepedata'\"
else
echo shar: Extracting \"'pepedata'\" \(439 characters\)
sed "s/^X//" >'pepedata' <<'END_OF_FILE'
X ****** @ @
X ********** \ /
X ************** \ /
X ***************** ####
X ******************** ####
X **######################
X ~~~~~~~~~~~~~~~~~~~~~~
END_OF_FILE
if test 439 -ne `wc -c <'pepedata'`; then
echo shar: \"'pepedata'\" unpacked with wrong size!
fi
# end of 'pepedata'
fi
if test -f 'pepesort.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepesort.c'\"
else
echo shar: Extracting \"'pepesort.c'\" \(880 characters\)
sed "s/^X//" >'pepesort.c' <<'END_OF_FILE'
X#include <stdio.h>
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X int c,pepeindex,swaptemp,i,j,sortpasses;
X int pepebuffer[81];
X int line = 0;
X if (argc != 2)
X {
X printf("usage: pepesort sortpasses < pepefile > sortedpepefile\n");
X exit(1);
X }
X sscanf(argv[1],"%d",&sortpasses);
X pepeindex=0;
X printf("pepesort after %3d sort passes\n",sortpasses);
X while ((c = getchar()) != EOF)
X {
X pepebuffer[pepeindex++] = c;
X if (c == (int)'\n')
X {
X for (i=0;i<sortpasses;i++)
X {
X for (j=0;j<pepeindex-2;j++)
X {
X if (pepebuffer[j] > pepebuffer[j+1])
X {
X swaptemp = pepebuffer[j+1];
X pepebuffer[j+1] = pepebuffer[j];
X pepebuffer[j] = swaptemp;
X }
X }
X }
X for (i=0;i<pepeindex;i++) putchar(pepebuffer[i]);
X pepeindex = 0;
X }
X }
X printf("-----\n");
X exit(0);
X}
END_OF_FILE
if test 880 -ne `wc -c <'pepesort.c'`; then
echo shar: \"'pepesort.c'\" unpacked with wrong size!
fi
# end of 'pepesort.c'
fi
if test -f 'pepeunsort.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepeunsort.c'\"
else
echo shar: Extracting \"'pepeunsort.c'\" \(884 characters\)
sed "s/^X//" >'pepeunsort.c' <<'END_OF_FILE'
X#include <stdio.h>
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X int c,pepeindex,swaptemp,i,j,sortpasses;
X int pepebuffer[81];
X int line = 0;
X if (argc != 2)
X {
X printf("usage: pepeunsort sortpasses < pepefile > sortedpepefile\n");
X exit(1);
X }
X sscanf(argv[1],"%d",&sortpasses);
X pepeindex=0;
X printf("pepeunsort after %3d sort passes\n",sortpasses);
X while ((c = getchar()) != EOF)
X {
X pepebuffer[pepeindex++] = c;
X if (c == (int)'\n')
X {
X for (i=0;i<sortpasses;i++)
X {
X for (j=0;j<pepeindex-2;j++)
X {
X if (pepebuffer[j] < pepebuffer[j+1])
X {
X swaptemp = pepebuffer[j+1];
X pepebuffer[j+1] = pepebuffer[j];
X pepebuffer[j] = swaptemp;
X }
X }
X }
X for (i=0;i<pepeindex;i++) putchar(pepebuffer[i]);
X pepeindex = 0;
X }
X }
X printf("-----\n");
X exit(0);
X}
END_OF_FILE
if test 884 -ne `wc -c <'pepeunsort.c'`; then
echo shar: \"'pepeunsort.c'\" unpacked with wrong size!
fi
# end of 'pepeunsort.c'
fi
if test -f 'pepezap.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pepezap.c'\"
else
echo shar: Extracting \"'pepezap.c'\" \(918 characters\)
sed "s/^X//" >'pepezap.c' <<'END_OF_FILE'
X#include <stdio.h>
Xmain(argc,argv)
Xint argc;
Xchar *argv[];
X{
X int c,pepeindex,swaptemp,swapfrom,swapto,i,nanoseconds;
X int pepebuffer[81];
X int line = 0;
X if (argc != 2)
X {
X printf("usage: pepezap nanoseconds < pepefile > zappedpepefile\n");
X exit(1);
X }
X sscanf(argv[1],"%d",&nanoseconds);
X pepeindex=0;
X printf("pepezap after %3d nanoseconds\n",nanoseconds);
X while ((c = getchar()) != EOF)
X {
X pepebuffer[pepeindex++] = c;
X if (c == (int)'\n')
X {
X srandom(1+((line++)*42));
X for (i=0;i<nanoseconds;i++)
X {
X swapfrom = (int)(random() % (pepeindex - 1));
X swapto = (int)(random() % (pepeindex - 1));
X swaptemp = pepebuffer[swapto];
X pepebuffer[swapto] = pepebuffer[swapfrom];
X pepebuffer[swapfrom] = swaptemp;
X }
X for (i=0;i<pepeindex;i++) putchar(pepebuffer[i]);
X pepeindex = 0;
X }
X }
X printf("-----\n");
X exit(0);
X}
END_OF_FILE
if test 918 -ne `wc -c <'pepezap.c'`; then
echo shar: \"'pepezap.c'\" unpacked with wrong size!
fi
# end of 'pepezap.c'
fi
echo shar: End of shell archive.
exit 0
More information about the Alt.sources
mailing list