www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/10/26/10:13:48

Date: Tue, 26 Oct 1999 13:51:33 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
X-Sender: eliz AT is
To: "Juan Manuel Guerrero, Student, FB05" <ST001906 AT HRZ1 DOT HRZ DOT TU-Darmstadt DOT De>
cc: djgpp AT delorie DOT com
Subject: Re: djlsr203 (990819)
In-Reply-To: <84E1E9836AE@HRZ1.hrz.tu-darmstadt.de>
Message-ID: <Pine.SUN.3.91.991026134915.18693D-100000@is>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

On Tue, 12 Oct 1999, Juan Manuel Guerrero, Student, FB05 wrote:

> When decompressing a tgz-file with an entry of the form:
> libg++-1.2.3/libg++/readme.g++
> the program performs the substitution:
> ++  -->  plus.
> It should be clear that this substitution must be applied to all 
> occuriences of "++" and not only to the first as the program does.

Thanks for the report and the patches.

I corrected the problem in DJTAR a bit differently; see the patch below.  
The corrected version will be in DJGPP v2.03.

--- src/utils/djtar/djtar.c~1	Tue Aug 24 16:03:00 1999
+++ src/utils/djtar/djtar.c	Fri Oct 15 10:58:38 1999
@@ -1,3 +1,4 @@
+/* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1997 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1996 DJ Delorie, see COPYING.DJ for details */
@@ -6,6 +7,7 @@
 #include <unistd.h>
 #include <limits.h>
 #include <errno.h>
+#include <ctype.h>
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <io.h>
@@ -297,34 +299,40 @@ get_new_name(char *name_to_change, int *
   changed_name = get_entry(name_to_change);
   if (*should_be_written && !to_stdout && NO_LFN(changed_name))
   {
-    info = strstr(changed_name, ".info-");
-    if (info)
+    static char info_[] = ".info-";
+    info = strstr(changed_name, info_);
+    if (info && isdigit(info[sizeof(info_)-1]))
     {
       strcpy(new, changed_name);
-      info = strstr(new, ".info-");
-      strcpy(info+2, info+6);
+      info = strstr(new, info_);
+      strcpy(info+2, info+sizeof(info_)-1);
       fprintf(log_out, "[ changing %s to %s ]\n", changed_name, new);
     }
     else
     {
-      char *tgz = strstr(changed_name, ".tar.gz");
-      if (tgz)
+      static char _tar_gz[] = ".tar.gz", _tgz[] = ".tgz";
+      char *tgz = strstr(changed_name, _tar_gz);
+      if (tgz && tgz[sizeof(_tar_gz)-1] == '\0')
       {
 	strcpy(new, changed_name);
-	tgz = strstr(new, ".tar.gz");
-	strcpy(tgz, ".tgz");
-	strcat(tgz, tgz+7);
+	tgz += new - changed_name;
+	strcpy(tgz, _tgz);
 	fprintf(log_out, "[ changing %s to %s ]\n", changed_name, new);
       }
       else
       {
-	char *plus = strstr(changed_name, "++"), *plus2;
+	static char xx[] = "++";
+	register char *plus = strstr(changed_name, xx);
 	if (plus)
 	{
 	  strcpy(new, changed_name);
-	  plus2 = strstr(new, "++");
-	  strcpy(plus2, "plus");
-	  strcpy(plus2+4, plus+2);
+	  plus += new - changed_name;
+	  while (plus)
+	  {
+	    *plus++ = 'x';
+	    *plus++ = 'x';
+	    plus = strstr(plus, xx);
+	  }
 	  fprintf(log_out, "[ changing %s to %s ]\n", changed_name, new);
 	}
 	else
--- src/utils/utils.t~0	Tue Jun  1 09:23:16 1999
+++ src/utils/utils.tex	Fri Oct 15 11:10:34 1999
@@ -153,14 +153,15 @@
 
 @code{djtar} performs a number of file name conversions in an attempt
 to make the files fit into MS-DOS's restricted file names.  Any file
-ending in @file{.info-N} becomes @file{.iN}.  Any file ending in
-@file{.tar.gz} becomes @file{.tgz}.  Any file with @file{++} becomes
-@file{plus}.  Any leading dots are changed to underscores (but current
-and parent directories, @file{./} and @file{../} are left alone).  Any
-remaining multiple dots are changed to dashes, unless the part before the
-dot is shorter than 3 characters and there are more than 1 dot in the
-filename, in which case the dot also becomes an underscore.  As a result,
-e.g., @file{.foo.a.b} becomes @file{_foo.a-b}, and @file{sh.lex.c} becomes
+ending in @file{.info- AT var{n}}, where @var{n} is a number, becomes
+@file{.i AT var{n}}.  Any file ending in @file{.tar.gz} becomes
+@file{.tgz}.  Any @file{++} string within a file name becomes @file{xx}.
+Any leading dots are changed to underscores (but current and parent
+directories, @file{./} and @file{../} are left alone).  Any remaining
+multiple dots are changed to dashes, unless the part before the dot is
+shorter than 3 characters and there are more than 1 dot in the filename,
+in which case the dot also becomes an underscore.  As a result, e.g.,
+@file{.foo.a.b} becomes @file{_foo.a-b}, and @file{sh.lex.c} becomes
 @file{sh_lex.c}.
 
 While @code{djtar} is running, if it cannot successfully perform an

- Raw text -


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