Import BSDDB 4.7.25 (as of svn r89086)
This commit is contained in:
55
os_vxworks/os_vx_rpath.c
Normal file
55
os_vxworks/os_vx_rpath.c
Normal file
@@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* See the file LICENSE for redistribution information.
|
||||
*
|
||||
* Copyright (c) 1997,2008 Oracle. All rights reserved.
|
||||
*
|
||||
* $Id: os_vx_rpath.c 63573 2008-05-23 21:43:21Z trent.nelson $
|
||||
*/
|
||||
|
||||
#include "db_config.h"
|
||||
|
||||
#include "db_int.h"
|
||||
|
||||
#include "iosLib.h"
|
||||
|
||||
/*
|
||||
* __db_rpath --
|
||||
* Return the last path separator in the path or NULL if none found.
|
||||
*/
|
||||
char *
|
||||
__db_rpath(path)
|
||||
const char *path;
|
||||
{
|
||||
const char *s, *last;
|
||||
DEV_HDR *dummy;
|
||||
char *ptail;
|
||||
|
||||
/*
|
||||
* VxWorks devices can be rooted at any name. We want to
|
||||
* skip over the device name and not take into account any
|
||||
* PATH_SEPARATOR characters that might be in that name.
|
||||
*
|
||||
* XXX [#2393]
|
||||
* VxWorks supports having a filename directly follow a device
|
||||
* name with no separator. I.e. to access a file 'xxx' in
|
||||
* the top level directory of a device mounted at "mydrive"
|
||||
* you could say "mydrivexxx" or "mydrive/xxx" or "mydrive\xxx".
|
||||
* We do not support the first usage here.
|
||||
* XXX
|
||||
*/
|
||||
if ((dummy = iosDevFind((char *)path, &ptail)) == NULL)
|
||||
s = path;
|
||||
else
|
||||
s = ptail;
|
||||
|
||||
last = NULL;
|
||||
if (PATH_SEPARATOR[1] != '\0') {
|
||||
for (; s[0] != '\0'; ++s)
|
||||
if (strchr(PATH_SEPARATOR, s[0]) != NULL)
|
||||
last = s;
|
||||
} else
|
||||
for (; s[0] != '\0'; ++s)
|
||||
if (s[0] == PATH_SEPARATOR[0])
|
||||
last = s;
|
||||
return ((char *)last);
|
||||
}
|
||||
Reference in New Issue
Block a user