isdir.c 296 B

1234567891011121314151617181920
  1. #include <grass/dbmi.h>
  2. #include <unistd.h>
  3. #include <sys/types.h>
  4. #include <sys/stat.h>
  5. /*!
  6. \fn
  7. \brief
  8. \return
  9. \param
  10. */
  11. int db_isdir(const char *path)
  12. {
  13. struct stat x;
  14. if (stat(path, &x) != 0)
  15. return DB_FAILED;
  16. return (S_ISDIR(x.st_mode) ? DB_OK : DB_FAILED);
  17. }