freebsd-dev/gnu/libexec/uucp/libunix/app3.c

33 lines
706 B
C
Raw Normal View History

1993-08-05 18:28:27 +00:00
/* app3.c
Stick two directories and a file name together. */
#include "uucp.h"
#include "uudefs.h"
#include "sysdep.h"
char *
zsappend3 (zdir1, zdir2, zfile)
const char *zdir1;
const char *zdir2;
const char *zfile;
{
size_t cdir1, cdir2, cfile;
char *zret;
cdir1 = strlen (zdir1);
cdir2 = strlen (zdir2);
cfile = strlen (zfile);
zret = zbufalc (cdir1 + cdir2 + cfile + 3);
1994-05-07 18:14:43 +00:00
if (cdir1 == 1 && *zdir1 == '/')
cdir1 = 0;
else
memcpy (zret, zdir1, cdir1);
1993-08-05 18:28:27 +00:00
memcpy (zret + cdir1 + 1, zdir2, cdir2);
memcpy (zret + cdir1 + cdir2 + 2, zfile, cfile);
zret[cdir1] = '/';
zret[cdir1 + cdir2 + 1] = '/';
zret[cdir1 + cdir2 + cfile + 2] = '\0';
return zret;
}