Date: Sun, 17 Oct 1999 15:55:46 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp-workers AT delorie DOT com Subject: DJTAR and foo++ Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Regarding the one below: I would like to fix this DJTAR misfeature a bit differently: to replace "++" with "xx" (instead of "plus"). See the diffs below. (I didn't yet finish testing this, so if someone sees a bug, please tell me.) My concern is whether this change could break some package. For example, does it do any harm when unpacking the GCC or libg++ distributions? --- 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 #include #include +#include #include #include #include @@ -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 ---------- Forwarded message ---------- Date: Tue, 12 Oct 1999 10:17:52 +0200 From: Juan Manuel Guerrero, Student, FB05 To: djgpp AT delorie DOT com Subject: djlsr203 (990819) i would like to report to minor bugs in djlsr203 (990819). The first concern file: sys/config.h. The second concern the djtar program. 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. Patch follows. *** djtar.org Thu Jun 3 13:27:42 1999 --- djtar.c Mon Oct 11 21:03:04 1999 *************** get_new_name(char *name_to_change, int * *** 314,326 **** { char *plus = strstr(changed_name, "++"), *plus2; if (plus) { strcpy(new, changed_name); ! plus2 = strstr(new, "++"); ! strcpy(plus2, "plus"); ! strcpy(plus2+4, plus+2); fprintf(log_out, "[ changing %s to %s ]\n", changed_name, new); } else { strcpy(new, changed_name); --- 314,331 ---- { char *plus = strstr(changed_name, "++"), *plus2; if (plus) { strcpy(new, changed_name); ! while (plus) ! { ! plus2 = strstr(new, "++"); ! strcpy(plus2, "plus"); ! plus += 2; ! strcpy(plus2+4, plus); ! plus = strstr(plus, "++"); ! } fprintf(log_out, "[ changing %s to %s ]\n", changed_name, new); } else { strcpy(new, changed_name); *** config.h.org Wed Aug 4 15:55:00 1999 --- config.h Mon Oct 11 14:56:52 1999 *************** *** 337,347 **** #undef HAVE_GETDTABLESIZE #define HAVE_GETDTABLESIZE 1 /* Define if you have the getgroups function. */ #undef HAVE_GETGROUPS ! #define HAVE_GETGROUPS /* Define if you have gethostname() function in your library. */ #undef HAVE_GETHOSTNAME #define HAVE_GETHOSTNAME 1 --- 337,347 ---- #undef HAVE_GETDTABLESIZE #define HAVE_GETDTABLESIZE 1 /* Define if you have the getgroups function. */ #undef HAVE_GETGROUPS ! #define HAVE_GETGROUPS 1 /* Define if you have gethostname() function in your library. */ #undef HAVE_GETHOSTNAME #define HAVE_GETHOSTNAME 1