aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt4
-rw-r--r--magic/MAGIC.txt45
-rw-r--r--magic/alf25
3 files changed, 73 insertions, 1 deletions
diff --git a/README.txt b/README.txt
index cff578c..cfa3e0a 100644
--- a/README.txt
+++ b/README.txt
@@ -51,6 +51,9 @@ Included in the source distribution only:
script in the package: I wrote it for testing purposes only. You can
use "unalf -l" to list .alf files, so this is redundant.
+- magic/ - "magic" that allows the file(1) command to identify ALF
+ archive files. See magic/MAGIG.txt for details.
+
Included in the binary distribution only:
- README_Windows.txt.
@@ -58,4 +61,3 @@ Included in the binary distribution only:
- unalf.exe and alfsum.exe - the Windows executables.
- unalf.html and alfsum.html - the man pages, converted to HTML.
-
diff --git a/magic/MAGIC.txt b/magic/MAGIC.txt
new file mode 100644
index 0000000..9e04bb1
--- /dev/null
+++ b/magic/MAGIC.txt
@@ -0,0 +1,45 @@
+This directory contains "magic" for the file(1) command. It doesn't
+get installed by 'make install' because every OS seems to handle file
+magic differently.
+
+At some point, the ALF magic will be added to file(1). Try this:
+
+ file examples/aprog.alf
+
+If the result looks like this:
+
+ examples/aprog.alf: Atari 8-bit AlfCrunch data, first filename APROG10.001
+
+...then your file command already knows about ALF files, and you can stop
+reading now.
+
+If you get something similar to this:
+
+ examples/aprog.alf: data
+
+...then you can add ALF support by copying the file magic/alf to your
+magic directory (usually this is /etc/file/magic) and recompiling the
+magic database (this is done differently on different OSes).
+
+For Slackware Linux, the commands would be:
+
+ cp magic/alf /etc/file/magic
+ /etc/file/recompile_magic.mgc.sh
+
+On other OSes that have a /etc/file/magic directory, You could also
+try replacing the 2nd command with:
+
+ cd /etc/file
+ file --compile
+
+The above commands must be run as root. You can prefix them with
+"sudo" if your user is set up for sudo access.
+
+After recompiling the file magic database, the file command will
+identify ALF archives correctly, as in the first example above.
+
+If you're creating a distro package of unalf, install magic/alf
+to wherever your OS keeps its magic files, and recompile the magic
+database in your package system's post-install hook. If there's
+also a post-uninstall hook, you probably should recompile the magic
+again there.
diff --git a/magic/alf b/magic/alf
new file mode 100644
index 0000000..4517d0d
--- /dev/null
+++ b/magic/alf
@@ -0,0 +1,25 @@
+### AlfCrunch
+# Author: B. Watson (urchlay@slackware.uk)
+#
+# Reference:
+# https://slackware.uk/~urchlay/repos/unalf/plain/doc/fileformat.txt
+#
+# This is very similar to ARC (see Magdir/archive), but doesn't
+# overlap with it. The . in the filename is always present, even
+# if there's no extender after it.
+#
+# Offsets 18 and 28 are the high bytes of the 32-bit original and
+# compressed sizes. These will always be 0, since Atari files are
+# never >16MB in size (and since the UNALF dearchiver can't handle
+# them anyway).
+#
+# magicbits=53.7
+#
+0 uleshort 0x0f1a
+>18 ubyte 0x00
+>>28 ubyte 0x00
+>>>2 regex/13 [A-Z][A-Z0-9@_]{0,7}\.[A-Z0-9@_]{0,3}
+>>>>&0 ubyte 0
+>>>>>2 string x Atari 8-bit AlfCrunch data, first filename %s
+!:mime application/x-atari-8bit-alfcrunch
+!:ext alf