MCPcopy Create free account
hub / github.com/apache/nuttx / parse_line

Function parse_line

tools/cfgdefine.c:155–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153 */
154
155static void parse_line(char *ptr, char **varname, char **varval)
156{
157 *varname = ptr;
158 *varval = NULL;
159
160 /* Parse to the end of the variable name */
161
162 ptr = find_name_end(ptr);
163
164 /* An equal sign is expected next, perhaps after some white space */
165
166 if (*ptr && *ptr != '=')
167 {
168 /* Some else follows the variable name. Terminate the variable
169 * name and skip over any spaces.
170 */
171
172 *ptr = '\0';
173 ptr = skip_space(ptr + 1);
174 }
175
176 /* Verify that the equal sign is present */
177
178 if (*ptr == '=')
179 {
180 /* Make sure that the variable name is terminated (this was already
181 * done if the name was followed by white space.
182 */
183
184 *ptr = '\0';
185
186 /* The variable value should follow =, perhaps separated by some
187 * white space.
188 */
189
190 ptr = skip_space(ptr + 1);
191 if (*ptr)
192 {
193 /* Yes.. a variable follows. Save the pointer to the start
194 * of the variable string.
195 */
196
197 *varval = ptr;
198
199 /* Find the end of the variable string and make sure that it
200 * is terminated.
201 */
202
203 ptr = find_value_end(ptr);
204 *ptr = '\0';
205 }
206 }
207}
208
209static char *dequote_value(const char *varname, char *varval)
210{

Callers 1

generate_definitionsFunction · 0.70

Calls 3

find_name_endFunction · 0.70
skip_spaceFunction · 0.70
find_value_endFunction · 0.70

Tested by

no test coverage detected