home *** CD-ROM | disk | FTP | other *** search
/ Current Shareware 1994 January / SHAR194.ISO / modem / hs_gap63.zip / FLISTCNV.PAS < prev    next >
Pascal/Delphi Source File  |  1993-09-07  |  1KB  |  57 lines

  1.  
  2.  
  3. function trimit (ln: string): string;
  4. var
  5.    i: integer;
  6.    
  7. begin
  8.    
  9.    for i := 1 to length(ln) do
  10.       if ln[i]= #0 then
  11.          ln[i]:= ' ';
  12.    
  13.    while ln[length(ln)] = ' ' do
  14.       dec(ln[0]);
  15.  
  16.    while copy(ln,1,1) = ' ' do
  17.       delete(ln,1,1);
  18.  
  19.    trimit := ln;
  20. end;
  21.  
  22.  
  23. type
  24.    {this matches the format of the filelst.dwn file produced by gap}
  25.    thefile = record
  26.          fname:  array[1..12] of char;
  27.          junk1:  char;
  28.          junk2:  char;
  29.          dir:    array[1..25] of char;
  30.          junk3:  array[1..27] of char;
  31.    end;
  32.    
  33. var
  34.    i:    integer;
  35.    cnv:  thefile;
  36.    fd1:  file of thefile;
  37.    fd2:  text;
  38.    
  39. begin
  40.    assign(fd1, 'filelst.dwn');
  41.    reset(fd1);
  42.    assign(fd2, 'filelist');
  43.    rewrite(fd2);
  44.    
  45.    for i := 1 to filesize (fd1) do
  46.    begin
  47.       read(fd1, cnv);
  48.       {writeln('[',cnv.dir,'] [', cnv.fname,']');}
  49.       writeln(fd2, trimit (cnv.dir), '\', trimit (cnv.fname));
  50.    end;
  51.    
  52.    close(fd2);
  53.    close(fd1);
  54.  
  55. end.
  56.  
  57.