summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-02 09:07:27 -0500
committerJeffrey Armstrong <jeffrey.armstrong@approximatrix.com>2014-01-02 09:07:27 -0500
commiteb626bd8ee3fddae050dbf9babfbea19961a36f2 (patch)
tree2002c12e08bf87e3a266f3696e932ce3e2af0170 /util.c
downloadprism-eb626bd8ee3fddae050dbf9babfbea19961a36f2.tar.gz
prism-eb626bd8ee3fddae050dbf9babfbea19961a36f2.zip
Initial code commit, including db init and file hashing
Diffstat (limited to 'util.c')
-rw-r--r--util.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/util.c b/util.c
new file mode 100644
index 0000000..1c663ae
--- /dev/null
+++ b/util.c
@@ -0,0 +1,34 @@
+/* Prism Versioning
+ * Copyright 2014 Jeffrey Armstrong <jeff@rainbow-100.com>
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys\types.h>
+#include <direct.h>
+#include <string.h>
+
+#include "prism.h"
+
+char *alloc_and_combine_paths(char *p1, char *p2)
+{
+int l1, l2;
+char *ret, *two;
+
+ if(p1 == NULL || p2 == NULL) return NULL;
+
+ l1 = strlen(p1); l2 = strlen(p2);
+
+ ret = (char *)malloc((l1+l2+2)*sizeof(char));
+ if(ret == NULL) return ret;
+
+ ret[0] = '\0';
+ strcat(ret, p1);
+ two = ret + l1;
+ two[0] = DIR_SEP;
+ two[1] = '\0';
+ two = NULL;
+ strcat(ret, p2);
+
+ return ret;
+} \ No newline at end of file