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