X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fbasic%2Fpath-util.c;h=5f4252f48cfe7d86ece820d592ed21dd336e05bd;hp=3ebc5c5366c4c3e70f786218b54a4143dc8351f1;hb=6b05aab633fa55aa3070f186869d8fa219be2f38;hpb=eaca07ccfdf5d7dabc50afc7e539c2413dd69d3e;ds=sidebyside diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 3ebc5c536..5f4252f48 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -1,5 +1,3 @@ -/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/ - /*** This file is part of systemd. @@ -20,11 +18,11 @@ ***/ #include -#include +#include #include #include #include -#include +#include #include /* When we include libgen.h because we need dirname() we immediately @@ -34,18 +32,16 @@ #undef basename #include "alloc-util.h" -#include "fd-util.h" -#include "fileio.h" +#include "extract-word.h" #include "fs-util.h" #include "log.h" #include "macro.h" #include "missing.h" -#include "parse-util.h" #include "path-util.h" #include "stat-util.h" #include "string-util.h" #include "strv.h" -#include "util.h" +#include "time-util.h" bool path_is_absolute(const char *p) { return p[0] == '/'; @@ -55,8 +51,7 @@ bool is_path(const char *p) { return !!strchr(p, '/'); } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind int path_split_and_make_absolute(const char *p, char ***ret) { char **l; int r; @@ -77,7 +72,6 @@ int path_split_and_make_absolute(const char *p, char ***ret) { *ret = l; return r; } -#endif // 0 char *path_make_absolute(const char *p, const char *prefix) { assert(p); @@ -90,6 +84,7 @@ char *path_make_absolute(const char *p, const char *prefix) { return strjoin(prefix, "/", p, NULL); } +#endif // 0 int path_make_absolute_cwd(const char *p, char **ret) { char *c; @@ -118,8 +113,7 @@ int path_make_absolute_cwd(const char *p, char **ret) { return 0; } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind int path_make_relative(const char *from_dir, const char *to_path, char **_r) { char *r, *p; unsigned n_parents; @@ -447,8 +441,7 @@ bool path_equal_or_files_same(const char *a, const char *b) { return path_equal(a, b) || files_same(a, b) > 0; } -/// UNNEEDED by elogind -#if 0 +#if 0 /// UNNEEDED by elogind char* path_join(const char *root, const char *path, const char *rest) { assert(path); @@ -464,9 +457,6 @@ char* path_join(const char *root, const char *path, const char *rest) { rest && rest[0] == '/' ? rest+1 : rest, NULL); } -#endif // 0 -/// UNNEEDED by elogind -#if 0 int find_binary(const char *name, char **ret) { int last_error, r; @@ -584,10 +574,10 @@ static int binary_is_good(const char *binary) { if (r < 0) return r; - return !path_equal(d, "true") && - !path_equal(d, "/bin/true") && - !path_equal(d, "/usr/bin/true") && - !path_equal(d, "/dev/null"); + return !PATH_IN_SET(d, "true" + "/bin/true", + "/usr/bin/true", + "/dev/null"); } int fsck_exists(const char *fstype) { @@ -647,7 +637,6 @@ char *prefix_root(const char *root, const char *path) { strcpy(p, path); return n; } -#endif // 0 int parse_path_argument_and_warn(const char *path, bool suppress_root, char **arg) { char *p; @@ -680,6 +669,7 @@ int parse_path_argument_and_warn(const char *path, bool suppress_root, char **ar *arg = p; return 0; } +#endif // 0 char* dirname_malloc(const char *path) { char *d, *dir, *dir2; @@ -790,6 +780,9 @@ bool hidden_file_allow_backup(const char *filename) { endswith(filename, ".dpkg-bak") || endswith(filename, ".dpkg-backup") || endswith(filename, ".dpkg-remove") || + endswith(filename, ".ucf-new") || + endswith(filename, ".ucf-old") || + endswith(filename, ".ucf-dist") || endswith(filename, ".swp"); } @@ -802,6 +795,7 @@ bool hidden_file(const char *filename) { return hidden_file_allow_backup(filename); } +#if 0 /// UNNEEDED by elogind bool is_device_path(const char *path) { /* Returns true on paths that refer to a device, either in @@ -811,3 +805,4 @@ bool is_device_path(const char *path) { path_startswith(path, "/dev/") || path_startswith(path, "/sys/"); } +#endif // 0