(no commit message)
[prss.git] / src / io.h
diff --git a/src/io.h b/src/io.h
new file mode 100644 (file)
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