home *** CD-ROM | disk | FTP | other *** search
/ back2roots/padua / padua.7z / padua / uucp / duucp-1.17 / AU-117b4-src.lha / src / lib / isdir.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-24  |  618 b   |  39 lines

  1. /*
  2.  * IsDir
  3.  *
  4.  * Confirms that the specified path is a directory.
  5.  *
  6.  * Copyright 1990 by J. Gregory Noel, All Rights Reserved.
  7.  * Changes Copyright 1993 by Michael B. Smith, All Rights Reserved.
  8.  */
  9.  
  10. #include <libraries/dos.h>
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include "config.h"
  14. #include "version.h"
  15.  
  16. IDENT (".02");
  17.  
  18. Prototype int IsDir (const char *);
  19.  
  20. int
  21. IsDir (const char *path)
  22. {
  23.     int
  24.         r = 0;
  25.     BPTR
  26.         lock;
  27.     __aligned struct FileInfoBlock
  28.         fib;
  29.  
  30.     if (lock = Lock ((UBYTE *) path, ACCESS_READ)) {
  31.         if (Examine (lock, &fib))
  32.             if (fib.fib_DirEntryType > 0)
  33.                 r = 1;
  34.         UnLock (lock);
  35.     }
  36.  
  37.     return r;
  38. }
  39.