STRUCTC.101

56.8 KB 168e8f2080cb2b69…
/********************************************************************
 * EzyCom structures converted to C format
 * by Colin Berg (Fido 3:635/500)
 * last updated : 12/Feb/1992
 *              : 09/May/1992 (for use with Ezycom v1.01)
 *
 * These structures may ONLY be used in accordance with those
 * agreements laid out in the Official Ezycom Structures.
 * Colin Berg and Peter Davies take no responsibility whatsoever
 * for the correctness of these structures.
 *
 * The following programs are currently in development.
 * Check with Colin Berg at Fido 3:635/500 for further information.
 *
 * ECDOOR v1.00 : Fully functional door developers lib in C (Turbo/Borland).
 *              : Other formats as soon as I can afford the languages.
 *
 * ECTICK v1.00 : An EzyCom Specific Tick/Hatch "compatible" utility.
 *              : Provides all the functionality of Tick, Hatch, Raid,
 *              : Inter, & Ticket in the one utility suite.
 *
 * ECOMS  v1.00 : An EzyCom offline Mail Packer/Tosser and Reader System.
 *
 * EZYUP  v1.00 : A Standalone Sysop File Upload Utility.
 *
 * ECHARD v1.00 : Utility to Print Hardcopy of ALL EzyCom Config Files.
 *
 * ECCOS  v1.00 : Co-Sysop Maintenance Door.
 *
 * ECBBS  v1.00 : BBS List Door.
 ********************************************************************/

#define  EZYVER     "1.01"
#define  PRODNAME   "Ezycom"
#define  COPYRIGHT  "Peter Davies"
#define  EZYVERHI     1
#define  EZYVERLO    01
#define  MAXFREE    685
#define  USERFREE    35
#define  MAXNODES   128
#define  MAXAKA      16
#define  MAXMESS    400
#define  MAXMESSALL 500
#define  MAXFILES   400

/****** Take Note ********************************************************
Boolean can be defined as a Char value under C or as an enum with a
true/false value under C++ (if compiled with enum to char switch)
WARNING: Make sure that you don't have another header which defines Boolean
**************************************************************************/
/* typedef char Boolean; */

/* The following can also be defined as enum under C++ */
typedef char AskType;          /* 0=yes, 1=no, 2=ask */
typedef char PhoneType;        /* 0=business, 1=data, 2=nophone */
typedef char MsgType;          /* 0=localmail, 1=netmail, 2=echomail, 3=passthru, 4=waitthru, 5=allmail */
typedef char MsgKindsType;     /* 0=public, 1=private, 2=private or public */
typedef char ShowFileSizeType; /* 0=nosize, 1=size in bytes, 2=size in kbytes */

/* Swapping Types : 0=None, 1=Ems, 2=Xms, 3=Disk, 4=EmsXms, 5=XmsEms */

typedef unsigned char MaxStr[256];
typedef unsigned char UserString[36];
typedef unsigned char Date[9];
/* typedef unsigned char Str3[4]; */
/* typedef unsigned char Str8[9]; */
/* typedef unsigned char Str30[31]; */
typedef unsigned char File8[9];
typedef unsigned char FlagType[4];
typedef unsigned char PathString[61];

/*************************************************************************
 * Datetime record as defined under Turbo Pascal
 *************************************************************************/
typedef struct DATETIME
{
    unsigned int year,
                 month,
                 day,
                 hour,
                 min,
                 sec;
}DATETIME;

typedef struct DATERECORD
{
    unsigned int  year;
    unsigned char month,
                  day;
}DATERECORD;

typedef struct SECURITYRECORD
{
    unsigned int  security;
    FlagType      onflags;
    FlagType      offflags;
}SECURITYRECORD;

typedef struct NETRECORD
{
    unsigned int  zone,
                  net,
                  node,
                  point;
}NETRECORD;

/********************************************************************
 * USERS.BBS record structure
 *
 *     attribute bit 0 : deleted
 *               bit 1 : clear screen
 *               bit 2 : more prompt
 *               bit 3 : ansi capable
 *               bit 4 : don't kill user
 *               bit 5 : file points ignore
 *               bit 6 : full screen ed
 *               bit 7 : quiet mode
 *
 *    attribute2 bit 0 : ignore file ratios
 *               bit 1 : extended ibm characters
 *               bit 2 : on = mmddyy off = ddmmyy
 *               bit 3 : ignore paging hours
 *               bit 4 : exclude user
 *               bit 5 : avatar capable
 *               bit 6 : ignore menu time restrictions
 *               bit 7 : ignore message ratios
 *
 *    attribute3 bit 0 : do not sound page
 *                   1 : page on logon
 *                   2 : hold mailbox
 *                3..7 : Reserved
 *
 *    attribute4 bit 0..7 reserved
 ********************************************************************/
typedef struct USERSRECORD
{
    UserString    name,                   /* Users Name */
                  alias;                  /* Users Alias */
    unsigned char password[16];           /* Users Password */
    unsigned int  security;               /* Users SecLvl */
    unsigned char attribute,              /* See Type Comment */
                  attribute2,             /* See Type Comment */
                  attribute3,             /* See Type Comment */
                  attribute4;             /* See Type Comment */
    FlagType      flags;                  /* Users Access Flags */
    unsigned char dataphone[15],          /* Users Data Phone No: */
                  voicephone[15];         /* Users Voice Phone No: */
} USERSRECORD;


/********************************************************************
 * USERSEXT.BBS record structure
 *
 * colour?_? : To retrieve the first colour  " && 15 "
 *             To retrieve the second colour " >> 4  "
 ********************************************************************/
