/* _dir_remove.c *********** Copyright 1989-1991 by Vermont Creative Software *********** _dir_remove() Remove a directory Call #include int _dir_remove(pathp) UCHAR *pathp; Name of directory to delete Returns 1 Success. Directory removed. 0 Failure. Directory not removed. Description Removes a directory from the file system. This function exists in order to provide a common interface for removing directories under different OS's. PCDOS, UNIX and POSIX: Uses rmdir() but change the return value to Vermont Views standard. Note: For those UNIX systems where rmdir() 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. VMS: Use RMS calls to first change the file protection bits on the directory file and then delete the file. Related Functions _dir_make() Cautions The directory must be empty and must not be the current directory. */ #include #if UNIX #if NO_DIR_FUNC #include #include #endif #endif #if POSIX #include #endif int FASTCALL _dir_remove(pathp) UCHAR *pathp; { #if UNIX #if NO_DIR_FUNC UCHAR sys_call[LENLIBNAME + 7]; /*Need extra space for "rmdir " */ #endif #endif int retval = 0; #if UNIX #if NO_DIR_FUNC strcpy(sys_call, "rmdir "); strcat(sys_call, pathp); if (!system(sys_call)) retval = 1; else errno = EACCES; #else if (!rmdir(pathp)) retval = 1; #endif #endif #if POSIX if (!rmdir(pathp)) retval = 1; #endif return(retval); }