/* the following is for the new xmodem file */
#define FANSI
#define SIGCLD SIGCHLD
#define STX 2
#ifdef FANSI
#define XCPROMPT "\033[7m <XC> \033[27m "
#else
#define XCPROMT " XC>"
#endif
#ifdef linux
#define TERMIOS termios
#else
#define TERMIOS termio
#endif
/*	xc.h -- header  file for XC
	This file was generated by configure on {{DATE}} by {{USER}}
	This file uses 4-character tabstops
*/

/* Local preferences and modems */

/*	CAPTFILE
	This is the default name given to the capture buffer in terminal mode (and
	during script processing). You can always reset this while running the
	program.
*/
#define	CAPTFILE "capture.log"	/* Default capture file */

/*	LIBDIR
	This is the default name given to a directory where PHFILE, STARTUP, and
	any XC scripts might be found. XC will search for such files
		1st) in a path in a colon-separated list of directories in
			 XC_PATH, if such an environment variable exists,
		2nd) in the current directory,
		3rd) in your HOME directory, if HOME is an environment variable,
		4th) in LIBDIR.
*/
#define LIBDIR "/usr/local/lib/xc"

/*	PHFILE
	This is the default name given to the dialing directory.
*/
#define PHFILE "phonelist"	/* Default phonelist file */

/*	STARTUP
	This is the default name of the startup script for XC. If this file is
	found it will be executed immediately on XC startup.
*/
#define STARTUP "xc.init"	/* XC Startup Script */

/*	DIALSTR
	A format string to send a telephone number to the modem with the
	appropriate dialing command.
*/
/*#define DIALSTR "AAATDT%s\r"	/* printf format for older Telebits */
/*#define DIALSTR "ATDTi%s\r"	/* printf format for modem TONE dial command */

#ifdef linux
#define DIALSTRT "ATDT"		/* printf format for modem TONE dial command */
#define DIALSTRP "ATDP"		/* printf format for modem PULSE dial command */
#endif

/* DTR_DROPS_CARRIER
	On some (most?) modems, dropping the DTR signal will instruct the modem
	to disconnect the phone line. On most (some?) Unix systems, setting a
	bit/second rate of 0 will drop carrier.

	If either of these conditions do NOT apply to your setup, set this value to
	0 and an alternate hangup function will be used. This alternate function
	sends the modem the ATTEN string, waits a few seconds, and then sends the
	HANGUP string, so check if those are correct for your modem.
*/
#define	DTR_DROPS_CARRIER 1
#if !DTR_DROPS_CARRIER		/* If not, then we need the next two defines */
#define ATTEN "+++"		/* Modem "attention" signal */
#define HANGUP "ATH\r"		/* Modem "hang up" command */
#endif

/* DEBUG
	If this manifest is set to 1, then whenever XC is run within a
	directory that contains a file called "debug.log", XC will append to
	that file a copy of all XC output, whether to the terminal "file" or
	to standard error. This can be useful for debugging scripts, coupled
	with the "debug" script command, which causes the lines of a script
	to be echoed to the terminal as they get executed. Since often such
	output passes up the terminal screen too quickly to read, the
	"debug.log" file provides a hard-copy of the XC session.
	No echoing to a "debug.log" file is done if XC is also capturing
	incoming text to a capture file. If no "debug.log" file exists in the
	current directory, then no such echoing is done regardless of whether
	the DEBUG is here defined as 0 or 1.
*/
#define DEBUG 1
#if DEBUG && !NODEBUG
#define fprintf Fprintf
#define fputc Fputc
#define fputs Fputs
#endif

/* NOSHELL
	Set this to 1 to disallow shell escapes. Both the "!" and "$" mechanisms
	from the XC prompt, and the analogous SHELL and PIPE keywords in scripts,
	silently do nothing. However the standard output of backquoted shell
	commands can still be assigned to a script variable.
*/
/* #define NOSHELL	{{NOSHELL}} */

/* For XC, the following definitions are significant:
	DIDO=0
		This will not include any of the LCK..file code respected by cu/uucp.
	DIDO=2
	DIDO=3
	DIDO=4
		For a Dial-In/Dial-Out port.

		2 is for SCO Xenix 2.2 which uses ungetty.
		3 is for SCO Xenix 2.3 whose getty is effectively a uugetty,
		  for SCO Unix, or for other sites using uugetty.
		4 is for Unix Sys V Release 4
*/
/* Linux DOES NOT define DIDO */
/*#define DIDO	{{DIDO}}*/
#ifdef linux
#define LOCKDIR  "/usr/spool/locks"
#endif

/* Local Unix peculiarities */