typedef struct USERSEXTRARECORD
{
    unsigned char location[26];              /* Users Location */
    long int      lasttimedate;              /* (Dos packed) Last Login Date Time */
    unsigned int  credit,                    /* Netmail Credit */
                  pending;                   /* Netmail Points Pending */
    unsigned int  msgsposted,                /* Msgs posted */
                  nocalls,                   /* Times Called */
                  uploads,                   /* Users Uploads (Files) */
                  todayk,                    /* K's Downloaded today */
                  timeused,                  /* Time Used today */
                  downloads;                 /* Users Downloads (Files) */
    long int      uploadsk,                  /* Kilobytes Uploaded */
                  downloadsk;                /* Kilobytes Downloaded */
    unsigned char screenlength,              /* Users Screen Length */
                  lastpwdchange;             /* Logons since password last changed */
    unsigned int  timebanked,                /* Time banked by user */
                  ksbanked,                  /* Kilobytes banked by user */
                  filepoints;                /* Filepoints remaining */
    unsigned char qwkcompression,            /* QWK Compression Type */
                  qwkdaysold;                /* QWK Days old to pack mail */
    unsigned char comment[41];               /* Sysops comment about user */
    unsigned char colour1_2,                 /* Message\File area colors */
                  colour3_4,                 /* Message\File area colors */
                  colour5_6,                 /* Message\File area colors */
                  colour7_8,                 /* Message\File area colors */
                  bkcolour;                  /* Message\File area colors */
    unsigned char sessionfailures;           /* Number of Session Failures */
    Str8          topmenu;                   /* Name of Top Menu to show to user */
    unsigned int  filepointsgiven;           /* File Points given since last session */
    DATERECORD    dateofbirth;               /* Users date of birth */
    unsigned char groups[4];                 /* Currently unused */
    unsigned int  regodate,                  /* Users Registration date */
                  firstdate,                 /* Date of first logon */
                  lastfiledate;              /* Date of last New files listing */
    char          defprotocol;               /* Blank = NO protocol defined */
    unsigned int  timeleft;                  /* Users time left today */
    unsigned int  filearea;                  /* Last file area accessed by user */
    unsigned int  messarea;                  /* Last message area access by user */
    long int      usernumbermsb,             /* Unique user number MSB */
                  usernumberlsb;             /* Unique user number LSB */
    long int      qwkmaxmsgs;                /* Maximum Msgs for QWK Pkt */
    unsigned char qwkmaxmsgsperarea;         /* Maximum Msgs per area */
    char          extraspace[USERFREE];      /* For future expansion */
} USERSEXTRARECORD;

/********************************************************************
 * LASTCOMB.BBS record structure
 * This file grows and shrinks for EACH User depending on the
 * number of message areas defined in the configuration
 ********************************************************************/
typedef struct USERSLASTRECORD
{
    unsigned int  combinedinfo;
    unsigned int  lastreadinfo[16];
} USERSLASTRECORD;

/********************************************************************
 * *.MNU record structure
 *
 * attribute bit 0 : test ratio kb's
 *           bit 1 : test message/call ratio
 *           bit 2 : test age <config age> and over
 *           bit 3 : test ratio files
 *            4..7 : [ reserved ]
 ********************************************************************/
typedef struct MNURECORD
{
    unsigned char typ;              /* Menu option number */
    unsigned int  security;         /* SecLvl required to access option */
    FlagType      flags;            /* Flags required to access option */
    unsigned char display[91];      /* String to display to user, ";" = no display */
    char          hotkey;           /* Ctrl-A means Automatic Option */
    unsigned char miscdata[91];     /* Misc data field */
    unsigned char foreground,       /* Display foreground color */
                  background;       /* Display background color */
    unsigned char timeonline;       /* Minutes before user can access option */
    unsigned int  timestart;        /* Time for option to become active */
    unsigned int  timeend;          /* Time option is no longer active */
    unsigned char attribute;        /* See Type Comment */
    unsigned char node;             /* Nodes which can access option (0=All) */
} MNURECORD;

/********************************************************************
 * PROTOCOL.EZY record structure
 *
 * attribute bit 0 : enable/disable
 *           bit 1 : batch protocol
 *           bit 2 : [ reserved ]
 *           bit 3 : both directions
 *           bit 4 : up/down
 *           bit 5 : bidirectional (ONLY Works on Uploads)
 *            6..7 : [ reserved ]
 ********************************************************************/
typedef struct PROTOCOLRECORD
{
    unsigned char name[16];                /* Protocol name to be displayed */
    char          activekey;               /* Hotkey which selects protocol */
    unsigned char attribute;               /* See Type Comments */
    PathString    logfilename,             /* eg: Dsz logfile */
                  ctlfilename,             /* Protocol control file name */
                  dnctlstring;             /* String used by prot to indicate batch list */
    unsigned char dncmdstring[101],        /* Download command string */
                  upcmdstring[101];        /* Upload command string */
    unsigned char uplogkeyword[11],        /* Upload Key in Log */
                  dnlogkeyword[11],        /* Download Key in Log */
                  uperrkeyword[11],        /* Upload Error Key in Log */
                  dnerrkeyword[11],        /* Download Error Key in Log */
                  uperr2keyword[11],       /**/
                  dnerr2keyword[11];       /**/
    unsigned char xfernamewordnum,         /**/
                  xfercpswordnum;          /**/
    unsigned int  security;                /* SecLvl required to use this protocol */
    FlagType      flags;                   /* Flags required to use this protocol */
    unsigned char efficiency;              /* Protocols efficiency percentage */
} PROTOCOLRECORD;

/********************************************************************
 * CONFIG.<EZY or NODE> structure
 *
 * unknownarea = 0 - kill messages
 *               1 - make a new echomail area
 *               2 - make a new passthru area
 *
 * tossattr2 = bit 0 - [ reserved ]
 *                 1 - [ reserved ]
 *                 2 - kill bad archives
 *                 3 - arcmail 0.6 compat
 *
 * autodetect = bit 0 - Auto Detect Ansi
 *                  1 - Ansi Detect for New User
 *                  2 - Auto Detect Emsi
 *                  3 - auto detect emsi & for newuser
 *
 * tossattr = bit 0 : [reserved]
 *                1 : [reserved]
 *                2 : [reserved]
 *                3 : dupe detection
 *                4 : delete netmail on import
 *                5 : keep echoarea node receipts
 *                6 : allow message rescan
 *                7 : [reserved]
 *
 * multitasker = 0 = do not detect or use any multitasker
 *               1 = auto-detect
 *               2 = desqview (or compatiable)
 *               3 = double dos
 *               4 = OS.2
 *               5 = multidos plus
 *               6 = Taskview
 *               7 = Topview
 *               8 = PC MOS
 *               9..255 [reserved]
 *
 * printerport = 0 = LPT1
 *               1 = LPT2
 *               2 = LPT3
 *               3 = COM1
 *               4 = COM2
 *               5 = COM3
 *               6 = COM4
 ********************************************************************/
