www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/01/23/01:36:15

Date: Tue, 23 Jan 1996 08:28:22 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Is there a floppy in the drive?

On Mon, 22 Jan 1996, A.Appleyard wrote:

>   (1) Eli Zaretskii mentioned a coming v2.0 function getmntent(); (a) what
> exactly will this function do?, (b) when will v2.0 be fully debugged and up
> and on Simtel?

I'm sending you the docs of that function (from the v2.0 libc docs) by 
private mail (too long to include here).

>   (2) How, whether any netware is running or not, can Gnu C++ program, given a
> logical drive letter A: to Z: which is floppy or CD-ROM, find easily if it
> corresponds directly to a physical drive, and, if so, what is its physical
> drive number for use as DL in my `AX=0x0201, int13' as hereinabove?

`getmntent' does all of this.  It's rather non-trivial to do, because each
kind of drive requires its own quirky, semi-documented way of detecting
it.  This function exists exactly to hide all that trickery from the 
application.

>   (3) Will my hereinabove drive_is_empty() work with a CD-ROM drive? They also
> may or may not have a disk in. If not, how to find if a CD_ROM drive has a
> CD_ROM in or not?

Most probably not.  In my experience, CD-ROM drives return most of the
queries just the same whether they are empty or not (of course, if you try
to list the directory, you'll know if they are empty, but other than that
most of DOS functions return with success).  I've also never seen
Abort/Retry/Explode from trying to use an empty CD-ROM; the calls just
fail.  So it might be you'll never need to know if there is a disk inside
the drive (`getmntent' doesn't need that).  If you do need that, you can
look into the Interrupt List for CD-ROM functions to find one that will
tell you. 

>   (4) If a PC floppy drive has a `bad' floppy in, how can the program find
> easily if that floppy is probably in native Mac mode?

This is a bottomless pit: there are too many different non-DOS formats, 
and you can't possibly expect to detect every one of them.  The version 
of `getmntent' in the current v2.0 library should fail on non-DOS 
floppies (I think).

>   (5) I know of these sorts of logical drives: floppy empty; floppy full;
> CD-ROM empty; CD-ROM full; hard; ramdisk; net; nonexistent; are there any
> other sorts? How can the program distinguish them all?

One other problem: on systems with a single floppy drive, that drive is
mapped both to a: and b:, so when you try to access b: for the first time,
DOS pops a message telling you ``to insert the disk and strike any key''. 
Once again, `getmntent' does distinguish between all the cases you've
mentioned, prevents the above message from popping and even reports that
both a:/ and b:/ are on the same drive.  If you don't want to wait until
v2.0 is released or use it in beta version (it's quite stable right now to
be used, IMHO), you can always get the source of `getmntent' and compile
it under v1.x--it shouldn't require more than a few simple changes. 

- Raw text -


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