Back to index

cell-binutils  2.17cvs20070401
Defines | Functions
basename.c File Reference
#include "ansidecl.h"
#include "libiberty.h"
#include "safe-ctype.h"

Go to the source code of this file.

Defines

#define DIR_SEPARATOR   '/'
#define IS_DIR_SEPARATOR(ch)   ((ch) == DIR_SEPARATOR)

Functions

char * basename (const char *name)

Define Documentation

#define DIR_SEPARATOR   '/'

Definition at line 23 of file basename.c.

#define IS_DIR_SEPARATOR (   ch)    ((ch) == DIR_SEPARATOR)

Definition at line 36 of file basename.c.


Function Documentation

char* basename ( const char *  name)

Definition at line 43 of file basename.c.

{
  const char *base;

#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  /* Skip over the disk name in MSDOS pathnames. */
  if (ISALPHA (name[0]) && name[1] == ':') 
    name += 2;
#endif

  for (base = name; *name; name++)
    {
      if (IS_DIR_SEPARATOR (*name))
       {
         base = name + 1;
       }
    }
  return (char *) base;
}

Here is the caller graph for this function: