delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/01/06/00:32:40

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: Doug Kaufman <dkaufman AT rahul DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Problem with UNRAR
Date: Thu, 6 Jan 2005 05:18:57 +0000 (UTC)
Organization: a2i network
Lines: 40
Message-ID: <criho1$iit$1@blue.rahul.net>
References: <Pine DOT GSO DOT 4 DOT 31L2A DOT 0501052037160 DOT 28985-100000 AT mail> <crhjls$v2b$1 AT blue DOT rahul DOT net> <01c4f3ab$Blat.v2.2.2$28b62780 AT zahav DOT net DOT il>
NNTP-Posting-Host: green.rahul.net
X-Trace: blue.rahul.net 1104988737 19037 192.160.13.49 (6 Jan 2005 05:18:57 GMT)
X-Complaints-To: support AT rahul DOT net
NNTP-Posting-Date: Thu, 6 Jan 2005 05:18:57 +0000 (UTC)
User-Agent: nn/6.6.4
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Eli Zaretskii" <eliz AT gnu DOT org> writes:

>> From: Doug Kaufman <dkaufman AT rahul DOT net>
>> Date: Wed, 5 Jan 2005 20:45:48 +0000 (UTC)
>> 
>> +#ifdef __DJGPP__
>> +  {
>> +    __dpmi_regs regs;
>> +    memset(&regs,0,sizeof(regs));
>> +    regs.h.ah=0x36;
>> +    regs.h.dl=Drive;
>> +    __dpmi_int (0x21, &regs);
>> +    if (regs.x.ax==0xffff)
>> +      return(1457664);
>> +    Int64 FreeSize=regs.x.ax*regs.x.cx;
>> +    FreeSize=FreeSize*regs.x.bx;
>> +    return(FreeSize);
>> +  }
>> +#else

>Why work so hard when DJGPP has the `statfs' function which will return
>the disk free space?

I just modified the author's code to use __dpmi_int instead of the
_int86 in the original code. I didn't think about more efficient ways to
do it. Thanks for the suggestion. I presume that you are talking about
doing something like:
struct statfs fs;
statfs(Drive, &fs);
FreeSize=fs.f_bfree*fs.f_bsize;
return(FreeSize);

I am not a programmer, so I am usually happy just to get something to
work for me when I try to port a program. I'll try to remember that we
have statfs if the need arises with other programs.

                     Doug
-- 
Doug Kaufman
Internet: dkaufman AT rahul DOT net

- Raw text -


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