| 153 | */ |
| 154 | |
| 155 | static 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 | |
| 209 | static char *dequote_value(const char *varname, char *varval) |
| 210 | { |
no test coverage detected