home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / os2 / dwnsrs57.zip / DOWNVARS.C < prev    next >
C/C++ Source or Header  |  1993-06-17  |  10KB  |  195 lines

  1. /* ============================================================= */
  2. /*  Rob Hamerling's MAXIMUS download file scan and sort utility  */
  3. /*  -> DOWNVARS.C                                                */
  4. /*  -> Global data: variables and tables                         */
  5. /* ============================================================= */
  6.  
  7. #define INCL_BASE
  8. #define INCL_NOPMAPI
  9. #include <os2.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <time.h>
  13.  
  14. #include "..\max\mstruct.h"
  15. #include "downsort.h"
  16.  
  17. char VERSION      = '5';                /* current version              */
  18. char SUBVERS      = '7';                /* current release              */
  19. char SUFFIX       = 'd';                /* development suffix           */
  20.  
  21. char AC[]         = "Area";
  22. char AUTHOR[]     = "Rob Hamerling";    /* program author               */
  23. char BAK[]        = "BAK";              /* backup file extension        */
  24. char BY[]         = "Bytes";
  25. char CFG[]        = "CFG";              /* config file extension        */
  26. char CITY[]       = "Vianen, The Netherlands";
  27. char DAYS[]       = "days ";
  28. char DF[]         = "Date flag: new on this system since:";
  29. char DOT[]        = ".";
  30. char DS[]         = "Description";
  31. char DT[]         = "Date";
  32. char EMPTY[]      = "";                 /* empty string                  */
  33. char FIDO[]       = "Fido-net 2:512/4.1098";
  34. char FILPREFX[]   = "-δ";
  35. char FN[]         = "Filename";
  36. char FP[]         = "FilePath";
  37. char FS[]         = "Files";
  38. char MAX[]        = "MAXIMUS CBCS";
  39. char MO[]         = " = 1 month";
  40. char MONTHS[]     = "months ";
  41. char MP[]         = "Maximum privilege shown: ";
  42. char MSG_ARE[]    = "\tfiles in DL-dir %s (area %s)\r";
  43. char MSG_CFG[]    = "Reading configuration file: %s\n";
  44. char MSG_COA[]    = "Collecting file-area information from %s\n";
  45. char MSG_COF[]    = "Collecting file data\n";
  46. char MSG_FNT[]    = "Error: TitleFont out of range\n";
  47. char MSG_IEC[]    = "Internal error in data collection phase, "
  48.                     "counted: %u entries, chainsize=%u\n";
  49. char MSG_KWD[]    = "Unknown keyword or missing parameter value in:"
  50.                     "\n\t%-50.50s\n";
  51. char MSG_MEM[]    = "Insufficient memory, %s terminated\n";
  52. char MSG_MX1[]    = "Sorry, %s-file has unsupported AREA.DAT format!\n";
  53. char MSG_MX2[]    = "%s %c.%c%c works only for %s version 2.00 and up!\n";
  54. char MSG_OPA[]    = "\tOpen Action error for %s: %d\n";
  55. char MSG_OPI[]    = "\tCould not open inputfile: %s, rc=%d\n";
  56. char MSG_OPO[]    = "\tCould not open outputfile: %s, rc=%d\n";
  57. char MSG_ORP[]    = " %5u\torphans detected and dropped (in total)\n";
  58. char MSG_REC[]    = " \tFile entries written\r";
  59. char MSG_REP[]    = "Writing %s\n";
  60. char MSG_RST[]    = "Re-sorting first %u entries on filename\n";
  61. char MSG_SRT[]    = "Sorting %u files from %u areas for %s\n";
  62. char MSG_TRL[]    = " \tWarning: Include-file - %s - not found!\n";
  63. char MSG_UNK[]    = "Unknown Parameter: %-50.50s\n";
  64. char MSG_ZF[]     = "Not a single list%s falls withing report criteria, or\n";
  65. char MSG_ZP[]     = "no download paths found at all, %s terminated\n";
  66. char MSG_ZY[]     = "Maximum supported files (%u) exceeded, %s terminated\n";
  67. char NDS[46]      = "--- no description available ---";
  68. char OFFLINE[16]  = " -- OFFLINE -- ";
  69. char ORPHAN[46]   = "************ ORPHAN ************";
  70. char PHONE[]      = "Phone 31.3473.72136 (voice)";
  71. char PROGDESC[]   = "DOWNload file SORT and list utility";
  72. char PROGNAME[]   = "DOWNSORT";         /* program name (and list-fnames)*/
  73. char SZ[]         = "Size";
  74. char SUMM[]       = " Summary";
  75. char TM[]         = "Time";
  76. char WEEKS[]      = "weeks ";
  77. char WK[]         = " = 1 week";
  78. char WRITE[]      = "w";
  79.  
  80. char *priv_name[] = {"Twit",
  81.                      " ",               /* not used                      */
  82.                      "Disgrace",
  83.                      "Limited",
  84.                      "Normal",
  85.                      "Worthy",
  86.                      "Privil",
  87.                      "Favored",
  88.                      "Extra",
  89.                      "Clerk",
  90.                      "AsstSysop",
  91.                      " ",               /* not used                      */
  92.                      "Sysop",
  93.                      "Hidden"};
  94.  
  95. char today[26];                         /* output timestamp              */
  96. char list_title[21]    = "";            /* ALL/IPF/NEW/GBL BLOCK title   */
  97.  
  98. char *pre_title[MAXTIT]= {NULL,NULL,NULL,NULL,NULL,  /* pretitles        */
  99.                           NULL,NULL,NULL,NULL,NULL,
  100.                           NULL,NULL,NULL,NULL,NULL,
  101.                           NULL,NULL,NULL,NULL,NULL};
  102. char *sub_title[MAXTIT]= {NULL,NULL,NULL,NULL,NULL,  /* subtitles        */
  103.                           NULL,NULL,NULL,NULL,NULL,
  104.                           NULL,NULL,NULL,NULL,NULL,
  105.                           NULL,NULL,NULL,NULL,NULL};
  106. char *bot_lines[MAXTIT]= {NULL,NULL,NULL,NULL,NULL,  /* bottomlines      */
  107.                           NULL,NULL,NULL,NULL,NULL,
  108.                           NULL,NULL,NULL,NULL,NULL,
  109.                           NULL,NULL,NULL,NULL,NULL};
  110.  
  111. char non_dup_ext[201][4] = { "" };      /* non_dup extension pair array  */
  112. char selected_area[201][MAXANAME] = { '\0' }; /* + last entry indicator  */
  113. char areadat_path[128] = "AREA.DAT";    /* (default) AREA.DAT filespec   */
  114. char cfg_path[128]     = "DOWNSORT.CFG";/* (default) config filespec     */
  115. char buf2[MAXRCD]      = "";            /* text manipulation buffer      */
  116. char filesbbs_path[128]= "";            /* path to FILES.BBS output      */
  117. char oper_mode         = ' ';           /* blank: give some progress info*/
  118.                                         /* V=verbose: extensive reporting*/
  119.                                         /* Q=quit (only error messages)  */
  120.                                         /* H: display help-screen        */
  121. int   area_IN_EX       = 0;             /* area selection (+1 = INclude) */
  122.                                         /*                (-1 = EXclude) */
  123. char  area_seq         = GROUP;         /* area sort sequence            */
  124. char  strip_ava        = 'Y';           /* default: strip AVATAR graphics*/
  125. unsigned short int title_lines[] = {0,3,5,4,5};  /* # of lines per font  */
  126.                                         /* See DOWNFNT.C for 'real' table*/
  127. unsigned int max_aname = 0;             /* actual maximum length areaname*/
  128. unsigned int area_total_count  = 0;     /* number of area's with files   */
  129. unsigned int file_total_count  = 0;     /* counter for number of files   */
  130. unsigned long byte_count = 0;           /* counter for file sizes        */
  131. int    MAX_level       = 0;             /* version of MAX from AREA.DAT  */
  132. int    ABS_MAX_priv    = TWIT;          /* overall max report-privilege  */
  133. FILECHAIN *first_element = NULL;        /* ptr first chain element      */
  134. COUNTRYCODE c_code;                     /* country code buffer           */
  135. COUNTRYINFO c_info;                     /* country information buffer    */
  136.  
  137. struct _listparm lp[]  = {
  138.       {                                 /* BBS-list (P_BBS)              */
  139.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  140.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  141.         FONT2, 65535, "DOWNSORT.HDR", ' ', TIMESTAMP, TRUNC, ' ', ' ',
  142.         "DOWNSORT", "BBS"},
  143.       {                                 /* FILES.BBS (P_FIL)             */
  144.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  145.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  146.         FONT3, 65535, NULL, ' ', KEEPSEQ, TRUNC, ' ', ' ',
  147.         "FILES", "BBS"},
  148.       {                                 /* GBL-list (P_GBL)              */
  149.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  150.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  151.         FONT2, 65535, NULL, ' ', ALPHA, WRAP, ' ', ' ',
  152.         "DOWNSORT", "G~"},
  153.       {                                 /* NEW-list (P_NEW)              */
  154.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  155.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  156.         FONT2, 65535, NULL, ' ', TIMESTAMP, TRUNC, ' ', ' ',
  157.         "DOWNSORT", "N~"},
  158.       {                                 /* ALL-list (P_ALL)              */
  159.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  160.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  161.         FONT2, 65535, NULL, ' ', ALPHA, WRAP, ' ', ' ',
  162.         "DOWNSORT", "A~"},
  163.       {                                 /* IPF-list (P_IPF)              */
  164.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  165.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  166.         FONT2, 250, NULL, ' ', ALPHA, WRAP, ' ', ' ',
  167.         "DOWNSORT", "I~"},
  168.       {                                 /* DUP-list (P_DUP)              */
  169.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  170.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  171.         FONT2, 65535, NULL, ' ', ALPHA, WRAP, ' ', ' ',
  172.         "DOWNSORT", "DUP"},
  173.       {                                 /* ORP-list (P_ORP)              */
  174.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  175.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  176.         FONT2, 65535, NULL, ' ', ALPHA, TRUNC, ' ', ' ',
  177.         "DOWNSORT", "ORP"},
  178.       {                                 /* OK-file (P_OK)                */
  179.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  180.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  181.         FONT2, 65535, NULL, ' ', ALPHA, TRUNC, ' ', ' ',
  182.         "DOWNSORT", "O~"},
  183.       {                                 /* IPF2-file (P_IP2)             */
  184.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  185.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  186.         FONT2, 250, NULL, ' ', ALPHA, WRAP, ' ', ' ',
  187.         "DOWNSORT", "I~"},
  188.       {                                 /* EMI-file (P_EMI)              */
  189.        {HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,
  190.         HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1,HIDDEN+1},
  191.         FONT2, 65535, NULL, ' ', TIMESTAMP, WRAP, ' ', ' ',
  192.         "DOWNSORT", "E~"},
  193.          };
  194.  
  195.