home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 2 BBS / 02-BBS.zip / VP2_409E.SZH / FILEDIR.C < prev    next >
Text File  |  1991-06-27  |  1KB  |  67 lines

  1. #include <dos.h>
  2. #include <string.h>
  3. #include "fastecho.h"
  4.  
  5. #ifndef OS2
  6. #define dir_findfirst _dos_findfirst
  7. #define dir_findnext _dos_findnext
  8. #endif
  9.  
  10. static struct find_t sbuf;
  11. static struct find_t sbuf1;
  12.  
  13. int filedir (
  14.    char *name,
  15.    int   times,
  16.    char *ret_str,
  17.    int   mode)
  18. {
  19.     if (times == 0)
  20.         {
  21.         if (dir_findfirst (name, mode, &sbuf))
  22.          {
  23.             sbuf.name[0] = '\0';
  24.          sbuf.attrib = 0;
  25.          }
  26.         strcpy (ret_str, sbuf.name);
  27.         }
  28.     else
  29.         {
  30.         if (dir_findnext (&sbuf))
  31.          {
  32.             sbuf.name[0] = '\0';
  33.          sbuf.attrib = 0;
  34.          }
  35.         strcpy (ret_str, sbuf.name);
  36.         }
  37.  
  38.    return (sbuf.attrib);
  39.     }
  40.  
  41. long filedir1 (
  42.    char *name,
  43.    int   times,
  44.    char *ret_str)
  45. {
  46.     if (times == 0)
  47.         {
  48.         if (dir_findfirst (name, 0, &sbuf1))
  49.          {
  50.             sbuf1.name[0] = '\0';
  51.             sbuf1.size = 0;
  52.          }
  53.         strcpy (ret_str, sbuf1.name);
  54.         }
  55.     else
  56.         {
  57.         if (dir_findnext (&sbuf1))
  58.          {
  59.             sbuf1.name[0] = '\0';
  60.             sbuf1.size = 0;
  61.          }
  62.         strcpy (ret_str, sbuf1.name);
  63.         }
  64.  
  65.    return (sbuf1.size);
  66.     }
  67.