forked from bmc/daemonize
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbasename.c
More file actions
33 lines (23 loc) · 1.02 KB
/
basename.c
File metadata and controls
33 lines (23 loc) · 1.02 KB
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-2009 Brian M. Clapper, bmc <at> clapper <dot> org
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\
Includes
\*---------------------------------------------------------------------------*/
#include <stdio.h>
#include <string.h>
/*---------------------------------------------------------------------------*\
Public Routines
\*---------------------------------------------------------------------------*/
char *basename (char *path)
{
char *s = strrchr (path, '/');
return (s == NULL) ? path : ++s;
}