* cp-tree.h (struct lang_decl_flags): Add comdat.
[official-gcc.git] / libiberty / basename.c
blob689b0c2d39a06813d6ca7e58c48148bd99505c9b
1 /* Return the basename of a pathname.
2 This file is in the public domain. */
4 /*
5 NAME
6 basename -- return pointer to last component of a pathname
8 SYNOPSIS
9 char *basename (const char *name)
11 DESCRIPTION
12 Given a pointer to a string containing a typical pathname
13 (/usr/src/cmd/ls/ls.c for example), returns a pointer to the
14 last component of the pathname ("ls.c" in this case).
16 BUGS
17 Presumes a UNIX style path with UNIX style separators.
20 #include "ansidecl.h"
21 #include "libiberty.h"
23 #include "config.h"
25 #ifdef NEED_basename
27 char *
28 basename (name)
29 const char *name;
31 const char *base = name;
33 while (*name)
35 if (*name++ == '/')
37 base = name;
40 return (char *) base;
43 #endif