-/* This function is used to implement --delete-during. */
-void delete_in_dir(struct file_list *flist, char *fname)
-{
- static void *filt_array[MAXPATHLEN/2];
- static BOOL need_first_push = True;
- static int fa_lvl = 0;
- static char fbuf[MAXPATHLEN];
- struct file_list *dir_list;
- STRUCT_STAT st;
- int dlen, j;
-
- if (!flist) {
- while (fa_lvl)
- pop_local_filters(filt_array[--fa_lvl]);
- need_first_push = True;
- *fbuf = '\0';
- return;
- }
-
- if (max_delete && deletion_count >= max_delete)
- return;
-
- if (io_error && !(lp_ignore_errors(module_id) || ignore_errors)) {
- rprintf(FINFO,
- "IO error encountered -- skipping file deletion\n");
- max_delete = -1; /* avoid duplicating the above warning */
- return;
- }
-
- for (j = 0; fbuf[j]; j++) {
- if (fbuf[j] != fname[j]) {
- while (fa_lvl) {
- if (fbuf[j] == '/')
- pop_local_filters(filt_array[--fa_lvl]);
- if (!fbuf[++j])
- break;
- }
- break;
- }
- }
-
- dlen = strlcpy(fbuf, fname, MAXPATHLEN);
- if (need_first_push) {
- if (dlen != 1 || fbuf[0] != '.') {
- char *s = strrchr(fbuf, '/');
- int first_dlen;
- if (s)
- first_dlen = s - fbuf;
- else
- first_dlen = 0;
- if (!s || s[1] != '.' || s[2] != '\0') {
- filt_array[fa_lvl++] = push_local_filters(fbuf,
- first_dlen);
- }
- }
- need_first_push = False;