home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0020 - 0029 / ibm0020-0029 / ibm0028.tar / ibm0028 / GRLF-C-2.ZIP / GFUNC / FILEFIND.ASM < prev    next >
Encoding:
Assembly Source File  |  1990-05-30  |  1.4 KB  |  71 lines

  1. ;/*
  2. ;** filefind.asm
  3. ;** contains: filefind()
  4. ;*/
  5.  
  6.         include model.h
  7.         include prologue.h
  8.  
  9.  
  10.         pseg    filefind
  11. ;/*
  12. ;**  int
  13. ;** filefind(unsigned int attribute,char *pathname,FFFNBUF *buffer)
  14. ;**
  15. ;** ARGUMENT(s)
  16. ;**    attribute    -    attribute used for searching
  17. ;**    pathname    -    name of file(s) to search for
  18. ;**    buffer        -    points to FFFNBUF structure
  19. ;**
  20. ;** DESCRIPTION
  21. ;**  Finds the first filename that matches the specified file specification.
  22. ;**  subsequent calls can be made with the pathname == NULL, in which case
  23. ;**  the DOS find next matching file function will be called.
  24. ;**
  25. ;** RETURNS
  26. ;**    0 if successful else a DOS error code.
  27. ;**
  28. ;** AUTHOR
  29. ;**  ""   Thu 22-Dec-1988    13:52:02
  30. ;**   Copyright (C)1988-1990 Greenleaf Software Inc. All Rights Reserved.
  31. ;**
  32. ;** MODIFICATIONS
  33. ;**
  34. ;*/
  35.  
  36.         cproc    filefind
  37.         if    _LDATA
  38.          push    ds
  39.          lds    dx,parm4_        ;DS:DX points to buffer
  40.         else
  41.          mov    dx,parm3_
  42.         endif
  43.         mov    ah,1ah
  44.         int    21h            ;Set DTA
  45.         if    _LDATA
  46.          lds    dx,parm2_        ;DS:DX points to filename
  47.          mov    ax,ds
  48.          or    ax,dx            ;is it 0?
  49.         else
  50.          mov    dx,parm2_
  51.          or    dx,dx            ;is it 0
  52.         endif
  53.         jnz    dofirst
  54.         mov    ah,4fh
  55.         jmp    short ffcommon
  56. dofirst:    mov    cx,parm1_        ;CX = attribute
  57.         mov    ah,4eh
  58. ffcommon:    int    21h            ;Find first function
  59.         if    _LDATA
  60.          pop    ds            ;Restore DS
  61.         endif
  62.         jc    fndfiex
  63.         xor    ax,ax
  64. fndfiex:
  65.  
  66.         cproce
  67.  
  68.  
  69.         endps
  70.         end
  71.