| 2174 | } |
| 2175 | |
| 2176 | static void writeExpression(FILE *stream, int indent, const char *name, expressionObj *exp) |
| 2177 | { |
| 2178 | char *string_tmp; |
| 2179 | if(!exp || !exp->string) return; |
| 2180 | |
| 2181 | writeIndent(stream, ++indent); |
| 2182 | switch(exp->type) { |
| 2183 | case(MS_REGEX): |
| 2184 | fprintf(stream, "%s /%s/", name, exp->string); |
| 2185 | break; |
| 2186 | case(MS_STRING): |
| 2187 | if ( (strchr(exp->string, '\'') == NULL) && (strchr(exp->string, '\"') == NULL)) |
| 2188 | fprintf(stream, "%s \"%s\"", name, exp->string); |
| 2189 | else if ( (strchr(exp->string, '\"') != NULL) && (strchr(exp->string, '\'') == NULL)) |
| 2190 | fprintf(stream, "%s \'%s\'", name, exp->string); |
| 2191 | else if ( (strchr(exp->string, '\'') != NULL) && (strchr(exp->string, '\"') == NULL)) |
| 2192 | fprintf(stream, "%s \"%s\"", name, exp->string); |
| 2193 | else { |
| 2194 | string_tmp = msStringEscape(exp->string); |
| 2195 | fprintf(stream, "%s \"%s\"", name, string_tmp); |
| 2196 | free(string_tmp); |
| 2197 | } |
| 2198 | break; |
| 2199 | case(MS_EXPRESSION): |
| 2200 | fprintf(stream, "%s (%s)", name, exp->string); |
| 2201 | break; |
| 2202 | } |
| 2203 | if((exp->type == MS_STRING || exp->type == MS_REGEX) && (exp->flags & MS_EXP_INSENSITIVE)) |
| 2204 | fprintf(stream, "i"); |
| 2205 | writeLineFeed(stream); |
| 2206 | } |
| 2207 | |
| 2208 | int loadHashTable(hashTableObj *ptable) |
| 2209 | { |
no test coverage detected