home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / MAXMAILP.ZIP / MAX.H < prev    next >
C/C++ Source or Header  |  1990-10-12  |  67KB  |  1,423 lines

  1. /***************************************************************************
  2.  *                                                                         *
  3.  *  MAXIMUS-CBCS Source Code, Version 1.02                                 *
  4.  *  Copyright 1989, 1990 by Scott J. Dudley.  All rights reserved.         *
  5.  *                                                                         *
  6.  *  Main Maximus header file                                               *
  7.  *                                                                         *
  8.  *  For complete details of the licensing restrictions, please refer to    *
  9.  *  the licence agreement, which is published in its entirety in MAX.C     *
  10.  *  and LICENCE.MAX.                                                       *
  11.  *                                                                         *
  12.  *  USE OF THIS FILE IS SUBJECT TO THE RESTRICTIONS CONTAINED IN THE       *
  13.  *  MAXIMUS-CBCS LICENSING AGREEMENT.  IF YOU DO NOT FIND THE TEXT OF THIS *
  14.  *  AGREEMENT IN ANY OF THE  AFOREMENTIONED FILES, OR IF YOU DO NOT HAVE   *
  15.  *  THESE FILES, YOU SHOULD IMMEDIATELY CONTACT THE AUTHOR AT ONE OF THE   *
  16.  *  ADDRESSES LISTED BELOW.  IN NO EVENT SHOULD YOU PROCEED TO USE THIS    *
  17.  *  FILE WITHOUT HAVING ACCEPTED THE TERMS OF THE MAXIMUS-CBCS LICENSING   *
  18.  *  AGREEMENT, OR SUCH OTHER AGREEMENT AS YOU ARE ABLE TO REACH WITH THE   *
  19.  *  AUTHOR.                                                                *
  20.  *                                                                         *
  21.  *  You can contact the author at one of the address listed below:         *
  22.  *                                                                         *
  23.  *  Scott Dudley           FidoNet  1:249/106                              *
  24.  *  777 Downing St.        IMEXnet  89:483/202                             *
  25.  *  Kingston, Ont.         Internet f106.n249.z1.fidonet.org               *
  26.  *  Canada - K7M 5N3       BBS      (613) 389-8315 - HST/14.4K, 24hrs      *
  27.  *                                                                         *
  28.  ***************************************************************************/
  29.  
  30. #ifndef _MAX_H_DEFINED
  31. #define _MAX_H_DEFINED
  32.  
  33.  
  34. #define realpriv() (locked2 ? lockpriv2 : usr.priv)
  35.  
  36. /***************************************************************************
  37.                           Initialization of variables
  38.  ***************************************************************************/
  39.  
  40. #ifdef NOVARS
  41. #ifndef NOINIT
  42. #define INITIALIZE
  43. #endif
  44. #endif
  45.  
  46. #ifdef INITIALIZE
  47. #define extrn
  48. #define IS(x) =x
  49. #define LEN(x) x
  50. #else
  51. #define extrn extern
  52. #define IS(x)
  53. #define LEN(x)
  54. #endif
  55.  
  56.  
  57. /***************************************************************************
  58.       Conditional flags for the entire program, and portability stuff
  59.  ***************************************************************************/
  60.  
  61. #include <time.h>
  62.  
  63. /* #define DMALLOC */      /* Signifies that we want debugging malloc()    *
  64.                             * calls turned on...                           */
  65.  
  66. /* #define TEST_VER */     /* Says we're not compiling a release version.  *
  67.                             * Includes stuff such as forced log-file       *
  68.                             * flushing, and others which are helpful for   *
  69.                             * debugging...                                 */
  70.  
  71. #define FLUSH_LOG          /* Tells Maximus to flush the log file after    *
  72.                             * each transaction.                            */
  73.  
  74. #define INTERNAL_PROTOCOLS /* Means we use internal file-xfer routines,    *
  75.                             * rather than shelling out to DSZ and CLINK!   *
  76.                             * Note that you can only DOWNLOAD using this   *
  77.                             * option:  External DSZ/CLINK uploads are      *
  78.                             * not supported, unless you go through the     *
  79.                             * standard external protocol interface.        */
  80.  
  81. #define SHORT_MDM_CMD      /* Use the abbreviated version of mdm_cmd().    */
  82.  
  83.  
  84. /* If we're using TC, then turn off the following two warnings...  They    *
  85.  * are mainly just an annoyance, especially when working with someone      *
  86.  * else's structures or code.  All of the other warnings should be on.     */
  87.  
  88. #ifdef __TURBOC__
  89. #pragma warn -ucp /* Turn off unsigned/signed char pointer mixup warnings */
  90. #pragma warn -stu /* Turn off undefined structure warnings */
  91. #endif
  92.  
  93. /***************************************************************************
  94.       #undefine's, to handle some crap in other people's header files
  95.  ***************************************************************************/
  96.  
  97. #ifdef PATHLEN
  98. #undef PATHLEN
  99. #endif
  100.  
  101. #ifdef BLINK
  102. #undef BLINK
  103. #endif
  104.  
  105. #ifdef DLE
  106. #undef DLE
  107. #endif
  108.  
  109. #ifdef lputs
  110. #undef lputs
  111. #endif
  112.  
  113. #ifdef TIMEOUT
  114. #undef TIMEOUT
  115. #endif
  116.  
  117.  
  118. /***************************************************************************
  119.                           Miscellanious Macros
  120.  ***************************************************************************/
  121.  
  122. #define Mdm_keyp() (Mdm_kpeek() != -1)
  123.  
  124. #define Clear_KBuffer() *linebuf='\0'
  125.  
  126. #define Save_Directory(path) Save_Dir(&orig_disk,orig_path,path)
  127. #define Restore_Directories() Restore_Dir(&orig_disk,orig_path)
  128.  
  129. #define Save_Directory2(path) Save_Dir(&orig_disk2,orig_path2,path)
  130. #define Restore_Directories2() Restore_Dir(&orig_disk2,orig_path2)
  131.  
  132. #define Save_Directory3(path) Save_Dir(&orig_disk3,orig_path3,path)
  133. #define Restore_Directories3() Restore_Dir(&orig_disk3,orig_path3)
  134.  
  135. #define Yes_or_No(expr) ((expr) ? yes : no)
  136.  
  137. /* The next macro determines if character `c' is an uppercase character
  138.    or a space.  There is a quickie way to do it with Turbo C, so we'll
  139.    automatically use that if we're using the right compiler.               */
  140.  
  141. #ifdef __TURBOC__
  142. #define isupsp(c) (_ctype[(c) + 1] & (_IS_UPP | _IS_SP))
  143. #else
  144. #define isupsp(c) (isupper(c) || isspace(c))
  145. #endif
  146.  
  147. /* The following are translations for the local keyboard services.  You
  148.    might want to change them to something else on a different architechture,
  149.    depending on what works.                                                */
  150.  
  151. #define kbhit()  (fossil_peek() != -1)
  152. #define pgetch() fossil_getcw() /* Get char. from local console function   */
  153.  
  154. /* The following are shorthand macros for calling the Input(), wInput_Char(),
  155.    and GetListAnswer() functions:
  156.  
  157.    The uses for the functions are as follows:
  158.  
  159.    OpusGets -   Get a word from the user, no special features.
  160.    OpusGetsC -  Get a word from the user, having the C)haracter `c' already
  161.                 been entered.
  162.    OpusGetse -  Get a word from the user, E)choing the character `e' for
  163.                 every character the user types.
  164.    OpusGetsL -  Get a L)ine from the user, not utilizing linebuf, and with
  165.                 a maximum of `m' characters entered.
  166.    OpusGetsNH - Same as OpusGetsL, but no moving to the top line if
  167.                 HOTFLASH is on.
  168.    OpusGetsLe - Same as OpusGetsL, but echoes the character `e'.
  169.    OpusGetsLL - Get a L)ine from the user, but we DO utilize L)inebuf.
  170.  
  171.     KeyGet -    Gets a character, displaying it both in HOTFLASH and
  172.                 normal uses, and storing the answer in lastmenu.  The
  173.                 character must be in the string `a'.
  174.     KeyGetN -   Same as KeyGet(), provided for compatibility
  175.     KeyGetR -   Gets a character, displaying it in both help
  176.                 modes (HOTFLASH/normal), and returning the value through
  177.                 a return() call.
  178.  
  179.     KeyGetRP -  Same as KeyGetR, but displaying the prompt `p' beforehand.
  180.     KeyGetRN -  Gets a character, NOT displaying it if we're in HOTFLASH
  181.                 mode (but will display it in normal), returning the
  182.                 character via return(), and displaying no prompt.
  183.  
  184.     KeyGetRNP - Displaying the prompt `p' beforehand, gets a character,
  185.                 NOT displaying it in HOTFLASH, and zooming up to the top
  186.                 line of the screen (and back) for HOTFLASH entry, if the
  187.                 user has that mode selected.  (Otherwise, we stay put.)
  188. */
  189.  
  190. #define OpusGets(d,p)       Input(d,INPUT_word,0,0,p)
  191. #define OpusGetsM(d,m,p)    Input(d,INPUT_word,0,m,p)
  192. #define OpusGetsWNH(d,p)    Input(d,INPUT_word | INPUT_nohotflash,0,0,p)
  193.  
  194. #define OpusGetse(d,e,p)    Input(d,INPUT_word | INPUT_echo,e,0,p)
  195. #define OpusGetseNH(d,e,p)  Input(d,INPUT_word | INPUT_echo | INPUT_nohotflash,e,0,p)
  196.  
  197. #define OpusGetsC(d,c,p)    Input(d,INPUT_word | INPUT_alreadych,c,0,p)
  198. #define OpusGetsL(d,m,p)    Input(d,INPUT_nlb_line,0,m,p)
  199. #define OpusGetsNH(d,m,p)   Input(d,INPUT_nlb_line | INPUT_nohotflash,0,m,p)
  200. #define OpusGetsLe(d,m,e,p) Input(d,INPUT_nlb_line | INPUT_echo,e,m,p)
  201. #define OpusGetsLL(d,m,p)   Input(d,INPUT_lb_line,0,m,p)
  202. #define mdm_getsp(d,m)      Input(d,INPUT_msgenter | INPUT_nlb_line | INPUT_nohotflash,0,m,NULL)
  203.  
  204. #define KeyGetRNP(p)        Input_Char(CINPUT_display | CINPUT_prompt | CINPUT_hotflash | CINPUT_noxlt,p)
  205.  
  206. #define GetYnAnswer(p,t) GetListAnswer(Yn,NULL,useyforyes,t,p)
  207. #define GetyNAnswer(p,t) GetListAnswer(yN,NULL,useyforyes,t,p)
  208. #define GetYnnsAnswer(p,t) GetListAnswer(Yne,NULL,useyforyesns,t,p)
  209. #define GetYnhAnswer(h,p,t) GetListAnswer(Ynq,h,useyforyes,t,p)
  210. #define GetyNhAnswer(h,p,t) GetListAnswer(yNq,h,useyforyes,t,p)
  211.  
  212. /* Priv level definitions */
  213.  
  214. #define priv_twit         (_privs[0].name)
  215. #define priv_disgrace     (_privs[1].name)
  216. #define priv_limited      (_privs[2].name)
  217. #define priv_normal       (_privs[3].name)
  218. #define priv_worthy       (_privs[4].name)
  219. #define priv_privil       (_privs[5].name)
  220. #define priv_privel       (_privs[5].name)
  221. #define priv_favored      (_privs[7].name)
  222. #define priv_extra        (_privs[8].name)
  223. #define priv_clerk        (_privs[9].name)
  224. #define priv_asstsysop    (_privs[10].name)
  225. #define priv_sysop        (_privs[11].name)
  226. #define priv_hidden       (_privs[12].name)
  227.  
  228. /* Macros for the lock/key system.  UserHasKey() determines if a user
  229.    is carrying key `k', UserKeyOff(k) takes key `k' away from the user
  230.    (if he had it in the first place), and UserKeyOn(k) gives key `k' to
  231.    the user.  AreaHasLock() determines if the area `a' (a _sys structure)
  232.    is locked with lock `l'.                                                */
  233.  
  234. #define UserHasKey(k) (usr.key & (1 << (k)))
  235. #define UserKeyOff(k) (usr.key &= ~(1 << (k)))
  236. #define UserKeyOn(k)  (usr.key |= (1 << (k)))
  237.  
  238. #define MsgAreaHasLock(a,l)   ((a).msglock & (1 << (l)))
  239. #define FileAreaHasLock(a,l)  ((a).filelock & (1 << (l)))
  240.  
  241. #define GEPriv(p1,p2) ((signed int)(p1) >= (signed int)(p2))
  242. #define LEPriv(p1,p2) ((signed int)(p1) <= (signed int)(p2))
  243.  
  244. /* Macros for finding out the user's current time status.   timeleft is
  245.    the time (in minutes) that the user has left on the system.  timeonline
  246.    is the length (in minutes) that the current user has been on-line.      */
  247.  
  248. /*
  249. #define timeleft (((__temptime=time(NULL)) > timeoff) ? (-1) : ((int)(((signed long)timeoff-(signed long)__temptime)/60L)+1))
  250. #define timeonline ((int)((time(NULL)-(signed long)timeon)/60L))
  251. */
  252.  
  253. /* Figures out the user's graphics state, and puts it in one, single
  254.    variable.  Kludgery to get around the original Opus bitfields.         */
  255.  
  256. #define graph (usr.ansi ? GRAPHICS_ansi : (usr.avatar ? GRAPHICS_avatar : 0))
  257.  
  258. /* A macro for Goto(), and local screen display function pointers: */
  259.  
  260. #define Goto(xx,yy) Printf(goto_str,(char)(xx),(char)(yy))
  261. #define lputc(c) (*local_putc)(c)
  262. #define lputs(s) (*local_puts)(s)
  263.  
  264. /* To see if a character is an alphanumeric or punctuation... */
  265. #define isalnumpunct(ch) (! is_wd(ch))
  266.  
  267. /***************************************************************************
  268.                             Constant #define's
  269.  ***************************************************************************/
  270.  
  271. #define STATUS_normal     0x00
  272. #define STATUS_remove     0x01
  273. #define STATUS_force      0x02
  274.  
  275. #define IREADLEN            60
  276. #define MAXED_SAVE_MEM   4000L /* How much mem to save while in MaxEd */
  277. #define BORED_SAVE_MEM   4000L /* How much mem to save in BORED */
  278. #define MAXLEN    85           /* size of primary line-input buffer    */
  279. #define NORM_SCAN_TIME     15L
  280. #define CHAT_SCAN_TIME      1L
  281.  
  282. #define CMSG_page   0x00
  283. #define CMSG_enq    0x01
  284. #define CMSG_ack    0x02
  285. #define CMSG_eot    0x03
  286. #define CMSG_cdata  0x04
  287.  
  288. #define MAX_TASK  256           /* Maximus number of tasks                 */
  289. #define MAX_TRIES 20            /* # of times to retry IPCxx.BBS operation */
  290. #define MAX_OVR            16   /* Maximum # of override privs per area    */
  291. #define AREA_SIGNATURE ((unsigned char)'\xf5') /* Signature for area.id */
  292. #define MAX_MENUNAME  PATHLEN   /* Max. length of menuname[]. */
  293. #define MAX_QUOTEBUF       50   /* Maximum number of quote windows to page */
  294. #define COPY_SIZE       16384   /* Default buffer size for copy_file() */
  295. #define RST_VER             3   /* Version number of RESTARxx.BBS          */
  296. #define MAX_AREAS        1296   /* Maximum number of total areas -- This # *
  297.                                  * can't be changed, but it is handy to    *
  298.                                  * have a def. for internal calculations.  *
  299.                                  * 1296==(26+10)^2, since each of the      *
  300.                                  * two digits of the area number can be    *
  301.                                  * 0-9 or A-Z.                             */
  302. #define NUM_AIDX           80   /* Number of AREAS.IDX entries at once     */
  303. #define NUM_NDI           160   /* Number of nodelist entries to read in   */
  304. #define USR_SEARCH         32   /* Number of users to read in at a time    */
  305. #define MAX_LINE          255   /* Max. length of a .CTL file line!        */
  306. #define SCAN_BLOCK         10   /* # of msgs to read in from scanfile at   *
  307.                                  * once                                    */
  308. #define MAX_MSGDISPLAY     26   /* Max # of lines that Msg_Display() will  *
  309.                                  * req. from Msg_Read_Lines at once.       */
  310. #define MAX_MSGLINES      256   /* Max # of lines you can req. from        *
  311.                                  * Msg_Read_Lines at once.                 */
  312. #define MAX_MSGWIDTH      129   /* Max. width of each message line */
  313. #define MAX_PRINTF        256   /* Max. number of output ...printf() chars */
  314. #define SEEK_SIZE          64   /* # of bytes of ZIPfile to search for     *
  315.                                  * header in at a time.  This MUST not     *
  316.                                  * be higher than 64, 'bcuz we may get     *
  317.                                  * into problems with NESTED ZIPfiles if   *
  318.                                  * it is any larger.                       */
  319. #define MAX_NEST            8   /* Max. number of .BBS files to nest.      *
  320.                                  * We can go more, but we'd have to        *
  321.                                  * increase the stack size quite a bit!    */
  322. #define MAX_BUSYLOOP       15   /* Max. number of times we should loop     *
  323.                                  * waiting for a file to become un-busy    */
  324. #define FILEBUFSIZ        512   /* Size of display-file read-in buffer     */
  325. #define FWD_BUFSIZ        512   /* #ofbytes to copy at a time for msg. fwd */
  326. #define FWD_OVERLAP        40   /* #ofbytes to overlap for msg. fwd        */
  327. #define CHANGE_SCREENLEN   85   /* # of #'s to print when testing user's   *
  328.                                  * screen length.                          */
  329. #define TIMEOUT           240   /* #of seconds for input timeout! (4 min.) */
  330. #define RETIMEOUT          60   /* #of seconds until hangup after 1st      *
  331.                                  * timeout warning (1 min.)                */
  332. #define MAX_EXECARGS       64   /* Max. number of parameters when invoking *
  333.                                  * an external program                     */
  334. #define BMSGBUFLEN (MSGBUFLEN*3) /* Amount to allow for msgbuffer          */
  335. #define MSGBUFLEN         512   /* Max. num of characters of message to    *
  336.                                  * hold at any one time.  No less than 80  */
  337. #define WORDBUFLEN         60   /* Length of wordwrap buffer               */
  338. #define DEFAULT_ATTR        3   /* Cyan on black                           */
  339. /* #define NONSTOP            18*/   /* Code returned which means nonstop       */
  340. #define PATHLEN           120   /* MAXIMUM length of any path\filename.ext */
  341. #define BUFLEN             80   /* Size of primary line input buffer       */
  342. #define PROMPTLEN          90   /* Max. length of any prompt               */
  343.  
  344.  
  345. /* With a 64K data seg, we only have enough room to hold 1500 msgs. */
  346.  
  347. #if defined(__NEARDATA__)
  348. #define MAX_MSG          1500   /* Max. # of messages in one area          */
  349. #elif defined(__FARDATA__)
  350. #define MAX_MSG          4000   /* Max. # of messages in one area          */
  351. #else
  352. #error I don't know what model I'm in.  (Include compiler.h maybe?)
  353. #endif
  354.  
  355. #define DLE                16   /* DLE character used in BBS file display  */
  356. #define PREREGISTERED  0x7530   /* Priv. value that means let no new       *
  357.                                  * callers on the system.                  */
  358.  
  359. /***************************************************************************
  360.                    Bit Masks and Function Behaviour Controls
  361.  ***************************************************************************/
  362.  
  363. #define DISPLAY_none      0x00 /* Nothing special for display */
  364. #define DISPLAY_filesbbs  0x01 /* If displaying a FILES.BBS */
  365. #define DISPLAY_newfiles  0x02 /* If only displaying new files */
  366. #define DISPLAY_search    0x04 /* If we're searching FILES.BBS for text */
  367. #define DISPLAY_areaname  0x08 /* If we display area name for each area */
  368. #define DISPLAY_hotmenu   0x10 /* */
  369. #define DISPLAY_pcall     0x20 /* Increment the #-of-callers count */
  370. #define DISPLAY_menuhelp  0x40 /* If we should use menuhelp for usr.help */
  371.  
  372. #define STATUS_available  0x00 /* For Who_Is_On() */
  373. #define STATUS_notavail   0x01
  374. #define STATUS_filexfer   0x02
  375. #define STATUS_msgenter   0x03
  376.  
  377. #define SCROLL_up         0x06 /* Modes for VioScroll() */
  378. #define SCROLL_down       0x07
  379.  
  380. #define MSGLINE_normal    0x00 /* Type of line currently being displayed  */
  381. #define MSGLINE_seenby    0x01 /* in message...                           */
  382. #define MSGLINE_kludge    0x02 /*                                         */
  383. #define MSGLINE_quote     0x04 /*                                         */
  384. #define MSGLINE_end       0x08 /*                                         */
  385. #define MSGLINE_soft      0x10 /* Soft C/R (wordwrapped)                  */
  386.  
  387. #define DIRECTION_previous 0x00 /* Direction of message reading            */
  388. #define DIRECTION_next    0x01 /*                                         */
  389.  
  390. #define CTL_none          0x00 /* What type of .CTL to generate for       */
  391. #define CTL_normal        0x01 /* external programs.                      */
  392. #define CTL_upload        0x02
  393. #define CTL_download      0x03
  394.  
  395. #define OUTSIDE_errorlevel 0x01 /* Method to use for outside command!      */
  396. #define OUTSIDE_chain     0x02
  397. #define OUTSIDE_run       0x03
  398. #define OUTSIDE_dos       0x04
  399. #define OUTSIDE_concur    0x05
  400. #define OUTSIDE_reread    0x40 /* Re-read LASTUSxx.BBS after execution */
  401. #define OUTSIDE_stay      0x80 /* Stay in current directory when going out! */
  402.  
  403. #define GRAPHICS_none     0x00 /* The current user's graphics setting...  */
  404. #define GRAPHICS_ansi     0x01 /* Use to compare with `graph'!            */
  405. #define GRAPHICS_avatar   0x02
  406.  
  407. #define LINE_restore      0x00 /* Tells TopLine() what to do              */
  408. #define LINE_top          0x01
  409.  
  410. #define MENU_msg          0x01 /* The currently-loaded menu is...         */
  411. #define MENU_file         0x02
  412. #define MENU_other        0x03
  413.  
  414. #define ENTRY_false       0x00 /* If we're not entering current msg. area */
  415. #define ENTRY_true        0x01 /* If we ARE just entering current area    */
  416. #define ENTRY_noheader    0x02 /* Equal to ENTRY_true, but we just don't  *
  417.                                 * print anything when we re-scan.         */
  418. #define ENTRY_nocheck     0x03 /* Don't re-read area's info.              */
  419. #define ENTRY_nohdr       0x04 /* Same as noheader, but no display at all */
  420. #define ENTRY_nohdre      0x05 /* Same as above, but enter area           */
  421. #define ENTRY_nochecke    0x06 /* Same as nocheck, but enter area         */
  422.  
  423. #define ERROR_minfile        2 /* The different errorlevel exits we use   */
  424. #define ERROR_file           3 /* for various reasons.                    */
  425. #define ERROR_nofossil       3
  426. #define ERROR_param          3
  427. #define ERROR_critical       3
  428. #define ERROR_recycle        2
  429.  
  430. #define VIDEO_dos         0x00 /* Specifies type of local video, used for */
  431. #define VIDEO_fossil      0x01 /* `displaymode'.                          */
  432. #define VIDEO_ibm         0x02
  433. #define VIDEO_fast        0x03 /*                                         */
  434.  
  435. #define SKIP_none            0 /* For the ^Pxxx commands in .BBS files.   */
  436. #define SKIP_file            1
  437. #define SKIP_line            2
  438.  
  439. #define ARCHIVE_arc       0x00 /* An .ARC                                 */
  440. #define ARCHIVE_lzh       0x01 /* A .LZH                                  */
  441.  
  442.  
  443.  
  444. /* Definitions for the Input() function.  Remember to use no more than ONE
  445.    of `INPUT_echo' or `INPUT_alreadych'!                                   */
  446.  
  447. #define INPUT_lb_line     0x0001 /* Input a line, utilizing linebuf         */
  448. #define INPUT_nlb_line    0x0002 /* Input a line, NOT utilizing linebuf     */
  449. #define INPUT_word        0x0004 /* Input a word, utilizing linebuf         */
  450.  
  451. #define INPUT_echo        0x0008 /* `ch' contains character to echo back.  */
  452. #define INPUT_alreadych   0x0010 /* `ch' contains a character that has     *
  453.                                   * already been entered by the user.      */
  454. #define INPUT_nohotflash  0x0020 /* Don't go up to the top line of screen! */
  455. #define INPUT_noctrlc     0x0040 /* Don't allow user to ^C to dump output  *
  456.                                   * and redisplay prompt.                  */
  457. #define INPUT_msgenter    0x0080 /* If we're currently entering message    *
  458.                                   * header info, and the arrow keys are    *
  459.                                   * allowed to do something...             */
  460. #define INPUT_nolf        0x0100 /* Don't send LF at end of input function */
  461. #define INPUT_msgread     0x0200 /* Allow Prev/Next arrow keys             */
  462. #define INPUT_wordwrap    0x0400 /* Word-wrap this string                  */
  463.  
  464.  
  465.  
  466. /* Definitions for the Input_Char() function.  Remember to use no more than
  467.    ONE of `CINPUT_acceptable' or `CINPUT_prompt'!                          */
  468.  
  469.  
  470. #define CINPUT_display    0x0001  /* If we display the character entered, if *
  471.                                  * we're in hotkey mode.  If we're not, we *
  472.                                  * *always* display the characters entered */
  473.  
  474. #define CINPUT_acceptable 0x0002 /* `extra' specifies a list that the       *
  475.                                   * entered character must be one of.       *
  476.                                   * Otherwise, we re-prompt and ask again.  */
  477. #define CINPUT_prompt     0x0004 /* Display the prompt `extra' before       *
  478.                                   * trying to get the character.            */
  479. #define CINPUT_lastmenu   0x0008 /* If set, we set `lastmenu' to be the     *
  480.                                   * character the user pressed.  Otherwise, *
  481.                                   * we simply return() it.                  */
  482. #define CINPUT_hotflash   0x0010 /* If we should go up to the top line (for *
  483.                                   * HOTFLASH), or just stay where we are)   */
  484. #define CINPUT_noxlt      0x0020 /* Don't translate special characters,     *
  485.                                   * such as \r and \n, into their ASCII     *
  486.                                   * equivilents.  (ie. '\r'=='|')           */
  487. #define CINPUT_noctrlc    0x0040 /* Don't allow user to ^C to dump output   *
  488.                                   * and redisplay prompt.                   */
  489. #define CINPUT_p_ctrlc    0x0080 /* Only display prompt if user ^C's...     */
  490. #define CINPUT_nolf       0x0100 /* Don't display LF */
  491. #define CINPUT_fullprompt 0x0200 /* The GetListAnswer() o_prompt parm does  *
  492.                                   * include the choices                     */
  493. #define CINPUT_allanswers 0x0400 /* If we need an answer or not             */
  494. #define CINPUT_dump       0x0800 /* DUMP output once we get a character     */
  495. #define CINPUT_msgread    0x1000 /* Arrow keys for msg.reading              */
  496. #define CINPUT_iread      0x2000
  497.  
  498.  
  499.  
  500. #define LAST_none         0x00  /* Used in SILT to control the status      */
  501. #define LAST_section      0x01  /* display.                                */
  502. #define LAST_area         0x02
  503. #define LAST_menu         0x03
  504.  
  505. #define RESTART_menu      0x00  /* If restarting at a menu                */
  506. #define RESTART_dotbbs    0x01  /* If restarting in middle of .BBS file   */
  507.  
  508. #define NUM_MENU           256  /* Max. # of options in a menu file       */
  509.  
  510. #define bit   unsigned
  511. #define sword signed int
  512. #define word  unsigned int
  513. #define dword long int
  514. #define byte  unsigned char
  515.  
  516. /* Defines for *.MNU: */
  517.  
  518. #define AREATYPE_local    0x01  /* Tells which type (and which type ONLY)  */
  519. #define AREATYPE_matrix   0x02  /* that command can be used in.            */
  520. #define AREATYPE_echo     0x04
  521. #define AREATYPE_all      (AREATYPE_local | AREATYPE_matrix | AREATYPE_echo)
  522.  
  523. #define HEADER_none       0x00  /* The header type for each menu.          */
  524. #define HEADER_message    0x01
  525. #define HEADER_file       0x02
  526. #define HEADER_change     0x03
  527. #define HEADER_chat       0x04
  528.  
  529. #define OFLAG_nodsp       0x0001 /* Don't display menu option on MENU, but */
  530.                                  /* accept it as a command.                */
  531. #define OFLAG_ctl         0x0002 /* Produce a .CTL file for this xtern cmd */
  532. #define OFLAG_nocls       0x0004 /* Don't do a CLS for this display_menu   */
  533. #define OFLAG_then        0x0008 /* Do only if last IF equation was true   */
  534. #define OFLAG_else        0x0010 /* Do only if last IF equation was FALSE  */
  535. #define OFLAG_ulocal      0x0020 /* Only display for local users           */
  536. #define OFLAG_uremote     0x0040 /* Only display for remote useres         */
  537. #define OFLAG_reread      0x0080 /* Re-read LASTUSER.BBS upon re-entry     */
  538.  
  539.  
  540. /* A few colours to make things easier on ME, the programmer.  These are   *
  541.  * used all over the place, and made AVATAR commands a helluvalot easier   *
  542.  * to deal with.  Unfortunately, if you don't have an ANSI compiler,       *
  543.  * you're pretty well out of luck!                                         */
  544.  
  545. /* Standard colours: */
  546.  
  547. #define BLACK        "\x16\x01\x00"
  548. #define BLUE         "\x16\x01\x01"
  549. #define GREEN        "\x16\x01\x02"
  550. #define CYAN         "\x16\x01\x03"
  551. #define RED          "\x16\x01\x04"
  552. #define MAGENTA      "\x16\x01\x05"
  553. #define BROWN        "\x16\x01\x06"
  554. #define GRAY         "\x16\x01\x07"
  555. #define GREY         "\x16\x01\x07"
  556. #define LBLACK       "\x16\x01\x08"
  557. #define LBLUE        "\x16\x01\x09"
  558. #define LGREEN       "\x16\x01\x0a"
  559. #define LCYAN        "\x16\x01\x0b"
  560. #define LRED         "\x16\x01\x0c"
  561. #define LMAGENTA     "\x16\x01\x0d"
  562. #define YELLOW       "\x16\x01\x0e"
  563. #define WHITE        "\x16\x01\x0f"
  564.  
  565. /* Special AVATAR sequences: */
  566.  
  567. #define BLINK        "\x16\x02"
  568. #define CLS          "\x0c"
  569. #define CLEOL        "\x16\x07"
  570. #define UP           "\x16\x03"
  571. #define DOWN         "\x16\x04"
  572. #define LEFT         "\x16\x05"
  573. #define RIGHT        "\x16\x06"
  574.  
  575. /* Now some special colours that we use: */
  576.  
  577. #define BLKONWHIT    "\x16\x01\x70"
  578. #define REDONWHIT    "\x16\x01\x74"
  579. #define WHITONWHIT   "\x16\x01\x77"
  580. #define MAGONBLUE    "\x16\x01\x1d"
  581. #define WHITONBLUE   "\x16\x01\x1f"
  582. #define YELONBLUE    "\x16\x01\x1e"
  583. #define DKGRAYONWHIT "\x16\x01\x78"
  584. #define CHATTR       "\x16\x01%c"
  585.  
  586. /***************************************************************************
  587.                        Definitions for MaxEd and Bored
  588.  ***************************************************************************/
  589.  
  590. /* #define UPDATE_POSITION*/     /* Whether or not we want to have a        *
  591.                                  * display in the lower-right hand corner  *
  592.                                  * of the screen, telling the current      *
  593.                                  * cursor position.  (Default OFF, too     *
  594.                                  * slow from remote!)                      */
  595.  
  596. #define SAVE               0x00 /* Return codes from the editor...         */
  597. #define ABORT              0x01
  598. #define NOTHING            0x02
  599.  
  600. #define LOCAL_EDIT         0x03 /* Returned ONLY by Editor() func, passed  *
  601.                                  * back through Local_Editor().            */
  602.  
  603. #define HARD_CR           '\x0d'/* User pressed C/R here, insert into      *
  604.                                  * the actual message.                     */
  605. #define SOFT_CR           '\x8d'/* Local wordwrap, don't bother storing    *
  606.                                  * it in the messages.                     */
  607.  
  608. #define MODE_UPDATE           0 /* Update position after wordwrap          */
  609. #define MODE_NOUPDATE         1 /* Don't update position after wordwrap    */
  610. #define MODE_SCROLL           2 /* Update position, and scroll if          *
  611.                                  * necessary!                              */
  612.  
  613. #define QUOTELINES            4 /* Number of lines to quote at a time      */
  614. #define MAX_LINES           100 /* Maximum number of lines in file         */
  615. #define MAX_LINELEN (LINELEN*2) /* Double the length of line which can     *
  616.                                  * possibly be entered in editor.          */
  617. #define LINELEN              80 /* Max. length of line to use              */
  618. #define MAX_WRAPLEN          35 /* Length of largest word to wordwrap      */
  619. #define UPDATEBUF_LEN (MAX_LINES+26) /* # of update_table entries          */
  620.  
  621. #define SCROLL_LINES (usrlen-4)     /* Number of lines to scroll down or up */
  622. /* used to be (usrlen/3)*2) */      /* for any given command which goes past*/
  623.                                     /* screen boundaries.                   */
  624.  
  625. #define SCROLL_CASUAL (usrlen >> 1)  /* Half of screen for casual scroll    */
  626.  
  627. /* Go left XX characters */
  628. #define Cursor_LeftM(n) {Goto(current_line,current_col-(n)); cursor_y -= min(cursor_y-1,n);}
  629.  
  630. /*--------------------------------------------------------------------------*/
  631. /* Access levels                                                            */
  632. /*--------------------------------------------------------------------------*/
  633.  
  634. /*
  635.    When adding priv levels, don't forget to change the following files:
  636.  
  637.        MAX_DISP.C
  638.        MAX_UED.C
  639.        MAX_MISC.C
  640.        MAX_SELU.C (don't forget priv_up(), priv_down()!)
  641.        MAX_LOG.C
  642.        MAX_IN.C
  643.        MAX_V.H
  644.        SILT.C
  645. */
  646.  
  647.    #define  TWIT        -2 /* 0xFFFE */
  648.    #define  DISGRACE    0x0000
  649.    #define  LIMITED     0x0001  /**/
  650.    #define  NORMAL      0x0002
  651.    #define  WORTHY      0x0003  /**/
  652.    #define  PRIVIL      0x0004
  653.    #define  FAVORED     0x0005  /**/
  654.    #define  EXTRA       0x0006
  655.    #define  CLERK       0x0007  /**/
  656.    #define  ASSTSYSOP   0x0008
  657.    #define  SYSOP       0x000A
  658.  
  659. #ifdef NUMBER_PRIVS
  660.    #define  HIDDEN      0x7fff
  661. #else
  662.    #define  HIDDEN      0x000b
  663. #endif
  664.  
  665.  
  666. /***************************************************************************
  667.                        Structure Definitions
  668.  ***************************************************************************/
  669.  
  670. /*--------------------------------------------------------------------------*/
  671. /* Nodelist.Idx                                                             */
  672. /* (File is terminated by EOF)                                              */
  673. /*--------------------------------------------------------------------------*/
  674. struct _ndi
  675.    {
  676.       sword node;          /* node number  */
  677.       sword net;           /* net number   */
  678.    };
  679.  
  680.  
  681. /*--------------------------------------------------------------------------*/
  682. /* FIDONET ADDRESS STRUCTURE                                                */
  683. /*--------------------------------------------------------------------------*/
  684. typedef struct _ADDRESS
  685.    {
  686.      sword Zone;
  687.      sword Net;
  688.      sword Node;
  689.      sword Point;
  690.    } ADDR;
  691.  
  692.  
  693.  
  694. /*--------------------------------------------------------------------------*/
  695. /* System?.Bbs structure                                                    */
  696. /* Please note that the `_sys' structure should NOT be considered stable.   */
  697. /*--------------------------------------------------------------------------*/
  698. struct _sys
  699. {
  700.     word ls_caller;        /* Used in SYSTEM.BBS only: number of callers    */
  701.     sword priv;            /* Minimum privs required to get to the area     */
  702.     byte msgpath[40];      /* Path to messages                              */
  703.     byte bbspath[40];      /* Path to BBS/GBS files *or* the barricade file */
  704.     byte hlppath[40];      /* Path to the user-help system                  */
  705.     byte uppath[40];       /* Path to the file upload sub-directory         */
  706.     byte filepath[40];     /* Path to the file download sub-directory       */
  707.     word attrib;           /* Area attribute (see below)                    */
  708.     byte lock;             /*                                               */
  709.     byte filler;           /* Free space for another kludge...              */
  710.     long quote_pos;        /* Position of next usable byte in Quote file    */
  711. };
  712.  
  713.  
  714. #include "utime.h"
  715.  
  716. #include "max_u.h"        /* USER.BBS structure */
  717. #include "option.h"       /* Menu option enumeration */
  718.  
  719. /* An individual menu option.  There are many of these contained in one    *
  720.  * _menu file, following the _menu data header, optionally with some       *
  721.  * NULL-terminated strings between each _opt structure, for the argument.  */
  722.  
  723. struct _opt
  724. {
  725.   option type;  /* What this menu option does...                           */
  726.  
  727.   word arglen,  /* Length of this command's argument, if any               */
  728.        priv;    /* Priv level required to execute this command             */
  729.  
  730.   byte areatype,/* If this particular option can only be used if the user  *
  731.                  * is in a certain message-area type.                      */
  732.        lock;    /* Bit-field locks for this particular menu option         */
  733.  
  734.   word flag;    /* See the OFLAG_xxx contants for more info.               */
  735.  
  736.   byte name[20];/* The menu option, as it appears to the user.             */
  737.  
  738.   byte far *keypoke;/* Auto-keypoke string                                 */
  739.   byte kp_len;  /* Length of keypoke                                       */
  740.  
  741.   byte rsvd[4]; /* Reserved for future uses */
  742. };
  743.  
  744.  
  745. struct _menu
  746. {
  747.   word header,      /* What to display when the user enters menu, such as  *
  748.                      * "The MESSAGE Section", "The CHG SETUP Section", etc */
  749.        num_options, /* Total number of options (struct _opt's) in menu     */
  750.        menu_length; /* Number of lines long the .?BS menu file is!         */
  751.  
  752.   sword hot_colour; /* What colour to display if a user uses hotkeys to    *
  753.                      * bypass a .?BS menu display, before displaying the   *
  754.                      * key.  -1 == display nothing.                        */
  755.  
  756.   word title_len;   /* Length of the title string, not counting \0.        */
  757.   byte *title;      /* The name of the menu */
  758.  
  759.   word headfile_len;/* Length of the header filename, not counting \0      */
  760.   byte *headfile;   /* File to display when first entering menu            */
  761.  
  762.   word dspfile_len; /* Length of the dspfile filename, not counting \0.    */
  763.   byte *dspfile;    /* Name of file to display for menu, instead of        *
  764.                      * generating menu from .Mnu file.                     */
  765.  
  766.   struct _opt *options[NUM_MENU];
  767.   byte *arg[NUM_MENU];
  768.  
  769.   byte rsvd[16];   /* Reserved by Maximus for future uses */
  770. };
  771.  
  772.  
  773.  
  774. #define STATS_VER           0   /* Version number of the BBSTATxx.BBS file */
  775.  
  776. struct _bbs_stats
  777. {
  778.   byte    version;      /* Version number of BBSTATxx.BBS file */
  779.   dword   num_callers;
  780.   dword   quote_pos;
  781.   dword   msgs_written;
  782.   time_t  online_date;
  783.   dword   total_dl;
  784.   dword   total_ul;
  785. };
  786.  
  787.  
  788.  
  789.  
  790. #include "prm.h"    /* MAX.PRM structure */
  791.  
  792.  
  793. struct _aidx
  794. {
  795.   word  area;       /* Same format as area.areano */
  796.   dword offset;
  797.   dword name_crc;   /* Currently undefined, but reserved by Maximus.       *
  798.                      * This will probably become a CRC-32 of the           *
  799.                      * area.name string, below... but is currently not     *
  800.                      * implemented.                                        */
  801. };
  802.  
  803.  
  804. #ifdef NEVER
  805.  
  806. /*  NOTE:  The _area structure has a dynamic length!  To access this file, *
  807.  *         you should read the first _area structure from the file, and    *
  808.  *         check the struct_len byte.  Then, to access the file, you seek  *
  809.  *         to each new location, instead of reading straight through.      *
  810.  *                                                                         *
  811.  *         For example, to read all of the _area file into an array, you   *
  812.  *         MUST do it like this, for upward compatiblity:                  */
  813.  
  814.   {
  815.     struct _area area[NUM_AREAS];
  816.  
  817.     int x,
  818.         slen;
  819.  
  820.     if ((areafile=open(area_name,O_RDONLY | O_BINARY))==-1)
  821.       Error();
  822.  
  823.     /* Read the first record of the file, to grab the structure-length     *
  824.      * byte.                                                               */
  825.  
  826.     read(areafile,&area[0],sizeof(struct _area));
  827.     slen=area[0].struct_len;
  828.  
  829.     for (x=0;! eof(area_data);x++)
  830.     {
  831.       /* Note this lseek() call, which positions the pointer to the        *
  832.        * start of the next record, no matter how long the previous         *
  833.        * record was.                                                       */
  834.  
  835.       lseek(areafile,x*(long)struct_len,SEEK_SET);
  836.       read(areafile,&area[x],sizeof(struct _area));
  837.     }
  838.  
  839.     close(areafile);
  840.   }
  841.  
  842. #endif
  843.  
  844.  
  845. struct _override
  846. {
  847.   int priv;   /* Override priv level */
  848.   byte lock;  /* Override lock setting */
  849.  
  850.   byte ch;    /* First letter of menu option to apply override to */
  851. };
  852.  
  853.  
  854.  
  855. #define AREA_id   0x54414441L /* "ADAT" */
  856.  
  857. struct _area
  858. {
  859.   long id;              /* Unique identifier for AREA.DAT structure.       *
  860.                          * Should be AREA_id, above.                       */
  861.  
  862.   word struct_len;      /* Length of _area structure -- this needs only    *
  863.                          * to be read from the first record in an area     *
  864.                          * data file, since it can be assumed to remain    *
  865.                          * the same throughout the entire file.  This is   *
  866.                          * GUARANTEED to be at offset two for all future   *
  867.                          * versions of this structure.                     */
  868.  
  869.   word areano;          /* This is the integer representation of this      *
  870.                          * area's name, and will be obsoleted very         *
  871.                          * shortly, even though the current version of     *
  872.                          * Maximus uses this internally.  Use the 'name'   *
  873.                          * element instead:  It is a standard string, and  *
  874.                          * is what will be supported in future versions.   *
  875.                          * One of the items on our "To Do" list is to      *
  876.                          * completely go with area names.  This means that *
  877.                          * we'll be using a string for an area "number",   *
  878.                          * and it could theoretically be as long as could  *
  879.                          * fit in the 'name' variable, as long as it is a  *
  880.                          * single word.  ie. "BinkleyTerm" could be a      *
  881.                          * valid area name!  By using the 'name' element   *
  882.                          * as a straight ASCII string, you'll have         *
  883.                          * automatic support for future versions of Max.   */
  884.  
  885.   byte name[40];        /* String format of area's name.  USE THIS!        */
  886.  
  887.   /*************************************************************************/
  888.   /**                        Message Area Information                     **/
  889.   /*************************************************************************/
  890.  
  891.   word area_type;       /* Message base type.  0x00 = *.MSG.  Others are   *
  892.                          * currently undefined, and rsvd by Maximus.       */
  893.  
  894.   byte msgpath[80],     /* Path to messages                                */
  895.        msgname[40],     /* The 'tag' of the area, for use in ECHOTOSS.LOG  */
  896.        msginfo[80],     /* The DIR.BBS-like description for msg section    */
  897.        msgbar[80],      /* Barricade file for message area                 */
  898.        origin[62];      /* The ORIGIN line for this area                   */
  899.  
  900.   sword msgpriv;        /* This is the priv required to access the msg     *
  901.                          * section of this area.                           */
  902.   byte msglock;         /* The lock for the message area                   */
  903.  
  904.   byte fill1;
  905.  
  906.   sword origin_aka;     /* This is the AKA number to use on the origin     *
  907.                          * line.  See the normal SysOp documentation on    *
  908.                          * the "Origin" statement, for info on how this    *
  909.                          * number is used.                                 */
  910.  
  911.   /*************************************************************************/
  912.   /**                        File Area Information                        **/
  913.   /*************************************************************************/
  914.  
  915.  
  916.   byte filepath[80],    /* Path for downloads                              */
  917.        uppath[80],      /* Path for uploads                                */
  918.        filebar[80],     /* Barricade file for file areas                   */
  919.        filesbbs[80],    /* Path to FILES.BBS-like catalog for this area    */
  920.        fileinfo[80];    /* The DIR.BBS-like description for file section   */
  921.  
  922.   sword filepriv;       /* This is the priv required to access the file    *
  923.                          * section of this area.                           */
  924.   byte filelock;        /* The locks for the file area                     */
  925.   byte fill2;
  926.  
  927.   /*************************************************************************/
  928.   /**                      Miscellaneous Information                      **/
  929.   /*************************************************************************/
  930.  
  931.  
  932.   byte msgmenuname[13], /* Alternate *.MNU name to use for this msg.area   */
  933.        filemenuname[13];/* Alternate *.MNU name to use for this file area  */
  934.  
  935.   word attrib[MAXCLASS];/* This is an array of attributes for the          *
  936.                          * msg/file areas.  These are dependant on PRIV    *
  937.                          * level.  Once you have the CLASS number for a    *
  938.                          * particular user (via Find_Class_Number()), you  *
  939.                          * can find the attributes for that particular     *
  940.                          * priv level like this: "area.attrib[class]"      *
  941.                          * ...which will get you the attribute for that    *
  942.                          * priv level.                                     */
  943.  
  944.   /*************************************************************************/
  945.   /**                      Stuff hacked on later                          **/
  946.   /*************************************************************************/
  947.  
  948.   struct _override movr[MAX_OVR]; /* Override privs for msg/file areas */
  949.   struct _override fovr[MAX_OVR];
  950.  
  951. };
  952.  
  953.  
  954.  
  955.  
  956.  
  957. /* ChatFind...() handle.  Only used internally. */
  958.  
  959. struct _cgs
  960. {
  961.   int ptr,
  962.       num_tid;
  963.  
  964.   int tids[255];
  965. };
  966.  
  967.  
  968. /* IPCxx.BBS header structure (see MAX_CHAT.C) */
  969.  
  970. struct _cstat
  971. {
  972.   int avail;
  973.  
  974.   char username[36],
  975.        status[80];
  976.  
  977.   int msgs_waiting;
  978.  
  979.   long msg_offset;
  980.   int msglen;
  981. };
  982.  
  983.  
  984.  
  985. /* Data element in IPCxx.BBS file (see MAX_CHAT.C) */
  986.  
  987. struct _cdat
  988. {
  989.   int tid,
  990.       type,
  991.       len;
  992.  
  993.   long prior_offset;
  994.   int prior_len;
  995. };
  996.  
  997. /* Handle for saving CHAT status.  Mainly used internally, but also        *
  998.  * in RESTARxx.BBS.                                                        */
  999.  
  1000. struct _css
  1001. {
  1002.   int avail;
  1003.   char status[80];
  1004. };
  1005.  
  1006.  
  1007. /* NOTE: The following structure is not completely stable.  Unless         *
  1008.  * rst.rst_ver is equal to RST_VER, then the ONLY items you're guaranteed  *
  1009.  * to be able to read are those marked with "*STABLE*".  Those items       *
  1010.  * are guaranteed to be stored at those offsets for all future versions    *
  1011.  * of Maximus, regardless of the version number.  However, everything      *
  1012.  * else is likely to change at a moment's notice.                          */
  1013.  
  1014. struct _restart
  1015. {
  1016.   char rst_ver; /* Version number of restart data               *STABLE*   */
  1017.  
  1018.   long timeon,  /* Date user got on system, seconds since 1970  *STABLE*   */
  1019.        timeoff, /* Date user must be OFF system, secs since '70 *STABLE*   */
  1020.        restart_offset; /* Offset in .BBS file to restart at     *STABLE*   */
  1021.  
  1022.   unsigned long baud,     /* User's baud rate                   *STABLE*   */
  1023.                 max_time; /* Max time, as given by '-t' param   *STABLE*   */
  1024.  
  1025.   int port;               /* Current COM port, 0=COM1, 1=COM2,  *STABLE*   */
  1026.  
  1027.   char written_echomail,  /* 0=user HASN'T written echomail     *STABLE*   */
  1028.        written_matrix,    /* 0=user HASN'T entered matrix msg   *STABLE*   */
  1029.        local;             /* 0=NOT local                        *STABLE*   */
  1030.  
  1031.   struct _stamp laston;   /* Time the user was last on system   *STABLE*   */
  1032.  
  1033.   long starttime,         /* Start time, for external protocol             */
  1034.        timestart;         /* Time when MAX.EXE was started                 */
  1035.  
  1036.   char restart_type,      /* 1 if started via .BBS file, 0 otherwise       */
  1037.        restart_name[PATHLEN], /* Name of .BBS file to restart in           */
  1038.        menuname[PATHLEN], /* Name of current menu                          */
  1039.        menupath[PATHLEN], /* The current menu path                         */
  1040.        firstname[36],     /* The user's first name                         */
  1041.        next_ldate[19],    /* Date to insert in usr.ldate when s/he logs off*/
  1042.        last_onexit[PATHLEN], /* The 'onexit' filename for current .BBS file*/
  1043.        parm[PATHLEN],     /* Parms for external program, if any            */
  1044.        fix_menupath[PATHLEN], /* Readjust menu name                        */
  1045.        last_name[MAX_MENUNAME], /* Name of the last menu                   */
  1046.        lastmenu,          /* Last ^oR menu choice                          */
  1047.        snoop,             /* If snoop is currently on or off               */
  1048.        locked,            /* If priv is locked via keyboard 'L' command    */
  1049.        locked2,           /* If priv locked via barricade                  */
  1050.        keyboard,          /* If the Sysop's keyboard is turned on          */
  1051.        protocol_letter,   /* Letter representing current protocol choice   */
  1052.        chatreq,           /* If user wanted to chat with SysOp             */
  1053.        mn_dirty,          /* If menuname buf is dirty                      */
  1054.        barricade_ok;      /* If current barricade area is OK               */
  1055.  
  1056.   int usr_time,           /* User's usr.time value                         */
  1057.       usernum,            /* User's user number                            */
  1058.       ultoday,            /* Number of k-bytes uploaded today              */
  1059.       lockpriv,           /* If rst.locked (above), then this is real priv */
  1060.       lockpriv2,          /* If rst.locked2, then this is real priv        */
  1061.       ctltype;            /* Control-file type (for xternal protocol)      */
  1062.  
  1063.   unsigned int current_baud; /* User's baud rate, as a mask for mdm_baud() */
  1064.  
  1065.   /* Bit flags for ECHOTOSS.LOG */
  1066.   char echo_written_in[(MAX_AREAS/CHAR_BITS)+1];
  1067.  
  1068.   struct _area area;
  1069.   struct _css css;
  1070. };
  1071.  
  1072.  
  1073. #ifdef DMALLOC
  1074. #include "dmalloc.h"
  1075. #endif
  1076.  
  1077.  
  1078. /***************************************************************************
  1079.                       Global Variables and Constant Strings
  1080.  ***************************************************************************/
  1081.  
  1082. #ifndef NOVER
  1083. #include "max_vr.h"  /* Version information */
  1084. #endif
  1085.  
  1086. #include "max_p.h"   /* Protocol definitions */
  1087.  
  1088. #ifndef NOVARS
  1089. #include "max_v.h"   /* All of our external variables */
  1090. #endif
  1091.  
  1092. char *zalloc();
  1093. char *receive_file (char *fpath, char *fname, char protocol);
  1094.  
  1095. #undef extrn
  1096. #undef IS
  1097. #undef LEN
  1098.  
  1099. #ifndef MAX_NOPROTO
  1100. #include "proto.h"
  1101. #endif
  1102.  
  1103. /* The rest of this junk is from OPUS.H: */
  1104.  
  1105. /*--------------------------------------------------------------------------*/
  1106. /*               The Opus Computer-Based Conversation System                */
  1107. /*       (c) Copyright 1986, Wynn Wagner III, All Rights Reserved           */
  1108. /*                                                                          */
  1109. /*                                                                          */
  1110. /*                   YOOHOO is a trademark of Wynn Wagner III               */
  1111. /*                                                                          */
  1112. /*                        YOOHOO-YOOHOO/2U2 & WaZOO are                     */
  1113. /*           Copyright 1987, Wynn Wagner III, All Rights Reserved           */
  1114. /*                                                                          */
  1115. /*                                                                          */
  1116. /*                                                                          */
  1117. /* This material is available for use by anybody with no strings and        */
  1118. /* no guarantees.                                                           */
  1119. /*                                                                          */
  1120. /*--------------------------------------------------------------------------*/
  1121.  
  1122.  
  1123. /*--------------------------------------------------------------------------*/
  1124. /* NodeList.Sys                                                             */
  1125. /*                                                                          */
  1126. /*    NET > 0 and NODE > 0    Normal node                                   */
  1127. /*                                                                          */
  1128. /*    NET > 0 and NODE <= 0   Host node                                     */
  1129. /*                               Net host........node== 0                   */
  1130. /*                               Regional host...node==-1                   */
  1131. /*                               Country host....node==-2                   */
  1132. /*                                                                          */
  1133. /*    NET == -1      Nodelist.Sys revision                                  */
  1134. /*                                                                          */
  1135. /*    NET == -2      Nodelist statement                                     */
  1136. /*                                                                          */
  1137. /*--------------------------------------------------------------------------*/
  1138.  
  1139.  
  1140. /*--------------------------------------------------------------------------*/
  1141. /* NODE                                                                     */
  1142. /* Please note the NewStyle structure (below).  Time is running out for the */
  1143. /* existing `_node' structure!  Opus currently uses the old style node      */
  1144. /* structure, but not for long.                                             */
  1145. /*--------------------------------------------------------------------------*/
  1146. struct _node
  1147.    {
  1148.       sword number;        /* node number                                   */
  1149.       sword net;           /* net number                                    */
  1150.       word  cost;          /* cost of a message to this node                */
  1151.       word  rate;          /* baud rate                                     */
  1152.       byte  name[20];      /* node name                                     */
  1153.       byte  phone[40];     /* phone number                                  */
  1154.       byte  city[40];      /* city and state                                */
  1155.    };
  1156.  
  1157. /*--------------------------------------------------------------------------*/
  1158. /* THE NEWSTYLE NODE LIST IS NOW BEING USED BY OPUS 1.10                    */
  1159. /*--------------------------------------------------------------------------*/
  1160. struct _newnode
  1161. {
  1162.    word NetNumber;
  1163.    word NodeNumber;
  1164.    word Cost;                                    /* cost to user for a
  1165.                                                   * message */
  1166.    byte SystemName[34];                          /* node name */
  1167.    byte PhoneNumber[40];                         /* phone number */
  1168.    byte MiscInfo[30];                            /* city and state */
  1169.    byte Password[8];                             /* WARNING: not necessarily
  1170.                                                   * null-terminated */
  1171.    word RealCost;                                /* phone company's charge */
  1172.    word HubNode;                                 /* node # of this node's hub
  1173.                                                   * or 0 if none */
  1174.    byte BaudRate;                                /* baud rate divided by 300 */
  1175.    byte ModemType;                               /* RESERVED for modem type */
  1176.    word NodeFlags;                               /* set of flags (see below) */
  1177.    word NodeFiller;
  1178. };
  1179.  
  1180. /*------------------------------------------------------------------------*/
  1181. /* Values for the `NodeFlags' field                                       */
  1182. /*------------------------------------------------------------------------*/
  1183. #define B_hub      0x0001
  1184. #define B_host     0x0002
  1185. #define B_region   0x0004
  1186. #define B_zone     0x0008
  1187. #define B_CM       0x0010
  1188. #define B_ores1    0x0020
  1189. #define B_ores2    0x0040
  1190. #define B_ores3    0x0080
  1191. #define B_ores4    0x0100
  1192. #define B_ores5    0x0200
  1193. #define B_res1     0x0400
  1194. #define B_res2     0x0800
  1195. #define B_res3     0x1000
  1196. #define B_res4     0x2000
  1197. #define B_res5     0x4000
  1198. #define B_res6     0x8000
  1199.  
  1200. #define MAXEXPAND 30          /* max download files (wildcard expansion)    */
  1201. #define CMDLEN    60          /* size of the command typeahead buffer       */
  1202. #define CARRYLEN  20          /* LORE editor's carry buffer                 */
  1203.  
  1204. /*--------------------------------------------------------------------------*/
  1205. /* The rest of this file contains structure definitions similar to those    */
  1206. /* used by Fido<tm> version 11w.  No claim is made that Opus will maintain  */
  1207. /* compatibility with these structures beyond Opus version 0.               */
  1208. /*                                                                          */
  1209. /* The original version of the following items can be found in STRUCT.H, an */
  1210. /* include file writte (and probably copyrighted by) Tom Jennings.          */
  1211. /*--------------------------------------------------------------------------*/
  1212.  
  1213. /*--------------------------------------------------------------------------*/
  1214. /* User help levels                                                         */
  1215. /*--------------------------------------------------------------------------*/
  1216. #define  EXPERT      0x02  /* grizzled veteran, no menus at all             */
  1217. #define  REGULAR     0x04  /* experienced user, brief menus                 */
  1218. #define  NOVICE      0x06  /* Full menus plus additional hand-holding       */
  1219. #define  HOTFLASH    0x20  /* Hotkey, full-screen interface                 */
  1220.  
  1221. /*--------------------------------------------------------------------------*/
  1222. /*                                                                          */
  1223. /* MESSAGE AND FILE AREAS                                                   */
  1224. /*                                                                          */
  1225. /*--------------------------------------------------------------------------*/
  1226.  
  1227.  
  1228. /*--------------------------------------------------------------------------*/
  1229. /* Area attributes (limit or describe the behavior of an area)              */
  1230. /*--------------------------------------------------------------------------*/
  1231. #define  SYSMAIL   0x0001 /* is a mail area                                */
  1232. #define  NOPUBLIC  0x0004 /* OPUS: Disallow public messages                */
  1233. #define  NOPRIVATE 0x0008 /* OPUS: Disallow private messages               */
  1234. #define  ANON_OK   0x0010 /* OPUS: Enable anonymous messages               */
  1235. #define  ECHOMAIL  0x0020 /* OPUS: Set=Echomail Clear=Not Echomail         */
  1236. #define  HIGHBIT   0x0040 /* MAX:  Allow high-bit chars in this area       */
  1237. #define  NREALNAME 0x0200 /* MAX:  Don't use ^aREALNAME for this area      */
  1238. #define  UREALNAME 0x0400 /* MAX:  Use usr.realname instead of usr.name    */
  1239.  
  1240.  
  1241.  
  1242. /*--------------------------------------------------------------------------*/
  1243. /*                                                                          */
  1244. /* MESSAGES                                                                 */
  1245. /*                                                                          */
  1246. /*--------------------------------------------------------------------------*/
  1247.  
  1248. /*--------------------------------------------------------------------------*/
  1249. /* Message header                                                           */
  1250. /*--------------------------------------------------------------------------*/
  1251. struct _msg
  1252.    {
  1253.       byte from[36];
  1254.       byte to[36];
  1255.       byte subj[72];
  1256.       byte date[20];       /* Obsolete/unused ASCII date information        */
  1257.       word times;          /* FIDO<tm>: Number of times read                */
  1258.       sword dest;          /* Destination node                              */
  1259.       sword orig;          /* Origination node number                       */
  1260.       word cost;           /* Unit cost charged to send the message         */
  1261.  
  1262.       sword orig_net;      /* Origination network number                    */
  1263.       sword dest_net;      /* Destination network number                    */
  1264.  
  1265.                            /* A TIMESTAMP is a 32-bit integer in the Unix   */
  1266.                            /* flavor (ie. the number of seconds since       */
  1267.                            /* January 1, 1970).  Timestamps in messages are */
  1268.                            /* always Greenwich Mean Time, never local time. */
  1269.  
  1270.       struct _stamp date_written;   /* When user wrote the msg              */
  1271.       struct _stamp date_arrived;   /* When msg arrived on-line             */
  1272.  
  1273.       word reply;          /* Current msg is a reply to this msg number     */
  1274.       word attr;           /* Attribute (behavior) of the message           */
  1275.       word up;             /* Next message in the thread                    */
  1276.    };
  1277.  
  1278.  
  1279.  
  1280. /*--------------------------------------------------------------------------*/
  1281. /* Message attributes                                                       */
  1282. /*--------------------------------------------------------------------------*/
  1283. #define MSGPRIVATE 0x0001  /* private message         * 0000 0000 0000 0001 */
  1284. #define MSGCRASH   0x0002  /* squirtmail              * 0000 0000 0000 0010 */
  1285. #define MSGREAD    0x0004  /* read by addressee       * 0000 0000 0000 0100 */
  1286. #define MSGSENT    0x0008  /* sent OK (remote)          0000 0000 0000 1000 */
  1287. #define MSGFILE    0x0010  /* file attached to msg    * 0000 0000 0001 0000 */
  1288. #define MSGFWD     0x0020  /* in transit                0000 0000 0010 0000 */
  1289. #define MSGORPHAN  0x0040  /* unknown dest node         0000 0000 0100 0000 */
  1290. #define MSGKILL    0x0080  /* kill after bundling     * 0000 0000 1000 0000 */
  1291. #define MSGLOCAL   0x0100  /* FidoNet vs. local         0000 0001 0000 0000 */
  1292. #define MSGHOLD    0x0200  /* Hold, don't send        * 0000 0010 0000 0000 */
  1293. #define MSGXX2     0x0400  /* <reserved>             X? 0000 0100 0000 0000 */
  1294. #define MSGFRQ     0x0800  /* file request            * 0000 1000 0000 0000 */
  1295. #define MSGRRQ     0x1000  /* receipt requested      X* 0001 0000 0000 0000 */
  1296. #define MSGCPT     0x2000  /* is a return receipt    X* 0010 0000 0000 0000 */
  1297. #define MSGARQ     0x4000  /* audit trail requested  X* 0100 0000 0000 0000 */
  1298. #define MSGURQ     0x8000  /* update request         X* 1000 0000 0000 0000 */
  1299.                                                    /*-----------------------*/
  1300.                                                    /* ^                     */
  1301.                                                    /* |                     */
  1302.                                                    /*  * = preserved by     */
  1303.                                                    /*      the network      */
  1304.                                                    /*  ? = stripped by the  */
  1305.                                                    /*      net (FTSC spec)  */
  1306.                                                    /*      but preserved    */
  1307.                                                    /*      by seadog<tm>    */
  1308.                                                    /*  X = not used by Opus */
  1309.                                                    /*-----------------------*/
  1310.  
  1311.  
  1312. /*--------------------------------------------------------------------------*/
  1313. /* Message bundle header                                                    */
  1314. /*--------------------------------------------------------------------------*/
  1315.  
  1316. #define PKTVER       2        /* Used for `ver' (below)                     */
  1317.  
  1318.                               /*--------------------------------------------*/
  1319.                               /* POSSIBLE VALUES FOR `product' (below)      */
  1320.                               /*                                            */
  1321.                               /* NOTE: These product codes are assigned by  */
  1322.                               /* the FidoNet<tm> Technical Stardards Com-   */
  1323.                               /* mittee.  If you are writing a program that */
  1324.                               /* builds bundles, you will need a product    */
  1325.                               /* code.  Please use ZERO until you get your  */
  1326.                               /* own.  For more information on codes, write */
  1327.                               /* to FTSC at 220/1.                          */
  1328.                               /*                                            */
  1329.                               /*--------------------------------------------*/
  1330. #define isFIDO       0        /* Fido<tm>'s product code                    */
  1331. #define isSPARK      1        /* FastScan, Rover, etc                       */
  1332. #define isSEA        2        /* Seadog<tm>'s product code                  */
  1333. #define isOPUS       5        /* Opus<no_tm>'s product code (a PRIME number)*/
  1334. #define isHENK       6        /* Dutchie product code                       */
  1335. #define isBRINKERS   7
  1336. #define isTABBIE     8
  1337. #define isDOUG       9
  1338.  
  1339.  
  1340. struct _pkthdr
  1341.    {
  1342.       sword orig_node;        /* originating node               */
  1343.       sword dest_node;        /* destination node               */
  1344.       word  year;             /* 0..99  when packet was created */
  1345.       word  month;            /* 1..12  when packet was created */
  1346.       word  day;              /* 1..31  when packet was created */
  1347.       word  hour;             /* 0..23  when packet was created */
  1348.       word  minute;           /* 0..59  when packet was created */
  1349.       word  second;           /* 0..59  when packet was created */
  1350.       word  rate;             /* destination's baud rate        */
  1351.       word  ver;              /* packet version                 */
  1352.       sword orig_net;         /* originating network number     */
  1353.       sword dest_net;         /* destination network number     */
  1354.       byte  product;          /* product type                   */
  1355.       byte  rev_level;        /* filler (used by some systems)  */
  1356.  
  1357.                               /* ------------------------------ */
  1358.                               /* THE FOLLOWING SECTION IS NOT   */
  1359.                               /* THE SAME ACROSS SYSTEM LINES:  */
  1360.                               /* ------------------------------ */
  1361.       byte password[8];       /* ONLY 6 CHARS ARE SIGNIFICANT!! */
  1362.  
  1363.       word qm_orig_zone,
  1364.            qm_dest_zone;
  1365.  
  1366.       byte rsvd1[8];
  1367.  
  1368.       word orig_zone,
  1369.            dest_zone,
  1370.            orig_point,
  1371.            dest_point;
  1372.  
  1373.       long pr_data;
  1374.    };
  1375.  
  1376.  
  1377. struct _pktprefix
  1378. {
  1379.   word  ver;
  1380.   sword orig_node;
  1381.   sword dest_node;
  1382.   sword orig_net;
  1383.   sword dest_net;
  1384.   word  attr;
  1385.   word  cost;
  1386. };
  1387.  
  1388.  
  1389. /*
  1390.       struct star_dot_pkt=
  1391.       {
  1392.         struct _pkthdr;
  1393.  
  1394.         struct
  1395.         {
  1396.           struct _pktprefix;
  1397.  
  1398.           null-terminated (date)
  1399.           null-terminated (to)
  1400.           null-terminated (from)
  1401.           null-terminated (subj)
  1402.           null-terminated (message!)
  1403.         };
  1404.  
  1405.         char null='\x00';
  1406.       }
  1407. */
  1408.  
  1409. #if defined(ORACLE) && defined(__TURBOC__)
  1410.  
  1411. /* Turn off warnings for "Unused parameter", "Defined var never used",     *
  1412.  * and "assigned value that is never used", bcuz they make things messy    *
  1413.  * when compiling Oracle.                                                  */
  1414.  
  1415. #pragma warn -par
  1416. #pragma warn -aus
  1417. #pragma warn -use
  1418.  
  1419. #endif
  1420.  
  1421. #endif  /* _MAX_H_DEFINED */
  1422.  
  1423.