typedef struct CONFIGRECORD
{
    unsigned char ezyver[9];              /* Ezycom Version Number */
    unsigned char bbsname[41];            /* Your BBS's Name */
    UserString    sysopname;              /* Sysops Name */
    PathString    logpath,                /* Path to system logfile */
                  textpath,               /* Path to textfiles, *.Ans */
                  menupath,               /* Path to *.Mnu files */
                  mnurampath,             /* Path to *.Mnu area 2 */
                  netmailpath,            /* Path to Netmail directory */
                  nodelistpath,           /* Path to Nodelist files */
                  msgpath,                /* Path to Message area datafiles */
                  filepath,               /* Path to File area datafiles */
                  editorpath,             /**/
                  bipath,                 /* Path to BiModem directory */
                  temppath,               /* Path to Temp processing directory */
                  userbasepath,           /* Path to Userbase files */
                  avatarpath,             /* Path to *.Avt files */
                  ascpath,                /* Path to *.Asc files */
                  asclowpath,             /* Path to *.Asl files */
                  filemaint,              /* Path to Maint*.* files */
                  fileattachpath,         /* Currently unused */
                  soundpath,              /* Path to *.Voc files */
                  fastindexpath;          /* Path to Fast File Index database */

    unsigned char systempwd[16],          /* Pwd to logon system */
                  sysoppwd[16],           /* Pwd to sysop functions */
                  newuserpwd[16];         /* Pwd for new user */
    Str8          newtopmenu;             /* Top menu to show new users */
    unsigned char freespace1[4];          /* Currently unused */

    PathString    inboundmail,            /* Path to Inbound network bundles */
                  outboundmail,           /* Path to store Outbound mail bundles */
                  uploadpath,             /* Path to Temp Upload directory */
                  swapfile,               /* Path to store swap files */
                  multipath;              /* Path to Multiline System directory */
    unsigned char brackets[3];            /* Brackets used to enclose files count */
    unsigned char inactivitytime,         /* Max user inactivity time */
                  minmesscheck,           /**/
                  maxlogintime;           /* Max time allowed to complete a logon */
             char multiline;              /* (B) Is this a multinode system */
    unsigned char answerdelay;            /* Time to delay before modem answers */
             char shellswap,              /* (B) */
                  highbit,                /* (B) Are Hibit chars allowed */
                  disppass,               /* (B) Display users Pwd to sysop at logon */
                  asklocalpass,           /* (B) Ask for Pwd when local login */
                  fastlogon,              /* (B) Use fast logins when local */
                  sysopremote,            /* (B) Allow sysop to logon from remote */
                  printerlog,             /* (B) Log activity to printer */
                  phone1ask,              /* (B) */
                  colourask,              /* (B) New user color setup */
                  aliasask,               /* (B) New user ask alias */
                  dobask,                 /* (B) New user DOB ask */
                  phoneforce,             /* (B) Force phone number format */
                  direct_video,           /* (B) Use direct video writes */
                  snow_check;             /* (B) Check for snow */
    unsigned char swaponezymail;          /* (B) Swap out for ezymail */
    unsigned char screen_blank;           /* (B) Screen Blanking */
             char oneword;                /* (B) Are one word names allowed */
    AskType       checkmail,              /* Check mail at login */
                  checkfile,              /* Check New files at login */
                  ansiask,                /* New user ansii option */
                  fullscreenask,          /* New user FSE option */
                  clearask,               /* New user clearscreen */
                  moreask,                /* New user more prompt */
                  avatarask,              /* New user avatar option */
                  extendask,              /**/
                  usdateask;              /**/
    unsigned char phone2ask;              /* (B) Phone 2 ask */
    unsigned char phoneformat[15];        /* Phone number format */
    unsigned char nameprompt[61],         /* Displayed when user asked Name */
                  pwdprompt[61],          /* Displayed when user asked Password */
                  shellprompt[61],        /* Displayed when system shells */
                  shell2prompt[61],       /* Displayed when system returns from shell */
                  enterprompt[61],        /* Displayed when user is required to press enter */
                  chatprompt[61],         /**/
                  listprompt[61],         /**/
                  graphicprompt[61],      /* Displayed when user asked if IBM Graphics supported */
                  fseprompt[61],          /* Displayed when user asked if FSE required */
                  moreprompt[61],         /* Displayed when user asked if More prompt required */
                  waitphone[61],          /**/
                  chat2prompt[61],        /**/
                  screenlengthprompt[61], /* Displayed when user asked Screen length */
                  screenclearprompt[61],  /* Displayed when user asked if Screenclearing required */
                  locationprompt[61],     /* Displayed when user asked for Location */
                  userscanprompt[61],     /**/
                  loadprompt[61],         /* Displayed when Door is being loaded */
                  avatarprompt[61],       /* Displayed when user asked if Avatar */
                  aliasprompt[61];        /* Displayed when user asked for Alias */
    unsigned int  security,               /**/
                  logonsecurity;          /**/
    FlagType      flags;                  /**/
    unsigned char minpasslength,          /* Minimum user Pwd length */
                  dispfwind,              /**/
                  dispbwind,              /**/
                  disppopupf,             /* Popup Forground */
                  disppopupborder,        /* Popup Border */
                  disppopupb,             /* Popup Background */
                  dispf,                  /**/
                  newusercol1,            /**/
                  comport,                /* Serial port to be used */
                  passlogons;             /* Times user can logon before forced Pwd change */
             char doblogon;               /* (B) */
    unsigned char printerport,            /* Printer port to be used */
                  passtries;              /* Max attempts to enter Pwd */
    unsigned char topmenu[9];             /* Name of First menu user shown */
    unsigned int  maxtimebank,            /* Max time that user can bank */
                  maxksbank,              /* Max kilobytes user can bank */
                  watchmess,              /* Securrity watchdog message area */
                  netmailcredit,          /* New user netmail credit */
                  ansiminbaud,            /* Min baudrate for ansi use */
                  fileminbaud,            /* Min baudrate to access file areas */
                  slowbaud,               /**/
                  minloginbaud;           /* Min baudrate allowed for login */
    unsigned int  lowsecuritystart,       /**/
                  lowsecurityend,         /**/
                  slowstart,              /**/
                  slowend;                /**/
    unsigned char quotestring[6];         /* Used by editor when quoting a message */
    unsigned char unknownarea;            /**/
    unsigned char SBIrq;                  /* Soundblaster IRQ location */
    unsigned int  forcecrashmail,         /**/
                  optioncrashmail,        /**/
                  netmailfileattach;      /**/
    unsigned char popuphighlight;         /**/
    unsigned char tossattr2;              /**/
    unsigned char maxpages,               /* Max time user can page sysop */
                  maxpagefiles,           /* Number of page files for random selection */
                  pagelength;             /* Max length of page */
    unsigned int  pagestart[7];           /* 0 .. 6 */
    unsigned int  pagemessboard,          /* Message board for paging, 0=Not in use */
                  localfattachsec,        /**/
                  sectouploadmess,        /**/
                  sectoupdateusers,       /**/
                  readsecnewecho,         /**/
                  writesecnewecho,        /**/
                  sysopsecnewecho,        /**/
                  secreplyvianetmail;     /**/
    AskType       netmailkillsent;        /**/
             char swaponarchive;          /* (B) */
    unsigned char freespace2[9];          /**/
    unsigned char popuptext;              /**/
    unsigned int  pageend[7];             /**/
             char newareagroup[16];       /* 1 .. 16 */
        long int  freespace3;             /**/
    unsigned int  badmsgboard,            /* Area bad messages tossed */
                  incomingcallstart,      /* */
                  incomingcallend;        /* */
    unsigned int  SBhex;                  /* Soundblaster Hex Address */
    unsigned char altf[10][61];           /* Sysop defined function keys */
    unsigned char ctrlf[10][41];          /* Sysop defined function keys */
    unsigned int  maxmess,                /* Max number of message areas */
                  maxfile,                /* Max number of file areas */
                  fp_credit;              /**/
    unsigned char ks_per_fp,              /**/
                  fp_upload,              /**/
                  rego_warn_1,            /**/
                  rego_warn_2;            /**/
    unsigned int  badpwdmsgboard;         /* Bad Logon Msg Board To Sysop */
    unsigned int  min_space_1;            /**/
             char swapbimodem,            /* (B) */
                  modembusy,              /* Toggle DTR or ATH1 */
                  scrheight;              /* (B) 25/43/50 line modes */
    unsigned char msgtmptype;             /* (B) True=Msgtmp, False=Msgtmp.<Node> */
             char swapupload;             /* (B) */
             char phonelogon,             /**/
                  mailcheckfast;          /* (B) Fast mail checks */
    unsigned char freespace6;             /**/
    unsigned char max_descrip;            /* Max file description length */
    unsigned char min_descrip;            /* Min file description length */
    unsigned int  requestreceipt;         /* */
             char ushowdate;              /* (B) Show filedate in User filelist */
    ShowFileSizeType ufilesizek;          /**/
             char uuploader,              /* (B) Show uploaders name in user filelist */
                  udownloadcount,         /* (B) Show times downloaded in user filelist */
                  freespace11,            /* current unused */
                  ushowsecurity,          /* (B) Show if file secured in user filelist */
                  sshowdate;              /* (B) Show filedate in Sysop filelist */
    ShowFileSizeType sfilesizek;          /**/
             char suploader,              /* (B) Show uploader name in Sysop filelist */
                  sdownloadcount,         /* (B) Show times downloaded in Sysop filelist */
                  freespace10,            /* currently unused */
                  sshowsecurity,          /* (B) Show if file secured in sysop filelist */
                  ushowtime,              /* (B) Show time required to download in user filelist */
                  ushowfp,                /* (B) Show filepoints in user filelist */
                  sshowtime,              /* (B) Show time required to download in sysop filelist */
                  sshowfp;                /* (B) Show filepoints in sysop filelist */
    unsigned int  fp_percent;             /**/
    unsigned char autodetect;             /**/
             char dispsecurityfile,       /* (B) */
                  askforpagereason,       /* (B) Ask user for page reason */
                  delincompletefiles,     /* (B) Delete incomplete uploads */
                  externalconvert,        /* (B) */
                  swaponfeditview;        /* */
    char          freespace13,            /* current unused */
                  secfileschar,           /* Char used to indicate Secured file in listings */
                  passchar,               /* Char used to indicate file passworded */
                  highbitchar;            /* Char to be used in Hibit replacement */
    unsigned char conversiononmaster;     /* Currently Unused */
    unsigned char leftbracket[2];         /**/
    unsigned char rightbracket[2];        /**/
    unsigned int  ignorefp;               /* (B) */
    unsigned char menuminage;             /* Minimum age for Age Check options */
             char killnullnetmail;        /* (B) */
    unsigned int  modemeff[11];           /**/
    unsigned int  modembaud[11];          /**/
    unsigned char modemconnect[11][16];   /**/
    unsigned char modemerr[11];           /**/
    unsigned char tossattr;               /**/
    unsigned char usercol1_2,             /**/
                  usercol3_4,             /**/
                  usercol5_6,             /**/
                  usercol7_8;             /**/
    unsigned char userbkcol;              /**/
    unsigned char newusercol2;            /**/
    unsigned char chstatcol;              /**/
    unsigned char getentercol;            /**/
             char usdateforsysop;         /* (B) */
    PathString    ezyovrpath;             /* Path to ezy.Ovl file */
    UserString    sysopalias;             /* Sysops alias */
             char ovrems;                 /* (B) Store overlay in EMS */
    unsigned char swapezy;                /**/
    PathString    filesecpath;            /**/
             char scanvirus;              /* (B) */
    unsigned char multitasker;            /* See Type Comment */
    unsigned int  maxbaud;                /* Max baudrate modem supports */
             char lockedport;             /* (B) Is Fossil locked */
    unsigned int  filereqsec;             /**/
             char autoanswer;             /* (B) Should Ezycom answer phone */
    unsigned char initresponse[11];       /**/
    unsigned char ringstring[11];         /**/
    unsigned char inittries;              /**/
    unsigned char initstring1[61];        /**/
    unsigned char initstring2[61];        /**/
    unsigned char busystring[21];         /**/
    unsigned char answerstring[21];       /**/
    unsigned char mailerstring[61];       /**/
    unsigned int  modemstart;             /**/
    unsigned int  modemend;               /**/
    unsigned char modemdelay;             /**/
             char sendbreak;              /* (B) Send break sequence to modem */
    PathString    externaleditor;         /**/
    unsigned char defaultorigin[51];      /* Default echo\netmail origin line */
    unsigned int  newareastmess[16];      /* New area start msg board */
    unsigned int  uploadcredit;           /* Upload credit percentage */
    unsigned char systemlocation[36];     /* */
    unsigned char shownewfileschar;       /* Show new files character or not */
    unsigned int  zone[16];               /**/
    unsigned int  net[16];                /**/
    unsigned int  node[16];               /**/
    unsigned int  point[16];              /**/
    unsigned int  netmailboard[16];       /* Netmail area numbers */
    unsigned char domain[16][21];         /**/
    unsigned char nocarrierstring[21];    /**/
    unsigned char guestaccount[36];       /* Guest Account username */
    unsigned char freespace8[MAXFREE];    /**/
}CONFIGRECORD;


