xref: /titanic_41/usr/src/cmd/sendmail/db/os/os_rpath.c (revision cde2885fdf538266ee2a3b08dee2d5075ce8fa2b)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
15 
16 #ifndef lint
17 static const char sccsid[] = "@(#)os_rpath.c	10.2 (Sleepycat) 10/24/97";
18 static const char sccsi2[] = "%W% (Sun) %G%";
19 #endif /* not lint */
20 
21 #ifndef NO_SYSTEM_INCLUDES
22 #include <string.h>
23 #endif
24 
25 #include "db_int.h"
26 
27 /*
28  * __db_rpath --
29  *	Return the last path separator in the path or NULL if none found.
30  *
31  * PUBLIC: char *__db_rpath __P((const char *));
32  */
33 char *
34 __db_rpath(path)
35 	const char *path;
36 {
37 	const char *s, *last;
38 
39 	last = NULL;
40 	if (PATH_SEPARATOR[1] != '\0') {
41 		for (s = path; s[0] != '\0'; ++s)
42 			if (strchr(PATH_SEPARATOR, s[0]) != NULL)
43 				last = s;
44 	} else
45 		for (s = path; s[0] != '\0'; ++s)
46 			if (s[0] == PATH_SEPARATOR[0])
47 				last = s;
48 	return ((char *)last);
49 }
50