home *** CD-ROM | disk | FTP | other *** search
/ The Elite Hackers Toolkit / TheEliteHackersToolkitVolume1_1998.rar / HACKERS.BIN / appcraks / SPLITUPC.ZIP / SPLITUPC.PAS < prev   
Pascal/Delphi Source File  |  1998-01-26  |  6KB  |  171 lines

  1. program splitupc;        {kudut@mystics.bungi.com   ver 1 apr 15, 1993}
  2.                                                     {ver 2 jan 26, 1998}
  3.                           {purpose: splits uupc/extended-type mailbox into files
  4.                            of sequentially-numbered filenames, for use
  5.                            with the news portion of the waffle.
  6.  
  7.                            {UPDATE JAN 1998 Re-writing program to
  8.                            1) work with UUPC (20 ^A's and a linefeed) and
  9.                            2) work with Waffle under these new conditions:
  10.                               a) Creating old Waf 1.64 mailbox-style
  11.                                  instead of Newsgroup style.
  12.                            PURPOSE: To facilitate (hopefully) importing
  13.                            of UUPC mailbox-style into Waffle style
  14.                            mailboxes    2.00
  15.  
  16.                            I'm going to try it reading line by line
  17.                            to speed up process for UUPC mailbox
  18.                            iT WORKS!  iT WORKS!}
  19.  
  20. uses dos;
  21.  
  22. var
  23.             ch : string;
  24.            f,g : text;
  25. end_of_message : boolean;
  26.       filename : string;
  27.     filenumber : integer;     {which number we're at when creating new filenames}
  28.  
  29.  
  30. function IntToStr(i: Longint): string;
  31. { Convert any Integer type to a string }
  32. var
  33.   s: string;
  34. begin
  35.   Str(i, s);
  36.   IntToStr := s;
  37. end;
  38.  
  39.  
  40. function FileExists(FileName: STRING)
  41.                                 : Boolean;
  42. { Returns True IF file exists; otherwise,
  43.   it returns False. }
  44.  
  45. VAR
  46.   f : file;
  47. BEGIN
  48.   {$I-}
  49.   ASSIGN(f, FileName);
  50.   RESET(f);
  51.   CLOSE(f);
  52.   {$I+}
  53.   FileExists := (IOResult = 0) and
  54.    (FileName <> '');
  55. END;  { FileExists }
  56.  
  57.  
  58. procedure Read_And_Write_New_Files;
  59. var i : integer;
  60. begin
  61. i := 0;
  62.  
  63. (* reads in for the twenty control-a's *)
  64.             begin
  65.             readln(f,ch);
  66.                if ch = ''
  67.                          then end;
  68.  
  69. if eof(f) then exit;
  70.  
  71.         repeat
  72.         end_of_message := FALSE;
  73.           readln(f,ch);
  74.                if ch = '' then begin
  75.                   end_of_message := TRUE;
  76.                   exit;
  77.                   end
  78.                  else
  79.           write ('#');  {progress indicator}
  80.           writeln(g,ch);
  81.         until (eof(f)) or (end_of_message = TRUE);
  82.         end;
  83.  
  84.  
  85.  
  86. (* Dispersion of Wisdom is always a good thing *)
  87. procedure fun_error_message;
  88. const number_of_quotes = 20;
  89.  
  90. begin
  91. randomize;
  92. case random(number_of_quotes) of
  93.      0 : write('Be quick to take advantage of an advantage. - ');
  94.      1 : write('Trust in God but lock your car. - ');
  95.      2 : write('Never miss an opportunity to sleep in a screened-in porch. - ');
  96.      3 : writeln('Wear a shirt and tie to every interview - even for a job packing crates. --> ');
  97.      4 : write('When you go to borrow money, dress as if you have plenty of it. - ');
  98.      5 : write('Never apologize for being early for an appointment. - ');
  99.      6 : write('Accept a breath mint if someone offers you one. - ');
  100.      7 : write('Love deeply and passionately.  You may get hurt, but it''s the only way to       live life completely. --> ');
  101.      8 : write('Never laugh at anybody''s dreams. - ');
  102.      9 : writeln('Don''t be surprised to discover that luck favors those who are prepared. --> ');
  103.      10: writeln('Make allowances for your friends'' imperfections as easily you do your own. -> ');
  104.      11: writeln('Smile when picking up the phone.  The caller will hear it in your voice. --> ');
  105.      12: writeln('Write a short note inside the cover, when giving a book as a gift. --> ');
  106.      13: write('Be the first to fight for a just cause. - ');
  107.      14: writeln('Every so often, invite the person behind you in line to go in front. --> ');
  108.      15: write('Give people more than they expect and do it cheerfully. - ');
  109.      16: write('Don''t overlook life''s small joys when seeking the big ones. - ');
  110.      17: write('Talk slow but think quick. - ');
  111.      18: write('When you lose, don''t lose the lesson. - ');
  112.      19: write('Stop and watch stonemasons at work. - ');
  113.      20: write('Remember that a good example is the best sermon. - ');
  114. end;
  115. end;
  116.  
  117. begin
  118.  
  119. (* GLOAT SECTION *)
  120.  
  121. writeln('SplitUPC 2.00 by Kenneth Udut');
  122. writeln;
  123. writeln('       Takes UUPC/Extended-Style Mailbox, where each message is separated by a set of');
  124. writeln('       20 Control-A''s, and spits out each message into a separate file, named');
  125. writeln('       1, 2, 3, 4, etc.  Created for the use of easily porting mailboxes to a');
  126. writeln('       format that Waffle Newsreaders like.');
  127. writeln;
  128. writeln('              +-----------------------------+');
  129. writeln('              | Usage: SPLITUPC mailbox.spb |');
  130. writeln('              +-----------------------------+');
  131. writeln;
  132. writeln('                                                        kudut@mystics.bungi.com');
  133.  
  134. (* Check Whether or not specified filename (MAILBOX.F) for example, exists *)
  135.  
  136. filename := paramstr(1);
  137. while not FileExists(filename) do
  138.    begin
  139.         fun_error_message;
  140.         write('Filename: ');
  141.         readln(filename);
  142.    end;
  143.  
  144. (* Now that the file exists, open up the file and start processing *)
  145. assign(f,filename);
  146. reset(f);
  147.  
  148. readln(f,ch);  {reading into the first message helps the problem of skipped first message}
  149.  
  150. filenumber := 1;
  151. end_of_message := TRUE;
  152.  
  153. (* Progresses filenumber plus one, or skips if the file exists already *)
  154. repeat
  155.       while fileexists(IntToStr(filenumber)) do filenumber := filenumber + 1;
  156.       assign(g, IntToStr(filenumber));
  157.       rewrite(g);
  158.  
  159.       writeln;
  160.       write(filenumber,' ');
  161.  
  162.       Read_And_Write_New_Files;
  163.  
  164.       close(g);
  165. until eof(f);
  166. close(f);
  167.  
  168. writeln;
  169. fun_error_message;
  170. end.
  171.