2 * See the file LICENSE for redistribution information.
5 * Sleepycat Software. All rights reserved.
11 static const char sccsid
[] = "@(#)db_os_abs.c 10.5 (Sleepycat) 7/5/97";
14 #ifndef NO_SYSTEM_INCLUDES
23 * Return if a path is an absolute path.
25 * PUBLIC: int __db_abspath __P((const char *));
34 * Check for drive specifications, e.g., "C:". In addition, the path
35 * separator used by the win32 DB (PATH_SEPARATOR) is \; look for both
36 * / and \ since these are user-input paths.
38 if (isalpha(path
[0]) && path
[1] == ':')
40 return (path
[0] == '/' || path
[0] == '\\');
45 * Absolute pathnames always start with a volume name, which must be
46 * followed by a colon, thus they are of the form:
47 * volume: or volume:dir1:dir2:file
49 * Relative pathnames are either a single name without colons or a
50 * path starting with a colon, thus of the form:
51 * file or :file or :dir1:dir2:file
53 return (strchr(path
, ':') != NULL
&& path
[0] != ':');
55 return (path
[0] == '/');
62 * Return the last path separator in the path or NULL if none found.
64 * PUBLIC: char *__db_rpath __P((const char *));
73 if (PATH_SEPARATOR
[1] != '\0') {
74 for (s
= path
; s
[0] != '\0'; ++s
)
75 if (strchr(PATH_SEPARATOR
, s
[0]) != NULL
)
78 for (s
= path
; s
[0] != '\0'; ++s
)
79 if (s
[0] == PATH_SEPARATOR
[0])
81 return ((char *)last
);