source: rtems/cpukit/libcsupport/src/sup_fs_next_token.c @ 80cf60e

5
Last change on this file since 80cf60e was 80cf60e, checked in by Sebastian Huber <sebastian.huber@…>, on 04/15/20 at 07:48:32

Canonicalize config.h include

Use the following variant which was already used by most source files:

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS File System Eval Eat Delimiter Path
5 *  @ingroup LibIOInternal
6 */
7
8/*
9 * Copyright (c) 2012 embedded brains GmbH.  All rights reserved.
10 *
11 *  embedded brains GmbH
12 *  Obere Lagerstr. 30
13 *  82178 Puchheim
14 *  Germany
15 *  <rtems@embedded-brains.de>
16 *
17 * The license and distribution terms for this file may be
18 * found in the file LICENSE in this distribution or at
19 * http://www.rtems.org/license/LICENSE.
20 */
21
22#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25
26#include <rtems/libio_.h>
27
28void rtems_filesystem_eval_path_eat_delimiter(
29  rtems_filesystem_eval_path_context_t *ctx
30)
31{
32  const char *current = ctx->path;
33  const char *end = current + ctx->pathlen;
34
35  while (current != end && rtems_filesystem_is_delimiter(*current)) {
36    ++current;
37  }
38
39  ctx->path = current;
40  ctx->pathlen = (size_t) (end - current);
41}
42
43static void next_token(rtems_filesystem_eval_path_context_t *ctx)
44{
45  const char *begin = ctx->path;
46  const char *end = begin + ctx->pathlen;
47  const char *current = begin;
48
49  while (current != end && !rtems_filesystem_is_delimiter(*current)) {
50    ++current;
51  }
52
53  ctx->path = current;
54  ctx->pathlen = (size_t) (end - current);
55  ctx->token = begin;
56  ctx->tokenlen = (size_t) (current - begin);
57}
58
59void rtems_filesystem_eval_path_next_token(
60  rtems_filesystem_eval_path_context_t *ctx
61)
62{
63  rtems_filesystem_eval_path_eat_delimiter(ctx);
64  next_token(ctx);
65}
Note: See TracBrowser for help on using the repository browser.