1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 1997,2008 Oracle. All rights reserved. 5 * 6 * $Id: os_vx_rpath.c,v 12.8 2008/01/08 20:58:45 bostic Exp $ 7 */ 8 9#include "db_config.h" 10 11#include "db_int.h" 12 13#include "iosLib.h" 14 15/* 16 * __db_rpath -- 17 * Return the last path separator in the path or NULL if none found. 18 */ 19char * 20__db_rpath(path) 21 const char *path; 22{ 23 const char *s, *last; 24 DEV_HDR *dummy; 25 char *ptail; 26 27 /* 28 * VxWorks devices can be rooted at any name. We want to 29 * skip over the device name and not take into account any 30 * PATH_SEPARATOR characters that might be in that name. 31 * 32 * XXX [#2393] 33 * VxWorks supports having a filename directly follow a device 34 * name with no separator. I.e. to access a file 'xxx' in 35 * the top level directory of a device mounted at "mydrive" 36 * you could say "mydrivexxx" or "mydrive/xxx" or "mydrive\xxx". 37 * We do not support the first usage here. 38 * XXX 39 */ 40 if ((dummy = iosDevFind((char *)path, &ptail)) == NULL) 41 s = path; 42 else 43 s = ptail; 44 45 last = NULL; 46 if (PATH_SEPARATOR[1] != '\0') { 47 for (; s[0] != '\0'; ++s) 48 if (strchr(PATH_SEPARATOR, s[0]) != NULL) 49 last = s; 50 } else 51 for (; s[0] != '\0'; ++s) 52 if (s[0] == PATH_SEPARATOR[0]) 53 last = s; 54 return ((char *)last); 55} 56