Date: Thu, 7 Jan 1999 11:13:37 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Doug Kaufman cc: djgpp AT delorie DOT com Subject: Re: ANNOUNCE: bzip2 port to DJGPP In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com On Wed, 6 Jan 1999, Doug Kaufman wrote: > I had no idea that filenames with more than one "." were allowed on > Windows 9x. When I said "long filenames will probably be preserved", I > really meant to say "more than 8 characters of the filename will > probably be preserved". ``Long file names'' is about much more than just the length of a file name. There are some characters, like `+', that DOS disallows in file names, but Windows 9X permits; there are multiple dots, including a leading dot, that are permitted; and there are extended file-oriented services, like 3 times per file instead of just one. > I'll try to incorporate these suggestions and redo the > port. All other suggestions welcome. I think I know why does the program fail with "Permission denied": it's because you used _dos_getattr and _dos_setattr to copy attribute bits. These functions don't support long file names, so they fail for a name like foo.bar_c.bz2. You should use _chmod instead, like this: retVal = _chmod ( dstName, 1, _chmod (srcName, 0, 0) & 0xffe6) == -1; (The AND with 0xffe6 is because you cannot have the volume and directory bits in the value passed to _chmod, otherwise the call will fail.) As a bonus, with the above replacement you don't need the separate ifdef'ed block that declares a variable and calls _dos_getattr. Btw, this piece of code should probably be conditioned on __MSDOS__, not on __DJGPP__, since any other DOS port will want it. For example, Borland C also has the _chmod function.