home *** CD-ROM | disk | FTP | other *** search
/ ftp.wwiv.com / ftp.wwiv.com.zip / ftp.wwiv.com / pub / BBS / DOORL093.ZIP / doorlib-0.9.3.tar.bz2 / doorlib-0.9.3.tar / doorlib-0.9.3 / src / door.h < prev    next >
C/C++ Source or Header  |  2003-08-31  |  6KB  |  197 lines

  1. #ifndef    _DOORLIB_H
  2. #define    _DOORLIB_H
  3.  
  4. /* $Id: door.h,v 1.2 2003/08/31 13:27:32 mbroek Exp $ */
  5.  
  6. #include <stdio.h>
  7. #include <stdlib.h>
  8. #include <limits.h>
  9. #include <sys/types.h>
  10. #include <sys/stat.h>
  11. #include <fcntl.h>
  12. #include <string.h>
  13. #include <termios.h>
  14. #include <unistd.h>
  15. #include <time.h>
  16. #include <ctype.h>
  17. #include <stdarg.h>
  18. #include <errno.h>
  19.  
  20.  
  21. #ifndef    TRUE
  22. #define    TRUE    1
  23. #define    FALSE    0
  24. #endif
  25.  
  26.  
  27. /*
  28.  *  Returned function keys
  29.  */
  30. #define KEY_BACKSPACE   8
  31. #define KEY_LINEFEED    10
  32. #define KEY_ENTER       13
  33. #define KEY_ESCAPE      27
  34. #define KEY_RUBOUT      127
  35. #define KEY_UP          200
  36. #define KEY_DOWN        201
  37. #define KEY_LEFT        202
  38. #define KEY_RIGHT       203
  39. #define KEY_HOME        204
  40. #define KEY_END         205
  41. #define KEY_INS         206
  42. #define KEY_DEL         207
  43. #define KEY_PGUP        208
  44. #define KEY_PGDN        209
  45.  
  46.  
  47.  
  48. /*
  49.  * ANSI colors
  50.  */
  51. #define BLACK           0
  52. #define BLUE            1
  53. #define GREEN           2
  54. #define CYAN            3
  55. #define RED             4
  56. #define MAGENTA         5
  57. #define BROWN           6
  58. #define LIGHTGRAY       7
  59. #define DARKGRAY        8
  60. #define LIGHTBLUE       9
  61. #define LIGHTGREEN      10
  62. #define LIGHTCYAN       11
  63. #define LIGHTRED        12
  64. #define LIGHTMAGENTA    13
  65. #define YELLOW          14
  66. #define WHITE           15
  67.  
  68.  
  69.  
  70. /*
  71.  * Some ANSI sequences
  72.  */
  73. #define ANSI_RED        "\x1B[31;1m"
  74. #define ANSI_YELLOW     "\x1B[33;1m"
  75. #define ANSI_BLUE       "\x1B[34;1m"
  76. #define ANSI_GREEN      "\x1B[32;1m"
  77. #define ANSI_WHITE      "\x1B[37;1m"
  78. #define ANSI_CYAN       "\x1B[36;1m"
  79. #define ANSI_MAGENTA    "\x1B[35m"
  80.  
  81. #define ANSI_HOME       "\x1B[H"
  82. #define ANSI_UP         "\x1B[A"
  83. #define ANSI_DOWN       "\x1B[B"
  84. #define ANSI_RIGHT      "\x1B[C"
  85. #define ANSI_LEFT       "\x1B[D"
  86.  
  87. #define ANSI_BOLD       "\x1B[1m"
  88. #define ANSI_NORMAL     "\x1B[0m"
  89. #define ANSI_CLEAR      "\x1B[2J"
  90. #define ANSI_CLREOL     "\x1B[K"
  91.  
  92.  
  93. /*
  94.  * Handy macros
  95.  */
  96. #define    DOOR_SS(x) (x)?(x):"(null)"
  97.  
  98.  
  99. int        ttyfd;              /* Filedescriptor for raw mode  */
  100. struct termios    tbufs, tbufsavs;    /* Structure for raw mode        */
  101.  
  102.  
  103. typedef struct    _keytab {        /* Configuration table        */
  104.     char    *key;            /* Keyword                */
  105.     int        (*prc)(char **);    /* Function to parse keyword    */
  106.     char**    dest;            /* Destination value to fill    */
  107. } keytab_t;
  108.  
  109.  
  110. typedef struct    _doorsys {        /* 52 lines door.sys file        */
  111.     char    *comport;        /* DOS style COM port        */
  112.     int        ebaud;            /* Effective baudrate        */
  113.     int        databits;        /* Databits                */
  114.     int        nodenumber;        /* Multiline nodenumber        */
  115.     int        lbaud;            /* Locked baudrate            */
  116.     char    *screen_display;    /* Screen display Y/N        */
  117.     char    *printer_on;        /* Printer on Y/N            */
  118.     char    *page_bell;        /* Paging bell Y/N            */
  119.     char    *caller_alarm;        /* Caller alarm Y/N            */
  120.     char    *username;        /* User name            */
  121.     char    *location;        /* User's location            */
  122.     char    *voice_phone;        /* User's voice phone        */
  123.     char    *data_phone;        /* User's data phone        */
  124.     char    *password;        /* User's password            */
  125.     int        seclevel;        /* User's security level        */
  126.     int        totalcalls;        /* User's total calls        */
  127.     char    *last_login;        /* last login date MM-DD-YYYY   */
  128.     int        sec_timeleft;        /* Seconds time left        */
  129.     int        min_timeleft;        /* Minutes time left        */
  130.     char    *graphics;        /* Graphics GR or NG        */
  131.     int        screenlen;        /* User's screen length        */
  132.     char    *usermode;        /* Always Y ??            */
  133.     char    *extra1;
  134.     char    *extra2;
  135.     char    *expiry_date;        /* User's expiry date        */
  136.     int        grecno;            /* User's record number        */
  137.     char    *protocol;        /* Transfer protocol        */
  138.     int        uploads;        /* Total uploads            */
  139.     int        downloads;        /* Total downloads            */
  140.     int        lim_downk;        /* Download limit in Kb.        */
  141.     int        lim_downk2;        /* Download limit in Kb.        */
  142.     char    *date_of_birth;        /* Date of birth            */
  143.     char    *userbase;        /* Path to userbase            */
  144.     char    *msgbase;        /* Path to msgbase            */
  145.     char    *sysopname;        /* Sysop name            */
  146.     char    *handle;        /* User's alias            */
  147.     char    *nextevent;        /* Next event time or none        */
  148.     char    *errorfree;        /* Error free connection        */
  149.     char    *allwaysN;
  150.     char    *allwaysY;
  151.     int        defcolor;        /* Default textcolor        */
  152.     int        allways0;
  153.     char    *last_login2;        /* Last login date            */
  154.     char    *time_login;        /* Login time            */
  155.     char    *last_login_time;   /* Last login time            */
  156.     int        maxinteger;        /* DOS maxint value            */
  157.     int        downs_today;        /* Downloads today            */
  158.     int        uploadK;        /* Uploads in Kb            */
  159.     int        downloadK;        /* Downloads in Kb            */
  160.     char    *comment;        /* User's comment            */
  161.     int        allways0_2;
  162.     int        posted;            /* Messages posted            */
  163. } doorsys_t;
  164.  
  165. doorsys_t    doorsys;        /* Loaded door.sys data        */
  166.  
  167.  
  168. unsigned char    door_getch(void);
  169. void        door_getstrp(char *, int, int);
  170. void        door_getstr(char *, int);
  171. void        door_getname(char *, int);
  172. void        door_getnum(char *, int);
  173. void        door_waitenter(char *);
  174. void        door_enter(int);
  175. void        door_cout(int, int, char *);
  176. void        door_color(int, int);
  177. void        door_center(char *);
  178. void        door_clear(void);
  179. void        door_locate(int, int);
  180. void        door_line(int);
  181. void        door_alarm_set(int);
  182. void        door_alarm_on(void);
  183. void        door_alarm_off(void);
  184. char        *door_xmalloc(size_t);
  185. char        *door_xstrcpy(char *);
  186. char        *door_xstrcat(char *, char *);
  187. int        door_load_doorsys(void);
  188. int        door_loginit(char *, char *, int);
  189. void        door_log(int, const char *, ...);
  190. int        door_parse_getstr(char **);
  191. int        door_parse_getlong(char **);
  192. int        door_parse_config(char *, keytab_t[]);
  193. int        door_dispfile(char *);
  194.  
  195.  
  196. #endif
  197.