delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2005/01/12/17:01:06

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: Wed, 12 Jan 2005 21:47:47 +0000 (UTC)
Organization: a2i network
Lines: 136
Message-ID: <cs45u3$b13$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 1105566467 11299 192.160.13.49 (12 Jan 2005 21:47:47 GMT)
X-Complaints-To: support AT rahul DOT net
NNTP-Posting-Date: Wed, 12 Jan 2005 21:47:47 +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:

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

OK. Here is a modified patch for unrar, including the above suggestion.
                               Doug


--- filefn.cpp.orig	2004-08-03 04:35:44.000000000 -0800
+++ filefn.cpp	2005-01-12 13:39:14.000000000 -0800
@@ -1,4 +1,7 @@
 #include "rar.hpp"
+#ifdef __DJGPP__
+#include <sys/vfs.h>
+#endif
 
 MKDIR_CODE MakeDir(const char *Name,const wchar *NameW,uint Attr)
 {
@@ -194,6 +197,15 @@
 #elif defined(_UNIX)
   return(1457664);
 #elif defined(_EMX)
+#ifdef __DJGPP__
+  {
+    struct statfs fs;
+    Int64 FreeSize;
+    statfs(Name, &fs);
+    FreeSize=fs.f_bfree*fs.f_bsize;
+    return(FreeSize);
+  }
+#else
   int Drive=(!isalpha(Name[0]) || Name[1]!=':') ? 0:toupper(Name[0])-'A'+1;
   if (_osmode == OS2_MODE)
   {
@@ -217,6 +229,7 @@
     FreeSize=FreeSize*outregs.x.bx;
     return(FreeSize);
   }
+#endif /* __DJGPP__ */
 #else
   #define DISABLEAUTODETECT
   return(1457664);
--- find.cpp.orig	2004-08-03 04:35:44.000000000 -0800
+++ find.cpp	2005-01-05 13:27:14.000000000 -0800
@@ -152,9 +152,7 @@
       fd->Error=(errno!=ENOENT);
       return(false);
     }
-#ifdef _DJGPP
-  fd->FileAttr=chmod(FindMask,0);
-#elif defined(_EMX)
+#if defined(_EMX) && !defined(_DJGPP)
   fd->FileAttr=st.st_attr;
 #else
   fd->FileAttr=st.st_mode;
--- makefile.dj.orig	2005-01-05 12:13:02.000000000 -0800
+++ makefile.dj	2005-01-05 12:14:54.000000000 -0800
@@ -0,0 +1,45 @@
+#
+# Makefile for DJGPP - unrar
+#
+# Note: you have to 'make clean' before you can build
+#	the sfx module
+#
+
+# DJGPP using GCC
+CXX=gpp
+CXXFLAGS=-O2 -W -Wall
+DEFINES=
+
+
+##########################
+
+COMPILE=$(CXX) $(CXXFLAGS) $(DEFINES)
+LINK=$(CXX)
+
+UNRAR_OBJ=filestr.o recvol.o rs.o scantree.o
+
+OBJECTS=rar.o strlist.o strfn.o pathfn.o int64.o savepos.o global.o file.o filefn.o filcreat.o \
+	archive.o arcread.o unicode.o system.o isnt.o crypt.o crc.o rawread.o encname.o \
+	resource.o match.o timefn.o rdwrfn.o consio.o options.o ulinks.o errhnd.o rarvm.o \
+	rijndael.o getbits.o sha1.o extinfo.o extract.o volume.o list.o find.o unpack.o cmddata.o
+
+.cpp.o:
+	$(COMPILE) -D$(WHAT) -c $<
+
+all:	unrar
+
+clean:
+	@rm -f *.o *.bak *~
+
+unrar:	WHAT=UNRAR
+unrar:	$(OBJECTS) $(UNRAR_OBJ)
+	@rm -f makeunrar
+	$(LINK) -o unrar $(LDFLAGS) $(OBJECTS) $(UNRAR_OBJ) $(LIBS)	
+	@strip unrar
+
+sfx:	WHAT=SFX_MODULE
+sfx:	$(OBJECTS)
+	@rm -f default.sfx
+	$(LINK) -o default.sfx $(LDFLAGS) $(OBJECTS) -DSFX_MODULE 
+	strip default.sfx
+
--- os.hpp.orig	2004-08-03 04:35:46.000000000 -0800
+++ os.hpp	2005-01-05 12:01:26.000000000 -0800
@@ -69,6 +69,8 @@
   #include <errno.h>
   #ifdef _DJGPP
     #include <utime.h>
+    #include <dpmi.h>
+    #include <io.h>
   #else
     #include <os2.h>
     #include <sys/utime.h>
--- pathfn.cpp.orig	2004-08-03 04:35:46.000000000 -0800
+++ pathfn.cpp	2005-01-05 11:38:16.000000000 -0800
@@ -294,6 +294,7 @@
     strcpy(RARFileName,Path);
   if (Number!=0)
     return(false);
+#ifndef __DJGPP__
   if (_osmode==OS2_MODE)
   {
     PTIB ptib;
@@ -302,6 +303,7 @@
     DosQueryModuleName(ppib->pib_hmte,NM,Path);
   }
   else
+#endif /* __DJGPP__ */
     strcpy(Path,RARFileName);
   RemoveNameFromPath(Path);
   return(true);
-- 
Doug Kaufman
Internet: dkaufman AT rahul DOT net

- Raw text -


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