case $CONFIG in
'')
    if test ! -f config.sh; then
	ln ../config.sh . || \
	ln ../../config.sh . || \
	ln ../../../config.sh . || \
	(echo "Can't find config.sh."; exit 1)
	echo "Using config.sh from above..."
    fi
    . ./config.sh
    ;;
esac
echo "Extracting config.h (with variable substitutions)"
sed <<!GROK!THIS! >config.h -e 's!^#undef!/\*#undef!'
/* config.h
 * This file was produced by running the config.h.SH script, which
 * gets its values from config.sh, which is generally produced by
 * running Configure.
 *
 * Feel free to modify any of this as the need arises.  Note, however,
 * that running config.h.SH again will wipe out any changes you've made.
 * For a more permanent change edit config.sh and rerun config.h.SH.
 */


/* EUNICE:
 *	This symbol, if defined, indicates that the program is being compiled
 *	under the EUNICE package under VMS.  The program will need to handle
 *	things like files that don't go away the first time you unlink them,
 *	due to version numbering.  It will also need to compensate for lack
 *	of a respectable link() command.
 */
/* VMS:
 *	This symbol, if defined, indicates that the program is running under
 *	VMS.  It is currently only set in conjunction with the EUNICE symbol.
 */
#$d_eunice	EUNICE		/**/
#$d_eunice	VMS		/**/

/* BCOPY:
 *	This symbol, if defined, indicates that the bcopy routine is available
 *	to copy blocks of memory.  Otherwise you should probably use memcpy().
 */
#$d_bcopy	BCOPY		/**/

/* CHARSPRINTF:
 *	This symbol is defined if this system declares "char *sprintf()" in
 *	stdio.h.  The trend seems to be to declare it as "int sprintf()".  It
 *	is up to the package author to declare sprintf correctly based on the
 *	symbol.
 */
#$d_charsprf	CHARSPRINTF 	/**/

/* index:
 *	This preprocessor symbol is defined, along with rindex, if the system
 *	uses the strchr and strrchr routines instead.
 */
/* rindex:
 *	This preprocessor symbol is defined, along with index, if the system
 *	uses the strchr and strrchr routines instead.
 */
#$d_index	index strchr	/* cultural */
#$d_index	rindex strrchr	/*  differences? */

/* MEMCPY:
 *	This symbol, if defined, indicates that the memcpy routine is available
 *	to copy blocks of memory.  Otherwise you should probably use bcopy().
 *	If neither is defined, roll your own.
 */
#$d_memcpy	MEMCPY		/**/

/* CPPSTDIN:
 *	This symbol contains the first part of the string which will invoke
 *	the C preprocessor on the standard input and produce to standard
 *	output.	 Typical value of "cc -E" or "/lib/cpp".
 */
/* CPPMINUS:
 *	This symbol contains the second part of the string which will invoke
 *	the C preprocessor on the standard input and produce to standard
 *	output.  This symbol will have the value "-" if CPPSTDIN needs a minus
 *	to specify standard input, otherwise the value is "".
 */
#define CPPSTDIN "$cppstdin"
#define CPPMINUS "$cppminus"

/* REREAD
 * This variable indicates that the function "read" is normally restarted 
 * when the process receives an interrupt (like SIGINT). This is the
 * default behaviour on e.g. BSD4.3 and SUN OS 3.5.
 */
#$d_reread REREAD		/**/

/* TERMIO:
 *	This symbol, if defined, indicates that the program should include
 *	termio.h rather than sgtty.h.  There are also differences in the
 *	ioctl() calls that depend on the value of this symbol.
 */
/* SYSTERMIO:
 * This variable, if defined, indicates that the termio header files
 * are in "/usr/include/sys" rather than in "/usr/include".
 */
#$d_termio	TERMIO		/**/
#$systermio	SYSTERMIO		/**/

/* look4char
 * This variable indicates how a program may look whether characters
 * are available from a terminal.
 * Unfortunately the ways to do this differ; some but not all may be available
 * on a given system, but there may even be some performance differences.
 * Each way is tagged with a name. If look4char contains this name,
 * the corresponding way to look for characters is used.
 * The ways and names are:
 * USE_SELECT : the system call "select" (man section 2) is available and
 *			works. This is usually the case on 4BSD derived systems like
 *			43BSD, SunOS 3.5.
 *			There are some systems like SIEMENS MX2 SINIX 2.1 that have
 *			"select" but it does not work on terminals.
 *			Expected return values:
 *				 0 : no characters available, timeout
 *				-1 : some error occured, e.g. intr, error number in errno.
 *			  else : (1 << fd) : filedescriptor for which stuff is available
 * USE_RDCHK : the system has the routine "rdchk".	This is usually the
 *			case on SYS III derived systems.
 *			It is called as "ret = rdchk(fd)" and returns
 *			-1 : error, 0 : no char available, 1 : char available
 * USE_FIONREAD: there is an ioctl with parameter "FIONREAD" which returns the
 *			number of characters available from a given filedescriptor.
 *			It is called as "ret = ioctl(fd, FIONREAD, &num)" where "ret",
 *			"num" and "fd" are integers.
 *			The numbers of available characters is returned in "num".
 *			This is usually the case on 4BSD systems. On some systems both
 *			"rdchk" and "FIONREAD" are available (SINIX 2.1), on some both
 *			"select" and "FIONREAD" are possible (BSD), use "select".
 */
#define USE_SELECT		1
#define USE_RDCHK		2
#define USE_FIONREAD		3
#define LOOK4CHAR	$look4char

/* wait4char
 * This variable indicates how a program may wait until either characters
 * are available from a terminal or a specified amount of time has elapsed.
 * Unfortunately the ways to do this differ; some but not all may be available
 * on a given system, but there may even be some performance differences.
 * Each way is tagged with a name. If wait4char contains this name,
 * the corresponding way to wait for characters is used.
 * The ways and names are:
 * USE_SELECT : the system call "select" (man section 2) is available and
 *			works. This is usually the case on 4BSD derived systems like
 *			43BSD, SunOS 3.5.
 *			There are some systems like SIEMENS MX2 SINIX 2.1 that have
 *			"select" but it does not work on terminals.
 *			Expected return values:
 *				 0 : no characters available, timeout
 *				-1 : some error occured, e.g. intr, error number in errno.
 *			  else : (1 << fd) : filedescriptor for which stuff is available
 *			Advantage: the program does not spend time.
 *			Disadvantage: on some machines, like on a VAX 11/780 running
 *				4.3BSD, the clock is not very accurate.
 * USE_RDCHK : the system has the routine "rdchk".	This is usually the
 *			case on SYS III derived systems.
 *			It is called as "ret = rdchk(fd)" and returns
 *			-1 : error, 0 : no char available, 1 : char available
 *			Advantage: quite accurate, even on loaded systems.
 *			Disadvantage: spends time looping and looking repeatedly.
 */
#define WAIT4CHAR	$wait4char

!GROK!THIS!
