home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / IOFUNC.ZIP / TOPTION.LIB < prev    next >
Encoding:
Text File  |  1986-04-12  |  2.0 KB  |  39 lines

  1. {           ╔═══╦══════════════════════════════════════════════╦═══╗
  2.             ║   ║         Pascal Library by Scott Wade         ║   ║
  3.             ║   ║           715 FM 1959      Apt 310           ║   ║
  4.             ║   ║           Houston, TX 77034                  ║   ║
  5.      ┌──────╨───╨──────────────────────────────────────────────╨───╨──────┐
  6.      │  This  group of routines is contributed to public domain,  and no  │
  7.      │  one can possibly get any commercial value out of them since they  │
  8.      │  must be used in other programs. I require that if these are used  │
  9.      │  as is in  any  program,  that this banner remain with the source  │
  10.      │  code of the program.  I would appreciate any comments or sugges-  │
  11.      │  tions on improvements, & am curious to hear how these are used.   │
  12.      │  You can leave a message for me on these BBS's:                    │
  13.      │          Ziggy's  821-1391         ScoreBoard  583-7848            │
  14.      │          TBL-COMM 661-9040         Test-Mode   660-9252            │
  15.      └────────────────────────────────────────────────────────────────────┘
  16.  
  17.  TOPTION.LIB v1.0   Command option parser.
  18.  v1.0:  4/11/86 : Given a buffer, this will extract a one-letter option that
  19.         is preceded by /. For example:
  20.         JOBRUN /f filename.ext
  21.         will return 70, the ascii equivalent of 'F', and the buffer will be
  22.         ' filename.ext' NOTE: it converts to uppercase!        }
  23.  
  24. procedure tOption( var BufLine : Buffer ; var AscInt : Integer );
  25. var
  26.    LenOpt          : Byte Absolute BufLine;
  27.    PosOpt, DelChar : Integer;
  28.    OptChar         : Char ;
  29. begin
  30.    If LenOpt > 1 then begin
  31.       PosOpt := Pos( '/', BufLine );
  32.       If (PosOpt > 0) AND ( PosOpt <  ( LenOpt )) then begin
  33.          AscInt  := Ord( UpCase( Copy( BufLine, PosOpt +1,1)));
  34.          Delete( BufLine, PosOpt, 2 );
  35.       end{ If / and anything after it };
  36.    end{ If long enuf to have options };
  37. end;
  38. { end  TOPTION.LIB
  39. *****************************************************************************}