basename.c
Go to the documentation of this file.
1 /* Return the name-within-directory of a file name.
2  Copyright (C) 1996,97,98,2002 Free Software Foundation, Inc.
3  This file is part of the GNU C Library.
4 
5  The GNU C Library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  The GNU C Library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with the GNU C Library; if not, write to the Free
17  Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18  02111-1307 USA. */
19 
20 /*
21  * $Id: basename.c,v 1.1 2005-02-08 15:37:21 gerkey Exp $
22  *
23  * taken from glibc, modified slightly for standalone compilation, and used as
24  * a fallback implementation when basename() is not available. - BPG
25  */
26 
27 #include <string.h>
28 
29 #ifndef _LIBC
30 /* We cannot generally use the name `basename' since XPG defines an unusable
31  variant of the function but we cannot use it. */
32 # define basename gnu_basename
33 #endif
34 
35 const char * basename( const char *filename )
36 {
37  char *p = strrchr (filename, '/');
38  return p ? p + 1 : (char *) filename;
39 }
40 
41 #ifdef _LIBC
42 libc_hidden_def (basename)
43 #endif
#define basename
Definition: basename.c:32


stage
Author(s): Richard Vaughan , Brian Gerkey , Reed Hedges , Andrew Howard , Toby Collett , Pooya Karimian , Jeremy Asher , Alex Couture-Beil , Geoff Biggs , Rich Mattes , Abbas Sadat
autogenerated on Mon Jun 10 2019 15:06:09