/*
	packdef.h

	Global defines and storage definitions for use by
	file packing.
        Last modification date: November 13, 1986

*/

/* --------------------------------------------------------------------- */
#include <stdio.h>
#define MAXLINE 82
#define CPMEOF 0x1a
#define TRUE      1
#define FALSE     0
#define ERROR    -1
#define OK        1
#define READ      0
#define WRITE     1
#define UPDATE    2
#define STDIN     0
#define STDOUT    1
#define CRLF      "\r\n"
/* --------------------------------------------------------------------- */

#define HEADER	  "header.bbs"	/* file name */
#define MESSAGES  "messages.bbs"	/* file name */
#define CROSSREF  "crossref.bbs"
#define MSGLOG	  "messages.log"
#define NEWHEADER "Oheader.bbs"
#define NEWXREF   "Ocrossref.bbs"
#define NEWMSG    "Omessages.bbs"
#define NEWLOG    "Omessages.log"
#define LINKH	  "Lhdr.bbs"
#define LINKM     "Lmsg.bbs"
#define LINKC     "Lxrf.bbs"
#define CHMOD     "chmod 666 "
#define CHMOD1	  "*"

/*
#define MSGS      "/user/bbsfiles/msgareas.bbs"
*/

#define	MSGS1	  "msgareas.bbs"

/*
#define ORGPATH   "/user/bbsfiles/"
*/

/*	defines used by the bbscfile.c routine     */

#define MSG1MAX 102		/* max. piece of message to put in 128 */
				/*  byte chunk of msg file */
#define MSGSECT 128		/* size of message sector */

/*			end of defines used by the bbscfile.c routine */

char	ORGPATH[75];
char	MSGS[99];

				/* global variables */
char    portin();		/* in routine returns a character */
char	*gb4sin();		/* returns pointer to character */

FILE	*inbuf ;		/* handy input buffer pointer */
FILE	*otbuf ;		/* another handy buffer pointer */
FILE	*itbuf ;		/* pointer used to read/write user file */
FILE	*rdstatbuf;
FILE	*wtstatbuf;
FILE	*STDerr;

char	w_fname[25];		/* first name on signon */
char	w_lname[25];		/* last  name on signon */
char	w_password[13];		/* password   on signon */
char	*passptr;		/* ptr to password */

				/* define user file fields */
char	u_fname[25];
char	u_lname[25];
char	u_password[13];
char	u_time1[12];		/* first time on system */
char	u_date1[9];		/* first date on system */
char	u_time2[12];		/* last  time on system */
char	u_date2[9];		/* last  date on system */
char	u_city[31];		/* city, state */

char	z_date[9];
				/* define message file fields	*/
char	msg_no[12];		/* message number */
char	msg_date[10];		/* date of message */
char	msg_time[16];		/* time of message */
char	msg_to[22];		/* who message is to */
char	msg_from[22];		/* who message is from */
char	msg_pass[12];		/* password */
char	msg_subject[22];	/* what it's all about */
char	msg_text[7400];		/* text of message 20 lines */
				/*  by 72 wide */
char	msg_delete[3];		/* indicates msg status */
				/*  0 = active */
				/*  9 = deleted */
				/*  5 = active private */
char	pubpriv[2];		/* temporary message type */

char	z_mm[3];
char	z_dd[3];
char	z_yy[3];
char	buf128[384];

int	mon_handle;		/* Monitor Handle */
int	debug;			/* switch for debug mode */
int	offline;		/* switch for offline mode */
int	xpert;			/* switch */
int	toggle;			/* switch for list mode */
int	if_monitor;
int	in_the_buffer;
int	active;			/* indicates if logged on */
int	statcnt;		/* count used for status routines */
int	stop_that;		/* switch - true indicates ctl-K */
				/*  or K received in portout routine */
				/* date/time fields - used by bbsclock.c */
char	mm[3];
char	dd[3];
char	yy[3];
char	month[20];		/* ie. January */
char	day[3];			/* dd */
char	year[5];		/* 19yy */
char	date[30];		/* ie. January 31, 1983 */ 
char	week[20];		/* day of week Monday, Tuesday... */
char	ttime[12];		/* time of day  HH:MM:SS xM */
				/*          where x = A or P */

/*			variables used by the bbscfile.c routine */

char	h_next_msg[10];		/* next avail. message # */
char	h_date[10];		/* last update date of header file */
char	h_act_msg[10];
char	jnk[2];
char	m_pathname[99];
int	lnctx;
int	h_act;
int	h_next;			/* next avail. message # in integer */
long	xtable[1000];
long	ytable[1000];

long	d_pos;
long	old_long_date;
long	new_long_date;
long	xmm;
long	xdd;
long	xyy;

/*			end of variables used by bbscfile.c */

			/* end of globals */

/* end of program */
