Add a new basename_of() function.
This commit is contained in:
parent
72012b54d0
commit
d08bdbd3d1
@ -1,4 +1,4 @@
|
||||
/* $Id: lib.h,v 1.9 1994/09/29 13:19:42 jkh Exp $ */
|
||||
/* $Id: lib.h,v 1.10 1994/10/04 16:07:50 jkh Exp $ */
|
||||
|
||||
/*
|
||||
* FreeBSD install - a package for the installation and maintainance
|
||||
@ -109,6 +109,7 @@ char *copy_string(char *);
|
||||
Boolean suffix(char *, char *);
|
||||
void nuke_suffix(char *);
|
||||
void str_lowercase(char *);
|
||||
char *basename_of(char *);
|
||||
|
||||
/* File */
|
||||
Boolean fexists(char *);
|
||||
|
@ -24,6 +24,18 @@ static const char *rcsid = "$Id";
|
||||
|
||||
#include "lib.h"
|
||||
|
||||
/* Return the filename portion of a path */
|
||||
char *
|
||||
basename_of(char *str)
|
||||
{
|
||||
char *basename = str + strlen(str) - 1;
|
||||
|
||||
while (basename != str && basename[-1] != '/')
|
||||
--basename;
|
||||
return basename;
|
||||
}
|
||||
|
||||
/* Get a string parameter as a file spec or as a "contents follow -" spec */
|
||||
char *
|
||||
get_dash_string(char **str)
|
||||
{
|
||||
@ -36,6 +48,7 @@ get_dash_string(char **str)
|
||||
return *str;
|
||||
}
|
||||
|
||||
/* Rather Obvious */
|
||||
char *
|
||||
copy_string(char *str)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user