summaryrefslogtreecommitdiffstats
path: root/cpukit/libcsupport/src/sup_fs_get_start_loc.c
blob: 89f7efbb0de04a155c0c70a592c4fa1355c5a224 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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;
  }
}