--- isofs/cd9660/cd9660_extern.h.orig	Mon Sep 27 22:46:08 1999
+++ isofs/cd9660/cd9660_extern.h	Tue Sep 28 10:35:30 1999
@@ -108,6 +108,6 @@
 extern int (**cd9660_fifoop_p) __P((void *));
 
 int isochar __P((const u_char *, const u_char *, int, u_char *));
-int isofncmp __P((const u_char *, int, const u_char *, int, int));
-void isofntrans __P((u_char *, int, u_char *, u_short *, int, int, int));
+int isofncmp __P((const u_char *, int, const u_char *, int, int, int, struct iso_directory_record *));
+void isofntrans __P((u_char *, int, const u_char *, u_short *, int, int, int, int, struct iso_directory_record *));
 ino_t isodirino __P((struct iso_directory_record *, struct iso_mnt *));
--- isofs/cd9660/cd9660_lookup.c.orig	Mon Sep 27 22:46:53 1999
+++ isofs/cd9660/cd9660_lookup.c	Tue Sep 28 10:19:39 1999
@@ -55,6 +55,7 @@
 #include <isofs/cd9660/cd9660_node.h>
 #include <isofs/cd9660/iso_rrip.h>
 #include <isofs/cd9660/cd9660_rrip.h>
+#include <isofs/cd9660/cd9660_mount.h>
 
 struct	nchstats iso_nchstats;
 
