home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 1 / crawlyvol1.bin / bbs / dbk_v120 / dbl_kill.txt < prev   
Text File  |  1994-01-01  |  8KB  |  232 lines

  1. Documentation for dbl_kill v1.20 10.8.90
  2.     Public-Domain - see Point 3
  3. ---------------------------------------
  4.  
  5. 1. What's this program for ?
  6. ----------------------------
  7.  
  8. Dbl_kill is a FIDONET/The-Box/QBBS/ACS-compatible double-message-killer,
  9. that means if there are some identical msgs in one of your areas
  10. dbl_kill will mark all of them but one as deleted.
  11.  
  12.  
  13. 2. Usage of the program
  14. -----------------------
  15.  
  16. If you call the program with option -h, you will get a help screen,
  17. that tells you what you can do with several options:
  18.  
  19. dbl_kill -h           <-- enter this from a command line interpreter
  20.  
  21. I won't describe this options here because you can read that in this
  22. help screen 8-)
  23.  
  24.  
  25. 3. Public Domain
  26. ----------------
  27.  
  28. This Program is PD, that means it costs you *nothing*, you can use and
  29. copy it (but always including this text !!!) like you want, but you MUST
  30. NOT modify this text or the program.
  31.  
  32. If you want to say 'Thank You!' because it works fine or '@%#%+~/ !!!'
  33. because it doesn't, you can send a message (or error report) to:
  34.  
  35. Thomas Waldmann
  36. FidoNet address: 2:509/27.1
  37.  
  38.  
  39. 4. Disclaimer
  40. =============
  41.  
  42.            You use this program at YOUR *OWN* RISK !
  43.  
  44. This program was tested in 2 FidoNet-Nodes and 1 Point for some versions
  45. and worked fine - so that I suppose that I have removed most bugs (incl.
  46. these from Turbo-C ;-), but remember:
  47.  
  48.                 There's always one bug more!
  49.                 
  50. That means, if your system crashes, thousands of messages are send to
  51. nirwana and your computer explodes - and all this through a misty bug in
  52. this program, this is *YOUR* problem - not mine.
  53.  
  54.  
  55. 5. System environment expected by the program
  56. ---------------------------------------------
  57.  
  58. Although very UNcritical (other programs need *MUCH* more), here is the
  59. memory and (hard-)disk usage of the program:
  60.  
  61. Memory usage:
  62. statically:        60KB
  63. dynamically:    minimum: msg_count_in_largest_area*10Bytes +
  64.                         two_largest_msg_txts, but please:
  65.                         Don't try this !
  66.                best: because of the built in header/msg-cache, the
  67.                      program works faster, if the *.HDR-File and some
  68.                      of the msgs of each area fit in memory
  69.                     
  70. (Hard-)Disk usage:
  71. additional space on disk only needed, if not enough memory for shortening
  72. of logfile available. Then there must be <new_length_of_logfile> Kbytes
  73. free space on disk !
  74.  
  75. Also the few bytes written into the logfile should be available!
  76.  
  77. Environment Variable and file access (access r=read, w=write):
  78.  
  79. Environment variable needed:    MAILER (r)
  80.  
  81. MAILER-path must contain the files:
  82.     "areas.bbs" (r)
  83.     "#areas.bbs" (r - only if -a option not set)
  84.     "tb.cfg" (r)
  85.     "acs.cfg" (r - only if -a option set)
  86. Further:
  87.     logfile (r/w, path from entry "statuslog" in "tb.cfg", e.g. "system.log")
  88.     echolist file (only if -a option set - path from "echolist" in "acs.cfg")
  89.     all *.HDR files from "areas.bbs" (r/w)
  90.     all *.MSG files from "areas.bbs" (r)
  91.     
  92.  
  93. If you are still reading and interested in the algorithm used by the
  94. program - read on (warning: C-Pseudo-Code contained!)...
  95.  
  96. 6. Algorithm used by the program
  97. --------------------------------
  98.  
  99. Here are a few introducing words:
  100. The program uses (for speed reasons) hashcode(*)-like values of the message-
  101. headers - these values are calculated only one time for all msgs in an area,
  102. and then all comparisons for double msgs are made on these values. If the
  103. values are the same, there is a high probability that the msgs are double,
  104. but to be sure, the msg-headers and the msg itself are looked through for
  105. differences. If there's only one difference, the msgs aren't double and
  106. therefore will not be deleted. I think this algorithm is very safe - it
  107. kills a lot, but not too much! 
  108.  
  109. (*)     a hashcode is a typical value for a data object, similar to a checksum,
  110.         used by hashing-algorithms [in this program no hashing is made, I only
  111.         took the name...]
  112.  
  113. The program was written with (Atari ST) Turbo C v1.1, an ANSI C-Compiler,
  114. which produces fast && compact code. The source code of this program is
  115. written in pure ANSI C and should be easily portable. If there's anyone
  116. out there, who wants to port it to other machines, contact me !
  117.  
  118.  
  119. Return codes of dbl_kill v1.20:
  120. ------------------------------
  121. #define OK 0            /* no error - all ok                    */
  122. #define EDIRNF -1        /* File areas.bbs not found        */
  123. #define EENVNF -2        /* env_var MAILER not found        */
  124. #define ELENNF -3        /* File #areas.bbs not found        */
  125. #define ECFGNF -4        /* File tb.cfg not found            */
  126. #define ELOGNFC -5    /* statuslog file not found        */
  127. #define ESTLNF -6        /* STATUSLOG entry not found        */
  128. #define ELOGNC -7        /* Logfile not creatable            */
  129. #define ETMPNC -8        /* temporary file not creatable    */
  130. #define EMALLOC -9    /* malloc failed                        */
  131. #define EELNF -10        /* ECHOLIST entry not found        */
  132. #define EELFNF -11    /* ECHOLIST file not found            */
  133.  
  134. Here is the pseudo-C-code of the program, derived from the original program
  135. text - best to be read from the end.
  136.  
  137. Almost all things concerning file-access, logfile and screen message output,
  138. error handling, dynamical memory allocation,'C'-implementation etc. have
  139. been left out here.
  140.  
  141. /*** dbl_kill v1.20 ***/
  142.  
  143. /* hashcodes were the same, now to be sure:    */
  144. is_double(message1,message2){
  145.     if(-d option set)
  146.         if(destaddr1!=destaddr2)
  147.             return FALSE;
  148.     if(messagehdr1.to!=messagehdr2.to)
  149.         return FALSE;
  150.     if(messagehdr1.from!=messagehdr2.from)
  151.         return FALSE;
  152.     if(messagehdr1.topic!=messagehdr2.topic)
  153.         return FALSE;
  154.     /* now compare msg-txt without SEEN-BY, PATH and program-infos    */
  155.     if(messagetxt1_up_to_"\n---" != messagetxt2_up_to_"\n---")
  156.         return FALSE;
  157.     /* else ... */
  158.     return TRUE;
  159. }
  160.  
  161. kill(message){
  162.     set flag 'DELETED' in header;
  163. }
  164.  
  165. scan_area(area,length){
  166.     if(length_of_headerfile!=length or option -a or -e set){
  167.         calc_hashcodes_of_all_msgheaders;
  168.  
  169.         /* look for double msgs */
  170.         for(all pairs message1,message2 in this area,
  171.              excluded the ones containing a deleted msg)
  172.             if(hashcode[message1]==hashcode[message2])
  173.                 if(is_double(message1,message2))
  174.                     kill(message2);
  175.                     /*   ^^^^^^^^ the newer one */
  176.     }
  177. }
  178.  
  179.  
  180. dbl_kill(){
  181.     path=get_environment_variable(MAILER);
  182.     dirfile=path+"areas.bbs";
  183.     lenfile=path+"#areas.bbs";
  184.     cfgfile=path+"tb.cfg";
  185.     open_logfile(value of entry statuslog in cfgfile);
  186.  
  187.     if(option -a set)
  188.         for(all areas in echolist file)
  189.             scan_area(area,dontcare)
  190.     else
  191.         for(all areas in dirfile){
  192.             length=get_length_from_lenfile;
  193.             scan_area(area,length)
  194.         }
  195.     close_logfile();
  196. }
  197.  
  198. main(){
  199.     if(option -s is set)
  200.         shorten_logfile();
  201.     dbl_kill();
  202. }
  203.  
  204. 7. Versions of the program
  205. --------------------------
  206.  
  207. V1.00 First spreaded version
  208. V1.01 Forget this (trash) version, delete it !!!
  209. V1.02 Bug (2 bombs) in dynamical memory allocation of V1.00 fixed
  210.         (this bug appeared only if you had a lot of msgs with identical
  211.         headers [more than free memory], because the memory malloc'd
  212.         for these msgs wasn't free'd after use)
  213. V1.10 -a option for ACS-System compatibility now - uses ECHOLIST file
  214.         instead of #areas.bbs
  215.         -e option for scan of Every area
  216. V1.20 much faster now, uses internal header/msg-cache and modified
  217.         algorithm
  218.         -d option added for usage on nodes:
  219.         in the netmail area of nodes are many double msgs - the msgs
  220.         for the points ! they only differ in the destination address
  221.         and should *not* be deleted. The -d option includes a test for
  222.         different dest. addresses in the double-test-routine of dbl_kill.
  223.  
  224.         IF YOU ARE A NODE, PLEASE INCLUDE THE MAIL-AREA IN YOUR AREAS.BBS
  225.         NOW AND USE THE -d OPTION, IF POSSIBLE. THIS PREVENTS THAT DOUBLE
  226.         MSGS ARE SENT TO YOUR POINTS !!!
  227.         
  228.  
  229. 8. Sorry for my English !
  230. -------------------------
  231.  
  232.