delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1998/03/29/11:27:46

Date: Sun, 29 Mar 1998 19:24:41 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp-workers AT delorie DOT com
Subject: Re: Where to get the latest sources for djtar
Message-ID: <Pine.SUN.3.91.980329192355.16257D-100000@is>
MIME-Version: 1.0

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);

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019