delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/11/07/17:30:16

From: ad354 AT FreeNet DOT Carleton DOT CA (James Owens)
Newsgroups: comp.os.msdos.djgpp
Subject: InfoZip vol labelling: made it work -- please advise
Date: 7 Nov 2000 22:12:43 GMT
Organization: The National Capital FreeNet
Lines: 49
Message-ID: <8u9uor$6ca$1@freenet9.carleton.ca>
NNTP-Posting-Host: freenet10
X-Trace: freenet9.carleton.ca 973635163 6538 134.117.136.30 (7 Nov 2000 22:12:43 GMT)
X-Complaints-To: complaints AT ncf DOT ca
NNTP-Posting-Date: 7 Nov 2000 22:12:43 GMT
X-Given-Sender: ad354 AT freenet10 DOT carleton DOT ca (James Owens)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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
for some cases:

    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).

I don't understand isfloppy() at all, but it's short. Please tell me if
you can see anything wrong.  (I put a printf("Error") in the error clause
and it did not print out.)

/***********************/
/* Function isfloppy() */
/***********************/

static int isfloppy(nDrive)  /* more precisely, is it removable? */
    int nDrive;
{
    union REGS regs;

    regs.h.ah = 0x44;
    regs.h.al = 0x08;
    regs.h.bl = (uch)nDrive;
#ifdef __EMX__
    _int86(0x21, &regs, &regs);
    if (WREGS(regs,flags) & 1)
#else
    intdos(&regs, &regs);
    if (WREGS(regs,cflag))        /* error:  do default a/b check instead */
#endif
    {
        Trace((stderr,
          "error in DOS function 0x44 (AX = 0x%04x):  guessing instead...\n",
          WREGS(regs,ax)));
        return (nDrive == 1 || nDrive == 2)? TRUE : FALSE;
    } else
        return WREGS(regs,ax)? FALSE : TRUE;
}


--

                                     James Owens  ad354 AT Freenet DOT carleton DOT ca
                                     Ottawa, Ontario, Canada

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019