home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / PSYCHO.PRG < prev    next >
Encoding:
Text File  |  1991-07-31  |  880 b   |  29 lines

  1. /*
  2.    FUNCTION: PsychoPath()
  3.    AUTHOR:   Greg Lief (with a name like that, was there any doubt?)
  4.    DATE:     Tuesday, August 21, 1990
  5.    PURPOSE:  Find a file in the DOS path
  6.    SYNTAX:   PsychoPath(<file name to find>)
  7.    RETURNS:  Character string: either the path in which the file
  8.              exists, or a null string if the file was not found
  9.              in the DOS path
  10.    DIALECT:  Clipper 5.x
  11.              Compile with: clipper psycho /n/w/a
  12. */
  13. function PsychoPath(mfile)
  14. local cpath := getenv("PATH") + ";", ret_val := []
  15. local ptr := at(";", cpath)
  16. do while ptr > 0
  17.    ret_val := substr(cpath, 1, ptr - 1)
  18.    ret_val := ret_val + if(right(ret_val, 1) != '\', '\', '')
  19.    if file(ret_val + mfile)
  20.       exit
  21.    else
  22.       ptr := at(";", cpath := substr(cpath, ptr + 1) )
  23.       ret_val := []
  24.    endif
  25. enddo
  26. return ret_val
  27.  
  28. * eof psycho.prg
  29.