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