Files
Arquivotheca.SunOS-4.1.4/usr.etc/tfs/libtfs/path-util.c
seta75D ff309bfe1c Init
2021-10-11 18:37:13 -03:00

34 lines
603 B
C

#ifndef lint
static char sccsid[] = "@(#)path-util.c 1.1 94/10/31 Copyr 1988 Sun Micro";
#endif
/*
* Copyright (c) 1988 Sun Microsystems, Inc.
*/
/*
* Concatenate s2 on the end of s1 separated by a '/' (unless s1 is empty).
* Check for spurious '/'s. s1's space must be large enough. Return s1.
*/
char *
nse_pathcat(s1, s2)
register char *s1, *s2;
{
register char *os1;
os1 = s1;
while (*s1++)
;
--s1;
if (s1 != os1) {
if ((*s2 != '/') && (s1[-1] != '/')) {
*s1++ = '/';
} else if ((*s2 == '/') && (s1[-1] == '/')) {
++s2;
}
}
while (*s1++ = *s2++)
;
return (os1);
}