1
0
mirror of https://github.com/moparisthebest/pacman synced 2025-02-28 09:21:53 -05:00

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>
This commit is contained in:
Chantry Xavier 2007-11-25 16:13:30 -06:00 committed by Dan McGee
parent 7d37d9278d
commit 11133da587
3 changed files with 23 additions and 22 deletions

View File

@ -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

View File

@ -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)

View File

@ -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);