home *** CD-ROM | disk | FTP | other *** search
/ Monster Media 1994 #1 / monster.zip / monster / PROG_BAS / PBC23C.ZIP / FDESCREA.BAS < prev    next >
BASIC Source File  |  1994-03-13  |  2KB  |  67 lines

  1. '   +----------------------------------------------------------------------+
  2. '   |                                                                      |
  3. '   |        PBClone  Copyright (c) 1990-1994  Thomas G. Hanlin III        |
  4. '   |                                                                      |
  5. '   +----------------------------------------------------------------------+
  6.  
  7.    DECLARE SUB FClose1 (BYVAL FileHandle%)
  8.    DECLARE SUB FOpen1 (FileName$, BYVAL ReadWrite%, BYVAL Sharing%, FileHandle%, ErrCode%)
  9.    DECLARE SUB FReadLine (FileHandle%, Dest$, DLen%, TooLong%, ErrCode%)
  10.  
  11.  
  12. FUNCTION FDescRead$ (FileName$)
  13.  
  14.    IF LEN(FileName$) = 0 THEN
  15.       FDescRead$ = ""
  16.       EXIT FUNCTION
  17.    END IF
  18.  
  19.    Path$ = FileName$
  20.    File$ = ""
  21.    Done% = 0
  22.    DO
  23.       ch$ = RIGHT$(Path$, 1)
  24.       IF LEN(ch$) = 0 OR ch$ = ":" OR ch$ = "\" OR ch$ = "/" THEN
  25.          Done% = -1
  26.       ELSE
  27.          Path$ = LEFT$(Path$, LEN(Path$) - 1)
  28.          File$ = ch$ + File$
  29.       END IF
  30.    LOOP UNTIL Done%
  31.  
  32.    IF LEN(File$) = 0 THEN
  33.       FDescRead$ = ""
  34.       EXIT FUNCTION
  35.    END IF
  36.  
  37.    FOpen1 Path$ + "DESCRIPT.ION", 0, 2, Handle%, ErrCode%
  38.    IF ErrCode% THEN
  39.       FDescRead$ = ""
  40.       EXIT FUNCTION
  41.    END IF
  42.  
  43.    St$ = SPACE$(256)
  44.    L% = LEN(File$)
  45.    DO
  46.       FReadLine Handle%, St$, SLen%, TooLong%, ErrCode%
  47.       Found% = (UCASE$(LEFT$(LEFT$(St$, SLen%), L%)) = File$)
  48.    LOOP UNTIL Found% OR ErrCode%
  49.    FClose1 Handle%
  50.  
  51.    IF Found% THEN
  52.       St$ = LEFT$(St$, SLen%)
  53.       tmp% = INSTR(St$, " ")
  54.       IF tmp% THEN
  55.          St$ = LTRIM$(MID$(St$, tmp% + 1))
  56.          tmp% = INSTR(St$, CHR$(4))
  57.          IF tmp% THEN St$ = LEFT$(St$, tmp% - 1)
  58.          FDescRead$ = St$
  59.       ELSE
  60.          FDescRead$ = ""
  61.       END IF
  62.    ELSE
  63.       FDescRead$ = ""
  64.    END IF
  65.  
  66. END FUNCTION
  67.