From: A.Raman@massey.ac.nz (Anand V Raman)
Subject: Indhist (shar) part 2 of 4
Organization: Massey University Computer Centre
Date: Sun, 4 Oct 92 04:20:42 GMT

# --- Cut here and throw this line away --- Indhist part 2 of 4 begins ---
X  41%outburst  of its  suppressed passion, it   gradually turns its eye to  its
X  41%food.  It is then freed from its bonds, but does not seek to escape, being
X  41%enthralled   with the music.  It  even  takes food  eagerly,   and, like a
X  41%luxurious guest riveted to the festive board, has no  wish to go, from its
X  41%love of the music.
X  41%
X  41%- Aelian Hist.Anim.XII.44
X  42%For  the Indians stand  almost alone  among the nations   in  never having
X  42%migrated  from  their  own country.  From  the  days  of Father Bacchus to
X  42%Alexander the Great their kings are  reckoned at 154,  whose reigns extend
X  42%over 6451 years and 3 months.
X  42%
X  42%- Pliny, Nat.Hist. Book VI: xxi.4-5
X  43%There is among the Brahmans in  India a sect  of philosophers who adopt an
X  43%independent life, and abstain from animal food and all  victuals cooked by
X  43%fire, being content to subsist upon fruits,  which they do  not so much as
X  43%gather from the trees, but pick up when they have dropped  to  the ground,
X  43%and their   drink is the  water   of  the river Tagabena   [Tungavena, now
X  43%Tungabadhra].
X  43%
X  43%- Pseudo-Origen, Philosoph, 24, ed. Delarue, Paris. 1733 vol.I.p.904
X  44%Throughout life they [the Brahmans] go about naked,  saying  that the body
X  44%has been given by  the Deity as a  covering for the  soul.  They hold that
X  44%God is light, but not such light as  we see with the eye,  nor such as the
X  44%sun or fire, but God is with them the Word, --  by which term  they do not
X  44%mean articulate speech,  but the  discourse of reason,  whereby the hidden
X  44%mysteries of knowledge are discerned by the wise.
X  44%
X  44%- Pseudo-Origen, Philosoph, 24, ed. Delarue, Paris. 1733 vol.I.p.904
X  45%King  Alexander, accordingly, when he heard  of  all this, was desirous of
X  45%learning the doctrines of the Brahmans, and so  he  sent for this Dandamis
X  45%as being   their  teacher  and President...   Onesikritos   was  therefore
X  45%despatched to fetch him, and when he  found the great  sage he said, "Hail
X  45%to thee, thou teacher  of the Brahmans.   The son of  the mighty god Zeus,
X  45%king Alexander, who is the sovereign lord of  all  men, asks  you to go to
X  45%him, and if you comply, he will reward you with  great and splendid gifts,
X  45%but if you refuse will cut off your head."
X  45%
X  45%Dandamis, with a complacent  smile, heard  him to the end,  but did not so
X  45%much as  lift  up his  head  from his  couch  of  leaves, and  while still
X  45%retaining his recumbent attitude returned this scornful answer:- "God, the
X  45%supreme king, is never the author of insolent wrong, but is the creator of
X  45%light, and of peace, of life, of water, of the body of  man, and of souls,
X  45%and these he receives when  death sets them free, being  in no way subject
X  45%to evil desire.  He alone is  the  god of my homage, who  abhors slaughter
X  45%and instigates no wars.  But Alexander is not God, since  he must taste of
X  45%death;  and how  can such as he be  the  world's master,  who has not  yet
X  45%reached the further shore  of the river  Tiberoboas, and who  has  not yet
X  45%seated himself on a throne of  universal dominion? ... Know this, however,
X  45%that what Alexander offers me, and  the gifts  he promises, are all things
X  45%to me utterly useless; but the things which I prize, and find  of real use
X  45%and worth, are  these leaves which are my   house,  these blooming  plants
X  45%which supply me with dainty food, and  the  water which is my drink, while
X  45%all other possessions and things, which are amassed with anxious care, are
X  45%wont to prove ruinous to those who amass them,  and  cause only sorrow and
X  45%vexation, with which  every   poor mortal is    fully fraught...    Should
X  45%Alexander cut  off   my  head, he cannot   also destroy   my  soul...  Let
X  45%Alexander, then,  terrify  with these threats those who  wish for gold and
X  45%for  wealth, and who dread  death, for against us  these  weapons are both
X  45%alike powerless, since the Brahmans neither love gold nor fear death...
X  45%
X  45%Alexander, on receiving from Onesikritos a report of the interview, felt a
X  45%stronger desire than ever to see Dandamis, who, though old and  naked, was
X  45%the only antagonist in whom  he, the conquerer  of many nations, had found
X  45%more than his match.
X  45%
X  45%- Pallad. de Bragmanibus pp.8,20 et seq. Ed. London 1668.
X  46%The same writer tells  us  further this remarkable fact  about India, that
X  46%all the Indians  are  free,   and  not  one   of them  is  a slave.    The
X  46%Lakedemonians and the  Indians   are here  so  far   in  agreement.    The
X  46%Lakedemonians, however, hold the Helots   as slaves, and  these Helots  do
X  46%servile labour; but the Indians do not even use aliens as slaves, and much
X  46%less a countryman of their own.
X  46%
X  46%- Arrian's Indika.i.10
X  47%And Nearchos adds  this, that Alexander  had all  the most skilful  of the
X  47%Indians    in the   healing art  collected around    him,  and had  caused
X  47%proclamation  to be made throughout  the camp that if  any one were bitten
X  47%[by a snake] he should repair to  the royal tent; but these  very same men
X  47%were able to cure other diseases and pains also.   With many bodily pains,
X  47%however, the Indians  are  not afflicted,  because  in  their  country the
X  47%seasons are genial.  In the case of an attack of severe pain, they consult
X  47%the sophists,  and these  seemed to  cure  whatever diseases could  not be
X  47%cured without divine help.
X  47%
X  47%- Arrian's Indika.i.15
X  48%The Indians wear also earrings of ivory, but only such of them do  this as
X  48%are very   wealthy, for all    Indians do  not wear them.    Their beards,
X  48%Nearchos tells us,  they dye  of one hue and  another, according to taste.
X  48%Some dye their white beards to make them  look as white  as  possible, but
X  48%others dye them blue; while some again prefer a  red tint,  some a purple,
X  48%and  others  a rank green.  Such  Indians,  he also says, as   are thought
X  48%anything of, use parasols as a screen from the heat.  They wear shoes made
X  48%of white leather,  and these are elaborately  trimmed, while the soles are
X  48%variegated, and made of great thickness, to  make the  wearer seem so much
X  48%the taller.
X  48%
X  48%- Arrian's Indika.i.16
X  49%They [The Brahmans] neither have  wives nor  beget children.  Persons  who
X  49%desire to  lead a life like  theirs cross over from  the other side of the
X  49%river,   and remain   with them for  good,  never returning to their   own
X  49%country.  These also are called Brahmans,  although they do not follow the
X  49%same  mode of life,  for there are  women in the   country, from  whom the
X  49%native inhabitants  are sprung, and of these   women they beget offspring.
X  49%With regard to  the Word,   which they call   God,  they hold that it   is
X  49%corporeal, and that it  wears  the body as  its external covering, just as
X  49%one wears a woollen surcoat, and that when  it divests  itself of the body
X  49%with which it is enwrapped it becomes manifest to the eye.
X  49%
X  49%- Pseudo-Origen, Philosoph, 24, ed. Delarue, Paris. 1733 vol.I.p.904
X  50%There is war, the Brahmans hold, in  the body wherewith  they are clothed,
X  50%and they regard the body as being the fruitful  source of wars, and, as we
X  50%have already shown,  fight against it  like soldiers in  battle contending
X  50%against the  enemy.  They maintain,   moreover, that all men are   held in
X  50%bondage, like prisoners of war,  to their own  innate enemies, the sensual
X  50%appetites, gluttony,  anger, joy, grief,  longing  desire,  and such like,
X  50%while it is only the man who has triumphed over these enemies  who goes to
X  50%God.
X  50%
X  50%- Pseudo-Origen, Philosoph, 24, ed. Delarue, Paris. 1733 vol.I.p.904
X  51%Of  the  Sarmanes [Sramanas], the most  honourable, he [Megasthanes] says,
X  51%are those called the Hylobioi [Greek for Skt. Vanaprasthas].  They live in
X  51%the forests,  subsist on leaves and  wild fruits,  wear garments made from
X  51%the bark of trees, and abstain from wine and commerce with women...Next in
X  51%honour to  the Hylobioi are the physicians,  for  they apply philosophy to
X  51%the study of the nature of man.  They are frugal  in their habits,  but do
X  51%not  live in the  fields.  Their  food consists  of rice  and barley-meal,
X  51%which everyone  gives who is asked, as  well as everyone who receives them
X  51%as a guest.  By their knowledge of medicine  they can make  persons have a
X  51%numerous  offspring, and  make  also the children  to be  either male   or
X  51%female.   They effect cures rather by  regulating diet than  by the use of
X  51%medicines.  The remedies in  most repute are ointments  and plasters.  All
X  51%others they suppose to partake largely of a noxious nature.
X  51%
X  51%- Strabo Book XV:I.60 
End of Indhist
echo Extracting Indhist.8 1>&2
sed 's/^X //' >Indhist.8 <<'End of Indhist.8' && chmod 644 Indhist.8
X .TH Indhist l
X 
X .SH NAME
X .I Indhist, fifo
X \- Print a random record from the Indhist database
X 
X .SH SYNTAX
X Indhist [dbname]
X .br
X fifo -dqf -p program -o node args
X 
X .SH DESCRIPTIONS
X 
X .SH 1) INDHIST
X 
X By itself,
X .I Indhist
X prints out a random record to standard output from the
X Indhist database which is contained in itself.  If the optional database
X name is supplied, then one record, randomly selected from that database
X is printed instead.  The database must conform to the following format:
X .PP
X \- Records may be any number of lines long, and each line may be of
X any width.
X .PP
X \- Each line must be preceded by its record number immediately followed
X by a percent sign.
X 
X .SH Example
X .EX
X   2%   This is record # 2
X 2%This is still record # 2
X    2%Ditto
X  3% This is record # 3
X .EE
X .SH 2) FIFO
X 
X .I Fifo
X can be used to create a named pipe, cat(1)ing which produces
X the output of `program args' each time.  The default name of
X the named pipe is .signature.indhist in home directory of the
X user.
X 
X .SH Options
X 
X .IP \-d
X Run as a daemon.  If
X .B \-d
X is not specified,
X .I fifo
X invokes the output program once and dies.  This
X switch must be specified if
X .I fifo
X must become a daemon behind a named pipe.
X .IP \-q
X Normally,
X .I fifo
X advertises for itself each time you open the node. Specifying
X .B \-q
X overrides this behavior and makes
X .I fifo
X only print out the requested
X record.
X .IP \-f
X If the named node already exists,
X .I fifo
X usually refuses to run.
X .B \-f
X forces
X .I fifo
X to run regardless of whether the named node already exists or not.
X .IP \-p
X program
X 
X The default output program that
X .I fifo
X runs each time the node is opened is
X .I Indhist.
X This can be changed by using the
X .B \-p
X option.
X For example,
X .EX
X fifo -d -p /usr/games/fortune -o fortunes
X .EE
X will create a named pipe called fortunes, the catting of which will
X print a new fortune cookie each time and
X .EX
X fifo -d -p /bin/echo -o greet hello world.
X .EE
X will create a named pipe called greet, which appears to be identical
X to a text file containing the line "hello world."
X 
X .IP \-o nodename
X The default nodename that
X .I fifo
X uses to create its named pipe is .signature.indhist.  This can be changed using the
X .B \-o
X switch.  See the example under the
X .B \-p
X option on how to use this switch.
X 
X .SH DIAGNOSTICS
X 
X fifo needs getopt
X 
X This is printed if the getopt program is not accessible through your
X PATH environment variable.
X 
X .SH AUTHOR
X Anand V Raman, Systems Group, Computing Services,
X .br
X Massey University, Palmerston North, NZ.
X 
X .SH SEE ALSO
X mknod(1)
X 
End of Indhist.8
echo Extracting fifo 1>&2
sed 's/^X //' >fifo <<'End of fifo' && chmod 755 fifo
X #! /bin/sh
X # fifo.sh: Shell version of the fifo for Indhist
X # anand v raman, 28 Aug 1992
X 
X if sh -c "getopt x -x >/dev/null" >/dev/null 2>&1; then
X    GETOPT=`which getopt`;
X else
X    echo "fifo needs getopt" 1>&2
X    exit 1;
X fi
X 
X ADVERTISEMENT='--
X # The following record is a random selection from Indhist 1.0
X # For more information on Indhist, mail A.Raman@massey.ac.nz
X --'
X 
X set - `$GETOPT dqfp:o: $*`
X for i in $*; {
X    case $i in
X       -f) FORCE=$i;      shift;;
X       -d) DAEMON=$i;     shift;;
X       -q) QUIET=$i;      shift;;
X       -o) NODNAME=$2;    shift; shift;;
X       -p) PRGNAME="$2";  shift; shift;;
X       --) shift; break;;
X    esac
X }
X # set -x		## Uncomment to debug
X 
X [ x$DAEMON = x -a x$NODNAME != x ] && {
X    echo "Node name ignored as Daemon mode wasn't specified" 1>&2
X };
X [ $PRGNAME ] || \
X    PRGNAME=Indhist;
X [ $NODNAME ] || \
X    NODNAME=$HOME/.signature.indhist;
X 
X [ x$DAEMON = x ] && {
X    $PRGNAME;
X    exit;
X }
X 
X # Daemon mode was specified.  We must create the fifo and background
X # ourselves.  For safety reasons, we must warn against creating a fifo
X # called $HOME/.signature.  It could result in the user inadvertently
X # appending an Indhist signature in inapproprite places.
X 
X if [ $NODNAME = .signature -a `pwd` = $HOME -o $NODNAME = $HOME/.signature ]
X then
X    echo "Warning: You don't want Indhist signatures in Unix Posts." 1>&2
X    [ x$QUIET != x-q ] && ADVERTISEMENT='--'	# At least save myself
X fi
X 
X # If be with us the Force, then zonk an existing NODNAME, we will.
X [ x$FORCE = x-f ] && rm -f $NODNAME
X 
X trap "[ x$NODNAME != x ] && /bin/rm -f $NODNAME; exit 0;" 1 2 3 14 15
X 
X ERR=`mknod $NODNAME p 2>&1`
X [ "$ERR" ] && {
X    echo $ERR
X    exit 1
X }
X chmod 644 $NODNAME >/dev/null 2>&1
X (
X    while true; do
X       [ -s $NODNAME ] && sleep 1 && [ -s $NODNAME ] && exit 1;
X       if [ x$QUIET = x-q ]; then
X          $PRGNAME $* | cat -u >$NODNAME;
X       else
X          (echo "$ADVERTISEMENT"; $PRGNAME $*) | cat -u >$NODNAME
X       fi
X       # sleep 1
X    done
X ) &
X exit 0
X 
End of fifo
echo Extracting getopt.c 1>&2
sed 's/^X //' >getopt.c <<'End of getopt.c' && chmod 644 getopt.c
X /*
X **  GETOPT PROGRAM AND LIBRARY ROUTINE
X **
X **  I wrote main() and AT&T wrote getopt() and we both put our efforts into
X **  the public domain via mod.sources.
X **	Rich $alz
X **	Mirror Systems
X **	(mirror!rs, rs@mirror.TMC.COM)
X **	August 10, 1986
X */
X 
X #include <stdio.h>
X 
X 
X #ifndef INDEX
X #define INDEX index
X #endif
X 
X 
X extern char	*INDEX();
X extern int	 optind;
X extern char	*optarg;
X 
X 
X main(ac, av)
X     register int	 ac;
X     register char 	*av[];
X {
X     register char 	*flags;
X     register int	 c;
X 
X     /* Check usage. */
X     if (ac < 2) {
X 	fprintf(stderr, "usage: %s flag-specification arg-list\n", av[0]);
X 	exit(2);
X     }
X 
X     /* Play games; remember the flags (first argument), then splice
X        them out so it looks like a "standard" command vector. */
X     flags = av[1];
X     av[1] = av[0];
X     av++;
X     ac--;
X 
X     /* Print flags. */
X     while ((c = getopt(ac, av, flags)) != EOF) {
X 	if (c == '?')
X 	    exit(1);
X 	/* We assume that shells collapse multiple spaces in `` expansion. */
X 	printf("-%c %s ", c, INDEX(flags, c)[1] == ':' ? optarg : "");
X     }
X 
X     /* End of flags; print rest of options. */
X     printf("-- ");
X     for (av += optind; *av; av++)
X 	printf("%s ", *av);
X     exit(0);
X }
X 
X /*
X **  This is the public-domain AT&T getopt(3) code.  I added the
X **  #ifndef stuff because I include <stdio.h> for the program;
X **  getopt, per se, doesn't need it.  I also added the INDEX/index
X **  hack (the original used strchr, of course).  And, note that
X **  technically the casts in the write(2) calls shouldn't be there.
X */
X 
X #ifndef NULL
X #define NULL	0
X #endif
X #ifndef EOF
X #define EOF	(-1)
X #endif
X #ifndef INDEX
X #define INDEX index
X #endif
X 
X 
X #define ERR(s, c)	if(opterr){\
X 	extern int strlen(), write();\
X 	char errbuf[2];\
X 	errbuf[0] = c; errbuf[1] = '\n';\
X 	(void) write(2, argv[0], (unsigned)strlen(argv[0]));\
X 	(void) write(2, s, (unsigned)strlen(s));\
X 	(void) write(2, errbuf, 2);}
X 
X extern int strcmp();
X extern char *INDEX();
X 
X int	opterr = 1;
X int	optind = 1;
X int	optopt;
X char	*optarg;
X 
X int
X getopt(argc, argv, opts)
X int	argc;
X char	**argv, *opts;
X {
X 	static int sp = 1;
X 	register int c;
X 	register char *cp;
X 
X 	if(sp == 1)
X 		if(optind >= argc ||
X 		   argv[optind][0] != '-' || argv[optind][1] == '\0')
X 			return(EOF);
X 		else if(strcmp(argv[optind], "--") == NULL) {
X 			optind++;
X 			return(EOF);
X 		}
X 	optopt = c = argv[optind][sp];
X 	if(c == ':' || (cp=INDEX(opts, c)) == NULL) {
X 		ERR(": illegal option -- ", c);
X 		if(argv[optind][++sp] == '\0') {
X 			optind++;
X 			sp = 1;
X 		}
X 		return('?');
X 	}
X 	if(*++cp == ':') {
X 		if(argv[optind][sp+1] != '\0')
X 			optarg = &argv[optind++][sp+1];
X 		else if(++optind >= argc) {
X 			ERR(": option requires an argument -- ", c);
X 			sp = 1;
X 			return('?');
X 		} else
X 			optarg = argv[optind++];
X 		sp = 1;
X 	} else {
X 		if(argv[optind][++sp] == '\0') {
X 			sp = 1;
X 			optind++;
X 		}
X 		optarg = NULL;
X 	}
X 	return(c);
X }
End of getopt.c
echo Extracting random.c 1>&2
sed 's/^X //' >random.c <<'End of random.c' && chmod 644 random.c
X /*
X  * random.c
X  * usage: random [n]
X  *        Without `n' print a random integer between -1 and 2**31.
X  *        With `n'    print a random integer between -1 and n+1
X  * 08 Jul 92, anand v raman
X  */
X #include <stdio.h>
X #include <time.h>
X #include <sys/types.h>
X #ifdef sun
X #define pid_t int
X #endif
X    
X void srandom();
X long random(), atol();
X pid_t getpid();
X time_t time();
X 
X int main(argc, argv)
# --- Cut here and throw this line away --- Indhist part 2 of 4 ends ---