home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / concat.zip / ReadMe < prev   
Text File  |  1995-06-27  |  4KB  |  82 lines

  1.  
  2.   ConCat - Concatenate multi-line file descriptions into one line
  3.  
  4.   Many BBSs make available a list of all files available on the system.
  5.   The format of the file listing varies from system to system.  After
  6.   downloading several files, I like to use 4OS/2's file description
  7.   feature to keep track of what I have.
  8.  
  9.   The ALLFILES.TXT file from Pete Norloff's OS/2 ShareWare BBS uses
  10.   a format in which each file has a full-line description, sometimes
  11.   followed by additional lines of description.  These lines begin
  12.   with enough spaces to make the descriptions line-up neatly beginning
  13.   in column thirty.  This looks very sharp, but makes it difficult to
  14.   pick out a complete description to give to 4OS/2.
  15.  
  16.   I found that I was using a text editor to copy the description pieces
  17.   line-by-line into the buffer, then pasting them into the 4OS/2
  18.   window where 4OS/2's DESCRIBE was waiting.
  19.  
  20.   I know, I could do it with PERL and AWK and SED, but I didn't have
  21.   time to learn any of the above, so I wrote a kludge to do the job
  22.   for me.
  23.  
  24.   ConCat copies all characters from stdin to stdout until it sees a
  25.   CR.  When it sees a CR it begins absorbing characters, starting
  26.   after the next (expected) LF, until it sees a non-space or has
  27.   absorbed thirty characters.  If it reaches thirty, ConCat discards
  28.   the absorbed characters and resumes copying stdin to stdout.  If
  29.   ConCat sees a non-space before it reaches thirty absorbed characters,
  30.   it copies all of the absorbed characters to stdout and resumes
  31.   copying stdin to stdout.
  32.  
  33.   The net effect is that any sequence of CR/LF followed by twenty-eight
  34.   spaces is deleted, leaving entire file descriptions on one line.
  35.  
  36.   It's a Pretty Dumb Algorithm (can you say 'brute-force?') but it 
  37.   works relatively fast, 11.6 seconds on a 486DX2-66 on ALLFILES.TXT.
  38.  
  39.   Oh yes, the other reason I had to write this is that neither Boxer
  40.   nor RimStar (my two favorite editors) could (easily, at least) search
  41.   for and delete an end-of-line followed by something.
  42.  
  43.   USAGE:
  44.  --------
  45.  
  46.   Pretty simple, actually.  ConCat is a filter, so use it something
  47.   like this:
  48.  
  49.     ConCat < ALLFILES.TXT > ALLFILES.CAT
  50.  
  51.  
  52.   Please note the comments in the code, including the ones that look
  53.   like this:
  54.  
  55.  *   Copyright (c) 1995 J. Daniel Ashton                               *
  56.  *                                                                     *
  57.  *   You are free to redistribute this code in its present format.     *
  58.  *   If you use this code in your program, please give appropriate     *
  59.  *   credit somewhere in your package, and please drop a note to me.   *
  60.  *   (I could use the ego boost!)                                      *
  61.  *                                                                     *
  62.  *   If you see any bugs or design issues, please let me know--I'm     *
  63.  *   still growing in the language (as are most of us ;-)  I'd like    *
  64.  *   to hear how you react to this program.                            *
  65.  *                                                                     *
  66.  *   jdashton@southern.edu                                             *
  67.  *   72401,1667@compuserve.com                                         *
  68.  *   (615) 238-7111 x2319 days (Eastern Time)                          *
  69.  *   (615) 559-1026       nights                                       *
  70.  *                                                                     *
  71.  *   J. Daniel Ashton                                                  *
  72.  *   PO Box 1327                                                       *
  73.  *   Collegedale, TN  37315-1327                                       *
  74.  
  75.   More than anything I'd like to get feedback on this:  Is the code
  76.   good, how would you have done it, which tools already do this sort
  77.   of thing, which words did I misspell, etc.  
  78.  
  79.   Enjoy! I look forward to hearing from you!
  80.  
  81.   Daniel
  82.