home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / drsk.zip / DOORSKEL.H < prev    next >
C/C++ Source or Header  |  1993-05-31  |  28KB  |  745 lines

  1. /**********************************************/
  2. /*                                            */
  3. /* XBBS Door Skeleton -- TC 2.0/MSC 6.0a code */
  4. /* Copyright (c) 1990/91/92/93 by M. Kimes    */
  5. /* All Rights Reserved                        */
  6. /* May be freely used for >>>FREE<<< programs */
  7. /* as long as you don't try to save any souls */
  8. /* (nasty habit)                              */
  9. /*                                            */
  10. /**********************************************/
  11.  
  12. typedef struct {
  13.   char soh;           /* 0x01 or 0x02 */
  14.   char blk;           /* block # */
  15.   char blkcmp;        /* 1's complement of block # */
  16.   char data[1027];    /* data and crc or csum */
  17. } GENBLK;
  18.  
  19. #define DOORTIMEOUT       -1
  20. #define DOORLOSTCARRIER   -2
  21. #define DOORFILEERROR     -3
  22. #define DOORNOSTART       -4
  23. #define DOORBLKCRCERR     -5
  24. #define DOORBLKMISMATCH   -6
  25. #define DOORBLKMINUS1     -7
  26. #define DOORBLKFATAL      -8
  27. #define DOORBLKEOF        -9
  28.  
  29. typedef unsigned short word;
  30.  
  31. #define DRSK_MAJVER 2
  32. #define DRSK_MINVER 0
  33.  
  34. /* DOORSKEL.H, DOORSKEL's main include file */
  35.  
  36. #ifndef OS2
  37.  #include <dos.h>
  38.  
  39. typedef struct {
  40.   word      strsize;       /* size of the structure in bytes     */
  41.   char      majver;        /* FOSSIL spec driver conforms to     */
  42.   char      minver;        /* rev level of this specific driver  */
  43.   char far *ident;         /* FAR pointer to ASCII ID string     */
  44.   word      ibufr;         /* size of the input buffer (bytes)   */
  45.   word      ifree;         /* number of bytes left in buffer     */
  46.   word      obufr;         /* size of the output buffer (bytes)  */
  47.   word      ofree;         /* number of bytes left in the buffer */
  48.   char      swidth;        /* width of screen on this adapter    */
  49.   char      sheight;       /* height of screen    "      "       */
  50.   char      speed;         /* ACTUAL speed, computer to modem    */
  51. } FOSSILINFO;
  52.  
  53.  /* portability junk.  lots and lots of portability junk. */
  54.  
  55.  #ifdef __TURBOC__
  56.  
  57.     #include <dir.h>
  58.     #define _fastcall pascal
  59.     #define _pascal   pascal
  60.     #define _cdecl    cdecl
  61.     #define FAR       far
  62.  
  63.     /*
  64.      * note: for increased portability with Doorskel, use DoorGetDrive and
  65.      * DoorSetDrive macros below instead of compiler-specific counterparts
  66.      */
  67.  
  68.     #define DoorGetDrive()  getdisk()
  69.     #define DoorSetDrive(x) setdisk((x) - 1)
  70.  
  71.  #else
  72.     #include <direct.h>
  73.  
  74.     #define MAXDIR        133
  75.     #define FAR           _far
  76.  
  77.     #define DoorGetDrive()  _getdrive()
  78.     #define DoorSetDrive(x) {int temp;_dos_setdrive(x,&temp);}
  79.  
  80.     #define SH_DENYNONE   SH_DENYNO
  81.     #define SH_DENYWRITE  SH_DENYWR
  82.     #define SH_DENYREAD   SH_DENYRD
  83.  
  84.     #if !defined(MK_FP)
  85.       #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16) | (unsigned)(off)))
  86.     #endif
  87.  
  88.  #endif
  89.  
  90. #else
  91.  
  92.  #define  INCL_DOSERRORS
  93.  #define  INCL_DOS
  94.  #define  INCL_VIO
  95.  #include "os2.h"
  96.  #include "direct.h"
  97.  
  98.   #ifndef MAXDIR
  99.     #define MAXDIR 257
  100.   #endif
  101.  
  102.     int  DoorGetDrive (void);
  103.     void DoorSetDrive (int dr);
  104.  
  105.     #if !defined(MK_FP)
  106.       #define MK_FP(seg,off) ((void FAR *)(((long)(seg) << 16) | (unsigned)(off)))
  107.     #endif
  108.  
  109. #endif
  110.  
  111. /*************************************************/
  112. /* Standardizing file finding so that it can     */
  113. /* be used transparently under MS-DOS (TC & MSC) */
  114. /* and OS/2                                      */
  115. /*************************************************/
  116.  
  117. #ifdef OS2
  118.   #define DOORFINDBUF FILEFINDBUF
  119.   #define DoorFindClose(h) DosFindClose(h)
  120.   /* these functions in findfile.c */
  121.   int DoorFindFirst(int *h,char *spec,DOORFINDBUF *buf,int attr);
  122.   int DoorFindNext(int h,DOORFINDBUF *buf);
  123. #else
  124.   #define HDIR_SYSTEM   0x0001  /* Use system handle (1)     */
  125.   #define HDIR_CREATE   0xFFFF  /* Allocate a new, unused handle   */
  126.   #define FILE_NORMAL     0x0000
  127.   #define FILE_READONLY   0x0001
  128.   #define FILE_HIDDEN     0x0002
  129.   #define FILE_SYSTEM     0x0004
  130.   #define FILE_DIRECTORY  0x0010
  131.   #define FILE_ARCHIVED   0x0020
  132.   typedef struct {
  133.     unsigned int twosecs : 5;
  134.     unsigned int minutes : 6;
  135.     unsigned int hours   : 5;
  136.   } FTIME;
  137.   typedef struct {
  138.     unsigned int day     : 5;
  139.     unsigned int month   : 4;
  140.     unsigned int year    : 7;
  141.   } FDATE;
  142.   typedef struct {
  143.     char  reserved[21];
  144.     char  attrFile;
  145.     FTIME ftimeLastWrite;
  146.     FDATE fdateLastWrite;
  147.     long  cbFile;
  148.     char  achName[13];
  149.   } DOORFINDBUF;
  150.  #ifdef __TURBOC__
  151.   #define DoorFindFirst(h,spec,buf,attr) findfirst((spec),((struct ffblk *)buf),(attr))
  152.   #define DoorFindNext(h,buf) findnext((struct ffblk *)buf)
  153.   #define DoorFindClose(h)
  154.  #else        /* MSC */
  155.   #define DoorFindFirst(h,spec,buf,attr) _dos_findfirst((spec),(attr),((struct find_t *)buf))
  156.   #define DoorFindNext(h,buf) _dos_findnext((struct find_t *)buf)
  157.   #define DoorFindClose(h)
  158.  #endif
  159. #endif
  160.  
  161. /* standard include files */
  162.  
  163. #include <stdlib.h>
  164. #include <stdio.h>
  165. #include <string.h>
  166. #include <signal.h>
  167. #include <limits.h>
  168. #include <io.h>
  169. #include <fcntl.h>
  170. #include <ctype.h>
  171. #include <time.h>
  172. #include <process.h>
  173. #include <share.h>
  174. #include <stdarg.h>
  175. #include <stddef.h>
  176. #include <conio.h>
  177. #include <sys/types.h>
  178. #include <sys/stat.h>
  179. #include <setjmp.h>
  180.  
  181. /*****************************************************/
  182. /* some hopefully helpful shortcut macros for best   */
  183. /* portability, use these instead of the functions   */
  184. /* they mask (like DoorFossilFuncs)                  */
  185. /*****************************************************/
  186.  
  187. #define BACKSPACE       "\b \b"
  188.  
  189. #ifndef OS2
  190.  #define DoorComCSendByte(x)  if(DoorGetBaudVar())while(!DoorFossilFuncs(TRANSMIT,(x)))DoorCheckCarrier()
  191.  #define DoorComCNSendByte(x) while(!DoorFossilFuncs(TRANSMIT,(x)))DoorCheckCarrier()
  192.  #define DoorComSendByte(x)   while(!DoorFossilFuncs(TRANSMIT,(x)))
  193.  #define DoorComWriteByte(x)  DoorComSendByte(x)
  194.  #define DoorComDTROn()       DoorFossilFuncs(DTR,UP)
  195.  #define DoorComDTROff()      DoorFossilFuncs(DTR,DOWN)
  196.  #define DoorComLDTROff()     DosSleep(1000L);DoorFossilFuncs(DTR,DOWN)
  197.  #define DoorComIsByte()      ((DoorFossilFuncs(GETSTAT,0) & 1) ? 1 : 0)
  198.  #define DoorComWatchOn()     (DoorFossilFuncs(WATCHDOG,1))
  199.  #define DoorComWatchOff()    (DoorFossilFuncs(WATCHDOG,2))
  200.  #define DoorInitComm()       (DoorFossilFuncs(INIT,0))
  201.  #define DoorDeinitComm()     (DoorFossilFuncs(DEINIT,0))
  202.  #define DoorComFlushOut()    (DoorFossilFuncs(FLUSHOUT,0))
  203.  #define DoorComPurgeIn()     (DoorFossilFuncs(PURGEIN,0))
  204.  #define DoorComPurgeOut()    (DoorFossilFuncs(PURGEOUT,0))
  205. #else
  206.  #define DoorComCSendByte(x)  if(DoorGetBaudVar())DoorComWriteByte(x);DoorCheckCarrier()
  207.  #define DoorComCNSendByte(x) DoorComWriteByte(x);DoorCheckCarrier()
  208.  #define DoorComSendByte(x)   DoorComWriteByte(x)
  209.  #define DoorComDTROn()       DoorComDTR(1)
  210.  #define DoorComDTROff()      DoorComDTR(0)
  211.  #define DoorComLDTROff()     DosSleep(1000L);DoorComDTR(0)
  212.  #define DoorComIsByte()      ((DoorComPeekByte(0L) != -1) ? 1 : 0)
  213.  #define DoorComWatchOn()
  214.  #define DoorComWatchOff()
  215.  int DoorInitComm(void);
  216.  void DoorDeinitComm(void);
  217. #endif
  218.  
  219. #define DoorModemPuts(x)    if(DoorGetBaudVar())DoorComWriteBlk((x),strlen(x))
  220. #define DoorRemoteBell()    if(DoorGetBaudVar())DoorComWriteByte('\07');else putchar('\07')
  221. #define DoorMinsLeft()      (((long)DoorGetTimeOff() - DoorGetTime()) / 60L)
  222. #define DoorANSISetPos(x,y) DoorPrintf("\x1b[%d;%dH",(y),(x))
  223. #define DoorANSISavePos()   DoorPuts("\x1b[s")
  224. #define DoorANSIRstrPos()   DoorPuts("\x1b[u")
  225. #define DoorIsANSI()        (DoorGetGraphics()!=0)
  226. #define DoorIsLocal()       (DoorGetBaudVar()==0)
  227. #define DoorPrintGraphics(s) if(DoorGetGraphics())DoorPuts(s)
  228. #define DoorPurgeInLocal()  while(kbhit()) getch()
  229. #define DoorFlushOutLocal() DoorFlushVideo()
  230.  
  231. #ifndef OS2
  232.  
  233.  /*================================================================*/
  234.  /* FOSSIL definitions (see function DoorFossilFuncs())            */
  235.  /*================================================================*/
  236.  
  237.  #define SETBAUD    0
  238.  #define TRANSWAIT  1
  239.  #define RECVWAIT   2
  240.  #define GETSTAT    3
  241.  #define INIT       4
  242.  #define DEINIT     5
  243.  #define DTR        6
  244.    #define UP         1
  245.    #define DOWN       0
  246.  #define FLUSHOUT   8
  247.  #define PURGEOUT   9
  248.  #define PURGEIN    10
  249.  #define TRANSMIT   11
  250.  #define PEEK       12
  251.  #define KEYNOWAIT  13
  252.  #define KEYWAIT    14
  253.  #define FLOW       15
  254.  #define ONOFF      16
  255.    #define ON          0
  256.    #define OFF         2
  257.  #define SETCRSR    17
  258.  #define READCRSR   18
  259.  #define ONEANSI    19
  260.    #define CARRIER    128
  261.    #define INITOK     0x1954
  262.  #define WATCHDOG   20
  263.  #define REBOOT     23
  264.    #define COLD        0
  265.    #define WARM        1
  266.  #define BLOCKREAD  24
  267.  #define BLOCKWRITE 25
  268.  
  269. #endif
  270.  
  271. /***************************************************************************/
  272. /* Symbols for DoorGenericInput()...                                       */
  273. /***************************************************************************/
  274.  
  275. #define ALLL     1
  276. #define ALPHA    2
  277. #define NUM      3
  278. #define ALPHANUM 4
  279. #define YESNO    5
  280. #define FLE      6
  281. #define FLEP     7
  282. #define FLEW     8
  283. #define FLEPW    9
  284. #define NAME     10
  285. #define NEAT     11
  286. #define PHONE    12
  287. #define DATE     13
  288. #define SUBJECT  14
  289. #define YESNOM   15
  290. #define ARROWS   16
  291. #define FBATCH   17
  292. #define FBATCHW  18
  293. #define FBATCHWP 19
  294. #define FBATCHP  20
  295. #define HYPER    21
  296. #define FLENX    64
  297. #define YESNOQ   65
  298.  
  299. /**************************************************************************/
  300. /*  Macros for implementing simple timers.  All timers use 1000ths of     */
  301. /*  a second, but are only 'accurate' to one clock tick.  Typical example */
  302. /*  of use (a one second timer):                                          */
  303. /*                                                                        */
  304. /*   clock_t t1;                                                          */
  305. /*                                                                        */
  306. /*   t1 = DoorTimerSet(1000L);                                            */
  307. /*   while(!DoorTimeUp(t1)) {                                             */
  308. /*      ...do something...                                                */
  309. /*      DosSleep(1L);          // give up time slice; dumb                */
  310. /*   }                                                                    */
  311. /**************************************************************************/
  312.  
  313. #ifdef __TURBOC__
  314.     #define CLOCKS_PER_SEC  CLK_TCK
  315. #endif
  316.  
  317.  #define DoorTimerSet(tmt) (clock_t)((((clock_t)(tmt) * (clock_t)CLOCKS_PER_SEC) / 1000L) + clock())
  318.  #define DoorTimeUp(tmt) (tmt < clock())
  319.  #define DoorTimeLeft(tmt) ((tmt<=clock())?0L:(((tmt-clock())/(clock_t)CLOCKS_PER_SEC)*1000L))
  320.  
  321.  
  322. /*******************************************************/
  323. /* multitasker-cooperation functions in setmtask.c     */
  324. /* and mtask.c                                         */
  325. /*******************************************************/
  326.  
  327. #ifndef OS2
  328.   void _fastcall DoorSetMtask (void);         /* called by DoorInit() */
  329.   void _fastcall DoorZeroMtask(void);         /* disable timeslicing */
  330.   void _fastcall DosSleep (clock_t millisecs); /* OS/2 provides this */
  331. #else
  332.   #define DoorZeroMtask()
  333.   #define DoorSetMtask()
  334. #endif
  335.  
  336.  
  337. /***********************************/
  338. /* functions in ansi.c (low-level) */
  339. /***********************************/
  340.  
  341. /*
  342.  * NOTE:  all screen output except for status line should go (ultimately)
  343.  * through DoorANSIPuts().  see also DoorANSIPrintf() function.
  344.  */
  345. int  _fastcall DoorANSIPuts (char *buf);
  346. void _fastcall DoorANSIPutc (char c);
  347. void _fastcall DoorFlushVideo(void);
  348. void _fastcall DoorZeroVideo(void);
  349. void _fastcall DoorSetScreensize (int reservedlines);
  350. void _fastcall DoorPutChar (char c,char attr,int x,int y);
  351. void _fastcall DoorPosHardcursor (int x,int y);
  352.  #define       DoorCursor(x,y) DoorPosHardcursor((x) - 1,(y) - 1)
  353. void _fastcall DoorHardCursorOff (void);
  354. void _fastcall DoorHardCursorOn (int x,int y);
  355. void _fastcall DoorScrollUp (int tx,int ty,int bx,int by,char attr);
  356. void _fastcall DoorClearWindow (int tx,int ty,int bx,int by,char attr);
  357. void _fastcall DoorCleartoEOL (int x,int y,int ex,char attr);
  358.  
  359.  
  360. /************************************/
  361. /* functions in misc.c              */
  362. /************************************/
  363.  
  364. char  * _fastcall DoorStripCR(char  *a);
  365. char  * _fastcall DoorLStrip(char  *a);
  366. char  * _fastcall DoorRStrip(char  *a);
  367. void    _fastcall DoorBackup (int num);
  368.  #define          DoorBackupString(s) DoorBackup(strlen(s) + 1)
  369.  
  370.  
  371. /************************************/
  372. /* functions in optional log.c      */
  373. /************************************/
  374.  
  375. char *_cdecl DoorAddToLog(char *text,...);
  376.  
  377.  
  378. /************************************/
  379. /* functions in int.c           */
  380. /************************************/
  381.  
  382. int   _fastcall       DoorInit(int argc,char **argv);
  383. void  _fastcall       DoorPrintHelp(void);
  384. long  _fastcall       DoorGetTime(void);
  385. void  _fastcall       DoorPrintInfo(void);
  386. void  _cdecl          DoorDeInitialize(void);
  387. void  _fastcall       DoorPrintStat(void);
  388. void  _cdecl          DoorBreakHandler (int sigl);
  389.  
  390.  
  391. /************************************/
  392. /* functions in input.c             */
  393. /************************************/
  394.  
  395. int     _fastcall  DoorInkey(long millisecs);
  396. int     _fastcall  DoorSpecialModemKey(int wuz);
  397. int     _fastcall  DoorSpecialLocalKey(int wuz);
  398. char *  _fastcall  DoorGenericInput(int length,int password,int caps,
  399.                                     int hot,int type,char *prompt,
  400.                                     char *buffer);
  401. int     _fastcall  DoorCheckCarrier(void);
  402. void    _fastcall  DoorHitReturn(void);
  403.  
  404.  
  405. /************************************/
  406. /* functions in chat.c              */
  407. /************************************/
  408.  
  409. void _fastcall DoorCheapChat(void);
  410. int  _fastcall DoorANSIChat(void);
  411.  
  412.  
  413. /************************************/
  414. /* functions in output.c            */
  415. /************************************/
  416.  
  417. void  _fastcall  DoorCLS(void);
  418. int   _cdecl     DoorPrintf(char *string,...);
  419. void  _cdecl     DoorANSIPrintf(char *string,...);
  420. void  _cdecl     DoorDebugPrintf(char *string,...);
  421. int   _fastcall  DoorPuts(char *text);
  422. int   _fastcall  DoorDirectPuts(int x,int y,char attr,char *str);
  423. int   _cdecl     DoorDirectPrintf(int x,int y,char attr,char *str,...);
  424. /* macros to make it easy to define colors for DoorDirectPuts/DoorDirectPrintf attr */
  425.  #define DoorMakeColor(fg,bg) ((fg & 15) | ((bg & 7) << 4))
  426.  #define DoorClr(bg,fg,in) ((fg) | (bg << 4) | (in))
  427.  
  428.  
  429. /************************************/
  430. /* functions in optional help.c     */
  431. /************************************/
  432.  
  433. void _fastcall DoorLoadHelp (char *helpfilename);
  434. void _fastcall DoorSetHelp (char *topic);
  435. void _fastcall DoorHelp (void);
  436.  
  437.  
  438. /************************************/
  439. /* functions in optional fansansi.c */
  440. /************************************/
  441.  
  442. int _fastcall DoorANSIMenu2 (char tcolor,char color,char *title,
  443.                               char *lineorig,char **variable,int direct);
  444. int _fastcall DoorANSIMenu (char color, char *lineorig);
  445.  
  446.  
  447. /************************************/
  448. /* functions in optional select1.c  */
  449. /************************************/
  450.  
  451. int _fastcall  DoorSelectOne (char **selections,int numselecs,char *prompt,
  452.                               unsigned int flags);
  453. int _fastcall  DoorTopMenu (char **selections,int numselects);
  454.  
  455.  
  456. /************************************/
  457. /* functions in optional reader.c   */
  458. /************************************/
  459.  
  460. int _fastcall DoorReadText(char *,int);
  461.  
  462.  
  463. /************************************/
  464. /* functions in optional dorinfo.c  */
  465. /************************************/
  466.  
  467. int _fastcall DoorReadDorInfo(void);
  468.  
  469.  
  470. /************************************/
  471. /* functions in optional modem.c    */
  472. /************************************/
  473.  
  474. int    _fastcall DoorDialTrans (char *str);
  475. char * _fastcall DoorGetModemString (clock_t timer);
  476. int    _fastcall DoorSetBaudRate (unsigned int baud,char parity,
  477.                                   int databits,int stopbits);
  478. int    _fastcall DoorDetectANSI (void);
  479.  
  480.  
  481. /************************************/
  482. /* functions in fsopen.c                        */
  483. /************************************/
  484. FILE * _fastcall DoorFsopen (char *filename,char *mode,int sharemode);
  485. char * _fastcall DoorStristr (char *t, char *s);
  486.  
  487.  
  488. /************************************/
  489. /* functions in makeansi.c                    */
  490. /************************************/
  491.  
  492. char * _fastcall DoorMakeANSI (int avacode,char *buf);
  493.  #define DoorMakeANSIIf(a,b) ((DoorGetGraphics())?DoorMakeANSI((a),(b)):"\0")
  494.  
  495.  
  496. /************************************/
  497. /* functions in system.c            */
  498. /************************************/
  499.  
  500. long  _fastcall DoorFreeSpace (char *path);
  501. void  _fastcall DoorSetFDate (char *name,long tim);
  502. char* _fastcall DoorStrTime(time_t t,char *s);
  503. char* _fastcall DoorStrDate(time_t t,char *s);
  504. void  _fastcall DoorReadScreenLine(int x,char *s);
  505. void  _fastcall DoorReadScreen(int *s);
  506. void  _fastcall DoorWriteScreen(int *s);
  507. void  _fastcall DoorCurrCursor(int  *x,int  *y);
  508. int   _fastcall DoorWhereX(void);
  509. int   _fastcall DoorWhereY(void);
  510. int   _fastcall DoorSpawn(unsigned char  *strr);
  511. int   _fastcall DoorComReadByte (long msecs);
  512. int   _fastcall DoorComOnLine (void);
  513. int   _fastcall DoorComWriteBlk (char *buf,int len);
  514. int   _fastcall DoorComPeekByte (long msecs);
  515. int   _fastcall DoorComReadBlk (char *buf,int len,long msecs);
  516.  #define DoorComOutEmpty() (DoorComOutWaiting() == 0)
  517. int  _fastcall DoorComOutWaiting (void);
  518.  #define DoorComInEmpty() (DoorComInWaiting() == 0)
  519. int  _fastcall DoorComInWaiting (void);
  520. #ifndef OS2
  521.  int   _fastcall DoorComReceive (char *buf,int len);
  522. #else
  523.  #define DoorComReceive(buf,len) DoorComReadBlk((buf),(len),0L)
  524. #endif
  525. char * _fastcall DoorSearchPath(char *filename);
  526. #ifdef OS2
  527.  /* OS/2-specific comm support */
  528.  int  _fastcall DoorComWriteByte (char x);
  529.  void _fastcall DoorComDTR (int which);
  530.  void _fastcall DoorComPurgeIn (void);
  531.  void _fastcall DoorComPurgeOut (void);
  532.  void _fastcall DoorComFlushOut (void);
  533. #else
  534.  /* MS-DOS-specific comm support */
  535.  char _fastcall DoorFossilFuncs(char function,
  536.                                 char arg);
  537. #endif
  538.  
  539.  
  540. /***************************************/
  541. /* global variable declarations        */
  542. /***************************************/
  543.  
  544. #ifdef DEFINEDRSKGLOBALS
  545.  
  546.   int    DoorDebugMode              = 0;
  547.   int    DoorGraphics               = 0;
  548.   time_t DoorTimeOff;
  549.   word   DoorBaud                   = 0;
  550.   int    DoorLength                 = 24;
  551.   word   DoorSecLevel               = 5;
  552.   int    DoorSysopIn                = 0;
  553.   word   DoorCommHandle             = (word)-1;
  554.   char   DoorLogFile[133]           = "XBBS.LOG";
  555.   char   DoorUserName[36]           = "A. Ghost";
  556.   int    DoorWidth                  = 80;
  557.   int    DoorChatting               = 0;
  558.   int    DoorChatted                = 0;
  559.   int    DoorNodeNumber             = 1;
  560.   char   DoorSystemName[64]         = "";
  561.   char   DoorSysOp[36]              = "";
  562.   char   DoorCurAttr                = 7;
  563.   int    DoorCurx                   = 0,
  564.          DoorCury                   = 0;
  565.   int    DoorMaxx                   = 80,
  566.          DoorMaxy                   = 25;  /* size of ansi output window */
  567.   int    DoorRealMaxy,DoorRealMaxx;        /* real screen size */
  568.   char   DoorUseANSI                = 1;   /* while true, interp ansi seqs */
  569.   int    DoorTabSpaces              = 8;
  570.   int    DoorUseBIOS                = 0;
  571.   word  *DoorLVB;
  572.   word   DoorLVBMin,DoorLVBMax,DoorLVBLen;
  573. #ifdef OS2
  574.   int    DoorVidHandle              = 0;
  575. #endif
  576.   char  *DoorProgramName            = "A DoorSkel Door";
  577.   char  *DoorCopyRight              = "Door Driver Library copyright (c) 1993 by M. Kimes";
  578.   int    DoorDorInfo                = 0;
  579.   int    DoorNumStatLines           = 1;
  580. #ifndef OS2
  581.   void  (*DoorPauseMtask)(void);     /* fp -- give up time slice */
  582. #endif
  583.   void  (*DoorOutOfTime)(void)      = NULL;  /* fp -- called if time runs out */
  584.   void  (*DoorTimedOut)(void)       = NULL;  /* fp -- called if idle timeout */
  585.   void  (*DoorLostCarrier)(void)    = NULL;  /* fp -- called if carrier lost */
  586.   void  (*DoorExtraHelp)(void)      = NULL;  /* fp -- called if cl request 4 help */
  587.   void  (*DoorExtraStatLine)(void)  = NULL;  /* fp -- called to display more stats */
  588.   int   (*DoorExtraArgs)(char *)    = NULL;  /* fp -- called w/ unknown cl args */
  589.   void  (*DoorFunctionKey[10])(void) =       /* fp -- called if Fkey pressed and set */
  590.         {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
  591. #else
  592.  
  593.   extern int    DoorDebugMode;
  594.   extern int    DoorGraphics;
  595.   extern time_t DoorTimeOff;
  596.   extern word   DoorBaud;
  597.   extern int    DoorLength;
  598.   extern word   DoorSecLevel;
  599.   extern int    DoorSysopIn;
  600.   extern word   DoorCommHandle;
  601.   extern char   DoorLogFile[133];
  602.   extern char   DoorUserName[36];
  603.   extern int    DoorWidth;
  604.   extern int    DoorChatting;
  605.   extern int    DoorChatted;
  606.   extern int    DoorNodeNumber;
  607.   extern char   DoorSystemName[64];
  608.   extern char   DoorSysOp[36];
  609.   extern int    DoorMaxx,DoorMaxy;
  610.   extern int    DoorRealMaxx,DoorRealMaxy;
  611.   extern int    DoorUseBIOS;
  612.   extern word  *DoorLVB;
  613.   extern word  DoorLVBMin,DoorLVBMax,DoorLVBLen;
  614.   #ifdef OS2
  615.    extern int   DoorVidHandle;
  616.   #endif
  617.   extern int    DoorUseANSI;
  618.   extern int    DoorTabSpaces;
  619.   extern char   DoorCurAttr;
  620.   extern int    DoorCurx,DoorCury;
  621.   extern int    DoorNumStatLines;
  622.   extern char  *DoorProgramName;
  623.   extern char  *DoorCopyRight;
  624.   extern int    DoorDorInfo;
  625.   extern void (*DoorPauseMtask)(void);
  626.   extern void (*DoorOutOfTime)(void);
  627.   extern void (*DoorTimedOut)(void);
  628.   extern void (*DoorLostCarrier)(void);
  629.   extern void (*DoorExtraHelp)(void);
  630.   extern void (*DoorExtraStatLine)(void);
  631.   extern int  (*DoorExtraArgs)(char *);
  632.   extern void (*DoorFunctionKey[10])(int);
  633. #endif
  634.  
  635. /*********************************************/
  636. /* macros for providing an API-like way to   */
  637. /* manipulate Doorskel's global variables    */
  638. /* USE THESE MACROS.  It will allow Doorskel */
  639. /* to change the way these variables are     */
  640. /* used in the future without breaking your  */
  641. /* code.                                     */
  642. /*********************************************/
  643.  
  644.  #define DoorSetTimeOff(x)        (DoorTimeOff=(x))
  645.  #define DoorSetProgramName(x)    if((char *)x)DoorProgramName=(x)
  646.  #define DoorSetCopyRight(x)      if((char *)x)DoorCopyRight=(x)
  647.  #define DoorSetNumStatLines(x)   if((x) > 0 && (x) < 7)DoorNumStatLines=(x)
  648.  #define DoorSetOutOfTime(x)      if(x)DoorOutOfTime=(x)
  649.  #define DoorSetTimedOut(x)       if(x)DoorTimedOut=(x)
  650.  #define DoorSetLostCarrier(x)    if(x)DoorLostCarrier=(x)
  651.  #define DoorSetExtraHelp(x)      if(x)DoorExtraHelp=(x)
  652.  #define DoorSetExtraStatLine(x)  if(x)DoorExtraStatLine=(x)
  653.  #define DoorSetExtraArgs(x)      if(x)DoorExtraArgs=(x)
  654.  #define DoorSetFunctionKey(k,x)  if((k) > 0 && (k)<11&&(x))DoorFunctionKey[k-1]=(x)
  655.  #define DoorSetGraphics(x)       (DoorGraphics=((x)!=0)?1:0)
  656.  #define DoorSetBaudVar(x)        (DoorBaud=(x))
  657.  #define DoorSetLength(x)         if((x)>15&&(x)<101)DoorLength=(x)
  658.  #define DoorSetSecLevel(x)       (DoorSecLevel=(x))
  659.  #define DoorSetSysopIn(x)        (DoorSysopIn=((x)!=0)?1:0)
  660.  #define DoorSetLogFile(x)        if((char *)(x))strcpy(DoorLogFile,x)
  661.  #define DoorSetUserName(x)       if((char *)(x))strncpy(DoorUserName,x,35);DoorUserName[35]=0
  662.  #define DoorSetWidth(x)          if((x)>31&&(x)<133)DoorWidth=(x)
  663.  #define DoorSetNodeNumber(x)     (DoorNodeNumber=(x))
  664. #ifndef OS2
  665.  #define DoorSetUseBIOS(x)        (DoorUseBIOS=((x)!=0)?1:0)
  666. #else
  667.  #define DoorSetUseBIOS(x)        (x)
  668. #endif
  669.  #define DoorSetUseANSI(x)        (DoorUseANSI=((x)!=0)?1:0)
  670.  #define DoorSetTabSpaces(x)      (DoorTabSpaces=(x))
  671.  #define DoorUseDorInfo()         (DoorDorInfo=1)
  672. #ifdef OS2
  673.  #define DoorSetVidHandle(x)      (DoorVidHandle=(x))
  674. #else
  675.  #define DoorSetVidHandle(x)      (x)
  676. #endif
  677.  #define DoorSetSystemName(x)     if((char *)(x))strncpy(DoorSystemName,x,63);DoorSystemName[63]=0
  678.  #define DoorSetSysopName(x)      if((char *)(x))strncpy(DoorSysOp,x,35);DoorSysOp[35]=0
  679.  #define DoorSetDebugMode(x)      (DoorDebugMode=(x))
  680.  #define DoorSetMaxx(x)           (DoorMaxx=(x))
  681.  #define DoorSetMaxy(x)           (DoorMaxy=(x))
  682.  #define DoorSetRealMaxx(x)       (DoorRealMaxx=(x))
  683.  #define DoorSetRealMaxy(x)       (DoorRealMaxy=(x))
  684.  #define DoorSetCommHandle(x)     (DoorCommHandle=(x))
  685.  #define DoorSetCurx(x)           (DoorCurx=(x))
  686.  #define DoorSetCury(x)           (DoorCury=(x))
  687.  #define DoorSetCurAttr(x)        (DoorCurAttr=(x))
  688.  #define DoorSetLVB(x)            (DoorLVB=(x))
  689.  #define DoorSetLVBLen(x)         (DoorLVBLen=(x))
  690.  #define DoorSetLVBMin(x)         (DoorLVBMin=(x))
  691.  #define DoorSetLVBMax(x)         (DoorLVBMax=(x))
  692.  
  693.  #define DoorGetProgramName()     (DoorProgramName)
  694.  #define DoorGetCopyRight()       (DoorCopyRight)
  695.  #define DoorGetNumStatLines()    (DoorNumStatLines)
  696.  #define DoorGetOutOfTime()       (DoorOutOfTime)
  697.  #define DoorGetTimedOut()        (DoorTimedOut)
  698.  #define DoorGetLostCarrier()     (DoorLostCarrier)
  699.  #define DoorGetExtraHelp()       (DoorExtraHelp)
  700.  #define DoorGetExtraStatLine()   (DoorExtraStatLine)
  701.  #define DoorGetExtraArgs()       (DoorExtraArgs)
  702.  #define DoorGetFunctionKey(k)    (((k)>0&&(k)<11)?(DoorFunctionKey[k-1]):NULL)
  703.  #define DoorGetGraphics()        (DoorGraphics)
  704.  #define DoorGetBaudVar()         (DoorBaud)
  705.  #define DoorGetLength()          (DoorLength)
  706.  #define DoorGetSecLevel()        (DoorSecLevel)
  707.  #define DoorGetSysopIn()         (DoorSysopIn)
  708.  #define DoorGetLogFile()         (DoorLogFile)
  709.  #define DoorGetUserName()        (DoorUserName)
  710.  #define DoorGetWidth()           (DoorWidth)
  711.  #define DoorGetNodeNumber()      (DoorNodeNumber)
  712. #ifndef OS2
  713.  #define DoorGetUseBIOS()         (DoorUseBIOS)
  714. #else
  715.  #define DoorGetUseBIOS()         (0)
  716. #endif
  717.  #define DoorGetUseANSI()         (DoorUseANSI)
  718.  #define DoorGetTabSpaces()       (DoorTabSpaces)
  719.  #define DoorDontUseDorInfo()     (DoorDorInfo=0)
  720. #ifdef OS2
  721.  #define DoorGetVidHandle()       (DoorVidHandle)
  722. #else
  723.  #define DoorGetVidHandle()       (0)
  724. #endif
  725.  #define DoorGetSystemName()      (DoorSystemName)
  726.  #define DoorGetSysopName()       (DoorSysOp)
  727.  #define DoorGetDebugMode()       (DoorDebugMode)
  728.  #define DoorGetDorInfo()         (DoorDorInfo)
  729.  #define DoorGetMaxx()            (DoorMaxx)
  730.  #define DoorGetMaxy()            (DoorMaxy)
  731.  #define DoorGetRealMaxx()        (DoorRealMaxx)
  732.  #define DoorGetRealMaxy()        (DoorRealMaxy)
  733.  #define DoorGetCommHandle()      (DoorCommHandle)
  734.  #define DoorGetTimeOff()         (DoorTimeOff)
  735.  #define DoorToggleGraphics()     (DoorGraphics=(DoorGraphics)?0:1)
  736.  #define DoorGetCurx()            (DoorCurx)
  737.  #define DoorGetCury()            (DoorCury)
  738.  #define DoorGetCurAttr()         (DoorCurAttr)
  739.  #define DoorGetLVB()             (DoorLVB)
  740.  #define DoorGetLVBLen()          (DoorLVBLen)
  741.  #define DoorGetLVBMin()          (DoorLVBMin)
  742.  #define DoorGetLVBMax()          (DoorLVBMax)
  743.  
  744. /* END OF FILE: doorskel.h */
  745.