Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/planix-v0/sys/src/ape/cmd/patch/basename.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
/* basename.c -- return the last element in a path */
2
 
3
#if HAVE_CONFIG_H
4
# include <config.h>
5
#endif
6
 
7
#include <backupfile.h>
8
 
9
#ifndef FILESYSTEM_PREFIX_LEN
10
#define FILESYSTEM_PREFIX_LEN(f) 0
11
#endif
12
 
13
#ifndef ISSLASH
14
#define ISSLASH(c) ((c) == '/')
15
#endif
16
 
17
/* In general, we can't use the builtin `basename' function if available,
18
   since it has different meanings in different environments.
19
   In some environments the builtin `basename' modifies its argument.  */
20
 
21
char *
22
base_name (name)
23
     char const *name;
24
{
25
  char const *base = name += FILESYSTEM_PREFIX_LEN (name);
26
 
27
  for (; *name; name++)
28
    if (ISSLASH (*name))
29
      base = name + 1;
30
 
31
  return (char *) base;
32
}