From da33fde375f0ef045415058cb8027cb6df6b9cbd Mon Sep 17 00:00:00 2001 From: Le Philousophe Date: Fri, 1 Jan 2021 16:20:16 +0000 Subject: [PATCH] RISCOS: Refactor zip patches Enable decomma by default and make it negatable. We will use this zip version only for RiscOS so it's simpler like that. --- ...p.patch => 01-add-forriscos-support.patch} | 95 +++++++++++++++++-- .../zip/patches/02-decomma-by-default.patch | 38 ++++++++ .../riscos/packages/zip/patches/globals.patch | 13 --- .../riscos/packages/zip/patches/zip.patch | 58 ----------- 4 files changed, 125 insertions(+), 79 deletions(-) rename toolchains/riscos/packages/zip/patches/{zipup.patch => 01-add-forriscos-support.patch} (62%) create mode 100644 toolchains/riscos/packages/zip/patches/02-decomma-by-default.patch delete mode 100644 toolchains/riscos/packages/zip/patches/globals.patch delete mode 100644 toolchains/riscos/packages/zip/patches/zip.patch diff --git a/toolchains/riscos/packages/zip/patches/zipup.patch b/toolchains/riscos/packages/zip/patches/01-add-forriscos-support.patch similarity index 62% rename from toolchains/riscos/packages/zip/patches/zipup.patch rename to toolchains/riscos/packages/zip/patches/01-add-forriscos-support.patch index 18f9ae2..105e474 100644 --- a/toolchains/riscos/packages/zip/patches/zipup.patch +++ b/toolchains/riscos/packages/zip/patches/01-add-forriscos-support.patch @@ -1,6 +1,85 @@ ---- a/zipup.c.orig 2008-01-12 22:29:14.000000000 -0800 -+++ b/zipup.c 2008-01-12 22:36:00.000000000 -0800 -@@ -118,6 +118,9 @@ +Index: zip30/globals.c +=================================================================== +--- zip30.orig/globals.c ++++ zip30/globals.c +@@ -30,6 +30,10 @@ int dispose = 0; /* 1=remove file + int pathput = 1; /* 1=store path with name */ + #ifdef RISCOS + int scanimage = 1; /* 1=scan through image files */ ++#else ++#ifdef FORRISCOS ++int decomma = 0; ++#endif + #endif + int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ + int dosify = 0; /* 1=make new entries look like MSDOS */ +Index: zip30/zip.c +=================================================================== +--- zip30.orig/zip.c ++++ zip30/zip.c +@@ -668,6 +668,9 @@ local void help() + ," -h2 show more help -I don't scan thru Image files" + #else + ," -h2 show more help" ++#ifdef FORRISCOS ++," -, strip ,xxx from filename and convert to RISCOS filetype encoding" ++#endif + #endif + #endif /* ?MACOS */ + #ifdef VMS +@@ -1144,6 +1147,9 @@ local void version_info() + #if CRYPT && defined(PASSWD_FROM_STDIN) + "PASSWD_FROM_STDIN", + #endif /* CRYPT & PASSWD_FROM_STDIN */ ++#ifdef FORRISCOS ++ "FORRISCOS", ++#endif + NULL + }; + +@@ -2109,6 +2115,9 @@ struct option_struct far options[] = { + #ifdef RISCOS + {"/", "exts-to-swap", o_REQUIRED_VALUE, o_NOT_NEGATABLE, '/', "override Zip$Exts"}, + #endif ++#ifdef FORRISCOS ++ {",", "strip-type", o_NO_VALUE, o_NOT_NEGATABLE, ',', "strip ,xxx extension"}, ++#endif + /* the end of the list */ + {NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE, 0, NULL} /* end has option_ID = 0 */ + }; +@@ -2847,6 +2856,12 @@ char **argv; /* command line + case 'I': /* Don't scan through Image files */ + scanimage = 0; + break; ++#else ++#ifdef FORRISCOS ++ case ',': /* Convert ,xxx to RISC OS extended filetype info */ ++ decomma = 1; ++ break; ++#endif + #endif + #ifdef MACOS + case o_jj: /* store absolute path including volname */ +Index: zip30/zip.h +=================================================================== +--- zip30.orig/zip.h ++++ zip30/zip.h +@@ -323,6 +323,10 @@ extern int pathput; /* Store + + #ifdef RISCOS + extern int scanimage; /* Scan through image files */ ++#else ++#ifdef FORRISCOS ++extern int decomma; /* Convert ,xxx filename to RISC OS filetype info */ ++#endif + #endif + + #define BEST -1 /* Use best method (deflation or store) */ +Index: zip30/zipup.c +=================================================================== +--- zip30.orig/zipup.c ++++ zip30/zipup.c +@@ -139,6 +139,9 @@ #else local int filetypes OF((char *, char *)); #endif @@ -10,7 +89,7 @@ local unsigned file_read OF((char *buf, unsigned size)); #ifdef USE_ZLIB local int zl_deflate_init OF((int pack_level)); -@@ -276,7 +279,133 @@ +@@ -379,7 +382,133 @@ char *s; /* list } #endif /* ?RISCOS */ @@ -47,7 +126,7 @@ + if (cptr) + if ((cptr - z->iname) != (int)(strlen(z->iname)-4)) + cptr = NULL; /* There was a comma, but it wasn't a ,xxx at the end! */ -+ + + if (cptr) + { + *cptr='\0'; /* Chop the filename at the comma */ @@ -139,12 +218,12 @@ + + return ZE_OK; +} - ++ +#endif /* FORRISCOS */ /* Note: a zip "entry" includes a local header (which includes the file name), an encryption header if encrypting, the compressed data -@@ -360,6 +489,15 @@ +@@ -552,6 +681,15 @@ struct zlist far *z; /* zip entry to #if !(defined(VMS) && defined(VMS_PK_EXTRA)) if (extra_fields) { /* create extra field and change z->att and z->atx if desired */ @@ -158,5 +237,5 @@ + else +#endif set_extra_field(z, &f_utim); - #ifdef QLZIP + # ifdef QLZIP if(qlflag) diff --git a/toolchains/riscos/packages/zip/patches/02-decomma-by-default.patch b/toolchains/riscos/packages/zip/patches/02-decomma-by-default.patch new file mode 100644 index 0000000..78fc9a2 --- /dev/null +++ b/toolchains/riscos/packages/zip/patches/02-decomma-by-default.patch @@ -0,0 +1,38 @@ +Index: zip30/globals.c +=================================================================== +--- zip30.orig/globals.c ++++ zip30/globals.c +@@ -32,7 +32,7 @@ int pathput = 1; /* 1=store path + int scanimage = 1; /* 1=scan through image files */ + #else + #ifdef FORRISCOS +-int decomma = 0; ++int decomma = 1; + #endif + #endif + int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ +Index: zip30/zip.c +=================================================================== +--- zip30.orig/zip.c ++++ zip30/zip.c +@@ -2116,7 +2116,7 @@ struct option_struct far options[] = { + {"/", "exts-to-swap", o_REQUIRED_VALUE, o_NOT_NEGATABLE, '/', "override Zip$Exts"}, + #endif + #ifdef FORRISCOS +- {",", "strip-type", o_NO_VALUE, o_NOT_NEGATABLE, ',', "strip ,xxx extension"}, ++ {",", "strip-type", o_NO_VALUE, o_NEGATABLE, ',', "strip ,xxx extension"}, + #endif + /* the end of the list */ + {NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE, 0, NULL} /* end has option_ID = 0 */ +@@ -2859,7 +2859,10 @@ char **argv; /* command line + #else + #ifdef FORRISCOS + case ',': /* Convert ,xxx to RISC OS extended filetype info */ +- decomma = 1; ++ if (negated) ++ decomma = 0; ++ else ++ decomma = 1; + break; + #endif + #endif diff --git a/toolchains/riscos/packages/zip/patches/globals.patch b/toolchains/riscos/packages/zip/patches/globals.patch deleted file mode 100644 index 66dc22e..0000000 --- a/toolchains/riscos/packages/zip/patches/globals.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/globals.c.orig 2005-03-20 12:32:02.000000000 -0800 -+++ b/globals.c 2008-01-12 22:45:07.000000000 -0800 -@@ -28,6 +28,10 @@ - int pathput = 1; /* 1=store path with name */ - #ifdef RISCOS - int scanimage = 1; /* 1=scan through image files */ -+#else -+#ifdef FORRISCOS -+int decomma = 0; -+#endif - #endif - int method = BEST; /* one of BEST, DEFLATE (only), or STORE (only) */ - int dosify = 0; /* 1=make new entries look like MSDOS */ diff --git a/toolchains/riscos/packages/zip/patches/zip.patch b/toolchains/riscos/packages/zip/patches/zip.patch deleted file mode 100644 index cc054f5..0000000 --- a/toolchains/riscos/packages/zip/patches/zip.patch +++ /dev/null @@ -1,58 +0,0 @@ ---- a/zip.c.orig 2009-05-07 11:54:09.000000000 +0100 -+++ b/zip.c 2009-05-07 11:53:08.000000000 +0100 -@@ -668,6 +668,9 @@ - ," -h2 show more help -I don't scan thru Image files" - #else - ," -h2 show more help" -+#ifdef FORRISCOS -+," -, strip ,xxx from filename and convert to RISCOS filetype encoding" -+#endif - #endif - #endif /* ?MACOS */ - #ifdef VMS -@@ -1144,6 +1147,9 @@ - #if CRYPT && defined(PASSWD_FROM_STDIN) - "PASSWD_FROM_STDIN", - #endif /* CRYPT & PASSWD_FROM_STDIN */ -+#ifdef FORRISCOS -+ "FORRISCOS", -+#endif - NULL - }; - -@@ -2109,6 +2115,9 @@ - #ifdef RISCOS - {"/", "exts-to-swap", o_REQUIRED_VALUE, o_NOT_NEGATABLE, '/', "override Zip$Exts"}, - #endif -+#ifdef FORRISCOS -+ {",", "strip-type", o_NO_VALUE, o_NOT_NEGATABLE, ',', "strip ,xxx extension"}, -+#endif - /* the end of the list */ - {NULL, NULL, o_NO_VALUE, o_NOT_NEGATABLE, 0, NULL} /* end has option_ID = 0 */ - }; -@@ -2847,6 +2856,12 @@ - case 'I': /* Don't scan through Image files */ - scanimage = 0; - break; -+#else -+#ifdef FORRISCOS -+ case ',': /* Convert ,xxx to RISC OS extended filetype info */ -+ decomma = 1; -+ break; -+#endif - #endif - #ifdef MACOS - case o_jj: /* store absolute path including volname */ ---- a/zip.h.org 2008-01-12 22:56:51.000000000 -0800 -+++ b/zip.h 2008-01-12 23:00:05.000000000 -0800 -@@ -256,6 +256,10 @@ - - #ifdef RISCOS - extern int scanimage; /* Scan through image files */ -+#else -+#ifdef FORRISCOS -+extern int decomma; /* Convert ,xxx filename to RISC OS filetype info */ -+#endif - #endif - - #define BEST -1 /* Use best method (deflation or store) */