Date: Sun, 29 Mar 1998 19:24:41 +0300 (IDT) From: Eli Zaretskii To: djgpp-workers AT delorie DOT com Subject: Re: Where to get the latest sources for djtar Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Precedence: bulk On Wed, 18 Mar 1998, Martin Stromberg wrote: > Sooner or later the user is feed up with giving directory names that > djtar can't create, so he answers with "". This would make the unpatched > djtar skip all the files that was in the directory that wasn't created. > The patched djtar tries to write the file uncreated_directory/one_file, > discovers that it can't open uncreated_directory/open_file, so ask the > user for a new name. Please see if the patch below (relative to the last version you checked) solves this. Note that if the archive has more than a single file in a directory `foo', say `foo/bar' and `foo/baz', and the user first tries to rename `foo' to `foo1' (say), and only then presses Enter to skip, this new version will still ask for a new name for `foo' when it sees the second file. That's because djtar was instructed to skip `foo1', not `foo'. I'm not sure whether this is a bug or a feature; it seems that there might be cases where this is the desired behavior. *** src/utils/djtar/djtar.c~1 Mon Mar 16 12:17:26 1998 --- src/utils/djtar/djtar.c Sun Mar 29 18:59:14 1998 *************** change(char *fname, const char *problem, *** 138,152 **** char *pos; for (ch=change_root; ch; ch = ch->next) ! if ((strncmp(fname, ch->old, strlen(ch->old)) == 0) && ch->isdir ! /* Don't use change rules which failed to work before. */ ! && access(ch->new, D_OK) == 0) { if (ch->isdir == 2) { fprintf(log_out, " [ skipping %s ]\n", fname); return 0; } /* fprintf(log_out, " [ changing %s to ", fname); */ sprintf(new, "%s%s", ch->new, fname+strlen(ch->old)); strcpy(fname, new); --- 138,153 ---- char *pos; for (ch=change_root; ch; ch = ch->next) ! if ((strncmp(fname, ch->old, strlen(ch->old)) == 0) && ch->isdir) { if (ch->isdir == 2) { fprintf(log_out, " [ skipping %s ]\n", fname); return 0; } + /* Don't use change rules which failed to work before. */ + if (access(ch->new, D_OK)) + continue; /* fprintf(log_out, " [ changing %s to ", fname); */ sprintf(new, "%s%s", ch->new, fname+strlen(ch->old)); strcpy(fname, new);