source: rtems/cpukit/libmisc/bspcmdline/bspcmdline_getparamrhs.c

Last change on this file was c499856, checked in by Chris Johns <chrisj@…>, on Mar 20, 2014 at 9:10:47 PM

Change all references of rtems.com to rtems.org.

  • Property mode set to 100644
File size: 967 bytes
Line 
1/**
2 * @file
3 *
4 * @brief Obtain COPY of the Right Hand Side of the Matching Argument
5 * @ingroup BSPCommandLine BSP Command Line Helpers
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2009.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#ifdef HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <string.h>
22
23#include <rtems/bspcmdline.h>
24
25const char *rtems_bsp_cmdline_get_param_rhs(
26  const char *name,
27  char       *value,
28  size_t      length
29)
30{
31  const char *p;
32  const char *rhs;
33  char       *d;
34
35  p = rtems_bsp_cmdline_get_param( name, value, length );
36  if ( !p )
37    return NULL;
38
39  rhs = &p[strlen(name)];
40  if ( *rhs != '=' )
41    return NULL;
42
43  rhs++;
44  if ( *rhs == '\"' )
45    rhs++;
46  for ( d=value ; *rhs ; )
47    *d++ = *rhs++;
48  if ( *(d-1) == '\"' )
49    d--;
50  *d = '\0';
51
52  return value;
53}
Note: See TracBrowser for help on using the repository browser.