diff options
author | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-06-07 15:07:39 +0000 |
---|---|---|
committer | Jennifer Averett <Jennifer.Averett@OARcorp.com> | 2010-06-07 15:07:39 +0000 |
commit | 452fdc106bf9ce56c675423695c7239fa8b4ac48 (patch) | |
tree | 82447421184f48d615d6316b3fc08e09e68ded00 /cpukit/libcsupport | |
parent | 2010-06-05 Bharath Suri <bharath.s.jois@gmail.com> (diff) | |
download | rtems-452fdc106bf9ce56c675423695c7239fa8b4ac48.tar.bz2 |
2010-06-07 Bharath Suri <bharath.s.jois@gmail.com>
* libcsupport/include/rtems/libio_.h: Removed macros
rtems_filesystem_is_separator
rtems_filesystem_get_start_loc
rtems_filesystem_get_sym_start_loc
and added them as files under libcsupport/src/
* libcsupport/src/: Added new files
libcsupport/src/sup_fs_get_start_loc.c
libcsupport/src/sup_fs_get_sym_start_loc.c
libcsupport/src/sup_fs_is_separator.c
* libcsupport/Makefile.am: Changes to accommodate new
files under libcsupport/src/
Diffstat (limited to 'cpukit/libcsupport')
-rw-r--r-- | cpukit/libcsupport/src/sup_fs_get_start_loc.c | 48 | ||||
-rw-r--r-- | cpukit/libcsupport/src/sup_fs_get_sym_start_loc.c | 47 | ||||
-rw-r--r-- | cpukit/libcsupport/src/sup_fs_is_separator.c | 30 |
3 files changed, 125 insertions, 0 deletions
diff --git a/cpukit/libcsupport/src/sup_fs_get_start_loc.c b/cpukit/libcsupport/src/sup_fs_get_start_loc.c new file mode 100644 index 0000000000..89f7efbb0d --- /dev/null +++ b/cpukit/libcsupport/src/sup_fs_get_start_loc.c @@ -0,0 +1,48 @@ + /** + * @file src/sup_fs_get_start_loc.c + */ + +/* + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +/* + * rtems_filesystem_get_start_loc + * + * Function to determine if path is absolute or relative + * + * Parameters: + * + * path : IN - path to be checked + * index: OUT - 0, if relative, 1 if absolute + * loc : OUT - location info of root fs if absolute + * location info of current fs if relative + * + * Returns: void + */ + +/* Includes */ + +#include "rtems/libio_.h" + +void rtems_filesystem_get_start_loc(const char *path, + int *index, + rtems_filesystem_location_info_t *loc) +{ + if (rtems_filesystem_is_separator(path[0])) { + *loc = rtems_filesystem_root; + *index = 1; + } + else { + *loc = rtems_filesystem_current; + *index = 0; + } +} diff --git a/cpukit/libcsupport/src/sup_fs_get_sym_start_loc.c b/cpukit/libcsupport/src/sup_fs_get_sym_start_loc.c new file mode 100644 index 0000000000..4bcc964a46 --- /dev/null +++ b/cpukit/libcsupport/src/sup_fs_get_sym_start_loc.c @@ -0,0 +1,47 @@ + /** + * @file src/sup_fs_get_sym_start_loc.c + */ + +/* + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +/* + * rtems_filesystem_get_sym_start_loc + * + * Function to determine if path is absolute or relative + * + * Parameters: + * + * path : IN - path to be checked + * index: OUT - 0, if relative, 1 if absolute + * loc : OUT - location info of root fs if absolute + * location info of current fs if relative + * + * Returns: void + */ + +/* Includes */ + +#include "rtems/libio_.h" + +void rtems_filesystem_get_sym_start_loc(const char *path, + int *index, + rtems_filesystem_location_info_t *loc) +{ + if (rtems_filesystem_is_separator(path[0])) { + *loc = rtems_filesystem_root; + *index = 1; + } + else { + *index = 0; + } +} diff --git a/cpukit/libcsupport/src/sup_fs_is_separator.c b/cpukit/libcsupport/src/sup_fs_is_separator.c new file mode 100644 index 0000000000..affd606271 --- /dev/null +++ b/cpukit/libcsupport/src/sup_fs_is_separator.c @@ -0,0 +1,30 @@ +/** + * @file src/sup_fs_is_separator.c + */ + +/* + * + * COPYRIGHT (c) 1989-1999. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + + +/* + * rtems_filesystem_is_separator + * + * Function to determine if a character is a path name separator. + * This was originally a macro in libio_.h + * + * NOTE: This function handles MS-DOS and UNIX style names. + */ + +int rtems_filesystem_is_separator(char ch) +{ + return ((ch == '/') || (ch == '\\') || (ch == '\0')); +} |