* hppa-dis.c (print_insn_hppa): Add args q, %, !, and |.
[binutils.git] / libiberty / basename.c
blobf544c853910c243cc58302176f22fcd431ff6b90
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 char *
24 basename (name)
25 const char *name;
27 const char *base = name;
29 while (*name)
31 if (*name++ == '/')
33 base = name;
36 return (char *) base;