diff options
author | Chantry Xavier <shiningxc@gmail.com> | 2007-11-25 23:13:30 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2007-11-25 23:13:30 +0100 |
commit | 11133da587ebc1c78478cfcd05d5e8298bd61b84 (patch) | |
tree | e97f332ff9fa5ed765149693eec6db6917254278 | |
parent | 7d37d9278d0ab6eb46ec4689c8091780382cbb95 (diff) | |
download | pacman-11133da587ebc1c78478cfcd05d5e8298bd61b84.tar.gz pacman-11133da587ebc1c78478cfcd05d5e8298bd61b84.tar.xz |
Move mbasename from pacman.c to util.c
This function can be useful in other places.
Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | src/pacman/pacman.c | 22 | ||||
-rw-r--r-- | src/pacman/util.c | 22 | ||||
-rw-r--r-- | src/pacman/util.h | 1 |
3 files changed, 23 insertions, 22 deletions
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c index 4c24d10b..3f4af22c 100644 --- a/src/pacman/pacman.c +++ b/src/pacman/pacman.c @@ -229,28 +229,6 @@ static void cleanup(int signum) exit(signum); } -/** Parse the basename of a program from a path. -* Grabbed from the uClibc source. -* @param path path to parse basename from -* -* @return everything following the final '/' -*/ -static char *mbasename(const char *path) -{ - const char *s; - const char *p; - - p = s = path; - - while (*s) { - if (*s++ == '/') { - p = s; - } - } - - return (char *)p; -} - /** Parse command-line arguments for each operation. * @param argc argc * @param argv argv diff --git a/src/pacman/util.c b/src/pacman/util.c index 77773bf5..a925be36 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -167,6 +167,28 @@ int rmrf(const char *path) } } +/** Parse the basename of a program from a path. +* Grabbed from the uClibc source. +* @param path path to parse basename from +* +* @return everything following the final '/' +*/ +char *mbasename(const char *path) +{ + const char *s; + const char *p; + + p = s = path; + + while (*s) { + if (*s++ == '/') { + p = s; + } + } + + return (char *)p; +} + /* output a string, but wrap words properly with a specified indentation */ void indentprint(const char *str, int indent) diff --git a/src/pacman/util.h b/src/pacman/util.h index 931b456b..e46555e0 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -42,6 +42,7 @@ int needs_transaction(); int getcols(); int makepath(const char *path); int rmrf(const char *path); +char *mbasename(const char *path); void indentprint(const char *str, int indent); char *strtoupper(char *str); char *strtrim(char *str); |