aboutsummaryrefslogtreecommitdiffstats
path: root/sdk/other/fncat.c
blob: 1d8e3e794807acabf6078c321e5548a1cb72356e (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
/*
 * Concatenate filenames.
 * $Id$
 * Copyright (c) 1997 by Tycho Softworks.
 * For conditions of distribution and reuse review product license.
 */

#include <std/files.h>
#include <other/string.h>

char	*fncat(char *prefix, const char *suffix)
{
	char	*t = tail(prefix);

	if(!*prefix)
	{
		strcpy(prefix, suffix);
		return prefix;
	};
	
	if(*(--t) != '/')
	{
		*(++t) = '/';
		*(++t) = 0;
	}

	strcat(prefix, suffix);
	return prefix;
}