blob: cd4b83834e27f19841e327a35a8ef0893ab731f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
/* 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;
if(p1 == NULL || p2 == NULL) return NULL;
l1 = strlen(p1); l2 = strlen(p2);
ret = (char *)malloc((l1+l2+strlen(DIR_SEP))*sizeof(char));
if(ret == NULL) return ret;
ret[0] = '\0';
strcat(ret, p1);
strcat(ret, DIR_SEP);
strcat(ret, p2);
return ret;
}
|