Ticket #1541: sup_fs_get_sym_start_loc.c

File sup_fs_get_sym_start_loc.c, 1.0 KB (added by Bharath Suri, on 06/05/10 at 13:15:32)

New file having rtems_filesystem_get_sym_start_loc function @ rtems/cpukit/libcsupport/src/

Line 
1 /**
2 * @file src/sup_fs_get_sym_start_loc.c
3 */
4
5/*
6 *
7 *  COPYRIGHT (c) 1989-1999.
8 *  On-Line Applications Research Corporation (OAR).
9 *
10 *  The license and distribution terms for this file may be
11 *  found in the file LICENSE in this distribution or at
12 *  http://www.rtems.com/license/LICENSE.
13 *
14 *  $Id: sup_fs_get_sym_start_loc.h,v 0.01 2010/05/31 15:54:19 ralf Exp $
15 */
16
17/*
18 *  rtems_filesystem_get_sym_start_loc
19 *
20 *  Function to determine if path is absolute or relative
21 *
22 *  Parameters:
23 *
24 *  path : IN  - path to be checked
25 *  index: OUT - 0, if relative, 1 if absolute
26 *  loc  : OUT - location info of root fs if absolute
27 *               location info of current fs if relative
28 *
29 *  Returns: void
30 */
31
32/* Includes */
33
34#include "rtems/libio_.h"
35 
36void rtems_filesystem_get_sym_start_loc(const char *path,
37                                        int *index,
38                                        rtems_filesystem_location_info_t *loc)
39{
40  if (rtems_filesystem_is_separator(path[0])) {
41      *loc = rtems_filesystem_root;
42      *index = 1;
43    }
44    else {
45      *index = 0;
46    }
47}