: Run this shell script with "sh" not "csh"
PATH=:/bin:/usr/bin:/usr/ucb
export PATH
all=FALSE
if [ $1x = -ax ]; then
	all=TRUE
fi
/bin/echo 'Extracting h/formatsbr.h'
sed 's/^X//' <<'//go.sysin dd *' >h/formatsbr.h
X/* formatsbr.h - definitions for fmtscan () */

X/*
 * This structure describes an "interesting" component.  It holds
 * the name & text from the component (if found) and one piece of
 * auxilary info.  The structure for a particular component is located
 * by hashing the name and using it as an index into the ptr array
 * "wantcomp".  All format entries that reference a particular component
 * point to its comp struct (so we only have to do component specific
 * processing once.  e.g., parse an address.).
 */
struct comp {
	char		*c_name;	/* component name (in lower case) */
	struct	comp	*c_next;	/* hash chain linkage */
	char		*c_text;	/* component text (if found) */
	short		c_flags;	/* misc. flags (from formatsbr) */
	short		c_type;		/* type info (from fmtcompile) */
	union {
		struct tws	*c_u_tws;
		struct mailname *c_u_mn;
	} c_un;
#define c_tws c_un.c_u_tws
#define c_mn c_un.c_u_mn
};

X/* c_type bits */
#define	CT_ADDR		1	/* referenced as address */
#define	CT_DATE		2	/* referenced as date */
#define	CT_MYMBOX	4	/* "mymbox" test being done */
#define	CT_ADDRPARSE	8	/* address parse being done */

extern int fmt_norm;

struct	comp	*wantcomp[128];	/* hash table for deciding if a
				 * component is "interesting" */

X/* 
 * Hash function for component name.  The function should be
 * case independent and probably shouldn't involve a routine
 * call.  This function is pretty good but will not work on
 * single character component names.  
 */
#define	CHASH(nm)	(((((nm)[0]) - ((nm)[1])) & 0x1f) + (((nm)[2]) & 0x5f))

#ifdef	GOULD_PN
X/* bug in the Gould PowerNode compiler: need a local pointer to name... */
#define FINDCOMP(comp,name1) \
	{ \
	char *name = (name1); \
	for (comp = wantcomp[CHASH(name)]; \
		comp && strcmp(comp->c_name,name); \
		comp = comp->c_next) ; \
	}
#else
#define FINDCOMP(comp,name) \
		for (comp = wantcomp[CHASH(name)]; \
		     comp && strcmp(comp->c_name,name); \
		     comp = comp->c_next) ;
#endif

X/*
 * This structure defines one formatting instruction.
 */
struct format {
	unsigned char	f_type;
	char		f_fill;
	short		f_width;	/* output field width */
#define f_skip f_width			/* instr to skip (false "if") */
	union {
		struct comp	*f_u_comp;	/* associated component */
		char		*f_u_text;	/* literal text */
		char		f_u_char;	/* literal character */
		int		f_u_value;	/* literal value */
	} f_un;
#define f_comp f_un.f_u_comp
#define f_text f_un.f_u_text
#define f_char f_un.f_u_char
#define f_value f_un.f_u_value
};

int	fmtscan ();
char   *new_fs ();
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 h/formatsbr.h
	/bin/echo -n '	'; /bin/ls -ld h/formatsbr.h
fi
/bin/echo 'Extracting h/mh.h'
sed 's/^X//' <<'//go.sysin dd *' >h/mh.h
X/* mh.h - main header file for all of MH */


X/* Well-used constants */

#define	NOTOK		(-1)	/* syscall()s return this on error */
#define	OK		0	/*  ditto on success */
#define	DONE		1	/* trinary logic */
#define ALL		""
#define NULLCP		((char *) 0)
#define NULLVP		((char **) 0)

#define MAXARGS		1000	/* max arguments to exec */

#define NFOLDERS	 100	/* max folder arguments on command line */

#define	MAXFOLDER	1000	/* message increment */
#define DMAXFOLDER	   4	/* typical number of digits */

#ifndef	BSD42 || BSD41A || VMUNIX || hpux
#define	vfork		fork
#endif	not BSD			/* how sad... */

X/*  */

X/* profile structure */

struct node {
    char   *n_name;		/* key */
    char   *n_field;		/* value */

    char    n_context;		/* context, not profile */

    struct node *n_next;	/* next entry */
};


X/* switches structure */

#define	AMBIGSW		(-2)	/* from smatch() on ambiguous switch */
#define	UNKWNSW		(-1)	/*  ditto on unknown switch */

struct swit {
    char   *sw;
    int     minchars;
};

extern struct swit  anoyes[];	/* standard yes/no switches */


X/* messages structure */

struct msgs {
    int     hghmsg;		/* Highest msg in directory     */
    int     nummsg;		/* Actual Number of msgs        */
    int     lowmsg;		/* Lowest msg number            */
    int     curmsg;		/* Number of current msg if any */

    int     lowsel;		/* Lowest selected msg number   */
    int     hghsel;		/* Highest selected msg number  */
    int     numsel;		/* Number of msgs selected      */

