Contents of /trunk/mkinitrd-magellan/busybox/libbb/concat_path_file.c
Parent Directory | Revision Log
Revision 532 -
(show annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (17 years ago) by niro
File MIME type: text/plain
File size: 606 byte(s)
Sat Sep 1 22:45:15 2007 UTC (17 years ago) by niro
File MIME type: text/plain
File size: 606 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
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 | * |
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ |
10 | |
11 | /* concatenate path and file name to new allocation buffer, |
12 | * not adding '/' if path name already has '/' |
13 | */ |
14 | |
15 | #include "libbb.h" |
16 | |
17 | char *concat_path_file(const char *path, const char *filename) |
18 | { |
19 | char *lc; |
20 | |
21 | if (!path) |
22 | path = ""; |
23 | lc = last_char_is(path, '/'); |
24 | while (*filename == '/') |
25 | filename++; |
26 | return xasprintf("%s%s%s", path, (lc==NULL ? "/" : ""), filename); |
27 | } |