Back to index

glibc  2.9
Classes | Defines
files-parse.c File Reference
#include <ctype.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  parser_data

Defines

#define EXTRA_ARGS
#define EXTRA_ARGS_DECL
#define EXTRA_ARGS_VALUE
#define CONCAT(a, b)   CONCAT1(a,b)
#define CONCAT1(a, b)   a##b
#define STRUCTURE   ENTNAME
#define ENTDATA_DECL(data)
#define parser_stclass   /* Global */
#define parse_line   CONCAT(_nss_files_parse_,ENTNAME)
#define nss_files_parse_hidden_def(name)   libnss_files_hidden_def (name)
#define LINE_PARSER(EOLSET, BODY)
#define STRING_FIELD(variable, terminator_p, swallow)
#define INT_FIELD(variable, terminator_p, swallow, base, convert)
#define INT_FIELD_MAYBE_NULL(variable, terminator_p, swallow, base, convert, default)
#define ISCOLON(c)   ((c) == ':')
#define TRAILING_LIST_PARSER   /* Nothing to do. */
#define LOOKUP_NAME(nameelt, aliaselt)
#define LOOKUP_NAME_CASE(nameelt, aliaselt)
#define GENERIC   "files-XXX.c"

Class Documentation

struct parser_data

Definition at line 56 of file files-parse.c.

Class Members
char linebuffer

Define Documentation

#define CONCAT (   a,
  b 
)    CONCAT1(a,b)

Definition at line 48 of file files-parse.c.

#define CONCAT1 (   a,
  b 
)    a##b

Definition at line 49 of file files-parse.c.

#define ENTDATA_DECL (   data)

Definition at line 62 of file files-parse.c.

#define EXTRA_ARGS

Definition at line 43 of file files-parse.c.

#define EXTRA_ARGS_DECL

Definition at line 44 of file files-parse.c.

Definition at line 45 of file files-parse.c.

#define GENERIC   "files-XXX.c"

Definition at line 272 of file files-parse.c.

#define INT_FIELD (   variable,
  terminator_p,
  swallow,
  base,
  convert 
)
Value:
{                                                                    \
    char *endp;                                                             \
    variable = convert (strtoul (line, &endp, base));                       \
    if (endp == line)                                                       \
      return 0;                                                             \
    else if (terminator_p (*endp))                                   \
      do                                                             \
       ++endp;                                                              \
      while (swallow && terminator_p (*endp));                              \
    else if (*endp != '\0')                                          \
      return 0;                                                             \
    line = endp;                                                     \
  }

Definition at line 130 of file files-parse.c.

#define INT_FIELD_MAYBE_NULL (   variable,
  terminator_p,
  swallow,
  base,
  convert,
  default 
)
Value:
{                                                                    \
    char *endp;                                                             \
    if (*line == '\0')                                                      \
      /* We expect some more input, so don't allow the string to end here. */ \
      return 0;                                                             \
    variable = convert (strtoul (line, &endp, base));                       \
    if (endp == line)                                                       \
      variable = default;                                            \
    if (terminator_p (*endp))                                               \
      do                                                             \
       ++endp;                                                              \
      while (swallow && terminator_p (*endp));                              \
    else if (*endp != '\0')                                          \
      return 0;                                                             \
    line = endp;                                                     \
  }

Definition at line 145 of file files-parse.c.

#define ISCOLON (   c)    ((c) == ':')

Definition at line 163 of file files-parse.c.

#define LINE_PARSER (   EOLSET,
  BODY 
)
Value:
parser_stclass int							      \
parse_line (char *line, struct STRUCTURE *result,                           \
           struct parser_data *data, size_t datalen, int *errnop            \
           EXTRA_ARGS_DECL)                                          \
{                                                                    \
  ENTDATA_DECL (data)                                                       \
  char *p = strpbrk (line, EOLSET "\n");                             \
  if (p != NULL)                                                     \
    *p = '\0';                                                              \
  BODY;                                                                     \
  TRAILING_LIST_PARSER;                                                     \
  return 1;                                                          \
}                                                                    \
nss_files_parse_hidden_def (parse_line)

Definition at line 99 of file files-parse.c.

#define LOOKUP_NAME (   nameelt,
  aliaselt 
)
Value:
{                                                                    \
  char **ap;                                                         \
  if (! strcmp (name, result->nameelt))                                     \
    break;                                                           \
  for (ap = result->aliaselt; *ap; ++ap)                             \
    if (! strcmp (name, *ap))                                               \
      break;                                                         \
  if (*ap)                                                           \
    break;                                                           \
}

Definition at line 245 of file files-parse.c.

#define LOOKUP_NAME_CASE (   nameelt,
  aliaselt 
)
Value:
{                                                                    \
  char **ap;                                                         \
  if (! __strcasecmp (name, result->nameelt))                               \
    break;                                                           \
  for (ap = result->aliaselt; *ap; ++ap)                             \
    if (! __strcasecmp (name, *ap))                                         \
      break;                                                         \
  if (*ap)                                                           \
    break;                                                           \
}

Definition at line 257 of file files-parse.c.

Definition at line 81 of file files-parse.c.

#define parse_line   CONCAT(_nss_files_parse_,ENTNAME)

Definition at line 75 of file files-parse.c.

#define parser_stclass   /* Global */

Definition at line 74 of file files-parse.c.

#define STRING_FIELD (   variable,
  terminator_p,
  swallow 
)
Value:
{                                                                    \
    variable = line;                                                 \
    while (*line != '\0' && !terminator_p (*line))                          \
      ++line;                                                        \
    if (*line != '\0')                                                      \
      {                                                                     \
       *line = '\0';                                                 \
       do                                                            \
         ++line;                                                     \
       while (swallow && terminator_p (*line));                      \
      }                                                                     \
  }

Definition at line 116 of file files-parse.c.

#define STRUCTURE   ENTNAME

Definition at line 52 of file files-parse.c.

#define TRAILING_LIST_PARSER   /* Nothing to do. */

Definition at line 167 of file files-parse.c.