home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 2 / ctrom_ii_b.zip / ctrom_ii_b / PROGRAM / FOXPRO / FCT1_12 / STRIP.PRG < prev    next >
Text File  |  1990-07-06  |  2KB  |  64 lines

  1. #include fct1.hdr
  2. #include fileio.hdr
  3.  
  4. vardef
  5.    logical  flag
  6.    logical  again
  7.    char     Buf
  8.    file     stream_read
  9. enddef   
  10.    
  11. procedure force_main
  12.    params const char cmdlin
  13.    
  14.    key_dos
  15.    scrn_dos
  16.    
  17.    if .not. f_open(stream_read, token(cmdlin, " ", 2), &f_read)
  18.       ?? "Can't open input file " + token(cmdlin, " ", 2)
  19.       _quit 1
  20.    endif
  21.    
  22.    ?? "*" + rtrim(center('Strip a header file, (c) 1990 by P.R.', 80))
  23.    ? "*" + Rtrim(Center(token(cmdlin, " ", 2) + ' stripped version.', 80))
  24.    ?   
  25.  
  26.    do while .not. f_eof(stream_read)
  27.       if .not. f_getln(stream_read, buf)
  28.          ? 'error reading file ' + token(cmdlin, " ", 1)
  29.          _quit 2
  30.       endif
  31.       
  32.       buf = alltrim(buf)
  33.  
  34.       if substr(buf, 1, 1) <> "*" .and. substr(buf, 1, 1) <> '&&'
  35.          if again
  36.             flag = .t.
  37.             ?? space(10) + buf
  38.          endif
  39.          if at('PROCEDURE', upper(buf)) <> 0 .or. at('FUNCTION', upper(buf)) <> 0 
  40.             if flag
  41.                ?
  42.             endif            
  43.             flag = .t.
  44.             ? buf
  45.          endif
  46.          if at('PARAMS', upper(buf)) <> 0 .or. at('PARAMETERS', upper(buf)) <> 0
  47.             flag = .f.
  48.             ? '   ' + Buf
  49.             ?
  50.          endif
  51.          if substr(buf,1,1)="#"
  52.             flag = .t.
  53.             ? buf
  54.          endif
  55.          if at(";", buf) <> 0
  56.             again = .t.
  57.          else
  58.             again = .f.
  59.          endif
  60.       endif   
  61.    enddo
  62.    f_close(stream_read)
  63.  
  64. endpro