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-05-08 04:31:32 +05:30
|
|
|
|
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));
|
|
|
|
sprintf(outbuf, (lc==NULL ? "%s/%s" : "%s%s"), path, filename);
|
2001-04-10 04:18:12 +05:30
|
|
|
return outbuf;
|
|
|
|
}
|