home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / INFO / TURBOPAS / TPPROC19.ZIP / GETPARMS.INC < prev    next >
Encoding:
Text File  |  1985-02-05  |  1.2 KB  |  27 lines

  1. (*--------------------------------------------------------------------------*)
  2. (*                        GETPARMS.INC                                      *)
  3. (*  Turbo Pascal procedure to retrieve command line parameters.             *)
  4. (*  Copywrite 1984 Michael A. Covington                                     *)
  5. (*--------------------------------------------------------------------------*)
  6. type parmtype = string[127];
  7. procedure getparm(var s:parmtype);
  8. (*--------------------------------------------------------------------------*)
  9. (*  returns first available parameter from DOS command line and removes it  *)
  10. (*  next parameter will be returned on next call.  If no more parameters    *)
  11. (*  are available, returns a null string.                                   *)
  12. (*--------------------------------------------------------------------------*)
  13. var
  14.    parms  : parmtype absolute CSEG:$80;
  15.  
  16. begin
  17.      s:='';
  18.      (* parms[1] exists even when length is zero *)
  19.      while ( length(parms) > 0) and (parms[1] = ' ') do
  20.           delete(parms,1,1);
  21.      while (length(parms) > 0) and (parms[1] <> ' ') do
  22.           begin
  23.                s:=s+parms[1]; delete(parms,1,1)
  24.           end
  25. end;
  26.  
  27.