11 char *
create_path(
const char *dir,
int dirlen,
const char *file,
int filelen)
21 if(dirlen == 0 && filelen > 0 && file[0] ==
'/')
25 else if(dirlen > 0 && filelen > 0)
27 if(dir[dirlen - 1] ==
'/')
34 pathlen = dirlen + filelen + 1;
35 path = malloc(pathlen + 1);
36 strncpy(path, dir, dirlen);
38 strncpy(path + dirlen + 1, file, filelen);
42 error(
_(
"create_path: length of filename is zero."));
#define str_len(s)
Shorthand for counting '\0' terminating strings. See _len for more info.
char * create_path(const char *dir, int dirlen, const char *file, int filelen)