Relocate paste() from helpers.h to util.h, for sharing with initctl

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2021-02-26 16:21:53 +01:00
1 parent 5e37f94775
commit 6d4bc670e6
4 files changed
+14 -11

No files matched your search

+12
View File
@@ -31,6 +31,7 @@
#include <sys/reboot.h>
#include <termios.h>
#endif
#include <lite/lite.h>
#ifndef RB_SW_SUSPEND /* Since Linux 2.5.18, but not in GLIBC until 2.19 */
#define RB_SW_SUSPEND 0xd000fce2
@@ -64,6 +65,17 @@ static inline char *strterm(char *str, size_t len)
return str;
}
/* paste dir/file into buf */
static inline int paste(char *buf, size_t len, const char *dir, const char *file)
{
if (!dir)
dir = "";
if (!file)
file = "";
return snprintf(buf, len, "%s%s%s", dir, fisslashdir(dir) ? "" : "/", file);
}
#endif /* FINIT_UTIL_H_ */
/**