aboutsummaryrefslogtreecommitdiff
path: root/example_packages/with_c/src/c_code.c
blob: 44604f029c7d8ccddf43999e6ca281d4cc470ae4 (plain)
1
2
3
4
5
6
7
8
9
10
#include <sys/stat.h>
/*
 *  Decides whether a given file name is a directory.
 *  return 1 if file exists and is a directory
 *  Source (Public domain): https://github.com/urbanjost/M_system
 */
int my_isdir (const char *path) {
   struct stat sb;
   return stat(path, &sb) == 0 && S_ISDIR (sb.st_mode);
}