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_file.h 00025 * 00026 * @brief Interface of the cynapses libc file function 00027 * 00028 * @defgroup cynFileInternals cynapses libc file functions 00029 * @ingroup cynLibraryAPI 00030 * 00031 * @{ 00032 */ 00033 00034 #ifndef _C_FILE_H 00035 #define _C_FILE_H 00036 00037 #include <sys/types.h> 00038 00039 #ifndef BUFFER_SIZE 00040 #define BUFFER_SIZE (16 * 1024) 00041 #endif 00042 00043 /** 00044 * @brief Check if a path is a regular file or a link. 00045 * 00046 * @param path The path to check. 00047 * 00048 * @return 1 if the path is a file, 0 if the path doesn't exist, is a 00049 * something else or can't be accessed. 00050 */ 00051 int c_isfile(const char *path); 00052 00053 /** 00054 * @brief copy a file from source to destination. 00055 * 00056 * @param src Path to the source file 00057 * @param dst Path to the destination file 00058 * @param mode File creation mode of the destination. If mode is 0 then the 00059 * mode from the source will be used. 00060 * 00061 * @return 0 on success, less then 0 on error with errno set. 00062 * EISDIR if src or dst is a file. 00063 */ 00064 int c_copy(const char *src, const char *dst, mode_t mode); 00065 00066 /** 00067 * }@ 00068 */ 00069 #endif /* _C_FILE_H */ 00070