    char   *foldpath;		/* Pathname of folder           */

    char    msgflags;		/* Folder status bits           */
#ifndef	MTR
    char    pad1[sizeof (int) - sizeof (char)];
#endif	not MTR
#define READONLY  0x01		/*     No write access to folder */
#define	SEQMOD	  0x02		/*     folder's sequences modifed */
#define	MHPATH	  0x04		/*     mhpath-style folder handling */
#define	OTHERS	  0x08		/*     folder has other files	*/
#define	MODIFIED  0x10		/*     msh in-core folder modified */
#define	FBITS	"\020\01READONLY\02SEQMOD\03MHPATH\04OTHERS\05MODIFIED"

X/* Note well: msgstats[] is a short, so we have 16 bits to work
	with.  The first 5 are for standard MH message flags,
	this leaves us 11 for user-defined attributes.  Of these,
	1 is reserved for future internal use, so this leaves
	users 10.						*/
#define	NATTRS	10		/* could be 11, see above	*/
    char   *msgattrs[NATTRS + 1];/* folder attributes		*/
    short   attrstats;		/* public=0/private=1		*/
#ifndef	MTR
    char    pad2[sizeof (int) - sizeof (short)];
#endif	not MTR

    int	    lowoff;		/* low element in msgstats[] */
    int	    hghoff;		/* hgh element in msgstats[] */

#ifndef	MTR
    short   msgstats[1];	/* msg status			*/
#else	MTR
    short  *msgbase;		/* msg base			*/
    short  *msgstats;		/* msg status			*/
#endif	MTR
#define EXISTS		0x0001	/*     exists			*/
#define DELETED		0x0002	/*     deleted			*/
#define SELECTED	0x0004	/*     selected for use		*/
#define SELECT_EMPTY	0x0008	/*     mhpath "new"		*/
#define	UNSEEN		0x0010	/*     inc/show "unseen"	*/
#define	FFATTRSLOT	5	/*     user-defined attributes	*/
				/*	first free slot is	*/
				/*	(1 << 5) or 0x20	*/
#define	MBITS	"\020\01EXISTS\02DELETED\03SELECTED\04NEW\05UNSEEN"

#ifndef	MTR
#define	MSIZE(mp,lo,hi)	\
		((unsigned) (sizeof *mp + ((hi) + 2) * sizeof *mp -> msgstats))
#else	MTR
#define	MSIZE(mp,lo,hi)	((unsigned) sizeof *mp)
#define	MSIZEX(mp,lo,hi)	\
		((unsigned) (((hi) - (lo) + 1) * sizeof *mp -> msgstats))
#endif	MTR
};

#define	NULLMP	((struct msgs *) 0)

X/*  */

X/* m_getfld() message parsing */

#define NAMESZ  128		/* Limit on component name size         */

#define LENERR  (-2)		/* Name too long error from getfld      */
#define FMTERR  (-3)		/* Message Format error                 */
#define FLD      0		/* Field returned                       */
#define FLDPLUS  1		/* Field " with more to come            */
#define FLDEOF   2		/* Field " ending at eom                */
#define BODY     3		/* Body  " with more to come            */
#define BODYEOF  4		/* Body  " ending at eom                */
#define FILEEOF  5		/* Reached end of input file            */


X/* Maildrop styles */

#define	MS_DEFAULT	0	/* default (one msg per file) */
#define	MS_UNKNOWN	1	/* type not known yet */
#define	MS_UUCP		2	/* Unix-style "from" lines */
#define	MS_MMDF		3	/* string mmdlm2 */
#define	MS_MSH		4	/* whacko msh */

extern int msg_count;		/* m_getfld() indicators */
extern int msg_style;		/*  .. */
extern char *msg_delim;		/*  .. */


#define	NOUSE	0		/* draft being re-used */

#define TFOLDER 0		/* path() given a +folder */
#define TFILE   1		/* path() given a file */
#define	TSUBCWF	2		/* path() given a @folder */

#ifndef	LINK
#define	LINK	"@"
#endif	not LINK

#ifndef	SBACKUP
#define	SBACKUP	","
#endif	not SBACKUP


#define OUTPUTLINELEN	72	/* default line length for headers */

X/*  */

X/*
 * These standard strings are defined in config.c.  They are the
 * only system-dependent parameters in MH, and thus by redefining
 * their values and reloading the various modules, MH will run
 * on any system.
 */

extern char *components;
extern char *context;
extern char *current;
extern char *defalt;
extern char *digestcomps;
extern char *distcomps;
extern char *draft;
extern char *faceproc;
extern char *fileproc;
extern char *foldprot;
extern char *forwcomps;
extern char *incproc;
extern char *installproc;
extern char *lproc;
extern char *mailproc;
extern char *mh_defaults;
extern char *mh_profile;
extern char *mh_seq;
extern char *mhlformat;
extern char *mhlforward;
extern char *mhlproc;
extern char *moreproc;
extern char *msgprot;
extern char *mshproc;
extern char *nsequence;
extern char *packproc;
extern char *postproc;
extern char *pfolder;
extern char *psequence;
extern char *rcvdistcomps;
extern char *replcomps;
extern char *rmfproc;
extern char *rmmproc;
extern char *sendproc;
extern char *showproc;
extern char *slocalproc;
extern char *sysed;
extern char *usequence;
extern char *version;
extern char *vmhproc;
extern char *whatnowproc;
extern char *whomproc;

