/* _dir_mak.c *********** Copyright 1989-1991 by Vermont Creative Software *********** _dir_make() Create a directory Call #include int _dir_make(pathp) UCHAR *pathp Pathname of directory to create Returns 1 Success. Directory created. 0 Failure. Directory not created. Description Creates a new directory. This function exists to provide a standard interface to the OS functions that create directories. On all systems we mkdir() is called to create the directory. On TERMINAL systems the directory permissions are set to 0660: read/write access for owner and group and search permission for no one. This makes it impossible for anyone to put files in the directory, which is desirable since this function is used only to lock access to a forms library. The return values from mkdir() are changed to the Vermont Views standard. Note: For those UNIX systems where mkdir() is not in the C library this routine will perform a system call. If your system is one of these please #define NO_DIR_FUNC 1 in vv_env.h to enable this functionality. Related Functions _dir_remove() */ #include #define PERMISSIONS 0660 #if NO_DIR_FUNC #include #include #endif int FASTCALL _dir_make(pathp) UCHAR *pathp; { #if UNIX #if NO_DIR_FUNC UCHAR sys_call[LENLIBNAME + 7]; /*Need extra space for "mkdir " */ #endif #endif int retval = 0; #if NO_DIR_FUNC strcpy(sys_call, "mkdir "); strcat(sys_call, pathp); if (!system(sys_call)) retval = 1; else errno = EACCES; #else if (!mkdir(pathp, PERMISSIONS)) retval = 1; #endif return(retval); }