home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / me34src.zip / me3 / util / misc / ibmdir.c next >
C/C++ Source or Header  |  1995-01-14  |  999b  |  47 lines

  1. /*
  2.  * Some support routines for MS-DOS.  These are directory/disk search
  3.  *   routines in Lattice C but not in other Cs.
  4.  * In Lattice C, these routines are minimal front ends to int 21 dos calls.
  5.  * J Burnell  3/92    Public Domain
  6.  */
  7.  
  8. #include <string.h>
  9. #include <dos.h>
  10. #include <dir.h>
  11. #include "ibmdir.h"
  12.  
  13. static struct ffblk find_buf;
  14.  
  15. int dfind (struct FILEINFO *buffer, const char *path, int attrib)
  16. {
  17. /* returns TRUE if no match found, FALSE otherwise */
  18.  
  19.   if (!findfirst (path, &find_buf, attrib)) {
  20.     buffer->attr = find_buf.ff_attrib;
  21.     strcpy (buffer->name, find_buf.ff_name);
  22.     return 0;
  23.   } else
  24.     return 1;
  25. }
  26.  
  27. int dnext (struct FILEINFO *buffer)
  28. {
  29. /* returns TRUE if no match found, FALSE otherwise   */
  30.  
  31.   if (!findnext (&find_buf)) {
  32.     buffer->attr = find_buf.ff_attrib;
  33.     strcpy (buffer->name, find_buf.ff_name);
  34.     return 0;
  35.   } else
  36.     return 1;
  37. }
  38.  
  39. int getdsk (void) {
  40.  
  41.   return getdisk ();
  42. }
  43.  
  44. int getcd (int drive, char *dir) {
  45.   return getcurdir (drive, dir);
  46. }
  47.