Initial arc port, this one done by Alexander Deynichenko.

This commit is contained in:
Scott McCreary
2009-11-27 00:39:52 +00:00
parent 0b5e8ea68e
commit ac3133c19f
3 changed files with 154 additions and 0 deletions

View File

@@ -0,0 +1,18 @@
DESCRIPTION="Create & extract files from DOS .ARC files"
HOMEPAGE="http://arc.sourceforge.net/"
SRC_URI="http://sunet.dl.sourceforge.net/project/arc/arc/arc-5.21o/arc-5.21o.tgz"
REVISION="1"
STATUS_HAIKU="stable"
DEPEND=""
BUILD {
cd arc-5.21o
make
}
INSTALL {
cd arc-5.21o
install arc /boot/common/bin
install marc /boot/common/bin
install arc.1 /boot/common/man/man1
}

View File

@@ -0,0 +1,5 @@
Package: arc
Version: 5.21o
Copyright: 1985-2009 Thom Henderson
License: GNU GPL v2
URL: http://arc.sourceforge.net/

View File

@@ -0,0 +1,131 @@
diff -Naur arc-5.21o.orig/Makefile arc-5.21o/Makefile
--- arc-5.21o.orig/Makefile 2009-11-23 21:01:04.000000000 +0000
+++ arc-5.21o/Makefile 2009-11-23 21:59:58.000000000 +0000
@@ -38,14 +38,14 @@
#SYSTEM = -DBSD=1
SYSTEM = -DSYSV=1
-OPT = -O
+OPT = -O2 -DNEED_ALPHASORT
# For MWC 3.0 on the Atari ST, use:
#CFLAGS = -VCOMPAC -VPEEP
CFLAGS = $(OPT) $(SYSTEM)
# GNU's gcc is very nice, if you've got it. Otherwise just cc.
#CC = cgcc -mshort -mbaserel
-CC = cc
+#CC = cc
# tmclock is only needed on Unix systems...
TMCLOCK = tmclock.o
diff -Naur arc-5.21o.orig/arcdos.c arc-5.21o/arcdos.c
--- arc-5.21o.orig/arcdos.c 2009-11-23 21:01:04.000000000 +0000
+++ arc-5.21o/arcdos.c 2009-11-23 21:26:18.000000000 +0000
@@ -33,7 +33,7 @@
#if BSD
#include <sys/time.h>
#else
-#include <time.h> /* Sys V. Bleah. */
+#include <sys/time.h> /* Sys V. Bleah. */
#if NEED_TIMEVAL
struct timeval {
long tv_sec;
diff -Naur arc-5.21o.orig/arcmisc.c arc-5.21o/arcmisc.c
--- arc-5.21o.orig/arcmisc.c 2009-11-23 21:01:04.000000000 +0000
+++ arc-5.21o/arcmisc.c 2009-11-23 22:22:03.000000000 +0000
@@ -8,6 +8,8 @@
#include "arc.h"
#include <string.h>
+#include <dirent.h>
+#include <errno.h>
#if BSD
#include <strings.h>
#endif
@@ -211,6 +213,73 @@
#endif
+#if UNIX
+
+#define DIRSIZ(d) (sizeof(struct dirent) + strlen(d->d_name) + 1)
+#define INITIAL_SIZE 30
+
+int
+scandir(name, dirlist, selector, sorter)
+ const char *name;
+ struct dirent ***dirlist;
+ int (*selector)();
+ int (*sorter)();
+{
+ static struct dirent *E;
+ struct dirent **names;
+ DIR *Dp;
+ int i;
+ int size = INITIAL_SIZE;
+
+ if (!(names = (struct dirent **) malloc(size * sizeof names[0])) ||
+ access(name, R_OK | X_OK) || !(Dp = opendir(name)))
+ return -1;
+
+ /* Read entries in the directory. */
+
+ for (i = 0; (E = readdir(Dp)); )
+ if (selector == NULL || (*selector)(E))
+ {
+ /* User wants them all, or he wants this one. */
+ if (++i >= size)
+ {
+ size <<= 1;
+ names = (struct dirent **) realloc(names,
+ size * sizeof names[0]);
+ if (names == NULL)
+ {
+ closedir(Dp);
+ free(&names);
+ return(-1);
+ }
+ }
+
+ /* Copy the entry. */
+ names[i - 1] = (struct dirent *) malloc(DIRSIZ(E));
+ if (names[i - 1] == NULL)
+ {
+ closedir(Dp);
+ free(&names);
+ return(-1);
+ }
+ strcpy(names[i - 1]->d_name, E->d_name);
+ }
+
+ /* Close things off. */
+ names = (struct dirent **) realloc(names,
+ (i + 1) * sizeof names[0]);
+ names[i] = 0;
+ *dirlist = names;
+ closedir(Dp);
+
+ /* Sort? */
+ if (i && sorter)
+ qsort((char *)names, i, sizeof names[0], sorter);
+
+ return i;
+}
+#endif
+
VOID
upper(string)
char *string;
@@ -309,9 +378,10 @@
static char **NameList;
static char namecopy[STRLEN], *dirname;
#if UNIX
- int alphasort();
- int scandir();
+ //int alphasort();
+ //int scandir();
#endif /* UNIX */
+
int fmatch();
static int Nnum = 0, ii;