/********************************************************************
 * STRINGS.EZY record structure
 ********************************************************************/
typedef struct COMPRESSRECORD
{
    unsigned char echounarccmd[6][13];
    unsigned char echounarcpar[6][19];
    unsigned char echoarccmd[7][13];
    unsigned char echoarcpar[7][19];
} COMPRESSRECORD;

typedef struct STRINGRECORD
{
    COMPRESSRECORD compress;
} STRINGRECORD;


/********************************************************************
 * LIMITS.EZY record structure
 ********************************************************************/
typedef struct LIMITSRECORD
{
    unsigned int  security;
    unsigned int  time;
    unsigned int  limit[11];
    unsigned char ratio;
    unsigned int  credit;
    unsigned char ratiok;
    unsigned int  creditk;
    unsigned int  regodays;
    unsigned int  creditmess;
    unsigned int  mess;
    unsigned int  timerpercall;
    unsigned char callsperday;
    unsigned char freespace;
} LIMITSRECORD;


/********************************************************************
 * FILEPATH.EZY record structure
 *
 * attribute = bit 0 : cd rom path
 *                 1 : show as not found
 *                 2 : free downloads
 *                 3 : age check (config age or over)
 *              4..7 : reserved
 ********************************************************************/
typedef struct FILEPATHRECORD
{
    PathString    filepath;
    unsigned int  security;
    FlagType      flags;
    unsigned int  uploadarea;
    unsigned char password[9];
    unsigned char attribute;
} FILEPATHRECORD;