/*	STRCHR and STRRCHR vs. INDEX and RINDEX
	Some Berkely and Xenix systems have index() and rindex() which are
	functionally identical to the more standard strchr() and strrchr()
	functions. These two defines should be 0 if your Unix uses index and
	rindex instead of strchr and strrchr.
*/
#define	HAVE_STRCHR 1
#define	HAVE_STRRCHR 1
#if !HAVE_STRCHR
#define	strchr	index
#endif
#if !HAVE_STRRCHR
#define	strrchr	rindex
#endif

/*	DUP2
	dup2() is not included with all versions of Unix. If your implementation
	does not have dup2() (or if you are just not sure), define this as 0 and a
	functional equivalent will be included in the source code.
*/
#define	DUP2 1

/*	STRSTR
	The draft Ansi C standard specifies the "strstr" function to return the
	position of a substring within a string. This is NOT included in many Unix
	systems, so code for this function is included unless you define this as 1.
*/
#define	STRSTR 1
#if !STRSTR
extern char *strstr ();
#endif

/*	MEMSET
	This function is not on earlier implementations of Unix. Define this as 0
	if you don't have it; making it 1 will not include our equivalent code.
*/
#define MEMSET 1

/*	STRDUP
	Again, a function not present on earlier versions of Unix, and again,
	defining this as 0 will thereby include our functional equivalent.
*/
#define STRDUP 1
#if !STRDUP
extern char *strdup ();
#endif

/* If you don't have these typedefs in your /usr/include/sys/types.h, then
   the following should be 0.
*/
#define	HAVE_USHORT 1
#define	HAVE_UNCHAR	1
#define	HAVE_ULONG 1
#define	HAVE_PID_T 1

#if !HAVE_USHORT
typedef unsigned short ushort;
#endif
#if !HAVE_UNCHAR
typedef unsigned char unchar;
#endif
#if !HAVE_ULONG
typedef unsigned long ulong;
#endif
#if !HAVE_PID_T
typedef short pid_t;
#endif


/* The reader is kindly invited to leave the rest of this just as it is! */

#define SOH		0x1	/* ^A */
#define ETX		0x3	/* ^C */
#define EOT		0x4	/* ^D */
#define ENQ		0x5	/* ^E */
#define ACK		0x6	/* ^F */
#define DLE		0x10	/* ^P */
#define XON		0x11	/* ^Q */
#define XOFF	0x13		/* ^S */
#define NAK	 	0x15	/* ^U */
#define CAN		0x18	/* ^X */

#ifndef TRUE
#define TRUE	1
#define FALSE	0
#endif
#define SUCCESS	1
#define FAILURE	0

#define NEWMODE	0
#define SIGMODE	1
#define OLDMODE	2

#ifdef toupper
#undef toupper
#undef tolower
#endif

#define SM_BUFF	 256
#define LG_BUFF 2048
#define S		show(1,Msg)
#define S0(x)	show(0,x)
#define S1(x)	show(1,x)
#define S2(x)	show(2,x)

/*	I prefer this NIL macro to present a NIL pointer than most other
	variations that I have seen (eg, NULL, 0, or (cast) 0.
	Comme ci, comme ca. - larry gensch
*/
#ifndef NIL
#define	NIL(type)	(type *) 0
#endif

/* globals in three or more files */

extern int CO, LI, my_escape, beep (), hangup (), show_bindings (), cbaud;
extern short capture, cismode, flowflag, linkflag, reterm;
extern char captfile[], ddsname[], phonefile[], *mport (), word[], *wptr,
  line[], Msg[], *lptr, Name[], *getenv (), *unctrl (), protocol[];
extern unsigned mrate (), sleep ();
extern unchar BS, LK;
extern ushort getuid (), getgid (), geteuid (), getegid ();
extern void cls (), cur_on (), cur_off (), default_bindings (), do_script (),
  drawline (), exit (), free (), getline (), getword (), mode (), lc_word (),
  msecs (), purge (), send_mbyte (), send_string (), sendbyte (), show (),
  show_abort (), ttgoto (), xc_setflow ();
extern FILE *tfp,		/* the local terminal */
 *openfile (), *QueryCreate ();
extern struct TERMIOS oldmode, newmode, sigmode;

typedef enum
  {
    ENDCHAR = 256,		/* Higher than any valid keyboard code */
    CAPTYES,
    CAPTEND,
    DIVCHAR,
    DIALCHR,
    HUPCHAR,
    SCRPCHR,
    BRKCHAR,
    HLPCHAR,
    QUITCHR,
    EMITSTR,
    DOSCRPT,
#ifdef linux
    CLRGRAF,			/* turn off vt102 graphics */
#endif
    BADFUNC = 0
  } bindfunc_t;
