X-Git-Url: https://git.wpitchoune.net/gitweb/?p=prss.git;a=blobdiff_plain;f=src%2Fio.h;fp=src%2Fio.h;h=189c3d1a59e66aafef5b1b44dddf841394e2337c;hp=0000000000000000000000000000000000000000;hb=77684af25efe1e3d3ca4e3462aed42c3489c0558;hpb=e68e296d497fcf6aadf73c0ee8f2dcd58aff0cc8 diff --git a/src/io.h b/src/io.h new file mode 100644 index 0000000..189c3d1 --- /dev/null +++ b/src/io.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2011-2012 jeanfi@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ + +#ifndef _PRSS_IO_H_ +#define _PRSS_IO_H_ + +/* + * Convenience functions for copying files. + */ + + +enum file_copy_code { + FILE_COPY_OK = 0, + FILE_COPY_ERROR_OPEN_SRC = 1, + FILE_COPY_ERROR_OPEN_DST, + FILE_COPY_ERROR_READ, + FILE_COPY_ERROR_WRITE, + FILE_COPY_ERROR_ALLOC_BUFFER +}; + +/* + * Copies file 'src' to 'dst'. + * + * Returns FILE_COPY_OK on success otherwise error code. + */ +int fcopy(const char *src, const char *dst); + +char *path_append(const char *odir, const char *name); + +void mkdirs(const char *dirs, mode_t mode); + +char *file_get_content(const char *fpath); + +#endif