From eb626bd8ee3fddae050dbf9babfbea19961a36f2 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Thu, 2 Jan 2014 09:07:27 -0500 Subject: Initial code commit, including db init and file hashing --- util.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 util.c (limited to 'util.c') 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 + */ + +#include +#include +#include +#include +#include + +#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 -- cgit v1.2.3