home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / msq31004.zip / INIT.C < prev    next >
C/C++ Source or Header  |  1995-07-12  |  4KB  |  131 lines

  1. /* init.c
  2. **
  3. ** Released into the PUBLIC DOMAIN 10 jul 1994 by John Dennis
  4. **
  5. ** Handles sub-system initaliseation for msgedsq..
  6. **
  7. */
  8.  
  9. #define INCL_MAIN
  10.  
  11. #include "msged.h"
  12. #include "msg.h"
  13. #include "fido.h"
  14. #include "main.h"
  15.  
  16. struct _sv   *string_vars;
  17. struct _swv  *switch_vars;
  18.  
  19. msghandle msgdo[2] =
  20. {
  21.     {
  22.         FidoMsgReadHeader, FidoMsgReadText,  FidoMsgWriteHeader,
  23.         FidoMsgWriteText,  FidoMsgDelete,    FidoAreaSetLast,
  24.         FidoMsgAreaOpen,   FidoMsgAreaClose, FidoMsgClose,
  25.         FidoUidToMsgn,     FidoMsgnToUid
  26.     },
  27.     {
  28.         SquishMsgReadHeader, SquishMsgReadText,  SquishMsgWriteHeader,
  29.         SquishMsgWriteText,  SquishMsgDelete,    SquishAreaSetLast,
  30.         SquishMsgAreaOpen,   SquishMsgAreaClose, SquishMsgClose,
  31.         SquishUidToMsgn,     SquishMsgnToUid
  32.     }
  33. };
  34.  
  35. D_LIST   *node_lists    = NULL;   /* the nodelists recognized by the system */
  36. AREA     *arealist      = NULL;   /* list of areas */
  37. ALIAS    *aliaslist     = NULL;   /* list of aliases */
  38. ADDRESS  *domain_list   = NULL;   /* list of domain-gates */
  39. ADDRESS  *alias         = NULL;   /* list of akas */
  40. msg      *message       = NULL;   /* current message */
  41. char    **templates     = NULL;   /* templates in system */
  42. USER      user_list[MAXUSERS];          /* list of users */
  43. ADDRESS   uucp_gate;              /* the uucp gate */
  44.  
  45. unsigned int  *macros[41];        /* function key macros + 1 for autostart */
  46. int    maxx;              /* maximum screen columns */
  47. int    maxy;              /* maximum screen rows */
  48. int    rot13;
  49. int    stripSoft;
  50.  
  51. int InitVars(void)
  52. {
  53.     /*
  54.     ** Allocate some memory & initialize it.
  55.     */
  56.  
  57.     string_vars = malloc(sizeof(struct _sv));
  58.     switch_vars = malloc(sizeof(struct _swv));
  59.  
  60.     if (!string_vars || !switch_vars)
  61.     {
  62.         release(string_vars);
  63.         release(switch_vars);
  64.         return FAIL;
  65.     }
  66.  
  67.     memset(string_vars, 0, sizeof(struct _sv));
  68.     memset(switch_vars, 0, sizeof(struct _swv));
  69.     memset(user_list,   0, sizeof(user_list));
  70.     memset(macros,      0, sizeof(macros));
  71.  
  72.     /*
  73.     **
  74.     ** Initialize all the variables to default values.
  75.     **
  76.     */
  77.  
  78.     SW->rm            = 80;
  79.     SW->qm            = 80;
  80.     SW->tabsize       = 4;
  81.     SW->use_lastr     = NO;
  82.     SW->qquote        = NO;
  83.     SW->msgids        = YES;
  84.     SW->opusdate      = NO;
  85.     SW->shownotes     = NO;
  86.     SW->seenbys       = YES;
  87.     SW->confirmations = YES;
  88.     SW->datearrived   = NO;
  89.     SW->redraw        = YES;
  90.     SW->showaddr      = YES;
  91.     SW->rawcc         = YES;
  92.     SW->savecc        = NO;
  93.     SW->hardquote     = YES;
  94.     SW->chopquote     = YES;
  95.     SW->showcr        = NO;
  96.     SW->showeol       = NO;
  97.     SW->showrealmsgn  = NO;
  98.     SW->usemouse      = YES;
  99.     SW->tabexpand     = YES;
  100.     SW->usepid        = NO;
  101.     SW->soteot        = YES;
  102.     SW->rquote        = MT_QUO;
  103.     SW->rotharea      = MT_QUO|MT_ARC;
  104.     SW->rfollow       = MT_QUO|MT_FOL;
  105.     SW->rextra        = MT_QUO|MT_FOL|MT_ARC;
  106.     SW->tearline      = YES;
  107.     SW->showsystem    = YES;
  108.     ST->comspec       = getenv("COMSPEC");
  109.     ST->outfile       = strdup("msged.txt");
  110.     ST->quotestr      = strdup(" > ");
  111.     ST->confmail      = strdup("confmail.out");
  112.     ST->lastread      = strdup("lastread");
  113.     ST->cfgfile       = strdup("msged.cfg");
  114.     ST->uucpgate      = strdup("UUCP");
  115.     ST->editorName    = NULL;
  116.     ST->nodebase      = NULL;
  117.     ST->sysop         = NULL;
  118.  
  119.     uucp_gate.notfound = 1;
  120.  
  121.     return OK;
  122. }
  123.  
  124. void DeinitMem(void)
  125. {
  126.     release(switch_vars);
  127.     release(string_vars);
  128. }
  129.  
  130. /* end */
  131.