From: lwall@netlabs.com (Larry Wall)
Newsgroups: comp.sources.misc
Subject: v18i043:  perl - The perl programming language, Part25/36
Message-ID: <1991Apr17.185725.2542@sparky.IMD.Sterling.COM>
Date: 17 Apr 91 18:57:25 GMT
Approved: kent@sparky.imd.sterling.com

Submitted-by: Larry Wall <lwall@netlabs.com>
Posting-number: Volume 18, Issue 43
Archive-name: perl/part25

[There are 36 kits for perl version 4.0.]

#! /bin/sh

# Make a new directory for the perl sources, cd to it, and run kits 1
# thru 36 through sh.  When all 36 kits have been run, read README.

echo "This is perl 4.0 kit 25 (of 36).  If kit 25 is complete, the line"
echo '"'"End of kit 25 (of 36)"'" will echo at the end.'
echo ""
export PATH || (echo "You didn't use sh, you clunch." ; kill $$)
mkdir h2pl os2 2>/dev/null
echo Extracting config.H
sed >config.H <<'!STUFFY!FUNK!' -e 's/X//'
X#ifndef config_h
X#define config_h
X/* config.h
X * This file was produced by running the config.h.SH script, which
X * gets its values from config.sh, which is generally produced by
X * running Configure.
X *
X * Feel free to modify any of this as the need arises.  Note, however,
X * that running config.h.SH again will wipe out any changes you've made.
X * For a more permanent change edit config.sh and rerun config.h.SH.
X */
X
X
X/* EUNICE
X *	This symbol, if defined, indicates that the program is being compiled
X *	under the EUNICE package under VMS.  The program will need to handle
X *	things like files that don't go away the first time you unlink them,
X *	due to version numbering.  It will also need to compensate for lack
X *	of a respectable link() command.
X */
X/* VMS
X *	This symbol, if defined, indicates that the program is running under
X *	VMS.  It is currently only set in conjunction with the EUNICE symbol.
X */
X/*#undef	EUNICE		/**/
X/*#undef	VMS		/**/
X
X/* ALIGNBYTES
X *	This symbol contains the number of bytes required to align a double.
X *	Usual values are 2, 4, and 8.
X */
X#define ALIGNBYTES 4		/**/
X
X/* BIN
X *	This symbol holds the name of the directory in which the user wants
X *	to keep publicly executable images for the package in question.  It
X *	is most often a local directory such as /usr/local/bin.
X */
X#define BIN "/usr/local/bin"             /**/
X
X/* BYTEORDER
X *	This symbol contains an encoding of the order of bytes in a long.
X *	Usual values (in octal) are 01234, 04321, 02143, 03412...
X */
X#define BYTEORDER 0x1234		/**/
X
X/* CPPSTDIN
X *	This symbol contains the first part of the string which will invoke
X *	the C preprocessor on the standard input and produce to standard
X *	output.	 Typical value of "cc -E" or "/lib/cpp".
X */
X/* CPPMINUS
X *	This symbol contains the second part of the string which will invoke
X *	the C preprocessor on the standard input and produce to standard
X *	output.  This symbol will have the value "-" if CPPSTDIN needs a minus
X *	to specify standard input, otherwise the value is "".
X */
X#define CPPSTDIN "cc -E"
X#define CPPMINUS "-"
X
X/* HAS_BCMP
X *	This symbol, if defined, indicates that the bcmp routine is available
X *	to compare blocks of memory.  If undefined, use memcmp.  If that's
X *	not available, roll your own.
X */
X#define	HAS_BCMP		/**/
X
X/* HAS_BCOPY
X *	This symbol, if defined, indicates that the bcopy routine is available
X *	to copy blocks of memory.  Otherwise you should probably use memcpy().
X */
X#define	HAS_BCOPY		/**/
X
X/* HAS_BZERO
X *	This symbol, if defined, indicates that the bzero routine is available
X *	to zero blocks of memory.  Otherwise you should probably use memset()
X *	or roll your own.
X */
X#define	HAS_BZERO		/**/
X
X/* CASTNEGFLOAT
X *	This symbol, if defined, indicates that this C compiler knows how to
X *	cast negative or large floating point numbers to unsigned longs, ints
X *	and shorts.
X */
X/* CASTFLAGS
X *	This symbol contains flags that say what difficulties the compiler
X *	has casting odd floating values to unsigned long:
X *		1 = couldn't cast < 0
X *		2 = couldn't cast >= 0x80000000
X */
X#define	CASTNEGFLOAT	/**/
X#define	CASTFLAGS 0	/**/
X
X/* CHARSPRINTF
X *	This symbol is defined if this system declares "char *sprintf()" in
X *	stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
X *	is up to the package author to declare sprintf correctly based on the
X *	symbol.
X */
X#define	CHARSPRINTF 	/**/
X
X/* HAS_CHSIZE
X *	This symbol, if defined, indicates that the chsize routine is available
X *	to truncate files.  You might need a -lx to get this routine.
X */
X/*#undef	HAS_CHSIZE		/**/
X
X/* HAS_CRYPT
X *	This symbol, if defined, indicates that the crypt routine is available
X *	to encrypt passwords and the like.
X */
X#define	HAS_CRYPT		/**/
X
X/* CSH
X *	This symbol, if defined, indicates that the C-shell exists.
X *	If defined, contains the full pathname of csh.
X */
X#define CSH "/bin/csh"		/**/
X
X/* DOSUID
X *	This symbol, if defined, indicates that the C program should
X *	check the script that it is executing for setuid/setgid bits, and
X *	attempt to emulate setuid/setgid on systems that have disabled
X *	setuid #! scripts because the kernel can't do it securely.
X *	It is up to the package designer to make sure that this emulation
X *	is done securely.  Among other things, it should do an fstat on
X *	the script it just opened to make sure it really is a setuid/setgid
X *	script, it should make sure the arguments passed correspond exactly
X *	to the argument on the #! line, and it should not trust any
X *	subprocesses to which it must pass the filename rather than the
X *	file descriptor of the script to be executed.
X */
X/*#undef DOSUID		/**/
X
X/* HAS_DUP2
X *	This symbol, if defined, indicates that the dup2 routine is available
X *	to dup file descriptors.  Otherwise you should use dup().
X */
X#define	HAS_DUP2		/**/
X
X/* HAS_FCHMOD
X *	This symbol, if defined, indicates that the fchmod routine is available
X *	to change mode of opened files.  If unavailable, use chmod().
X */
X#define	HAS_FCHMOD		/**/
X
X/* HAS_FCHOWN
X *	This symbol, if defined, indicates that the fchown routine is available
X *	to change ownership of opened files.  If unavailable, use chown().
X */
X#define	HAS_FCHOWN		/**/
X
X/* HAS_FCNTL
X *	This symbol, if defined, indicates to the C program that
X *	the fcntl() function exists.
X */
X#define	HAS_FCNTL		/**/
X
X/* FLEXFILENAMES
X *	This symbol, if defined, indicates that the system supports filenames
X *	longer than 14 characters.
X */
X#define	FLEXFILENAMES		/**/
X
X/* HAS_FLOCK
X *	This symbol, if defined, indicates that the flock() routine is
X *	available to do file locking.
X */
X#define	HAS_FLOCK		/**/
X
X/* HAS_GETGROUPS
X *	This symbol, if defined, indicates that the getgroups() routine is
X *	available to get the list of process groups.  If unavailable, multiple
X *	groups are probably not supported.
X */
X#define	HAS_GETGROUPS		/**/
X
X/* HAS_GETHOSTENT
X *	This symbol, if defined, indicates that the gethostent() routine is
X *	available to lookup host names in some data base or other.
X */
X#define	HAS_GETHOSTENT		/**/
X
X/* HAS_GETPGRP
X *	This symbol, if defined, indicates that the getpgrp() routine is
X *	available to get the current process group.
X */
X#define	HAS_GETPGRP		/**/
X
X/* HAS_GETPGRP2
X *	This symbol, if defined, indicates that the getpgrp2() (as in DG/UX)
X *	routine is available to get the current process group.
X */
X/*#undef	HAS_GETPGRP2		/**/
X
X/* HAS_GETPRIORITY
X *	This symbol, if defined, indicates that the getpriority() routine is
X *	available to get a process's priority.
X */
X#define	HAS_GETPRIORITY		/**/
X
X/* HAS_HTONS
X *	This symbol, if defined, indicates that the htons routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_HTONL
X *	This symbol, if defined, indicates that the htonl routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_NTOHS
X *	This symbol, if defined, indicates that the ntohs routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_NTOHL
X *	This symbol, if defined, indicates that the ntohl routine (and friends)
X *	are available to do network order byte swapping.
X */
X#define	HAS_HTONS	/**/
X#define	HAS_HTONL	/**/
X#define	HAS_NTOHS	/**/
X#define	HAS_NTOHL	/**/
X
X/* index
X *	This preprocessor symbol is defined, along with rindex, if the system
X *	uses the strchr and strrchr routines instead.
X */
X/* rindex
X *	This preprocessor symbol is defined, along with index, if the system
X *	uses the strchr and strrchr routines instead.
X */
X/*#undef	index strchr	/* cultural */
X/*#undef	rindex strrchr	/*  differences? */
X
X/* HAS_KILLPG
X *	This symbol, if defined, indicates that the killpg routine is available
X *	to kill process groups.  If unavailable, you probably should use kill
X *	with a negative process number.
X */
X#define	HAS_KILLPG		/**/
X
X/* HAS_LSTAT
X *	This symbol, if defined, indicates that the lstat() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_LSTAT		/**/
X
X/* HAS_MEMCMP
X *	This symbol, if defined, indicates that the memcmp routine is available
X *	to compare blocks of memory.  If undefined, roll your own.
X */
X#define	HAS_MEMCMP		/**/
X
X/* HAS_MEMCPY
X *	This symbol, if defined, indicates that the memcpy routine is available
X *	to copy blocks of memory.  Otherwise you should probably use bcopy().
X *	If neither is defined, roll your own.
X */
X#define	HAS_MEMCPY		/**/
X
X/* HAS_MKDIR
X *	This symbol, if defined, indicates that the mkdir routine is available
X *	to create directories.  Otherwise you should fork off a new process to
X *	exec /bin/mkdir.
X */
X#define	HAS_MKDIR		/**/
X
X/* HAS_MSG
X *	This symbol, if defined, indicates that the entire msg*(2) library is
X *	supported.
X */
X#define	HAS_MSG		/**/
X
X/* HAS_MSGCTL
X *	This symbol, if defined, indicates that the msgctl() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_MSGCTL		/**/
X
X/* HAS_MSGGET
X *	This symbol, if defined, indicates that the msgget() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_MSGGET		/**/
X
X/* HAS_MSGRCV
X *	This symbol, if defined, indicates that the msgrcv() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_MSGRCV		/**/
X
X/* HAS_MSGSND
X *	This symbol, if defined, indicates that the msgsnd() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_MSGSND		/**/
X
X/* HAS_NDBM
X *	This symbol, if defined, indicates that ndbm.h exists and should
X *	be included.
X */
X#define	HAS_NDBM		/**/
X
X/* HAS_ODBM
X *	This symbol, if defined, indicates that dbm.h exists and should
X *	be included.
X */
X#define	HAS_ODBM		/**/
X
X/* HAS_OPEN3
X *	This manifest constant lets the C program know that the three
X *	argument form of open(2) is available.
X */
X#define	HAS_OPEN3		/**/
X
X/* HAS_READDIR
X *	This symbol, if defined, indicates that the readdir routine is available
X *	from the C library to read directories.
X */
X#define	HAS_READDIR		/**/
X
X/* HAS_RENAME
X *	This symbol, if defined, indicates that the rename routine is available
X *	to rename files.  Otherwise you should do the unlink(), link(), unlink()
X *	trick.
X */
X#define	HAS_RENAME		/**/
X
X/* HAS_RMDIR
X *	This symbol, if defined, indicates that the rmdir routine is available
X *	to remove directories.  Otherwise you should fork off a new process to
X *	exec /bin/rmdir.
X */
X#define	HAS_RMDIR		/**/
X
X/* HAS_SELECT
X *	This symbol, if defined, indicates that the select() subroutine
X *	exists.
X */
X#define	HAS_SELECT	/**/
X
X/* HAS_SEM
X *	This symbol, if defined, indicates that the entire sem*(2) library is
X *	supported.
X */
X#define	HAS_SEM		/**/
X
X/* HAS_SEMCTL
X *	This symbol, if defined, indicates that the semctl() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SEMCTL		/**/
X
X/* HAS_SEMGET
X *	This symbol, if defined, indicates that the semget() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SEMGET		/**/
X
X/* HAS_SEMOP
X *	This symbol, if defined, indicates that the semop() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SEMOP		/**/
X
X/* HAS_SETEGID
X *	This symbol, if defined, indicates that the setegid routine is available
X *	to change the effective gid of the current program.
X */
X#define	HAS_SETEGID		/**/
X
X/* HAS_SETEUID
X *	This symbol, if defined, indicates that the seteuid routine is available
X *	to change the effective uid of the current program.
X */
X#define	HAS_SETEUID		/**/
X
X/* HAS_SETPGRP
X *	This symbol, if defined, indicates that the setpgrp() routine is
X *	available to set the current process group.
X */
X#define	HAS_SETPGRP		/**/
X
X/* HAS_SETPGRP2
X *	This symbol, if defined, indicates that the setpgrp2() (as in DG/UX)
X *	routine is available to set the current process group.
X */
X/*#undef	HAS_SETPGRP2		/**/
X
X/* HAS_SETPRIORITY
X *	This symbol, if defined, indicates that the setpriority() routine is
X *	available to set a process's priority.
X */
X#define	HAS_SETPRIORITY		/**/
X
X/* HAS_SETREGID
X *	This symbol, if defined, indicates that the setregid routine is
X *	available to change the real and effective gid of the current program.
X */
X/* HAS_SETRESGID
X *	This symbol, if defined, indicates that the setresgid routine is
X *	available to change the real, effective and saved gid of the current
X *	program.
X */
X#define	HAS_SETREGID		/**/
X/*#undef	HAS_SETRESGID		/**/
X
X/* HAS_SETREUID
X *	This symbol, if defined, indicates that the setreuid routine is
X *	available to change the real and effective uid of the current program.
X */
X/* HAS_SETRESUID
X *	This symbol, if defined, indicates that the setresuid routine is
X *	available to change the real, effective and saved uid of the current
X *	program.
X */
X#define	HAS_SETREUID		/**/
X/*#undef	HAS_SETRESUID		/**/
X
X/* HAS_SETRGID
X *	This symbol, if defined, indicates that the setrgid routine is available
X *	to change the real gid of the current program.
X */
X#define	HAS_SETRGID		/**/
X
X/* HAS_SETRUID
X *	This symbol, if defined, indicates that the setruid routine is available
X *	to change the real uid of the current program.
X */
X#define	HAS_SETRUID		/**/
X
X/* HAS_SHM
X *	This symbol, if defined, indicates that the entire shm*(2) library is
X *	supported.
X */
X#define	HAS_SHM		/**/
X
X/* HAS_SHMAT
X *	This symbol, if defined, indicates that the shmat() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SHMAT		/**/
X
X/* HAS_SHMCTL
X *	This symbol, if defined, indicates that the shmctl() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SHMCTL		/**/
X
X/* HAS_SHMDT
X *	This symbol, if defined, indicates that the shmdt() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SHMDT		/**/
X
X/* HAS_SHMGET
X *	This symbol, if defined, indicates that the shmget() routine is
X *	available to stat symbolic links.
X */
X#define	HAS_SHMGET		/**/
X
X/* HAS_SOCKET
X *	This symbol, if defined, indicates that the BSD socket interface is
X *	supported.
X */
X/* HAS_SOCKETPAIR
X *	This symbol, if defined, indicates that the BSD socketpair call is
X *	supported.
X */
X/* OLDSOCKET
X *	This symbol, if defined, indicates that the 4.1c BSD socket interface
X *	is supported instead of the 4.2/4.3 BSD socket interface.
X */
X#define	HAS_SOCKET		/**/
X
X#define	HAS_SOCKETPAIR	/**/
X
X/*#undef	OLDSOCKET	/**/
X
X/* STATBLOCKS
X *	This symbol is defined if this system has a stat structure declaring
X *	st_blksize and st_blocks.
X */
X#define	STATBLOCKS 	/**/
X
X/* STDSTDIO
X *	This symbol is defined if this system has a FILE structure declaring
X *	_ptr and _cnt in stdio.h.
X */
X#define	STDSTDIO 	/**/
X
X/* STRUCTCOPY
X *	This symbol, if defined, indicates that this C compiler knows how
X *	to copy structures.  If undefined, you'll need to use a block copy
X *	routine of some sort instead.
X */
X#define	STRUCTCOPY	/**/
X
X/* HAS_STRERROR
X *	This symbol, if defined, indicates that the strerror() routine is
X *	available to translate error numbers to strings.
X */
X/*#undef	HAS_STRERROR		/**/
X
X/* HAS_SYMLINK
X *	This symbol, if defined, indicates that the symlink routine is available
X *	to create symbolic links.
X */
X#define	HAS_SYMLINK		/**/
X
X/* HAS_SYSCALL
X *	This symbol, if defined, indicates that the syscall routine is available
X *	to call arbitrary system calls.  If undefined, that's tough.
X */
X#define	HAS_SYSCALL		/**/
X
X/* HAS_TRUNCATE
X *	This symbol, if defined, indicates that the truncate routine is
X *	available to truncate files.
X */
X#define	HAS_TRUNCATE		/**/
X
X/* HAS_VFORK
X *	This symbol, if defined, indicates that vfork() exists.
X */
X#define	HAS_VFORK	/**/
X
X/* VOIDSIG
X *	This symbol is defined if this system declares "void (*signal())()" in
X *	signal.h.  The old way was to declare it as "int (*signal())()".  It
X *	is up to the package author to declare things correctly based on the
X *	symbol.
X */
X/* TO_SIGNAL
X *	This symbol's value is either "void" or "int", corresponding to the
X *	appropriate return "type" of a signal handler.  Thus, one can declare
X *	a signal handler using "TO_SIGNAL (*handler())()", and define the
X *	handler using "TO_SIGNAL handler(sig)".
X */
X/*#undef	VOIDSIG 	/**/
X#define	TO_SIGNAL	 	/**/
X
X/* HASVOLATILE
X *	This symbol, if defined, indicates that this C compiler knows about
X *	the volatile declaration.
X */
X/*#undef	HASVOLATILE	/**/
X
X/* HAS_VPRINTF
X *	This symbol, if defined, indicates that the vprintf routine is available
X *	to printf with a pointer to an argument list.  If unavailable, you
X *	may need to write your own, probably in terms of _doprnt().
X */
X/* CHARVSPRINTF
X *	This symbol is defined if this system has vsprintf() returning type
X *	(char*).  The trend seems to be to declare it as "int vsprintf()".  It
X *	is up to the package author to declare vsprintf correctly based on the
X *	symbol.
X */
X/*#undef	HAS_VPRINTF	/**/
X/*#undef	CHARVSPRINTF 	/**/
X
X/* HAS_WAIT4
X *	This symbol, if defined, indicates that wait4() exists.
X */
X#define	HAS_WAIT4	/**/
X
X/* HAS_WAITPID
X *	This symbol, if defined, indicates that waitpid() exists.
X */
X/*#undef	HAS_WAITPID	/**/
X
X/* GIDTYPE
X *	This symbol has a value like gid_t, int, ushort, or whatever type is
X *	used to declare group ids in the kernel.
X */
X#define GIDTYPE int		/**/
X
X/* I_FCNTL
X *	This manifest constant tells the C program to include <fcntl.h>.
X */
X/*#undef	I_FCNTL	/**/
X
X/* I_GDBM
X *	This symbol, if defined, indicates that gdbm.h exists and should
X *	be included.
X */
X/*#undef	I_GDBM		/**/
X
X/* I_GRP
X *	This symbol, if defined, indicates to the C program that it should
X *	include grp.h.
X */
X#define	I_GRP		/**/
X
X/* I_NETINET_IN
X *	This symbol, if defined, indicates to the C program that it should
X *	include netinet/in.h.
X */
X/* I_SYS_IN
X *	This symbol, if defined, indicates to the C program that it should
X *	include sys/in.h.
X */
X#define	I_NETINET_IN		/**/
X/*#undef	I_SYS_IN		/**/
X
X/* I_PWD
X *	This symbol, if defined, indicates to the C program that it should
X *	include pwd.h.
X */
X/* PWQUOTA
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_quota.
X */
X/* PWAGE
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_age.
X */
X/* PWCHANGE
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_change.
X */
X/* PWCLASS
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_class.
X */
X/* PWEXPIRE
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_expire.
X */
X/* PWCOMMENT
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_comment.
X */
X#define	I_PWD		/**/
X/*#undef	PWQUOTA		/**/
X/*#undef	PWAGE		/**/
X/*#undef	PWCHANGE	/**/
X/*#undef	PWCLASS		/**/
X/*#undef	PWEXPIRE	/**/
X/*#undef	PWCOMMENT	/**/
X
X/* I_SYS_FILE
X *	This manifest constant tells the C program to include <sys/file.h>.
X */
X#define	I_SYS_FILE	/**/
X
X/* I_SYSIOCTL
X *	This symbol, if defined, indicates that sys/ioctl.h exists and should
X *	be included.
X */
X#define	I_SYSIOCTL		/**/
X
X/* I_TIME
X *	This symbol is defined if the program should include <time.h>.
X */
X/* I_SYS_TIME
X *	This symbol is defined if the program should include <sys/time.h>.
X */
X/* SYSTIMEKERNEL
X *	This symbol is defined if the program should include <sys/time.h>
X *	with KERNEL defined.
X */
X/* I_SYS_SELECT
X *	This symbol is defined if the program should include <sys/select.h>.
X */
X/*#undef	I_TIME	 	/**/
X#define	I_SYS_TIME 	/**/
X/*#undef	SYSTIMEKERNEL 	/**/
X/*#undef	I_SYS_SELECT 	/**/
X
X/* I_UTIME
X *	This symbol, if defined, indicates to the C program that it should
X *	include utime.h.
X */
X/*#undef	I_UTIME		/**/
X
X/* I_VARARGS
X *	This symbol, if defined, indicates to the C program that it should
X *	include varargs.h.
X */
X#define	I_VARARGS		/**/
X
X/* I_VFORK
X *	This symbol, if defined, indicates to the C program that it should
X *	include vfork.h.
X */
X/*#undef	I_VFORK		/**/
X
X/* INTSIZE
X *	This symbol contains the size of an int, so that the C preprocessor
X *	can make decisions based on it.
X */
X#define INTSIZE 4		/**/
X
X/* I_DIRENT
X *	This symbol, if defined, indicates that the program should use the
X *	P1003-style directory routines, and include <dirent.h>.
X */
X/* I_SYS_DIR
X *	This symbol, if defined, indicates that the program should use the
X *	directory functions by including <sys/dir.h>.
X */
X/* I_NDIR
X *	This symbol, if defined, indicates that the program should include the
X *	system's version of ndir.h, rather than the one with this package.
X */
X/* I_SYS_NDIR
X *	This symbol, if defined, indicates that the program should include the
X *	system's version of sys/ndir.h, rather than the one with this package.
X */
X/* I_MY_DIR
X *	This symbol, if defined, indicates that the program should compile
X *	the ndir.c code provided with the package.
X */
X/* DIRNAMLEN
X *	This symbol, if defined, indicates to the C program that the length
X *	of directory entry names is provided by a d_namlen field.  Otherwise
X *	you need to do strlen() on the d_name field.
X */
X#define	I_DIRENT	/**/
X/*#undef	I_SYS_DIR	/**/
X/*#undef	I_NDIR		/**/
X/*#undef	I_SYS_NDIR	/**/
X/*#undef	I_MY_DIR	/**/
X/*#undef	DIRNAMLEN	/**/
X
X
X/* RANDBITS
X *	This symbol contains the number of bits of random number the rand()
X *	function produces.  Usual values are 15, 16, and 31.
X */
X#define RANDBITS 31		/**/
X
X/* SCRIPTDIR
X *	This symbol holds the name of the directory in which the user wants
X *	to put publicly executable scripts for the package in question.  It
X *	is often a directory that is mounted across diverse architectures.
X */
X#define SCRIPTDIR "/usr/local/bin"             /**/
X
X/* SIG_NAME
X *	This symbol contains an list of signal names in order.
X */
X#define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","URG","STOP","TSTP","CONT","CHLD","TTIN","TTOU","IO","XCPU","XFSZ","VTALRM","PROF","WINCH","LOST","USR1","USR2"		/**/
X
X/* STDCHAR
X *	This symbol is defined to be the type of char used in stdio.h.
X *	It has the values "unsigned char" or "char".
X */
X#define STDCHAR char	/**/
X
X/* UIDTYPE
X *	This symbol has a value like uid_t, int, ushort, or whatever type is
X *	used to declare user ids in the kernel.
X */
X#define UIDTYPE uid_t		/**/
X
X/* VOIDHAVE
X *	This symbol indicates how much support of the void type is given by this
X *	compiler.  What various bits mean:
X *
X *	    1 = supports declaration of void
X *	    2 = supports arrays of pointers to functions returning void
X *	    4 = supports comparisons between pointers to void functions and
X *		    addresses of void functions
X *
X *	The package designer should define VOIDWANT to indicate the requirements
X *	of the package.  This can be done either by #defining VOIDWANT before
X *	including config.h, or by defining voidwant in Myinit.U.  If the level
X *	of void support necessary is not present, config.h defines void to "int",
X *	VOID to the empty string, and VOIDP to "char *".
X */
X/* void
X *	This symbol is used for void casts.  On implementations which support
X *	void appropriately, its value is "void".  Otherwise, its value maps
X *	to "int".
X */
X/* VOID
X *	This symbol's value is "void" if the implementation supports void
X *	appropriately.  Otherwise, its value is the empty string.  The primary
X *	use of this symbol is in specifying void parameter lists for function
X *	prototypes.
X */
X/* VOIDP
X *	This symbol is used for casting generic pointers.  On implementations
X *	which support void appropriately, its value is "void *".  Otherwise,
X *	its value is "char *".
X */
X#ifndef VOIDWANT
X#define VOIDWANT 1
X#endif
X#define VOIDHAVE 1
X#if (VOIDHAVE & VOIDWANT) != VOIDWANT
X#define void int		/* is void to be avoided? */
X#define VOID
X#define VOIDP (char *)
X#define M_VOID		/* Xenix strikes again */
X#else
X#define VOID void
X#define VOIDP (void *)
X#endif
X
X/* PRIVLIB
X *	This symbol contains the name of the private library for this package.
X *	The library is private in the sense that it needn't be in anyone's
X *	execution path, but it should be accessible by the world.  The program
X *	should be prepared to do ~ expansion.
X */
X#define PRIVLIB "/usr/local/lib/perl"		/**/
X
X#endif
!STUFFY!FUNK!
echo Extracting os2/config.h
sed >os2/config.h <<'!STUFFY!FUNK!' -e 's/X//'
X/* config.h
X * This file was hand tailored for compiling under MS-DOS and MSC 5.1.
X * Diomidis Spinellis, March 1990.
X *
X * Then it got mangled again for compiling under OS/2 and MSC 6.0.
X * Raymond Chen, June 1990.
X */
X#define OS2		/**/
X
X/* OS/2 supports some additional things MS-DOS doesn't.
X */
X#ifdef OS2
X#define PIPE
X#define GETPPID
X#define HAS_GETPRIORITY
X#define HAS_SETPRIORITY
X#define KILL
X#endif /* OS2 */
X
X/* SUFFIX:
X *      This symbol, if defined, indicates that the function add_suffix has
X *      been supplied in a system-dependent .c file.  This function is
X *      recommended for operating systems whose filenaming conventions
X *      do not permit arbitrary strings as filenames.
X */
X#define SUFFIX	/**/
X
X/* EUNICE:
X *	This symbol, if defined, indicates that the program is being compiled
X *	under the EUNICE package under VMS.  The program will need to handle
X *	things like files that don't go away the first time you unlink them,
X *	due to version numbering.  It will also need to compensate for lack
X *	of a respectable link() command.
X */
X/* VMS:
X *	This symbol, if defined, indicates that the program is running under
X *	VMS.  It is currently only set in conjunction with the EUNICE symbol.
X */
X/*#undef	EUNICE		/**/
X/*#undef	VMS		/**/
X
X/* BIN:
X *	This symbol holds the name of the directory in which the user wants
X *	to put publicly executable images for the package in question.  It
X *	is most often a local directory such as /usr/local/bin.
X */
X#define BIN "/usr/local/bin"             /**/
X
X/* BYTEORDER:
X *	This symbol contains an encoding of the order of bytes in a long.
X *	Usual values (in octal) are 01234, 04321, 02143, 03412...
X */
X/* CHECK */
X#define BYTEORDER 0x1234		/**/
X
X/* CPPSTDIN:
X *	This symbol contains the first part of the string which will invoke
X *	the C preprocessor on the standard input and produce to standard
X *	output.	 Typical value of "cc -{" or "/lib/cpp".
X */
X/* CPPMINUS:
X *	This symbol contains the second part of the string which will invoke
X *	the C preprocessor on the standard input and produce to standard
X *	output.  This symbol will have the value "-" if CPPSTDIN needs a minus
X *	to specify standard input, otherwise the value is "".
X */
X/* TODO */
X#define CPPSTDIN "cc -{"
X#define CPPMINUS ""
X
X/* HAS_BCMP:
X *	This symbol, if defined, indicates that the bcmp routine is available
X *	to compare blocks of memory.  If undefined, use memcmp.  If that's
X *	not available, roll your own.
X */
X/*#define	HAS_BCMP		/**/
X
X/* HAS_BCOPY:
X *	This symbol, if defined, indicates that the bcopy routine is available
X *	to copy blocks of memory.  Otherwise you should probably use memcpy().
X */
X/*#define	HAS_BCOPY		/**/
X
X/* CHARSPRINTF:
X *	This symbol is defined if this system declares "char *sprintf()" in
X *	stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
X *	is up to the package author to declare sprintf correctly based on the
X *	symbol.
X */
X/*#define	CHARSPRINTF 	/**/
X
X/* HAS_CRYPT:
X *	This symbol, if defined, indicates that the crypt routine is available
X *	to encrypt passwords and the like.
X */
X/* TODO */
X/*#define	HAS_CRYPT		/**/
X
X/* DOSUID:
X *	This symbol, if defined, indicates that the C program should
X *	check the script that it is executing for setuid/setgid bits, and
X *	attempt to emulate setuid/setgid on systems that have disabled
X *	setuid #! scripts because the kernel can't do it securely.
X *	It is up to the package designer to make sure that this emulation
X *	is done securely.  Among other things, it should do an fstat on
X *	the script it just opened to make sure it really is a setuid/setgid
X *	script, it should make sure the arguments passed correspond exactly
X *	to the argument on the #! line, and it should not trust any
X *	subprocesses to which it must pass the filename rather than the
X *	file descriptor of the script to be executed.
X */
X/*#define DOSUID		/**/
X
X/* HAS_DUP2:
X *	This symbol, if defined, indicates that the dup2 routine is available
X *	to dup file descriptors.  Otherwise you should use dup().
X */
X#define	HAS_DUP2		/**/
X
X/* HAS_FCHMOD:
X *	This symbol, if defined, indicates that the fchmod routine is available
X *	to change mode of opened files.  If unavailable, use chmod().
X */
X/*#define	HAS_FCHMOD		/**/
X
X/* HAS_FCHOWN:
X *	This symbol, if defined, indicates that the fchown routine is available
X *	to change ownership of opened files.  If unavailable, use chown().
X */
X/*#define	HAS_FCHOWN		/**/
X
X/* I_FCNTL:
X *	This symbol, if defined, indicates to the C program that it should
X *	include fcntl.h.
X */
X/*#define	I_FCNTL		/**/
X
X/* HAS_FLOCK:
X *	This symbol, if defined, indicates that the flock() routine is
X *	available to do file locking.
X */
X/*#define	HAS_FLOCK		/**/
X
X/* HAS_GETGROUPS:
X *	This symbol, if defined, indicates that the getgroups() routine is
X *	available to get the list of process groups.  If unavailable, multiple
X *	groups are probably not supported.
X */
X/*#define	HAS_GETGROUPS		/**/
X
X/* HAS_GETHOSTENT:
X *	This symbol, if defined, indicates that the gethostent() routine is
X *	available to lookup host names in some data base or other.
X */
X/*#define	HAS_GETHOSTENT		/**/
X
X/* HAS_GETPGRP:
X *	This symbol, if defined, indicates that the getpgrp() routine is
X *	available to get the current process group.
X */
X/*#define	HAS_GETPGRP		/**/
X
X/* HAS_GETPRIORITY:
X *	This symbol, if defined, indicates that the getpriority() routine is
X *	available to get a process's priority.
X */
X/*#define	HAS_GETPRIORITY		/**/
X
X/* HAS_HTONS:
X *	This symbol, if defined, indicates that the htons routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_HTONL:
X *	This symbol, if defined, indicates that the htonl routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_NTOHS:
X *	This symbol, if defined, indicates that the ntohs routine (and friends)
X *	are available to do network order byte swapping.
X */
X/* HAS_NTOHL:
X *	This symbol, if defined, indicates that the ntohl routine (and friends)
X *	are available to do network order byte swapping.
X */
X/*#define	HAS_HTONS		/**/
X/*#define	HAS_HTONL		/**/
X/*#define	HAS_NTOHS		/**/
X/*#define	HAS_NTOHL		/**/
X
X/* index:
X *	This preprocessor symbol is defined, along with rindex, if the system
X *	uses the strchr and strrchr routines instead.
X */
X/* rindex:
X *	This preprocessor symbol is defined, along with index, if the system
X *	uses the strchr and strrchr routines instead.
X */
X#define	index strchr	/* cultural */
X#define	rindex strrchr	/*  differences? */
X
X/* I_SYSIOCTL:
X *	This symbol, if defined, indicates that sys/ioctl.h exists and should
X *	be included.
X */
X/*#define	I_SYSIOCTL		/**/
X
X/* HAS_KILLPG:
X *	This symbol, if defined, indicates that the killpg routine is available
X *	to kill process groups.  If unavailable, you probably should use kill
X *	with a negative process number.
X */
X/*#define	HAS_KILLPG		/**/
X
X/* HAS_MEMCMP:
X *	This symbol, if defined, indicates that the memcmp routine is available
X *	to compare blocks of memory.  If undefined, roll your own.
X */
X#define	HAS_MEMCMP		/**/
X
X/* HAS_MEMCPY:
X *	This symbol, if defined, indicates that the memcpy routine is available
X *	to copy blocks of memory.  Otherwise you should probably use bcopy().
X *	If neither is defined, roll your own.
X */
X#define	HAS_MEMCPY		/**/
X
X/* HAS_MKDIR:
X *	This symbol, if defined, indicates that the mkdir routine is available
X *	to create directories.  Otherwise you should fork off a new process to
X *	exec /bin/mkdir.
X */
X#define	HAS_MKDIR		/**/
X
X/* HAS_NDBM:
X *	This symbol, if defined, indicates that ndbm.h exists and should
X *	be included.
X */
X#define	HAS_NDBM		/**/
X
X/* HAS_ODBM:
X *	This symbol, if defined, indicates that dbm.h exists and should
X *	be included.
X */
X/*#define	HAS_ODBM		/**/
X
X/* HAS_READDIR:
X *	This symbol, if defined, indicates that the readdir routine is available
X *	from the C library to create directories.
X */
X#define	HAS_READDIR		/**/
X
X/* HAS_RENAME:
X *	This symbol, if defined, indicates that the rename routine is available
X *	to rename files.  Otherwise you should do the unlink(), link(), unlink()
X *	trick.
X */
X#define	HAS_RENAME		/**/
X
X/* HAS_RMDIR:
X *	This symbol, if defined, indicates that the rmdir routine is available
X *	to remove directories.  Otherwise you should fork off a new process to
X *	exec /bin/rmdir.
X */
X#define	HAS_RMDIR		/**/
X
X/* HAS_SETEGID:
X *	This symbol, if defined, indicates that the setegid routine is available
X *	to change the effective gid of the current program.
X */
X/*#define	HAS_SETEGID		/**/
X
X/* HAS_SETEUID:
X *	This symbol, if defined, indicates that the seteuid routine is available
X *	to change the effective uid of the current program.
X */
X/*#define	HAS_SETEUID		/**/
X
X/* HAS_SETPGRP:
X *	This symbol, if defined, indicates that the setpgrp() routine is
X *	available to set the current process group.
X */
X/*#define	HAS_SETPGRP		/**/
X
X/* HAS_SETPRIORITY:
X *	This symbol, if defined, indicates that the setpriority() routine is
X *	available to set a process's priority.
X */
X/*#define	HAS_SETPRIORITY		/**/
X
X/* HAS_SETREGID:
X *	This symbol, if defined, indicates that the setregid routine is available
X *	to change the real and effective gid of the current program.
X */
X/*#define	HAS_SETREGID		/**/
X
X/* HAS_SETREUID:
X *	This symbol, if defined, indicates that the setreuid routine is available
X *	to change the real and effective uid of the current program.
X */
X/*#define	HAS_SETREUID		/**/
X
X/* HAS_SETRGID:
X *	This symbol, if defined, indicates that the setrgid routine is available
X *	to change the real gid of the current program.
X */
X/*#define	HAS_SETRGID		/**/
X
X/* HAS_SETRUID:
X *	This symbol, if defined, indicates that the setruid routine is available
X *	to change the real uid of the current program.
X */
X/*#define	HAS_SETRUID		/**/
X
X/* HAS_SOCKET:
X *      This symbol, if defined, indicates that the BSD socket interface is
X *      supported.
X */
X/* HAS_SOCKETPAIR:
X *      This symbol, if defined, indicates that the BSD socketpair call is
X *      supported.
X */
X/* OLDSOCKET:
X *      This symbol, if defined, indicates that the 4.1c BSD socket interface
X *      is supported instead of the 4.2/4.3 BSD socket interface.
X */
X/*#undef HAS_SOCKET          /**/
X
X/*#undef HAS_SOCKETPAIR      /**/
X
X/*#undef        OLDSOCKET       /**/
X
X/* STATBLOCKS:
X *	This symbol is defined if this system has a stat structure declaring
X *	st_blksize and st_blocks.
X */
X/*#define	STATBLOCKS 	/**/
X
X/* STDSTDIO:
X *	This symbol is defined if this system has a FILE structure declaring
X *	_ptr and _cnt in stdio.h.
X */
X#define	STDSTDIO 	/**/
X
X/* STRUCTCOPY:
X *	This symbol, if defined, indicates that this C compiler knows how
X *	to copy structures.  If undefined, you'll need to use a block copy
X *	routine of some sort instead.
X */
X#define	STRUCTCOPY	/**/
X
X/* HAS_SYMLINK:
X *	This symbol, if defined, indicates that the symlink routine is available
X *	to create symbolic links.
X */
X/*#define	HAS_SYMLINK		/**/
X
X/* HAS_SYSCALL:
X *	This symbol, if defined, indicates that the syscall routine is available
X *	to call arbitrary system calls.  If undefined, that's tough.
X */
X/*#define	HAS_SYSCALL		/**/
X
X/* s_tm:
X *	This symbol is defined if this system declares "struct tm" in
X *	in <sys/time.h> rather than <time.h>.  We can't just say
X *	-I/usr/include/sys because some systems have both time files, and
X *	the -I trick gets the wrong one.
X */
X/* I_SYS_TIME:
X *	This symbol is defined if this system has the file <sys/time.h>.
X */
X/*
X * I_TIME:
X *	This symbol is defined if time this  system has the file <time.h>.
X */
X/*#undef	s_tm 	/**/
X/*#define	I_SYS_TIME 	/**/
X#define I_TIME
X
X/* VARARGS:
X *	This symbol, if defined, indicates to the C program that it should
X *	include varargs.h.
X */
X#define	VARARGS		/**/
X
X/* vfork:
X *	This symbol, if defined, remaps the vfork routine to fork if the
X *	vfork() routine isn't supported here.
X */
X/*#undef	vfork fork	/**/
X
X/* VOIDSIG:
X *	This symbol is defined if this system declares "void (*signal())()" in
X *	signal.h.  The old way was to declare it as "int (*signal())()".  It
X *	is up to the package author to declare things correctly based on the
X *	symbol.
X */
X#define	VOIDSIG 	/**/
X
X/* HAS_VPRINTF:
X *	This symbol, if defined, indicates that the vprintf routine is available
X *	to printf with a pointer to an argument list.  If unavailable, you
X *	may need to write your own, probably in terms of _doprnt().
X */
X/* CHARVSPRINTF:
X *	This symbol is defined if this system has vsprintf() returning type
X *	(char*).  The trend seems to be to declare it as "int vsprintf()".  It
X *	is up to the package author to declare vsprintf correctly based on the
X *	symbol.
X */
X#define	HAS_VPRINTF		/**/
X/*#undef	CHARVSPRINTF 	/**/
X
X/* GIDTYPE:
X *	This symbol has a value like gid_t, int, ushort, or whatever type is
X *	used to declare group ids in the kernel.
X */
X/* TODO */
X#define GIDTYPE int		/**/
X
X/* I_DIRENT:
X *	This symbol, if defined, indicates to the C program that it should
X *	include dirent.h.
X */
X/* DIRNAMLEN:
X *	This symbol, if defined, indicates to the C program that the length
X *	of directory entry names is provided by a d_namlen field.  Otherwise
X *	you need to do strlen() on the d_name field.
X */
X/*#undef	I_DIRENT		/**/
X#define	DIRNAMLEN		/**/
X
X/* I_FCNTL:
X *	This symbol, if defined, indicates to the C program that it should
X *	include fcntl.h.
X */
X/*#define	I_FCNTL		/**/
X
X/* I_GRP:
X *	This symbol, if defined, indicates to the C program that it should
X *	include grp.h.
X */
X/*#define	I_GRP		/**/
X
X/* I_PWD:
X *	This symbol, if defined, indicates to the C program that it should
X *	include pwd.h.
X */
X/* PWQUOTA:
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_quota.
X */
X/* PWAGE:
X *	This symbol, if defined, indicates to the C program that struct passwd
X *	contains pw_age.
X */
X/*#define	I_PWD		/**/
X/*#define	PWQUOTA		/**/
X/*#undef	PWAGE		/**/
X
X/* I_SYS_DIR:
X *	This symbol, if defined, indicates to the C program that it should
X *	include sys/dir.h.
X */
X#define	I_SYS_DIR		/**/
X
X/* I_SYSIOCTL:
X *	This symbol, if defined, indicates that sys/ioctl.h exists and should
X *	be included.
X */
X/*#define	I_SYSIOCTL		/**/
X
X/* I_VARARGS:
X *	This symbol, if defined, indicates to the C program that it should
X *	include varargs.h.
X */
X#define	I_VARARGS		/**/
X
X/* INTSIZE:
X *	This symbol contains the size of an int, so that the C preprocessor
X *	can make decisions based on it.
X */
X#define INTSIZE 2		/**/
X
X/* RANDBITS:
X *	This symbol contains the number of bits of random number the rand()
X *	function produces.  Usual values are 15, 16, and 31.
X */
X#define RANDBITS 31		/**/
X
X/* SIG_NAME:
X *	This symbol contains an list of signal names in order.
X */
X#ifdef OS2
X#define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE",\
X	  /*      0      1     2     3      4      5     6     7    8 */\
X   "KILL","BUS","SEGV","SYS","PIPE","UALRM","TERM","ALRM","USR2","CLD",\
X  /* 9     10     11    12    13     14     15     16     17    18 */\
X   "PWR","USR3","BREAK","ABRT"
X  /*19     20     21    22   */
X#else
X#define SIG_NAME "ZERO","HUP","INT","QUIT","ILL","TRAP","IOT","EMT","FPE","KILL","BUS","SEGV","SYS","PIPE","ALRM","TERM","URG","STOP","TSTP","CONT","CHLD","TTIN","TTOU","IO","XCPU","XFSZ","VTALRM","PROF","WINCH","USR1","USR2"		/**/
X#endif /* OS2 */
X
X/* STDCHAR:
X *	This symbol is defined to be the type of char used in stdio.h.
X *	It has the values "unsigned char" or "char".
X */
X#define STDCHAR char	/**/
X
X/* UIDTYPE:
X *	This symbol has a value like uid_t, int, ushort, or whatever type is
X *	used to declare user ids in the kernel.
X */
X#define UIDTYPE int		/**/
X
X/* VOIDFLAGS:
X *	This symbol indicates how much support of the void type is given by this
X *	compiler.  What various bits mean:
X *
X *	    1 = supports declaration of void
X *	    2 = supports arrays of pointers to functions returning void
X *	    4 = supports comparisons between pointers to void functions and
X *		    addresses of void functions
X *
X *	The package designer should define VOIDUSED to indicate the requirements
X *	of the package.  This can be done either by #defining VOIDUSED before
X *	including config.h, or by defining defvoidused in Myinit.U.  If the
X *	latter approach is taken, only those flags will be tested.  If the
X *	level of void support necessary is not present, defines void to int.
X */
X#ifndef VOIDUSED
X#define VOIDUSED 7
X#endif
X#define VOIDFLAGS 7
X#if (VOIDFLAGS & VOIDUSED) != VOIDUSED
X#define void int		/* is void to be avoided? */
X#define M_VOID		/* Xenix strikes again */
X#endif
X
X/* PRIVLIB:
X *	This symbol contains the name of the private library for this package.
X *	The library is private in the sense that it needn't be in anyone's
X *	execution path, but it should be accessible by the world.  The program
X *	should be prepared to do ^ expansion.
X */
X#define PRIVLIB "c:/bin/perl"		/**/
X
X/*
X * BUGGY_MSC:
X *	This symbol is defined if you are the unfortunate owner of a buggy
X *	Microsoft C compiler and want to use intrinsic functions.  Versions
X *	up to 5.1 are known conform to this definition.
X */
X/*#define BUGGY_MSC			/**/
X
X/*
X * BINARY:
X *	This symbol is defined if you run under an operating system that
X *	distinguishes between binary and text files.  If so the function
X *	setmode will be used to set the file into binary mode.
X */
X#define BINARY
X
X#define S_ISUID 0
X#define S_ISGID 0
X#define CASTNEGFLOAT
!STUFFY!FUNK!
echo Extracting os2/popen.c
sed >os2/popen.c <<'!STUFFY!FUNK!' -e 's/X//'
X/* added real/protect mode branch at runtime and real mode version
X * names changed for perl
X * Kai Uwe Rommel
X */
X
X/*
XSeveral people in the past have asked about having Unix-like pipe
Xcalls in OS/2.  The following source file, adapted from 4.3 BSD Unix,
Xuses a #define to give you a pipe(2) call, and contains function
Xdefinitions for popen(3) and pclose(3).  Anyone with problems should
Xsend mail to me; they seem to work fine.
X
XMark Towfigh
XRacal Interlan, Inc.
X----------------------------------cut-here------------------------------------
X*/
X
X/*
X * The following code segment is derived from BSD 4.3 Unix.  See
X * copyright below.  Any bugs, questions, improvements, or problems
X * should be sent to Mark Towfigh (towfiq@interlan.interlan.com).
X *
X * Racal InterLan Inc.
X */
X
X/*
X * Copyright (c) 1980 Regents of the University of California.
X * All rights reserved.  The Berkeley software License Agreement
X * specifies the terms and conditions for redistribution.
X */
X
X#include <stdio.h>
X#include <stdlib.h>
X#include <io.h>
X#include <string.h>
X#include <process.h>
X#include <errno.h>
X
X#define INCL_NOPM
X#define	INCL_DOS
X#include <os2.h>
X
Xstatic FILE *dos_popen(const char *cmd, const char *flags);
Xstatic int dos_pclose(FILE *pipe);
X
X/*
X * emulate Unix pipe(2) call
X */
X
X#define	tst(a,b)	(*mode == 'r'? (b) : (a))
X#define READH           0
X#define WRITEH          1
X
Xstatic  int       popen_pid[20];
X
XFILE *mypopen(char *cmd, char *mode)
X{
X	int p[2];
X        register myside, hisside, save_stream;
X        char *shell = getenv("COMPSPEC");
X
X        if ( shell == NULL )
X          shell = "C:\\OS2\\CMD.EXE";
X
X        if ( _osmode == DOS_MODE )
X          return dos_popen(cmd, mode);
X
X	if (DosMakePipe((PHFILE) &p[0], (PHFILE) &p[1], 4096) < 0)
X                return NULL;
X
X        myside = tst(p[WRITEH], p[READH]);
X        hisside = tst(p[READH], p[WRITEH]);
X
X	/* set up file descriptors for remote function */
X	save_stream = dup(tst(0, 1));		/* don't lose stdin/out! */
X        if (dup2(hisside, tst(0, 1)) < 0)
X        {
X		perror("dup2");
X		return NULL;
X	}
X        close(hisside);
X
X	/*
X	 * make sure that we can close our side of the pipe, by
X	 * preventing it from being inherited!
X	 */
X
X	/* set no-inheritance flag */
X	DosSetFHandState(myside, OPEN_FLAGS_NOINHERIT);
X
X	/* execute the command:  it will inherit our other file descriptors */
X        popen_pid[myside] = spawnlp(P_NOWAIT, shell, shell, "/C", cmd, NULL);
X
X	/* now restore our previous file descriptors */
X        if (dup2(save_stream, tst(0, 1)) < 0)   /* retrieve stdin/out */
X        {
X		perror("dup2");
X		return NULL;
X	}
X        close(save_stream);
X
X	return fdopen(myside, mode);		/* return a FILE pointer */
X}
X
Xint mypclose(FILE *ptr)
X{
X	register f;
X        int status;
X
X        if ( _osmode == DOS_MODE )
X          return dos_pclose(ptr);
X
X	f = fileno(ptr);
X        fclose(ptr);
X
X	/* wait for process to terminate */
X	cwait(&status, popen_pid[f], WAIT_GRANDCHILD);
X
X	return status;
X}
X
X
Xint pipe(int *filedes)
X{
X  int res;
X
X  if ( res = DosMakePipe((PHFILE) &filedes[0], (PHFILE) &filedes[1], 4096) )
X    return res;
X
X  DosSetFHandState(filedes[0], OPEN_FLAGS_NOINHERIT);
X  DosSetFHandState(filedes[1], OPEN_FLAGS_NOINHERIT);
X  return 0;
X}
X
X
X/* this is the MS-DOS version */
X
Xtypedef enum { unopened = 0, reading, writing } pipemode;
X
Xstatic struct
X{
X    char *name;
X    char *command;
X    pipemode pmode;
X}
Xpipes[_NFILE];
X
Xstatic FILE *dos_popen(const char *command, const char *mode)
X{
X    FILE *current;
X    char name[128];
X    int cur;
X    pipemode curmode;
X
X    /*
X    ** decide on mode.
X    */
X    if(strchr(mode, 'r') != NULL)
X        curmode = reading;
X    else if(strchr(mode, 'w') != NULL)
X        curmode = writing;
X    else
X        return NULL;
X
X    /*
X    ** get a name to use.
X    */
X    strcpy(name, "piXXXXXX");
X    Mktemp(name);
X
X    /*
X    ** If we're reading, just call system to get a file filled with
X    ** output.
X    */
X    if(curmode == reading)
X    {
X        char cmd[256];
X        sprintf(cmd,"%s > %s", command, name);
X        system(cmd);
X
X        if((current = fopen(name, mode)) == NULL)
X            return NULL;
X    }
X    else
X    {
X        if((current = fopen(name, mode)) == NULL)
X            return NULL;
X    }
X
X    cur = fileno(current);
X    pipes[cur].name = strdup(name);
X    pipes[cur].command = strdup(command);
X    pipes[cur].pmode = curmode;
X
X    return current;
X}
X
Xstatic int dos_pclose(FILE * current)
X{
X    int cur = fileno(current), rval;
X    char command[256];
X
X    /*
X    ** check for an open file.
X    */
X    if(pipes[cur].pmode == unopened)
X        return -1;
X
X    if(pipes[cur].pmode == reading)
X    {
X        /*
X        ** input pipes are just files we're done with.
X        */
X        rval = fclose(current);
X        unlink(pipes[cur].name);
X    }
X    else
X    {
X        /*
X        ** output pipes are temporary files we have
X        ** to cram down the throats of programs.
X        */
X        fclose(current);
X        sprintf(command,"%s < %s", pipes[cur].command, pipes[cur].name);
X        rval = system(command);
X        unlink(pipes[cur].name);
X    }
X
X    /*
X    ** clean up current pipe.
X    */
X    free(pipes[cur].name);
X    free(pipes[cur].command);
X    pipes[cur].pmode = unopened;
X
X    return rval;
X}
!STUFFY!FUNK!
echo Extracting h2pl/tcbreak2
sed >h2pl/tcbreak2 <<'!STUFFY!FUNK!' -e 's/X//'
X#!/usr/bin/perl
X
Xrequire 'cbreak2.pl';
X
X&cbreak;
X
X$| = 1;
X
Xprint "gimme a char: ";
X
X$c = getc;
X
Xprint "$c\n";
X
Xprintf "you gave me `%s', which is 0x%02x\n", $c, ord($c);
X
X&cooked;
!STUFFY!FUNK!
echo " "
echo "End of kit 25 (of 36)"
cat /dev/null >kit25isdone
run=''
config=''
for iskit in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36; do
    if test -f kit${iskit}isdone; then
	run="$run $iskit"
    else
	todo="$todo $iskit"
    fi
done
case $todo in
    '')
	echo "You have run all your kits.  Please read README and then type Configure."
	for combo in *:AA; do
	    if test -f "$combo"; then
		realfile=`basename $combo :AA`
		cat $realfile:[A-Z][A-Z] >$realfile
		rm -rf $realfile:[A-Z][A-Z]
	    fi
	done
	rm -rf kit*isdone
	chmod 755 Configure
	;;
    *)  echo "You have run$run."
	echo "You still need to run$todo."
	;;
esac
: Someone might mail this, so...
exit

exit 0 # Just in case...
-- 
Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
Sterling Software, IMD           UUCP:     uunet!sparky!kent
Phone:    (402) 291-8300         FAX:      (402) 291-4362
Please send comp.sources.misc-related mail to kent@uunet.uu.net.