/********************************************************************
 * FILESEC.EZY structure
 *
 * attribute = bit 0 : [ reserved ]
 *                 1 : show as not found
 *                 2 : free downloads
 *                 3 : age check (config age or over)
 *              4..7 : [ reserved ]
 *
 ********************************************************************/
typedef struct FILESECRECORD
{
    unsigned char filename[13];
    unsigned int  security;
    FlagType      flags;
    unsigned char password[9];
    unsigned char attribute;
} FILESECRECORD;


/*****************************************************************
 * FILExxx.EZY record structure
 *
 * attribute = bit 0 : checked
 *                 1 : reserved
 *                 2 : offline
 *                 3 : reserved
 *                 4 : private
 *                 5 : deleted
 *                 6 : reserved
 *                 7 : security
 *
 *****************************************************************/
typedef struct FILELISTRECORD
{
    unsigned char filename[13];
    unsigned char description[51];
    long int      fsize;             /* Shown in Bytes */
    unsigned int  fdate;
    unsigned char attribute;
    unsigned char attribute2;       /* reserved */
    UserString    uploader;
    unsigned int  downloads;
} FILELISTRECORD;


/**************************************************************
 * FILES.EZY structure
 *
 * attribute = bit 0 : keep files offline
 *             bit 1 : offline allowed
 *             bit 2 : sortby date
 *             bit 3 : sortby alpha
 *             bit 4 : master list
 *             bit 5 : age testing using < age in config
 *              6..7 : [ reserved ]
 *
 *   convert = 0 : none
 *             1 : zip
 *             2 : lzh
 *             3 : arj
 *             4 : pak
 *             5 : arc
 *             6 : zoo
 *        7..255 : [ reserved ]
 *
 **************************************************************/
typedef struct FILERECORD
{
    unsigned char name[31];
    unsigned char attribute,
                  convert;
             char filegroup;
    unsigned int  uptemplate,
                  upfilepath;
    long int      freespace;
    unsigned int  security;
    FlagType      flags;
    unsigned int  syssecurity;
    FlagType      sysflags;
} FILERECORD;


/*************************************************************
 * EZYDOWN.<NODE> record structure  (Pre-Download)
 *************************************************************/
typedef struct PREDOWNLOADRECORD
{
    unsigned char filename[13];     /* */
    MaxStr        locationfile;     /* */
    long int      fsize;            /* File Size in kilobytes */
    char          freedown;         /* (B) */
    long int      timetodown;       /* download time in Seconds */
    char          deleted;          /* (B) */
} PREDOWNLOADRECORD;


/*************************************************************
 * EZYUP.<NODE> record structure (Pre-Upload)
 *************************************************************/
typedef struct PREUPLOADRECORD
{
    unsigned char filename[13];     /* */
    unsigned char description[51];  /* */
    char          isdupe;           /* (B) */
} PREUPLOADRECORD;


/*************************************************************
 * MAINT1.BBS - MAINT2.BBS record structures
 *************************************************************/
typedef struct MAINT_RECORD
{
    unsigned char filename[13];
    unsigned int  filepoint;
    UserString    downloader,
                  uploader;
} MAINT_RECORD;


/*************************************************************
 * Fast Find Index record structures
 * Information Below Explains how to fill the FASTINDEXRECORD.name Field
 * Filenames are PADDED to fill out the fields as follows.
 * Filename = 8 bytes
 * FileExt  = 4 bytes consisting of a .(Period) + 3 Alpha/Numeric chars
 * Length Byte Precedes the string in Pascal and is replaced with
 * a NULL or Terminating char under C.
 * If at anytime Filename or FileExt do not fill their fields
 * they are to be padded with spaces.
 * eg: DUMMY.LZH = "DUMMY   .LZH", or, DUMMY.L = "DUMMY   .L  "
 *
 * An easy way to achieve this under Turbo or Borland C follows.
 *
 * fnsplit(filename,drv,pth,fnm,ext);
 * sprintf(FASTINDEXRECORD.name,"%-8.8s%-4.4s",fnm,ext);
 *************************************************************/
