www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/04/07/11:47:29

Date: Sun, 7 Apr 1996 18:28:53 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Wang TianXing <gztxwang AT public1 DOT guangzhou DOT gd DOT cn>
Cc: DJGPP <djgpp AT delorie DOT com>
Subject: Re: Detecting drives
In-Reply-To: <3167C475.5C39@public1.guangzhou.gd.cn>
Message-Id: <Pine.SUN.3.91.960407181341.22948C-100000@is>
Mime-Version: 1.0

On Sun, 7 Apr 1996, Wang TianXing wrote:

> Well, as I read the info file, getmntent() returns nothing about whatever
> is inserted in the floppy drive, so why to spin the drive?

First, it does tell you that the disk is there, which is hardly nothing. 
Second, on systems with a single floppy drive it tells you that both A: 
and B: are ``mounted'' on the same drive.  Third, it tells you whether
that drive is actually SUBSTed or JOINed disk in disguise.  And besides,
`getmntent' is a compatibility function that was written to a specific
specification so that you could build a program like `df' from GNU
Fileutils with DJGPP.  So it just does what a function by that name does 
on Unix systems.

> _bios_equiplist().  To determine other drives, you use _dos_getdiskfree() -
> if _dos_getdiskfree() reports any error, the drive letter you've just tried
> is invalid, otherwise it denotes a valid drive.

Beware: under some DPMI hosts your program will GP fault if you call a DOS
function on an empty floppy drive (acessing an empty drive triggers Int
24h, and you are at the mercy of the DPMI host regarding the way Int 24h
is handled in protected mode).  That's why `getmntent' uses BIOS calls to
check if there's a disk there before issuing DOS calls which return the
rest of the info. 

> If an audio CD is being played in a CD-ROM drive, calling _dos_getdiskfree()
> with that drive may stop the audio in some situations.  So, it's better to
> check whether a drive is a CD-ROM drive first:

`getmntent' already reports CD-ROM drives as such (it also knows about RAM
disks, and disks compressed with DBLSPACE or with STACKER, and networked
drives, and...)

- Raw text -


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