home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Usenet 1994 October
/
usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso
/
unix
/
volume24
/
mkid2
/
part01
/
basename.c
next >
Wrap
C/C++ Source or Header
|
1991-10-09
|
433b
|
32 lines
/* Copyright (c) 1986, Greg McGary */
static char sccsid[] = "@(#)basename.c 1.1 86/10/09";
#include <string.h>
char *basename();
char *dirname();
char *
basename(path)
char *path;
{
char *base;
if ((base = strrchr(path, '/')) == 0)
return path;
else
return ++base;
}
char *
dirname(path)
char *path;
{
char *base;
if ((base = strrchr(path, '/')) == 0)
return ".";
else
return strnsav(path, base - path);
}