typedef long int FastPointerRecord[730];  /* FFPTR.EZY */
typedef struct FASTINDEXRECORD    /* FFIDX.EZY */
{
    unsigned char name[13];
    unsigned int  template;        /* directory of file 1 -> */
    char          deleted;         /* boolean */
} FASTINDEXRECORD;


/*************************************************************
 * ONLINE.BBS record structure
 *
 * status =   0: active
 *            1: reserved
 *            2: downloading
 *            3: uploading
 *            4: bimodem transfer
 *            5: message browsing
 *            6: door/outside
 *            7: in chat with sysop
 *            8: in chat with other users - channel 000
 *          ???: in chat with other users - channel ???
 *          207: in chat with other users - channel 199
 *      208-252: [reserved]
 *          253: node not active in any way
 *          254: user in login process
 *          255: waiting for caller
 *************************************************************/
 typedef struct ONLINERECORD
 {
    UserString    name,            /* Should Blank if NO user online */
                  alias;
    unsigned char status;
    unsigned char attribute;
    long int      baud;
    unsigned char location[26];
} ONLINERECORD;

/*************************************************************
 * MESSNODE.<NODE> record structure
 *************************************************************/
typedef struct MULTIMESSAGERECORD
{
    UserString    from;         /* From Username */
    unsigned char message[81];
    char          private;      /* boolean */
} MULTIMESSAGERECORD;

/*************************************************************
 * BESTSTAT.BBS record structure
 *
 *    bestname[0] is for bestmessages
 *    bestname[1] is for bestcalls
 *    .....
 *    bestname[6] is for bestdownk
 *
 *************************************************************/
typedef struct BESTUSERRECORD
{
    unsigned char bestname[7][36];
    unsigned int  bestmessages,
                  bestcalls,
                  bestups,
                  bestdns,
                  bestfps;
    long int      bestupk,
                  bestdownk;
} BESTUSERRECORD;


/*************************************************************
 * MSGHxxx.BBS record structure
 *
 * msgattr = bit 0    deleted
 *               1    netmail pending export
 *               2    [reserved]
 *               3    private
 *               4    received
 *               5    echomail pending export
 *               6    locally generated msg
 *               7    do not kill message
 *
 * netattr = bit 0     kill/sent
 *               1     sent
 *               2     file attach
 *               3     crash
 *               4     file req
 *               5     request reciept
 *               6     audit request
 *               7     is a return reciept
 *
 * extattr =  bit 0-7   [reserved]
 *
 *************************************************************/
typedef struct MSGHDRRECORD
{
    unsigned int  prevreply,
                  nextreply;            /* 0=No Reply Chain */
    long int      startposition,        /* Byte Offset of Text in MSGTxxx.BBS */
                  messagelength;        /* Length of msg including Null terminator */
    unsigned int  destzone;
    unsigned int  destnet,
                  destnode,
                  destpoint,
                  origzone,
                  orignet,
                  orignode,
                  origpoint;
    unsigned int  cost;
    unsigned char msgattr;
    unsigned char netattr;
    unsigned char extattr;
    long int      posttimedate;         /* Dos format packed time & date */
    long int      recvtimedate;         /* Dos format packed time & date */
    UserString    whoto,
                  whofrom;
    unsigned char subject[73];
} MSGHDRRECORD;


/*************************************************************
 * MSGFAST.BBS record structure
 *************************************************************/
typedef struct MSGFASTRECORD
{
    long     int  whoto;       /* 32 bit CRC on WhoTo in MSGHxxx.BBS */
    unsigned int  msgboard,
                  msgnumber;
} MSGFASTRECORD;


/*************************************************************
 * MSGEXPRT.BBS
 * file of maxmess records defining if area needs echo/netmail scan
 *************************************************************/
typedef char NeedScan;  /* boolean */


/*************************************************************
 * MSGTxxx.BBS structure definition (No Predefined Rec Size)
 *
 * Each text part of a message starts at "Startposition" and
 * continues until a NULL terminator is found, or EOF is reached.
 * Msg Text length is limited to 16Meg as defined by Turbo Pascal
 * The messagelength MUST be the same length as the message text
 * including the NULL terminator, as MSGCOMP uses this field for
 * speed and for kilobyte deletion
 *************************************************************/


/*************************************************************
 * MESSAGES.EZY record structure
 *
 * attribute = bit 0 : allow aliases
 *                 1 : use alias
 *                 2 : use alias, ask for aliases
 *                 3 : test age as defined in config.xx
 *                 4 : combined area access
 *                 5 : local file attaches
 *                 6 : strip private bit on incoming echomail
 *                 7 : [reserved]
 *
 * attribute2 = bit 0 : show seenby lines
 *                  1 : [reserved]
 *                  2 : strip forward seenbys
 *               3..4 : [reserved]
 *                  5 : areafix info visible
 *                  6 : initial combined area access
 *                  7 : [reserved]
 *
 * attribute3 = [Reserved]
 *
 * destnode = nodes  1 to  8 - destnode[1]
 *            nodes  9 to 16 - destnode[2]
 *            nodes 17 to 24 - destnode[3]
 *            etc, etc, etc.
 *
 *************************************************************/
typedef struct MESSAGERECORD
{
    unsigned char name[31];
    unsigned char areatag[31];
    MsgType       typ;              /* msgtype */
    MsgKindsType  msgkinds;         /* msgkinds type */
    unsigned char attribute,
                  attribute2,
                  attribute3;
    unsigned char dayskill,
                  recvkill;
    unsigned int  countkill,
                  kilobytekill,
                  readsecurity;
    FlagType      readflags;    /* Flagtype */
    unsigned int  writesecurity;
    FlagType      writeflags;      /* Flagtype */
    unsigned int  sysopsecurity;
    FlagType      sysopflags;      /* Flagtype */
    unsigned char originline[51];
    unsigned char originaddress;
    unsigned char seenby[MAXAKA/8];
    char          areagroup,
                  messgroup;
    unsigned char destnodes[MAXNODES/8];
    unsigned char echomailfeed;           /* 0=No Uplink */
} MESSAGERECORD;


