5 |
* Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> |
* Copyright (C) 2008 by Vladimir Dronnikov <dronnikov@gmail.com> |
6 |
* |
* |
7 |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
* Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 |
|
* Also for use in uClibc (http://uclibc.org/) licensed under LGPLv2.1 or later. |
9 |
*/ |
*/ |
10 |
|
|
11 |
#include "libbb.h" |
#include "libbb.h" |
79 |
return config_open2(filename, fopen_or_warn_stdin); |
return config_open2(filename, fopen_or_warn_stdin); |
80 |
} |
} |
81 |
|
|
82 |
static void config_free_data(parser_t *const parser) |
static void config_free_data(parser_t *parser) |
83 |
{ |
{ |
84 |
free(parser->line); |
free(parser->line); |
85 |
parser->line = NULL; |
parser->line = NULL; |
102 |
0. If parser is NULL return 0. |
0. If parser is NULL return 0. |
103 |
1. Read a line from config file. If nothing to read then return 0. |
1. Read a line from config file. If nothing to read then return 0. |
104 |
Handle continuation character. Advance lineno for each physical line. |
Handle continuation character. Advance lineno for each physical line. |
105 |
Discard everything past comment characher. |
Discard everything past comment character. |
106 |
2. if PARSE_TRIM is set (default), remove leading and trailing delimiters. |
2. if PARSE_TRIM is set (default), remove leading and trailing delimiters. |
107 |
3. If resulting line is empty goto 1. |
3. If resulting line is empty goto 1. |
108 |
4. Look for first delimiter. If !PARSE_COLLAPSE or !PARSE_TRIM is set then |
4. Look for first delimiter. If !PARSE_COLLAPSE or !PARSE_TRIM is set then |