X/*  */

X/* global variables -sigh- */

extern char ctxflags;
#define CTXMOD	0x01		/* context information modified */
#define	DBITS	"\020\01CTXMOD"

#ifdef	OVERHEAD
extern int  fd_def;
extern int  fd_ctx;
#endif	OVERHEAD

extern char *invo_name;		/* pgm invocation name */
extern char *mypath;		/* user's $HOME */
extern char *defpath;		/* pathname of user's profile */
extern char *ctxpath;		/* pathname of user's context */

extern struct node *m_defs;

X/*  */

X/* from the MH subroutine library */

char   *add ();
void	adios ();
void	admonish ();
void	advise ();
void	advertise ();
void	ambigsw ();
int     atooi ();
char  **brkstring ();
void	closefds ();
char   *concat ();
char   *copy ();
char  **copyip ();
void	cpydata ();
void	cpydgst ();
void	discard ();
void	done ();
int     fdcompare ();
int     gans ();
char  **getans ();
int	getanswer ();
char   *getcpy ();
void	help ();
char   *libpath ();
int     m_atoi ();
char   *m_backup ();
int     m_convert ();
int     m_delete ();
char   *m_draft ();
void	m_eomsbr ();
int     m_file ();
char   *m_find ();
void	m_fmsg ();
void    m_foil ();
void	m_getdefs ();
int     m_getfld ();
char   *m_getfolder ();
int     m_gmprot ();
struct msgs *m_gmsg ();
char   *m_maildir ();
char   *m_mailpath ();
char   *m_name ();
void	m_readefs ();
struct msgs *m_remsg ();
void	m_replace ();
char   *m_scratch ();
char   *m_seq ();
int	m_seqadd ();
char   *m_seqbits ();
int	m_seqdel ();
int	m_seqflag ();
int	m_seqnew ();
void	m_setcur ();
void	m_setseq ();
void	m_setvis ();
void    m_sync ();
char   *m_tmpfil ();
void	m_unknown ();
void	m_update ();
int	m_whatnow ();
int     makedir ();
char   *path ();
int     peekc ();
int     pidwait ();
#define	pidXwait(id,cp)	pidstatus (pidwait (id, NOTOK), stdout, cp)
int     pidstatus ();
void	printsw ();
void    push ();
int	putenv ();
char   *pwd ();
char   *r1bindex ();
int	refile ();
int	remdir ();
int     showfile ();
int     smatch ();
char   *sprintb();
int	ssequal ();
int	stringdex ();
char   *trimcpy ();
int     type ();
int     uleq ();
int	unputenv ();
int     uprf ();
int	vfgets ();

X/*  */

#include "../h/strings.h"


X/* should be in <stdio.h> */

#ifndef	SYS5
typedef struct _iobuf  *FP;
FP   popen ();
#else	SYS5
#define	FP	FILE*
#endif	SYS5


X/* miscellaneous */

#ifndef	BSD42
#define	rename(f1,f2)	(link (f1, f2) != NOTOK ? unlink (f1) : NOTOK)
#endif	BSD42

#define	setsig(s,f)	if (signal (s, SIG_IGN) != SIG_IGN) \
			    (void) signal (s, f)
#define	setsigx(i,s,f)	if ((i = signal (s, SIG_IGN)) != SIG_IGN) \
			    (void) signal (s, f)

#if	defined(sun) && !defined(NFS)
#define	NFS
#endif

#ifdef	NFS
#define	ruserpass	_ruserpass
#endif
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 h/mh.h
	/bin/echo -n '	'; /bin/ls -ld h/mh.h
fi
/bin/echo 'Extracting conf/examples/gonzo'
sed 's/^X//' <<'//go.sysin dd *' >conf/examples/gonzo
bin	/usr/uci
bboards	on
etc	/usr/uci/lib/mh
mail	.maildrop
manuals	local
mts	mmdf2/smtp
options	BSD42
options	ISI MHE MHRC OVERHEAD UCI WHATNOW
pop	on
popbboards on
options	RPOP
ldoptions -n -s
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 conf/examples/gonzo
	/bin/echo -n '	'; /bin/ls -ld conf/examples/gonzo
fi
/bin/echo 'Extracting conf/tailor/gonzo'
sed 's/^X//' <<'//go.sysin dd *' >conf/tailor/gonzo
localname:	twg.com
mmdfldir:	@(MHDROPATH)
mmdflfil:	@(MHDROPFIL)
uucpldir:
uucplfil:
hostable:	@(MHETCPATH)/hosts
servers:	gonzo.twg.com
popbbuser:	portal
everyone:	100
//go.sysin dd *
made=TRUE
if [ $made = TRUE ]; then
	/bin/chmod 644 conf/tailor/gonzo
	/bin/echo -n '	'; /bin/ls -ld conf/tailor/gonzo
fi
