2001-04-10 04:18:12 +05:30
|
|
|
/*
|
|
|
|
* busybox library eXtendet funcion
|
|
|
|
*
|
|
|
|
* concatenate path and file name to new allocation buffer,
|
|
|
|
* not addition '/' if path name already have '/'
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2001-06-30 00:29:32 +05:30
|
|
|
#include <string.h>
|
2001-04-10 04:18:12 +05:30
|
|
|
#include "libbb.h"
|
|
|
|
|
|
|
|
extern char *concat_path_file(const char *path, const char *filename)
|
|
|
|
{
|
|
|
|
char *outbuf;
|
2001-05-15 23:12:16 +05:30
|
|
|
char *lc;
|
2001-07-07 09:57:35 +05:30
|
|
|
|
|
|
|
if (!path)
|
|
|
|
path="";
|
2001-05-15 23:12:16 +05:30
|
|
|
lc = last_char_is(path, '/');
|
2001-05-08 04:31:32 +05:30
|
|
|
if (filename[0] == '/')
|
|
|
|
filename++;
|
|
|
|
outbuf = xmalloc(strlen(path)+strlen(filename)+1+(lc==NULL));
|
2001-07-07 09:57:35 +05:30
|
|
|
sprintf(outbuf, "%s%s%s", path, (lc==NULL)? "/" : "", filename);
|
|
|
|
|
2001-04-10 04:18:12 +05:30
|
|
|
return outbuf;
|
|
|
|
}
|