v0.0.6
[ppastats.git] / trunk / src / io.h
diff --git a/trunk/src/io.h b/trunk/src/io.h
new file mode 100644 (file)
index 0000000..259e218
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2011 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 _PPASTATS_IO_H_
+#define _PPASTATS_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);
+
+#endif