home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a075 / 1.img / TOOLKIT1.EXE / SST241.PRG < prev    next >
Encoding:
Text File  |  1989-08-08  |  2.0 KB  |  91 lines

  1. *******************
  2.  
  3. FUNCTION Drnames
  4.  
  5.    PARAMETERS _array, _drive, _doabort
  6.  
  7.    IF PCOUNT() < 2
  8.       RETURN(.F.)
  9.    ELSEIF TYPE("_array") != "A"
  10.       RETURN(.F.)
  11.    ELSEIF LEN(_drive) != 2
  12.       RETURN(.F.)
  13.    ENDIF
  14.  
  15.    FOR _x = 1 TO LEN(_array)
  16.       _array[_x] = ""
  17.    NEXT
  18.  
  19.    * the _doabort variable is for the WHEREIS() function
  20.  
  21.    IF PCOUNT() = 2
  22.       _doabort = .F.
  23.       IF TYPE("_doabort") != "L"
  24.          RETURN(.F.)
  25.       ENDIF
  26.    ENDIF
  27.  
  28.    PRIVATE _root, _dstring
  29.  
  30.    * _root = the root string format to search by
  31.    * _dstring = the string for the drives
  32.  
  33.    _root = "\*."
  34.    _dstring = "+\"
  35.    _count =  1
  36.    _scount = 1
  37.  
  38.    DO WHILE .T.
  39.  
  40.       IF _doabort
  41.          IF INKEY() = 27
  42.             RETURN(.F.)
  43.          ENDIF
  44.       ENDIF
  45.       _search = PARSING(@_dstring) 
  46.  
  47.       IF _scount = 1
  48.          _array[_scount] = "\"
  49.       ELSE
  50.          _array[_scount] = _search
  51.       ENDIF
  52.       _scount = _scount + 1
  53.  
  54.       IF EMPTY(_dstring)
  55.          EXIT
  56.       ENDIF
  57.  
  58.       _path = _drive + _search + _root
  59.       DECLARE _temp[1]
  60.       _temp[1] = ""
  61.       _howmany = ADIR(_path, .F., .F., .F., .F., _temp)
  62.       IF !EMPTY(_howmany)
  63.          DECLARE _temp[_howmany], _names[_howmany]
  64.          ADIR(_path, _names, .F., .F., .F., _temp)
  65.          FOR x = 1 TO LEN(_temp)
  66.             IF _doabort
  67.                IF INKEY() = 27
  68.                   RETURN(.F.)
  69.                ENDIF
  70.             ENDIF
  71.             IF _temp[x] = "D"
  72.                IF _names[x] = "." .OR. _names[x] = ".."
  73.                ELSE
  74.                   _dstring = _dstring + _search + "\" + _names[x] + "+"
  75.                   _count = _count + 1
  76.                   IF _count > LEN(_array)
  77.                      RETURN(.F.)
  78.                   ENDIF
  79.                ENDIF
  80.             ENDIF
  81.          NEXT
  82.       ENDIF
  83.       IF "\\"$_dstring
  84.          _dstring = STRTRAN(_dstring, "\\", "\")
  85.       ENDIF
  86.    ENDDO
  87.  
  88.    RETURN(.T.)
  89.  
  90. * End of File
  91.