No empty .Rs/.Re
[netbsd-mini2440.git] / external / ibm-public / postfix / dist / src / util / basename.c
blobfec7e221905e9f10ae2c5ea0a19c8a670fa595ec
1 /* $NetBSD$ */
3 /*++
4 /* NAME
5 /* basename 3
6 /* SUMMARY
7 /* extract file basename
8 /* SYNOPSIS
9 /* #include <stringops.h>
11 /* char *basename(path)
12 /* const char *path;
13 /* DESCRIPTION
14 /* The \fBbasename\fR routine skips over the last '/' in
15 /* \fIpath\fR and returns a pointer to the result.
16 /* LICENSE
17 /* .ad
18 /* .fi
19 /* The Secure Mailer license must be distributed with this software.
20 /* AUTHOR(S)
21 /* Wietse Venema
22 /* IBM T.J. Watson Research
23 /* P.O. Box 704
24 /* Yorktown Heights, NY 10598, USA
25 /*--*/
27 /* System library. */
29 #include <sys_defs.h>
30 #include <string.h>
32 #ifndef HAVE_BASENAME
34 /* Utility library. */
36 #include "stringops.h"
38 /* basename - skip directory prefix */
40 char *basename(const char *path)
42 char *result;
44 if ((result = strrchr(path, '/')) == 0)
45 result = (char *) path;
46 else
47 result += 1;
48 return (result);
51 #endif