home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / dwnsrs59.zip / DOWNVARS.C < prev    next >
C/C++ Source or Header  |  1993-12-18  |  9KB  |  192 lines

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