Date: Tue, 20 Mar 2001 11:24:33 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Juan Manuel Guerrero cc: djgpp-workers AT delorie DOT com Subject: Re: 2 suggestions for djtar In-Reply-To: <5167B200FDB@HRZ1.hrz.tu-darmstadt.de> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 19 Mar 2001, Juan Manuel Guerrero wrote: > + extension = strrchr(header.name, '.'); > + if (extension) > + { > + char *string = xmalloc(strlen(extension) + 1); > + strcpy(string, extension); > + > + i = 0; > + while (string[++i]) > + if (string[i] >= 'A' && string[i] <= 'T') > + string[i] = string[i] - 'A' + 'a'; > + if (strstr(string, ".bat") && string[sizeof(".bat") - 1] == '\0') > + batch_file_processing = 1; /* LF -> CRLF */ > + > + free(string); > + } Why didn't you simply use strncasecmp on the original extension, instead of copying and modifying it? That would simplify the code and avoid possible heap fragmentation due to many small allocations. Is there any reason I'm missing for not using strncasecmp? > ! if (batch_file_processing && !to_tty) > { > ! /* LF -> CRLF. > ! Note that we don't alter the original uncompressed > ! data so as not to screw up the CRC computations. */ > ! char *src = buf, *dest = tbuf; > ! int buflen = 0; > ! while (buflen < dsize) > { > ! if (*src == '\n' && *(src - 1) != '\r' && buflen) The last if clause should test buflen first, and only then reference src[-1], because if buflen is zero, src[-1] is outside the buffer. And please also send a short blurb for wc204.txi about this feature, and a patch for djtar's docs. With these minor issues taken care of, the patches can go in, I think. Thanks for working on this!