|
Revision 910, 1.4 kB
(checked in by ensc, 5 years ago)
|
initial checkin
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
#ifdef HAVE_CONFIG_H |
|---|
| 20 |
# include <config.h> |
|---|
| 21 |
#endif |
|---|
| 22 |
|
|---|
| 23 |
#include "pathinfo.h" |
|---|
| 24 |
#include "util-mem.h" |
|---|
| 25 |
|
|---|
| 26 |
void |
|---|
| 27 |
PathInfo_append(PathInfo * restrict lhs, |
|---|
| 28 |
PathInfo const * restrict rhs, |
|---|
| 29 |
char *buf) |
|---|
| 30 |
{ |
|---|
| 31 |
char * ptr = buf; |
|---|
| 32 |
char const * rhs_ptr = rhs->d; |
|---|
| 33 |
size_t rhs_len = rhs->l; |
|---|
| 34 |
|
|---|
| 35 |
while (lhs->l>1 && lhs->d[lhs->l-1]=='/') --lhs->l; |
|---|
| 36 |
|
|---|
| 37 |
if (lhs->l>0) { |
|---|
| 38 |
while (rhs->l>0 && *rhs_ptr=='/') { |
|---|
| 39 |
++rhs_ptr; |
|---|
| 40 |
--rhs_len; |
|---|
| 41 |
} |
|---|
| 42 |
|
|---|
| 43 |
ptr = Xmemcpy(ptr, lhs->d, lhs->l); |
|---|
| 44 |
if (ptr[-1]!='/') |
|---|
| 45 |
ptr = Xmemcpy(ptr, "/", 1); |
|---|
| 46 |
} |
|---|
| 47 |
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 |
ptr = Xmemcpy(ptr, rhs_ptr, rhs_len+1); |
|---|
| 51 |
|
|---|
| 52 |
lhs->d = buf; |
|---|
| 53 |
lhs->l = ptr-buf-1; |
|---|
| 54 |
} |
|---|