Last change
on this file since 2783 was 2725, checked in by Bruno Cornec, 13 years ago |
- Update mindi-busybox to 1.18.3 to avoid problems with the tar command which is now failing on recent versions with busybox 1.7.3
|
File size:
695 bytes
|
Rev | Line | |
---|
[821] | 1 | /* vi: set sw=4 ts=4: */
|
---|
| 2 | /*
|
---|
| 3 | * Utility routines.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) many different people.
|
---|
| 6 | * If you wrote this, please acknowledge your work.
|
---|
| 7 | *
|
---|
[2725] | 8 | * Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
---|
[821] | 9 | */
|
---|
| 10 |
|
---|
[2725] | 11 | /* Concatenate path and filename to new allocated buffer.
|
---|
| 12 | * Add '/' only as needed (no duplicate // are produced).
|
---|
| 13 | * If path is NULL, it is assumed to be "/".
|
---|
| 14 | * filename should not be NULL.
|
---|
| 15 | */
|
---|
[821] | 16 |
|
---|
| 17 | #include "libbb.h"
|
---|
| 18 |
|
---|
[2725] | 19 | char* FAST_FUNC concat_path_file(const char *path, const char *filename)
|
---|
[821] | 20 | {
|
---|
| 21 | char *lc;
|
---|
| 22 |
|
---|
| 23 | if (!path)
|
---|
| 24 | path = "";
|
---|
| 25 | lc = last_char_is(path, '/');
|
---|
| 26 | while (*filename == '/')
|
---|
| 27 | filename++;
|
---|
[1765] | 28 | return xasprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename);
|
---|
[821] | 29 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.