| 170 | } |
| 171 | |
| 172 | static void init_set_compression(void) |
| 173 | { |
| 174 | const char *f; |
| 175 | char *t, *start; |
| 176 | |
| 177 | if (skip_compress) |
| 178 | add_nocompress_suffixes(skip_compress); |
| 179 | |
| 180 | /* A non-daemon transfer skips the default suffix list if the |
| 181 | * user specified --skip-compress. */ |
| 182 | if (skip_compress && module_id < 0) |
| 183 | f = ""; |
| 184 | else |
| 185 | f = lp_dont_compress(module_id); |
| 186 | |
| 187 | match_list = t = new_array(char, strlen(f) + 2); |
| 188 | |
| 189 | per_file_default_level = do_compression_level; |
| 190 | |
| 191 | while (*f) { |
| 192 | if (*f == ' ') { |
| 193 | f++; |
| 194 | continue; |
| 195 | } |
| 196 | |
| 197 | start = t; |
| 198 | do { |
| 199 | if (isUpper(f)) |
| 200 | *t++ = toLower(f); |
| 201 | else |
| 202 | *t++ = *f; |
| 203 | } while (*++f != ' ' && *f); |
| 204 | *t++ = '\0'; |
| 205 | |
| 206 | if (t - start == 1+1 && *start == '*') { |
| 207 | /* Optimize a match-string of "*". */ |
| 208 | *match_list = '\0'; |
| 209 | suftree = NULL; |
| 210 | per_file_default_level = skip_compression_level; |
| 211 | break; |
| 212 | } |
| 213 | |
| 214 | /* Move *.foo items into the stuffix tree. */ |
| 215 | if (*start == '*' && start[1] == '.' && start[2] |
| 216 | && !strpbrk(start+2, ".?*")) { |
| 217 | add_suffix(&suftree, start[2], start+3); |
| 218 | t = start; |
| 219 | } |
| 220 | } |
| 221 | *t++ = '\0'; |
| 222 | } |
| 223 | |
| 224 | /* determine the compression level based on a wildcard filename list */ |
| 225 | void set_compression(const char *fname) |
no test coverage detected