#include "CArrayMasks.h" #include "CVars.h" #include "CMisc.h" #include "CErrors.h" #include "math.h" #include #include #include "CCalcFricVel.h" #include "CSetFricVel.h" #include #include #include #include #ifdef __INTEL_COMPILER #define PYM makedirectory #else #define PYM makedirectory_ #endif extern "C" void _FORTRAN PYM (char *path, int *status) { struct stat buf; #ifdef __INTEL_COMPILER if (!(*status = _mkdir(path, NULL))) return; #else if (!(*status = mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH))) return; #endif /* status != 0, so we've got a problem, look at errno */ /* if it's not EEXIST (already exists) return the non-zero status */ #ifndef __INTEL_COMPILER if (errno != EEXIST) return; /* the path already exists, so we need to know if it's a directory */ /* if stat fails, we can't read something, fail */ if (stat(path,&buf)) return; /* if it's a directory, return success, otherwise just return */ if (S_ISDIR(buf.st_mode)) *status = 0; #endif return; }