Mail Archives: djgpp/2009/03/23/02:45:18
X-Authentication-Warning: | delorie.com: mail set sender to djgpp-bounces using -f
|
From: | Jim Michaels <jmichae3 AT yahoo DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Documentation error
|
Date: | Mon, 23 Mar 2009 00:32:37 -0700 (PDT)
|
Organization: | http://groups.google.com
|
Lines: | 54
|
Message-ID: | <ca683ba1-e029-4556-ae77-37e6cb3f5658@p6g2000pre.googlegroups.com>
|
NNTP-Posting-Host: | 76.115.70.155
|
Mime-Version: | 1.0
|
X-Trace: | posting.google.com 1237793558 13539 127.0.0.1 (23 Mar 2009 07:32:38 GMT)
|
X-Complaints-To: | groups-abuse AT google DOT com
|
NNTP-Posting-Date: | Mon, 23 Mar 2009 07:32:38 +0000 (UTC)
|
Complaints-To: | groups-abuse AT google DOT com
|
Injection-Info: | p6g2000pre.googlegroups.com; posting-host=76.115.70.155;
|
| posting-account=05hOMwoAAAB6R8xtiQKzEljSMzgOhVF1
|
User-Agent: | G2/1.0
|
X-HTTP-UserAgent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7)
|
| Gecko/2009021910 Firefox/3.0.7 (.NET CLR 3.5.30729),gzip(gfe),gzip(gfe)
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Documentation error
a piece of code that doesn't work according to the documentation.
focusing on setdisk().
int thisDrive =3D getdisk();
int lastDrive =3D setdisk(thisDrive); // don't count floppies.
printf("[thisDrive=3D%d,lastDrive=3D%d]\n", thisDrive, lastDrive);
C:\prj\df\df-2.7\dos>df
[thisDrive=3D2,lastDrive=3D26]
*C:=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=8D=8D=8D=8D=8D=
=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D625
.08MB/1.02GB (61.05%)
TOT=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=90=8D=8D=8D=8D=8D=
=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D=8D625=
.08MB/1.02GB
(61.05%)
TOT USED: 398.86MB/1.02GB (38.95%)
TSE-Shell C:\prj\df\df-2.7\dos>
getdfree() works fine. setdisk() does not. The source code for
setdisk looks innocent enough. apparently it sets the disk correctly
under windows, but it is not returning the correct drive number. it
is off by 1 in the positive direction.
windows can be detected with the environment variable windir.
based on the real documentation (HELPPC21) for that interrupt 21
function e,
:int 21,e
^INT 21,E - Select Disk
AH =3D 0E
DL =3D zero based, drive number (0-25, A: - Z:)
on return:
AL =3D one based, total number of logical drives including
hardfiles (1-26)
- for DOS 3.x+, this function returns the number of logical
drives or the value of LASTDRIVE (default of 5) in the
CONFIG.SYS file
as you can see, it does a whammy on you and returns a 1-based drive
number instead of the zero-based number it took. This is not the
documentation given in djgpp.
this is not reflected in the documentation for setdisk() and without
any change to the docs is going to cause everyone headaches and
frustration. please fix. thanks in advance.
Jim Michaels
- Raw text -