home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 15 / CDACTUAL15.iso / cdactual / program / pascal / IOFUNC.ZIP / XCOMMAND.LIB < prev    next >
Encoding:
Text File  |  1986-04-12  |  2.9 KB  |  65 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.  XCOMMAND.LIB  Startup & Parameter parsing Library.
  18.  v2.2:  9/27/85 : eliminated useless proc xFnmParse, cleaned up & documented
  19.         it better, constructed xCommand.TST and removed TST module from
  20.         LIB file.
  21.  
  22. > xCommand( var Parms : buffer );
  23.         fetches the parameters used in the start keyin for the COM file. This
  24.         must be executed before any other statement in the program!
  25. > xCmdParse(      CmdParm    : buffer ;         Command Line input.
  26.              var  CmdList    : longwordlist;    array of parameters output.
  27.              var  TotalParms : Integer );       number of parameters output.
  28.         Parses command line and returns an array containing all parms.
  29. }
  30.  
  31. procedure xCommand( var Parms : buffer );{
  32. This  must be the first procedure executed in the program!!! otherwise only
  33. the first 32 characters are returned properly.                              }
  34.  
  35. var
  36.    CmdBuffr : buffer absolute cseg:$80 ;
  37. begin
  38.    Parms    := Copy( CmdBuffr, 2,Length(cmdBuffr));
  39. end{ Command };
  40.  
  41. procedure XCmdParse(    CmdParm    : buffer ;
  42.                     var CmdList    : LongWordList;
  43.                     var TotalParms : Integer );
  44. var
  45.    ParmLength, CommaPos   : integer  ;
  46.    OneParm     : LongWord ;
  47. begin
  48.    TotalParms := 1 ;
  49.    ParmLength := Length( CmdParm );
  50.  
  51.    If ParmLength > 2 then begin
  52.       While Pos(',', CmdParm) > 0 do begin
  53.          CommaPos              := Pos(',', CmdParm);
  54.          OneParm := copy( CmdParm, 1, CommaPos -1);
  55.          CmdList[ TotalParms ] := OneParm ;
  56.          TotalParms := Succ(TotalParms);
  57.          Delete( CmdParm, 1, CommaPos);
  58.       end{ while };
  59.    end{ If ParmLength };
  60.  
  61.    CMdList[ TotalParms ] := CmdParm ;
  62. end{ XCmdParse };
  63. { end xCommand.LIB
  64. *****************************************************************************}
  65.