home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari FTP
/
ATARI_FTP_0693.zip
/
ATARI_FTP_0693
/
Mint
/
mntlib25.zoo
/
mkdir.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-02-12
|
894b
|
46 lines
/* mkdir: make a new directory
* written by Eric R. Smith and placed in the public domain
* modified by Alan Hourihane, to check for directory and return EEXIST.
*/
#include <errno.h>
#include <limits.h>
#include <osbind.h>
#include <mintbind.h>
#include <stat.h>
#include "lib.h"
extern int errno;
extern int __mint;
int mkdir(_path, mode)
const char *_path;
unsigned mode;
{
struct stat statbuf;
int rv;
char path[PATH_MAX];
_unx2dos(_path, path);
rv = stat(path, &statbuf); /* Stat directory */
if (rv == 0) { /* Does it exist ? */
errno = EEXIST; /* Yes, so tell user. */
return -1;
}
if (errno != ENOENT) { /* Return stat error, if other than */
return -1; /* File not found. */
}
rv = Dcreate(path);
if (rv < 0) {
errno = -rv;
return -1;
}
if (__mint >= 9) {
(void)Fchmod(path, mode);
}
return 0;
}