| 176 | ****************************************************************************/ |
| 177 | |
| 178 | static void parse_line(char *ptr, char **varname, char **varval) |
| 179 | { |
| 180 | /* Skip over any leading spaces */ |
| 181 | |
| 182 | ptr = skip_space(ptr); |
| 183 | |
| 184 | /* The first no-space is the beginning of the variable name */ |
| 185 | |
| 186 | *varname = skip_space(ptr); |
| 187 | *varval = NULL; |
| 188 | |
| 189 | /* Parse to the end of the variable name */ |
| 190 | |
| 191 | ptr = find_name_end(ptr); |
| 192 | |
| 193 | /* An equal sign is expected next, perhaps after some white space */ |
| 194 | |
| 195 | if (*ptr && *ptr != '=') |
| 196 | { |
| 197 | /* Some else follows the variable name. Terminate the variable |
| 198 | * name and skip over any spaces. |
| 199 | */ |
| 200 | |
| 201 | *ptr = '\0'; |
| 202 | ptr = skip_space(ptr + 1); |
| 203 | } |
| 204 | |
| 205 | /* Verify that the equal sign is present */ |
| 206 | |
| 207 | if (*ptr == '=') |
| 208 | { |
| 209 | /* Make sure that the variable name is terminated (this was already |
| 210 | * done if the name was followed by white space. |
| 211 | */ |
| 212 | |
| 213 | *ptr = '\0'; |
| 214 | |
| 215 | /* The variable value should follow =, perhaps separated by some |
| 216 | * white space. |
| 217 | */ |
| 218 | |
| 219 | ptr = skip_space(ptr + 1); |
| 220 | if (*ptr) |
| 221 | { |
| 222 | /* Yes.. a variable follows. Save the pointer to the start |
| 223 | * of the variable string. |
| 224 | */ |
| 225 | |
| 226 | *varval = ptr; |
| 227 | |
| 228 | /* Find the end of the variable string and make sure that it |
| 229 | * is terminated. |
| 230 | */ |
| 231 | |
| 232 | ptr = find_value_end(ptr); |
| 233 | *ptr = '\0'; |
| 234 | } |
| 235 | } |
no test coverage detected