00001 /* 00002 * cynapses libc functions 00003 * 00004 * Copyright (c) 2008 by Andreas Schneider <mail@cynapses.org> 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License 00017 * along with this program; if not, write to the Free Software Foundation, 00018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 * 00020 * vim: ft=c.doxygen ts=2 sw=2 et cindent 00021 */ 00022 00023 /** 00024 * @file c_dir.h 00025 * 00026 * @brief Interface of the cynapses libc directory function 00027 * 00028 * @defgroup cynDirInternals cynapses libc directory functions 00029 * @ingroup cynLibraryAPI 00030 * 00031 * @{ 00032 */ 00033 00034 #ifndef _C_DIR_H 00035 #define _C_DIR_H 00036 00037 #include <sys/types.h> 00038 00039 00040 /** 00041 * @brief Create parent directories as needed. 00042 * 00043 * The newly created directory will be owned by the effective user ID of the 00044 * process. 00045 * 00046 * @param path The path to the directory to create. 00047 * 00048 * @param mode Specifies the permissions to use. It is modified 00049 * by the process's umask in the usual way: the 00050 * permissions of the created file are (mode & ~umask). 00051 * 00052 * @return 0 on success, < 0 on error with errno set: 00053 * - EACCES The parent directory does not allow write 00054 * permission to the process, or one of the directories 00055 * - ENOTDIR if durl is not a directory 00056 * - EINVAL NULL durl passed or smbc_init not called. 00057 * - ENOMEM Insufficient memory was available. 00058 * 00059 * @see mkdir() 00060 */ 00061 int c_mkdirs(const char *path, mode_t mode); 00062 00063 /** 00064 * @brief Check if a path is a directory. 00065 * 00066 * @param path The path to check. 00067 * 00068 * @return 1 if the path is a directory, 0 if the path doesn't exist, is a 00069 * file or can't be accessed. 00070 */ 00071 int c_isdir(const char *path); 00072 00073 /** 00074 * }@ 00075 */ 00076 #endif /* _CDIR_H */ 00077