forked from bmc/daemonize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
basename.c
33 lines (23 loc) · 1.01 KB
/
basename.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*---------------------------------------------------------------------------*\
NAME
basename.c - replacement basename(3) function
DESCRIPTION
This source file contains a version of the basename() function.
LICENSE
This source code is released under a BSD-style license. See the
LICENSE file for details.
Copyright (c) 2006-2015 Brian M. Clapper, bmc@clapper.org
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Includes
\*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*\
Public Routines
\*---------------------------------------------------------------------------*/
char *basename (char *path)
{
char *s = strrchr (path, '/');
return (s == NULL) ? path : ++s;
}