xref: /illumos-gate/usr/src/cmd/sendmail/db/os/os_rpath.c (revision 2a8bcb4e)
1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 1997
5  *	Sleepycat Software.  All rights reserved.
6  */
7 /*
8  * Copyright (c) 1998 by Sun Microsystems, Inc.
9  * All rights reserved.
10  */
11 
12 #include "config.h"
13 
14 #ifndef lint
15 static const char sccsid[] = "@(#)os_rpath.c	10.2 (Sleepycat) 10/24/97";
16 static const char sccsi2[] = "%W% (Sun) %G%";
17 #endif /* not lint */
18 
19 #ifndef NO_SYSTEM_INCLUDES
20 #include <string.h>
21 #endif
22 
23 #include "db_int.h"
24 
25 /*
26  * __db_rpath --
27  *	Return the last path separator in the path or NULL if none found.
28  *
29  * PUBLIC: char *__db_rpath __P((const char *));
30  */
31 char *
__db_rpath(path)32 __db_rpath(path)
33 	const char *path;
34 {
35 	const char *s, *last;
36 
37 	last = NULL;
38 	if (PATH_SEPARATOR[1] != '\0') {
39 		for (s = path; s[0] != '\0'; ++s)
40 			if (strchr(PATH_SEPARATOR, s[0]) != NULL)
41 				last = s;
42 	} else
43 		for (s = path; s[0] != '\0'; ++s)
44 			if (s[0] == PATH_SEPARATOR[0])
45 				last = s;
46 	return ((char *)last);
47 }
48