[File] [RFC PATCH] Add magic to detect PCjr Cartridge file.

laniel_francis at privacyrequired.com laniel_francis at privacyrequired.com
Tue Jan 5 19:09:14 UTC 2021


From: Francis Laniel <laniel_francis at privacyrequired.com>

Hi.


First, I do hope you are fine and the same for your relatives.

This patch add magic to detect IBM PCjr Cartridge image file.
It should close this debian issue:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=810501
Note that the magic values were taken from this post.

I added a test which comes with a fake cartridge handly written since true
cartridges are surely protected by copyright.

If you see any way to improve this patch, feel free to share.


Best regards.

Signed-off-by: Francis Laniel <laniel_francis at privacyrequired.com>
---
 magic/Magdir/pcjr   |   7 +++++++
 magic/Makefile.am   |   1 +
 tests/pcjr.result   |   1 +
 tests/pcjr.testfile | Bin 0 -> 514 bytes
 4 files changed, 9 insertions(+)
 create mode 100644 magic/Magdir/pcjr
 create mode 100644 tests/pcjr.result
 create mode 100644 tests/pcjr.testfile

diff --git a/magic/Magdir/pcjr b/magic/Magdir/pcjr
new file mode 100644
index 00000000..4ba60dfd
--- /dev/null
+++ b/magic/Magdir/pcjr
@@ -0,0 +1,7 @@
+#------------------------------------------------------------------------------
+# $File: pcjr,v 1 2021/01/05 18:08:16 christos Exp $
+# pcjr:  file(1) magic for PCjr Cartridge image file format
+# From: Francis Laniel <laniel_francis at privacyrequired.com>
+0 string PCjr
+>0x80 beshort 0x55aa PCjr Cartridge image
+>0x200 beshort 0x55aa PCjr Cartridge image
\ No newline at end of file
diff --git a/magic/Makefile.am b/magic/Makefile.am
index a24c4460..db97529f 100644
--- a/magic/Makefile.am
+++ b/magic/Makefile.am
@@ -225,6 +225,7 @@ $(MAGIC_FRAGMENT_DIR)/pbf \
 $(MAGIC_FRAGMENT_DIR)/pbm \
 $(MAGIC_FRAGMENT_DIR)/pc88 \
 $(MAGIC_FRAGMENT_DIR)/pc98 \
+$(MAGIC_FRAGMENT_DIR)/pcjr \
 $(MAGIC_FRAGMENT_DIR)/pdf \
 $(MAGIC_FRAGMENT_DIR)/pdp \
 $(MAGIC_FRAGMENT_DIR)/perl \
diff --git a/tests/pcjr.result b/tests/pcjr.result
new file mode 100644
index 00000000..955c8c77
--- /dev/null
+++ b/tests/pcjr.result
@@ -0,0 +1 @@
+PCjr Cartridge image
\ No newline at end of file
diff --git a/tests/pcjr.testfile b/tests/pcjr.testfile
new file mode 100644
index 0000000000000000000000000000000000000000..f8091d517084916a3b8356d6a4ec82950bc1a21d
GIT binary patch
literal 514
zcmWG=&MH!HPAn=Z%1lX5RmjXu1d?f)IjLN3iP@<N0jSc+`FSOYnR%Ic=?eLIIh6{D
V3K^-1DXB$zTnwXNNQOY at DgZG^8ae;~

literal 0
HcmV?d00001

-- 
2.20.1



More information about the File mailing list