/*************************************************************
 * ECHOMGR.EZY record structure ( 1 to 128 records )
 *
 * compress = 0 : compress to zip
 *            1 : compress to lzh
 *            2 : compress to arj
 *            3 : compress to arc
 *            4 : compress to pak
 *            5 : compress to zoo
 *            6 : compress to lzh (use lha old -lh1- method )
 *
 * attribute = bit 0 : node active
 *                 1 : crash mail
 *                 2 : hold mail
 *                 3 : node can create new echos
 *                 4 : add node to export on new echo creation
 *               5-7 : [reserved]
 *
 * sendpkttype = 0 : type 2
 *               1 : type 2+
 *               2-255 [reserved]
 *
 *************************************************************/
typedef struct ECHOMGRRECORD
{
    unsigned int  destpoint,
                  destnode,
                  destnet,
                  destzone;
    unsigned char groups[27];
    unsigned char compress;
    unsigned char attribute;
    unsigned char passwordto[21],
                  passwordfr[21];
    unsigned char dayshold,
                  sendpkttype;
} ECHOMGRRECORD;


/*************************************************************
 * EVENTS.EZY record structure
 *
 * attribute = bit 0 : enabled
 *              1..7 : [reserved]
 *
 * days = bit 0 : sunday
 *            1 : monday
 *            ...
 *            6 : saturday
 *            7 : [reserved]
 *
 *************************************************************/
typedef struct EVENTRECORD
{
    unsigned char attribute;
    unsigned int  starttime;     /* msb=Hour, lsb=Minutes */
    unsigned char errorlevel;
    unsigned char days;
    unsigned int  lasttimerun;
} EVENTRECORD;


/*************************************************************
 * TODAY.BBS & YESTER.BBS record structure
 *
 * didwhat = bit 0 : (n) new user
 *               1 : (u) upload
 *               2 : (d) download
 *               3 : (r) read mail
 *               4 : (s) sent mail
 *               5 : (o) door/outside
 *               6 : (c) chat
 *               7 : (p) paged sysop
 *
 *************************************************************/
typedef struct ONTODAYRECORD
{
    unsigned char line;
    UserString    name,
                  alias;
    unsigned char location[26];
    unsigned int  baudrate;
    unsigned int  logontime;
    unsigned int  logofftime;
    unsigned char didwhat;
} ONTODAYRECORD;


/*************************************************************
 * system usage record structure
 *************************************************************/
typedef struct USEAGERECORD
{
    unsigned int  startdate;
    long int      busyperhour[24];  /* Minutes Used */
    long int      busyperday[7];    /* Minutes Used */
} USEAGERECORD;


/*************************************************************
 * MSGINFO.<Node>
 * Created when external FSE called
 *
 * returnstatus = 0 = FSE Record Not Used
 *                1 = Message Saved
 *                2 = Message Aborted
 *                3 = User Inactivity
 *                4 = User Hungup
 *                5 = Sysop Hungup
 *
 * attribute = bit 0 : can change subject
 *                 1 : can change whoto
 *                 2 : can change private
 *                 3 : private message
 *                 4 : is message forwarded (false = quoted)
 *                 5 : netmail message
 *                 6 : reserved
 *                 7 : echomail message
 *************************************************************/
typedef struct FSERECORD
{
    UserString    whofrom;
    NETRECORD     orignet;
    UserString    whoto;
    NETRECORD     destnet;
    unsigned char subject[73];
    unsigned char returnstatus;
    unsigned char attribute;
} FSERECORD;


/*************************************************************
 * Used in ExitInfo record (Could be used as Union under C)
 *************************************************************/
typedef struct TIMERECORD
{
    unsigned char hour,
                  min;
} TIMERECORD;


/*************************************************************
 * EXITINFO.<node> record structure
 *
 * iemsi_req1 = bit 0 : News
 *                  1 : Mail
 *                  2 : File
 *                  3 : ClrScr
 *                  4 : Quiet
 *                  5 : More
 *                  6 : FSE
 *                  7 : [Reserved]
 *
 * iemsi_scrlen : Screen Length for current session Only.  If NO Iemsi
 *                session, this is set to users Normal screen length.
 *
 * iemsi_prot = bit 0 : ZModem
 *                  1 : SEAlink
 *                  2 : Kermit
 *               3..7 : [reserved]
 *
 * iemsi_crt  = 0 : TTY
 *              1 : ANSI
 *              2 : AVT0+
 *              3 : VT100
 *              4 : VT52
 *         5..255 : [reserved]
 *
 * iemsi_cap  = bit 0 : CHT
 *                  1 : MNU
 *                  2 : TAB
 *                  3 : ASCII
 *               4..7 : [reserved]
 *
 *************************************************************/
typedef struct EXITINFORECORD
{
    unsigned int  baud,                 /* Speed between Modem<->Modem */
                  lockedbaud;           /* Speed between Modem<->PC */
    unsigned char comport;              /* Com1=1 Com2=2 etc etc */
    unsigned int  efficiency;           /* Baud rate efficiency */
    unsigned int  userrecnum;           /* User Record Number, 0=User_1 */
    USERSRECORD   userinfo;
    USERSEXTRARECORD userextra;
    UserString    sysopname,            /* Sysops Name as defined in Config.xxx */
                  sysopalias;           /* Sysops Alias as defined in Config.xxx */
    unsigned char system[41];           /* System Name as defined in Config.xxx */
    unsigned int  downloadlimit;        /* */
    unsigned int  timelimit;
    unsigned int  timetakenevent;         /* Number of Minutes taken from user due to event */
    long int      timecreated;            /* Number of seconds since Midnight */
    long int      timeofnextevent;        /* Number of seconds from midnight */
    unsigned int  timetillnextevent;      /* Number of seconds After timecreated */
    unsigned char dayofnextevent;         /* 0=Sun, 6=Sat, 7=NoEvent */
    unsigned char errorlevelofnextevent;  /* Errorlevel to return from next event */
    unsigned char ratio;
    unsigned int  credit;
    unsigned char ratiok;
    unsigned int  creditk,
                  regodays,
                  creditmess;
    unsigned int  mess;
    DATETIME      logintimedate;
    unsigned char stack[20][9];           /* Menu Stack */
    unsigned char stackpos;               /* Menu Stack Position, 0 = No Stack */
    Str8          curmenu;                /* FileName of Current Menu */
    unsigned char oldpassword[16];
    unsigned int  limitrecnum;            /* Limits Record being used */
    unsigned char baudrecnum;             /* BaudRate record being used */
    char          hibitreplace;           /* HiBit replacement char */
    unsigned char maxpages;               /* Times user can page sysop */
    unsigned char pagedsysop;             /* Times user has paged sysop */
    char          wantchat;               /* boolean */
    long int      pagestart,
                  pageend;                /* Seconds since midnight */
    unsigned char pagelength;
    char          echoentered,            /* boolean */
                  netentered,
                  nextsysop;
    unsigned char inactivitytime;         /* Seconds */
    char          protrecnum;             /* Default Protocol record number, 0=NoDefault */
    unsigned char protname[16];           /* Default Protocol Name */
    unsigned char didwhat;                /* Did what flag for Todays callers */
    unsigned char pagereason[61];
    unsigned char mtasker;                /* 0=No Multitasker, 1=[Reserved] */
             char iemsi_session; /* boolean */
    unsigned char iemsi_req1,
                  iemsi_req2,
                  iemsi_scrlen;
    unsigned char iemsi_prot,
                  iemsi_crt,
                  iemsi_cap;
    char          pagesound;              /* (B) */
    unsigned char freespace[99];
} EXITINFORECORD;


