Sender: rich AT phekda DOT freeserve DOT co DOT uk Message-ID: <3AA25EB9.FC18DCD2@phekda.freeserve.co.uk> Date: Sun, 04 Mar 2001 15:26:49 +0000 From: Richard Dawe X-Mailer: Mozilla 4.51 [en] (X11; I; Linux 2.2.17 i586) X-Accept-Language: de,fr MIME-Version: 1.0 To: djgpp-workers AT delorie DOT com Subject: Re: Fileutils 4.0 port and ginstall References: <3AA2451A DOT 24DE1704 AT phekda DOT freeserve DOT co DOT uk> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp-workers AT delorie DOT com Hello. Richard Dawe wrote: > I am unsure how to decide that a file is a DOS batch file. The patches > to ginstall for DJGPP currently modify the target filename, depending on > the source file's file format. Here's some pseudo-code: > > if (_check_v2_prog returns valid data) { > if (unstubbed COFF) { > stubify > append .exe to target filename > } else if (stubbed COFF) { > append .exe to target filename > } else { > if (file header contains "MZ") { > /* FIXME: Distinguish between .exe and .com */ > append .exe to target filename > } > } I missed out an outer if condition - that the from file has no .com or .exe extension. I think I've been thinking about this the wrong way. Clearly ginstall needs to handle: ginstall file.$(EXEEXT) a by copying to a.$(EXEEXT) instead, where $(EXEEXT) is an executable extension. Also, so 'a' is not a batch file even if 'a' contains batch file commands, because it does not have a .bat extension. So my original question is actually bogus in the context that I meant it (my fault). OK, now I can handle the other cases, where source has an executable extension, but target does not. Tim, Martin, thanks for the help. Bye, Rich =] -- Richard Dawe http://www.bigfoot.com/~richdawe/ "The soul is the mirror of an indestructible universe." --- Gottfried W. Leibniz