home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 18 REXX / 18-REXX.zip / REX2U10.ZIP / DISPATH.CMD next >
OS/2 REXX Batch file  |  1991-07-16  |  1KB  |  43 lines

  1. /* Display Directory path of PATH or DPATH variable */
  2. /*            version 1.0  July 15, 1991        */
  3. /*                         Bob Pound            */
  4.  
  5. arg reqtype
  6. type=gettype(reqtype)
  7. PATH=value(type,,'OS2ENVIRONMENT')
  8. call Displaypath
  9. exit
  10.  
  11. /* Called Local Procedures */
  12.  
  13. Displaypath:
  14. sp=1
  15. do until ep>=length(path)
  16.     ep=pos(";",path,sp)
  17.      /* if path doesn't end with ;, then a 0 value is returned */
  18.      if ep=0 then ep=length(path)+1
  19.     dir=substr(path,sp,ep-sp)
  20.     SAY "DIR:" dir
  21.     sp=ep+1
  22. end
  23. return
  24.  
  25. gettype: 
  26. arg reqtype
  27. deftype="PATH"
  28. if reqtype=="" then type=deftype
  29. else do 
  30.     if reqtype = "PATH" | reqtype = "P" then type="PATH"
  31.     else do
  32.       if reqtype = "DPATH" | reqtype = "D" then type="DPATH"
  33.       else do      
  34.           say "**The valid parameters for this procedure are:"
  35.           say "       PATH or P   - to display the PATH"
  36.           say "       DPATH or D  - to display the DPATH"
  37.           say "  If no parameter is entered the default is PATH"
  38.           exit
  39.       end   
  40.     end
  41. end
  42. say type "directory listing"
  43. return (type)