/*************************************************************
 * sysinfo record structure
 *************************************************************/
typedef struct SYSINFORECORD
{
    long int      callcount;
    UserString    lastcaller;
    long int      filesizek;           /* Updated by EzyFF -C */
    unsigned int  newusers,
                  newfiles,
                  newmessages;         /* Does not include Inbound Echomail */
    UserString    lastalias;
    unsigned int  laststarttime;
    unsigned char extraspace[80];
} SYSINFORECORD;


/*************************************************************************/
/* Some sample C Src to replicate most of the functions shown in the     */
/* Pascal version of the EzyCom Structures  (Turbo/Borland)              */
/*************************************************************************/

/**********************************************************
 * Determine if a file or path exists.
 * Returns 1 if true and 0 if false.
 * To check a path do NOT include the trailing backslash.
 * Note: You could use "findfirst()" for this also.
 *
 * eg: if(exists(filepath)) do_something(); else is_error();
 **********************************************************/
int exists(char *filepath)
{
    return( access( filepath, 0 ) == 0 );
}

/**********************************************************
 * Check if file path has a trailing backslash.
 * It is assumed you won't be stupid enough to pass a NULL
 * length string.
 *
 * eg: fixslash(pathstring);
 **********************************************************/
void fixslash(char *s)
{
    while(*s) s++;                       /* Move to EOS */
    if (*(--s) == '\\') return;          /* If Ok return */
    *(++s) = '\\';                       /* Else Add Slash */
    *(++s) = '\0';                       /* Terminate String */
}

/**********************************************************
 * Locate the Config.xxx file
 *
 * The parameter "node" should be declared globaly and
 * initialized to "1" if not otherwise declared either
 * by your own program or the "TASK" environment variable.
 * Note: It's up to you to check these two things.
 *
 * eg: if((pntr=findc(2))==NULL) is_error();
 **********************************************************/
char *findc(int node)
{
    char p[128];                                  /* Temp String Pointer */
    static char path[128];                        /* To store the location */
    char *s[] = {"CONFIG.1","CONFIG.EZY"};

    strcpy(p,getenv("EZY"));                      /* Get EZY Environment value */
    fixslash(p);                                  /* Make sure theres a backslash */

    if(node > 1 && node < 251) sprintf(s[0],"CONFIG.%d",node);

    if(strlen(p) > 1)                             /* If environment path set */
    {
        strcpy(path,p);
        strcat(path,s[0]);
        if(exists(path)) return(path);            /* Env Path + Config.xxx */

        strcpy(path,p);
        strcat(path,s[1]);
        if(exists(path)) return(path);            /* Env Path + Config.Ezy */
    }

    strcpy(path,s[0]);
    if(exists(path)) return(path);                /* Config.xxx in CurDir */

    strcpy(path,s[1]);
    if(exists(path)) return(path);                /* Config.Ezy in CurDir */

    return(NULL);                                 /* Unable to locate config.xx */
}

/**********************************************************
 * Check for a valid date
 *
 * Returns 1 if a valid date and 0 if not.
 *
 * eg: if(!checkdate(1992,1,1)) do_nothing();
 **********************************************************/
int checkdate(unsigned int yy, unsigned int mm, unsigned int dd)
{
    int days[] = {31,29,31,30,31,30,31,31,30,31,30,31};

    if( mm < 1 || mm > 12) return(0);                        /* Invalid Month */
    if( dd < 1 || dd > days[mm-1]) return(0);                /* Invalid Day */
    if(yy < 1900) return(0);                                 /* Your to Old */
    if(((yy%4) != 0) && (dd == 29) &&  (mm == 2)) return(0); /* Tryin to fool me */

    return(1);                                               /* Everything must be valid */
}

/**********************************************************
 * Convert a Date to an Int
 *
 * Returns the converted date on success or 65535 on failure.
 *
 * eg: intdate = dat2int(1992,1,1);
 **********************************************************/
unsigned int dat2int(unsigned int yy, unsigned int mm, unsigned int dd)
{
    unsigned int  tofield=0;

    if(!checkdate(yy,mm,dd) || yy < 1980 || yy > 2107) return(65535);

    tofield = dd-1;
    tofield = tofield + ((mm-1) << 5);
    tofield = tofield + ((yy-1980) << 9);

    return(tofield);
}

/**********************************************************
 * Convert an Int to a Date
 *
 * Returns the converted date in the variables yy,mm,dd
 * and a true false value in relation to the conversion.
 *
 * eg: if(!int2dat(intdate,&year,&mon,&day)) is_error();
 **********************************************************/
int int2dat(unsigned int dat, unsigned int *yy, unsigned int *mm, unsigned int *dd)
{
    unsigned int temp=dat;

    if(dat == 65535) return(0);          /* Invalid Date */

    *dd = (temp & 31) + 1;
    temp >>= 5;
    *mm = (temp & 15) + 1;
    temp >>= 4;
    *yy = (temp & 127) + 1980;
    return(1);                         /* Conversion OK */
}