summaryrefslogtreecommitdiff
path: root/rfile.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-05 16:28:21 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-05 16:28:21 -0500
commit59a9b205dfb6d68545e75f28083cf68eb064547d (patch)
tree1be3a06d55d87d9c93cb3d9660e6eb4e1a16bf5c /rfile.c
parent50ff0e53d94c60860e768100f549e4dfe9110096 (diff)
downloadprism-59a9b205dfb6d68545e75f28083cf68eb064547d.tar.gz
prism-59a9b205dfb6d68545e75f28083cf68eb064547d.zip
Prism can now revert current changes
Diffstat (limited to 'rfile.c')
-rw-r--r--rfile.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/rfile.c b/rfile.c
index 11511a3..ae75bf7 100644
--- a/rfile.c
+++ b/rfile.c
@@ -1,6 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <io.h>
#include "prism.h"
#include "md5.h"
@@ -54,3 +55,21 @@ char *newfile;
return PRET_GZFAILED;
}
+
+int decompress_file(const char *destination, int id, int revision)
+{
+char *stored_name;
+
+ /* Arbitrary size... */
+ stored_name = (char *)malloc(128*sizeof(char));
+ if(stored_name == NULL)
+ return PRET_ERROR;
+ snprintf(stored_name, 128, "%s%s%x.%x", PDB_DIR, DIR_SEP, id, revision);
+
+ unlink(destination);
+
+ if(file_uncompress(stored_name, destination) >= 0)
+ return PRET_OK;
+
+ return PRET_GZFAILED;
+}