@@ -267,7 +268,8 @@
 						goto notfound;
 				} else if (!(res = isofncmp(name,len,
 						   ep->name,namelen,
-						   imp->im_joliet_level))) {
+						   imp->im_joliet_level,
+						   (imp->im_flags&ISOFSMNT_NOACORN),ep))) {
 					if (isonum_711(ep->flags)&2)
 						ino = isodirino(ep, imp);
 					else
--- isofs/cd9660/cd9660_mount.h.orig	Mon Sep 27 22:46:16 1999
+++ isofs/cd9660/cd9660_mount.h	Tue Sep 28 09:37:00 1999
@@ -51,3 +51,4 @@
 #define	ISOFSMNT_GENS	0x00000002	/* enable generation numbers */
 #define	ISOFSMNT_EXTATT	0x00000004	/* enable extended attributes */
 #define	ISOFSMNT_NOJOLIET 0x00000008	/* disable Joliet extensions */
+#define	ISOFSMNT_NOACORN 0x00000010	/* disable Acorn extensions */
--- isofs/cd9660/cd9660_vfsops.c.orig	Mon Sep 27 22:48:37 1999
+++ isofs/cd9660/cd9660_vfsops.c	Tue Sep 28 09:37:59 1999
@@ -437,7 +437,8 @@
 		bp = NULL;
 	}
 	isomp->im_flags = argp->flags & (ISOFSMNT_NORRIP | ISOFSMNT_GENS |
-					 ISOFSMNT_EXTATT | ISOFSMNT_NOJOLIET);
+					 ISOFSMNT_EXTATT | ISOFSMNT_NOJOLIET |
+					 ISOFSMNT_NOACORN);
 	switch (isomp->im_flags&(ISOFSMNT_NORRIP|ISOFSMNT_GENS)) {
 	default:
 	    isomp->iso_ftype = ISO_FTYPE_DEFAULT;
--- isofs/cd9660/cd9660_vnops.c.orig	Mon Sep 27 22:47:14 1999
+++ isofs/cd9660/cd9660_vnops.c	Tue Sep 28 10:53:53 1999
@@ -63,6 +63,7 @@
 #include <isofs/cd9660/cd9660_extern.h>
 #include <isofs/cd9660/cd9660_node.h>
 #include <isofs/cd9660/iso_rrip.h>
+#include <isofs/cd9660/cd9660_mount.h>
 
 /*
  * Structure for reading directories
@@ -554,7 +555,10 @@
 				   idp->current.d_name, &namelen,
 				   imp->iso_ftype == ISO_FTYPE_9660,
 				   isonum_711(ep->flags)&4,
-				   imp->im_joliet_level);
+				   imp->im_joliet_level,
+				   (imp->im_flags&ISOFSMNT_NOACORN),ep);
+
+
 			switch (idp->current.d_name[0]) {
 			case 0:
 				idp->current.d_name[0] = '.';
--- isofs/cd9660/cd9660_util.c.orig	Mon Sep 27 22:47:06 1999
+++ isofs/cd9660/cd9660_util.c	Tue Sep 28 15:01:50 1999
@@ -59,6 +59,75 @@
 #include <isofs/cd9660/cd9660_extern.h>
 
 /*
+ * Convert Acorn filename if directory is Acorn-format
+ */
+
+#define CD9660_NOACORNFILETYPE         -1
+#define CD9660_NOTACORN                -2
+
+#define DONT_ADD_ACORN_UNIXEX
+
+int get_acorn_filetype(rec, name)
+        struct iso_directory_record *rec;
+        char *name;
+{
+        int offset,filetype;
+        unsigned char *data;
+
+        offset = (isonum_711(rec->name_len)+ISO_DIRECTORY_RECORD_SIZE);
+        offset += offset%2; /* Round up to next even */
+        data = ((unsigned char *) rec) + offset;
+
+        if (isonum_711(rec->length)-offset != 32) return CD9660_NOTACORN;
+        if (strncmp(data,"ARCHIMEDES",10)) return CD9660_NOTACORN;
+        /* Directory record has 32 byte system use area
+
+          0-9 "ARCHIMEDES"
+                                 13121110
+        10-13 Load address      &FFFtttdd
+                                 17161514
+        14-17 Execution address &dddddddd
+                                 21201918
+        18-21 Attributes        &ffffffaa
+        22-31 Reserved          0
+
+        ttt = filetype
+        dd  = date stamp (ignored - use directory record date)
+        ffffff = filesystem specific attributes (bit 0 of offset 19 is
+                 set if initial underscore should be replaced by !)
+        aa  = RISCOS access permissions (ignore - read access is forced)
+
+        */
+
+        if (((data[19] & 1) == 1) && (name[0] == '_'))  name[0] = '!';
+
+        /* Don't read a filetype if a directory */
+        if ((isonum_711(rec->flags) & 2) != 0) return CD9660_NOACORNFILETYPE;
+
+        /* Return if not filetyped */
+        if( data[13] != 0xff || (data[12]&0xf0) != 0xf0) return CD9660_NOACORNFILETYPE;
+
+        filetype = ((data[12] & 0xf)<<8) | data[11];
+
+        switch(filetype) {
+#ifdef DONT_ADD_ACORN_TEXT
+        case 0xfff:
+             return CD9660_NOACORNFILETYPE;
+             break;
+#endif
+#ifdef DONT_ADD_ACORN_UNIXEX
+        case 0xfe6:
+             return CD9660_NOACORNFILETYPE;
+             break;
+#endif
+        default:
+             return filetype;
+             break;
+        }
+        return CD9660_NOACORNFILETYPE;
+}
+
+/*
  * Get one character out of an iso filename
  * Return number of bytes consumed
  */
@@ -91,18 +160,26 @@
  * Note: Version number plus ';' may be omitted.
  */
 int
-isofncmp(fn, fnlen, isofn, isolen, joliet_level)
-	const u_char *fn, *isofn;
-	int fnlen, isolen, joliet_level;
+isofncmp(fn, fnlen, isofnin, isolen, joliet_level, noacorn, ep)
+	const u_char *fn, *isofnin;
+	int fnlen, isolen, joliet_level, noacorn;
+	struct iso_directory_record *ep;
 {
 	int i, j;
 	char c;
-	const u_char *isoend = isofn + isolen;
+	u_char convname[NAME_MAX];
+	u_char *isofn = convname;
+	u_char *isoend;
+	u_short convlen;
+
+	isofntrans((u_char *)isofnin, isolen, convname, &convlen, 0, 0,
+		joliet_level, noacorn, ep);
+	isoend = (u_char *)isofn + convlen;
 
 	while (--fnlen >= 0) {
 		if (isofn == isoend)
 			return *fn;
-		isofn += isochar(isofn, isoend, joliet_level, &c);
+		c = (char) *isofn++;
 		if (c == ';') {
 			switch (*fn++) {
 			default:
@@ -118,8 +194,7 @@
 				}
 			}
 			for (j = 0; isofn != isoend; j = j * 10 + c - '0')
-				isofn += isochar(isofn, isoend,
-						 joliet_level, &c);
+				c = (char) *isofn++;
 			return i - j;
 		}
 		if (((u_char) c) != *fn) {
@@ -136,14 +211,13 @@
 		fn++;
 	}
 	if (isofn != isoend) {
-		isofn += isochar(isofn, isoend, joliet_level, &c);
+		c = (char) *isofn++;
 		switch (c) {
 		default:
 			return -1;
 		case '.':
 			if (isofn != isoend) {
-				isochar(isofn, isoend, joliet_level, &c);
-				if (c == ';')
+				if ((char)*isofn == ';')
 					return 0;
 			}
 			return -1;
@@ -158,34 +232,50 @@
  * translate a filename
  */
 void
-isofntrans(infn, infnlen, outfn, outfnlen, original, assoc, joliet_level)
-	u_char *infn, *outfn;
+isofntrans(infn, infnlen, outfnin, outfnlen, original, assoc, joliet_level, noacorn, ep)
+	u_char *infn;
+	const u_char *outfnin;
 	int infnlen;
 	u_short *outfnlen;
 	int original;
 	int assoc;
 	int joliet_level;
+	int noacorn;
+	struct iso_directory_record *ep;
 {
-	int fnidx = 0;
+	int fnidx = 0, filetype = CD9660_NOTACORN;
 	u_char *infnend = infn + infnlen;
+	u_char *outfn = (u_char *)outfnin;
+
+        if(noacorn == 0 && infnlen > 0) filetype = get_acorn_filetype(ep, infn);
 	
 	if (assoc) {
 		*outfn++ = ASSOCCHAR;
 		fnidx++;
 	}
+
 	for (; infn != infnend; fnidx++) {
 		char c;
 
 		infn += isochar(infn, infnend, joliet_level, &c);
 
-		if (!original && joliet_level == 0 && c >= 'A' && c <= 'Z')
+		if (!original && filetype == CD9660_NOTACORN &&
+		        joliet_level == 0 && c >= 'A' && c <= 'Z')
 			*outfn++ = c + ('a' - 'A');
 		else if (!original && c == ';') {
-			if (fnidx > 0 && outfn[-1] == '.')
+			if (fnidx > 0 && outfn[-1] == '.') {
 				fnidx--;
+				outfn--;
+			}
 			break;
 		} else
 			*outfn++ = c;
 	}
+	if (filetype >= 0) {
+	        *outfn++=',';
+       		sprintf (outfn ,"%3.3x", filetype);
+       		fnidx += 4;
+	}
+
 	*outfnlen = fnidx;
 }
--- isofs/cd9660/cd9660_rrip.c.orig	Tue Jul 13 12:16:07 1999
+++ isofs/cd9660/cd9660_rrip.c	Sun Oct 31 18:46:46 1999
@@ -58,6 +58,7 @@
 #include <isofs/cd9660/cd9660_node.h>
 #include <isofs/cd9660/cd9660_rrip.h>
 #include <isofs/cd9660/iso_rrip.h>
+#include <isofs/cd9660/cd9660_mount.h>
 
 typedef struct {
 	char type[2];
@@ -301,7 +301,8 @@
 	isofntrans(isodir->name, isonum_711(isodir->name_len),
 		   ana->outbuf, ana->outlen,
 		   1, isonum_711(isodir->flags) & 4,
-		   ana->imp->im_joliet_level);
+		   ana->imp->im_joliet_level,
+		   ISOFSMNT_NOACORN, isodir);
 	switch (ana->outbuf[0]) {
 	default:
 		break;
