Mail Archives: djgpp/2000/11/08/02:39:40
On 7 Nov 2000, James Owens wrote:
> By commenting out some code I can get the compiled UNZIPSFX.EXE to label
> the floppy. The original code causes the program to skip the labelling:
>
> if (uO.volflag == 0 || *buildpath < 'a' || /* no label/bogus disk */
> (uO.volflag == 1 && !isfloppy(nLabelDrive))) /* -$: no fixed */
>
> If I comment out the second line it works, so either the -$ parameter is
> not setting u0.volflag, or isfloppy() is returning the wrong result. (I
> guess).
The easiest way to know for sure is either to run the program under a
debugger, put a breakpoint on this line, and print the value of both
uO.volflag and isfloppy(nLabelDrive); or use printf to show those
values.
I would also look at the value of nLabelDrive: it should be 1 for
drive A:, 2 for B:, etc.
> I don't understand isfloppy() at all, but it's short. Please tell me if
> you can see anything wrong.
`isfloppy' is not wrong. It calls function 4408h of Int 21h, which
returns 0 in AX if the drive media is removable, 1 if it is fixed.
You should see the same DOS call in action if you call the DJGPP
library function `getmntent' and print the mnt_type member of the
struct that it returns: it should say "fd" for a floppy disk.
In fact, comparing the results of `getmntent' and `isfloppy' for the
same floppy drive might tell you whether something's subtly wrong in
InfoZip's implementation (it uses some macros whose definition I can
only guess).
But the most direct evidence for the cause of the problem is to see
what do uO.volflag and `isfloppy' actually return.
Also, please be *absolutely* sure that the second line is indeed the
cause of the problem. For example, the test "*buildpath < 'a'" seems
bogus to me (what if the drive letter is 'A'?).
- Raw text -