home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / C / TOPUSE4S / TOPUSERS.H < prev   
Text File  |  1991-12-24  |  4KB  |  163 lines

  1. /*
  2. ** Useful macros
  3. */
  4.  
  5. #define MAX_USERS 4000
  6. #define eqstri(a, b) (stricmp(a,b)==0)
  7.  
  8. /*
  9. ** prototypes
  10. */
  11.  
  12. void defaults();
  13. int compare_times(const void *a, const void *b);
  14. int compare_downs(const void *a, const void *b);
  15. int compare_ups(const void *a, const void *b);
  16.  
  17.  
  18. /*
  19. ** Keywords in the config file
  20. */
  21.                 /*  0          1          2            3          4     */
  22. char *parse[]={ "NAMEBBS", "USERFILE", "OUTFILE", "TOPNUMBER", "SYSOP",
  23.                 /*  5               6                7                  */
  24.                 "DOUBLEHORIZ", "DOUBLEVERT", "COLORTOP&SIDES",
  25.                 /*  8                      9                 10         */
  26.                 "COLORCALLHEADER", "COLORUPLDHEADER", "COLORDNLDHEADER",
  27.                 /*  11                12              13             14 */
  28.                 "COLORTOPCALL", "COLORTOPUPLD", "COLORTOPDNLD", "COLORREST",
  29.                 /*  15                     16                17         */
  30.                 "COLORTOTALCALLS", "COLORTOTALUPLDS", "COLORTOTALDNLDS",
  31.                 /*18       19           20             21           22  */
  32.                 "CLS", "MOREOFF", "COLORVACANT", "COLORBANNER", "COLORLINE",
  33.                 /*  23              24               25             26  */
  34.                 "NOAVERAGE", "COLORAVGDNLDS", "COLORAVGUPLDS", "COLORAVGCALLS",
  35.                 /*  27             28               29               30      */
  36.                 "NOSYSTEM", "COLORSYSCALLS", "COLORSYSDNLDS", "COLORSYSUPLDS",
  37.                 /* 31        32  */
  38.                 "MAXDIR", "NOTOTALS" };
  39.  
  40. /*
  41. ** Structure for config file
  42. */
  43.  
  44. typedef struct _cnf {
  45.    char bbsname[41];
  46.    char userfile[80];
  47.    char outfile[80];
  48.    char maxdir[80];
  49.    unsigned int topnumber : 7;
  50.    unsigned int avg       : 1;
  51.    unsigned int sys       : 1;
  52.    unsigned int sysop     : 1;
  53.    unsigned int dhoriz    : 1;
  54.    unsigned int shoriz    : 1;
  55.    unsigned int dvert     : 1;
  56.    unsigned int svert     : 1;
  57.    unsigned int cls       : 1;
  58.    unsigned int more      : 1;
  59.    char totals;
  60.    char topsides[9];
  61.    char callheader[9];
  62.    char upldheader[9];
  63.    char dnldheader[9];
  64.    char topcall[9];
  65.    char topupld[9];
  66.    char topdnld[9];
  67.    char rest[9];
  68.    char totalcalls[9];
  69.    char totaluplds[9];
  70.    char totaldnlds[9];
  71.    char avgcalls[9];
  72.    char avguplds[9];
  73.    char avgdnlds[9];
  74.    char syscalls[9];
  75.    char sysuplds[9];
  76.    char sysdnlds[9];
  77.    char vacant[9];
  78.    char banner[9];
  79.    char line[9];
  80. } CONFIG;
  81.  
  82. /*
  83. ** Local structures
  84. */
  85.  
  86. typedef struct _ind {
  87.    int index;
  88.    dword upk;
  89.    dword downk;
  90.    int times;
  91. } IND;
  92.  
  93. typedef struct _info {
  94.    int   user_num;
  95.    dword upk;
  96.    dword downk;
  97.    int   times;
  98.    char name[20];
  99. } INFO;
  100.  
  101. INFO *info[100];
  102. IND *ind[MAX_USERS];
  103. CONFIG config;
  104.  
  105. /*
  106. ** Default values
  107. */
  108.  
  109. void defaults()
  110. {
  111.    config.bbsname[0] = '\0';
  112.    strcpy(config.userfile,"user.bbs");
  113.    strcpy(config.outfile,"misc\\topusers.bbs");
  114.    strcpy(config.maxdir,"c:\\max\\");
  115.    config.topnumber = 10;
  116.    config.cls    = 0;
  117.    config.avg    = 1;
  118.    config.sys    = 1;
  119.    config.totals = 1;
  120.    config.more   = 1;
  121.    config.sysop  = 1;
  122.    config.dvert  = 0;
  123.    config.svert  = 1;
  124.    config.dhoriz = 0;
  125.    config.shoriz = 1;
  126.    strcpy(config.line,      "î");
  127.    strcpy(config.rest,      "ç");
  128.    strcpy(config.banner,    "Å");
  129.    strcpy(config.vacant,    "ç");
  130.    strcpy(config.topcall,   "Ä");
  131.    strcpy(config.topupld,   "î");
  132.    strcpy(config.topdnld,   "Å");
  133.    strcpy(config.topsides,  "â");
  134.    strcpy(config.avgcalls,  "ï");
  135.    strcpy(config.avguplds,  "ï");
  136.    strcpy(config.avgdnlds,  "ï");
  137.    strcpy(config.syscalls,  "ï");
  138.    strcpy(config.sysuplds,  "ï");
  139.    strcpy(config.sysdnlds,  "ï");
  140.    strcpy(config.callheader,"₧");
  141.    strcpy(config.upldheader,"₧");
  142.    strcpy(config.dnldheader,"₧");
  143.    strcpy(config.totalcalls,"ï");
  144.    strcpy(config.totaluplds,"ï");
  145.    strcpy(config.totaldnlds,"ï");
  146. }
  147.  
  148. /* Structure of BBSTATxx.BBS */
  149.  
  150. typedef struct _bbs_stats
  151. {
  152.   byte    version;
  153.   dword   num_callers;
  154.   dword   quote_pos;
  155.   dword   msgs_written;
  156.   time_t  online_date;
  157.   dword   total_dl;
  158.   dword   total_ul;
  159.   sword   today_callers;
  160.   union stamp_combo date;
  161. } STATS;
  162.  
  163.