summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/.symlinks1
-rw-r--r--lib/misc/last-path-component.h27
-rw-r--r--lib/misc/util.c7
-rw-r--r--lib/misc/util.h2
-rw-r--r--tools/fsadm/fsadm.c1
-rw-r--r--tools/lvmcmdline.c1
6 files changed, 31 insertions, 8 deletions
diff --git a/include/.symlinks b/include/.symlinks
index a127e2cfa..7c54d9e6a 100644
--- a/include/.symlinks
+++ b/include/.symlinks
@@ -39,6 +39,7 @@
../lib/misc/crc.h
../lib/misc/intl.h
../lib/misc/util.h
+../lib/misc/last-path-component.h
../lib/misc/lib.h
../lib/misc/lvm-exec.h
../lib/misc/lvm-file.h
diff --git a/lib/misc/last-path-component.h b/lib/misc/last-path-component.h
new file mode 100644
index 000000000..69a1ce0f9
--- /dev/null
+++ b/lib/misc/last-path-component.h
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2007 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+/*
+ * Return the address of the last file name component of NAME.
+ * If NAME ends in a slash, return the empty string.
+ */
+
+#include <string.h>
+
+static inline char *last_path_component(char const *name)
+{
+ char const *slash = strrchr (name, '/');
+ char const *res = slash ? slash + 1 : name;
+ return (char *) res;
+}
diff --git a/lib/misc/util.c b/lib/misc/util.c
index b134c5e8b..75c7afab6 100644
--- a/lib/misc/util.c
+++ b/lib/misc/util.c
@@ -19,9 +19,4 @@
#include "lib.h"
-char *last_path_component(char const *name)
-{
- char const *slash = strrchr (name, '/');
- char const *res = slash ? slash + 1 : name;
- return (char *) res;
-}
+/* empty for now. */
diff --git a/lib/misc/util.h b/lib/misc/util.h
index 694864cbc..5e5677d9c 100644
--- a/lib/misc/util.h
+++ b/lib/misc/util.h
@@ -25,6 +25,4 @@
(void) (&_a == &_b); \
_a > _b ? _a : _b; })
-char *last_path_component(char const *name);
-
#endif
diff --git a/tools/fsadm/fsadm.c b/tools/fsadm/fsadm.c
index 862116465..619228ac7 100644
--- a/tools/fsadm/fsadm.c
+++ b/tools/fsadm/fsadm.c
@@ -39,6 +39,7 @@
#include <sys/vfs.h>
#include "util.h"
+#include "last-path-component.h"
#define log_error(str, x...) fprintf(stderr, "%s(%u): " str "\n", __FILE__, __LINE__, x)
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 35a12664d..94575f382 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -20,6 +20,7 @@
#include "stub.h"
#include "lvm2cmd.h"
+#include "last-path-component.h"
#include <signal.h>
#include <syslog.h>