110 lines
2.7 KiB
Diff
110 lines
2.7 KiB
Diff
From 66588683b36042154ad35140bf9fcbb60c5d573c Mon Sep 17 00:00:00 2001
|
|
From: Mark Adler <madler@alumni.caltech.edu>
|
|
Date: Sat, 15 Apr 2023 11:27:12 -0700
|
|
Subject: [PATCH] Remove use of OF() from contrib/untgz and render it
|
|
compilable.
|
|
|
|
Reference:https://github.com/madler/zlib/commit/66588683b36042154ad35140bf9fcbb60c5d573c
|
|
Conflict:NA
|
|
---
|
|
contrib/untgz/untgz.c | 47 +++++++++++--------------------------------
|
|
1 file changed, 12 insertions(+), 35 deletions(-)
|
|
|
|
diff --git a/contrib/untgz/untgz.c b/contrib/untgz/untgz.c
|
|
index 2c391e598..3e530971c 100644
|
|
--- a/contrib/untgz/untgz.c
|
|
+++ b/contrib/untgz/untgz.c
|
|
@@ -14,15 +14,10 @@
|
|
|
|
#include "zlib.h"
|
|
|
|
-#ifdef unix
|
|
-# include <unistd.h>
|
|
-#else
|
|
+#ifdef _WIN32
|
|
# include <direct.h>
|
|
# include <io.h>
|
|
-#endif
|
|
-
|
|
-#ifdef WIN32
|
|
-#include <windows.h>
|
|
+# include <windows.h>
|
|
# ifndef F_OK
|
|
# define F_OK 0
|
|
# endif
|
|
@@ -33,6 +28,8 @@
|
|
# define strdup(str) _strdup(str)
|
|
# endif
|
|
#else
|
|
+# include <sys/stat.h>
|
|
+# include <unistd.h>
|
|
# include <utime.h>
|
|
#endif
|
|
|
|
@@ -102,28 +99,14 @@ struct attr_item
|
|
|
|
enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID };
|
|
|
|
-char *TGZfname OF((const char *));
|
|
-void TGZnotfound OF((const char *));
|
|
-
|
|
-int getoct OF((char *, int));
|
|
-char *strtime OF((time_t *));
|
|
-int setfiletime OF((char *, time_t));
|
|
-void push_attr OF((struct attr_item **, char *, int, time_t));
|
|
-void restore_attr OF((struct attr_item **));
|
|
-
|
|
-int ExprMatch OF((char *, char *));
|
|
-
|
|
-int makedir OF((char *));
|
|
-int matchname OF((int, int, char **, char *));
|
|
-
|
|
-void error OF((const char *));
|
|
-int tar OF((gzFile, int, int, int, char **));
|
|
-
|
|
-void help OF((int));
|
|
-int main OF((int, char **));
|
|
-
|
|
char *prog;
|
|
|
|
+void error(const char *msg)
|
|
+{
|
|
+ fprintf(stderr, "%s: %s\n", prog, msg);
|
|
+ exit(1);
|
|
+}
|
|
+
|
|
const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL };
|
|
|
|
/* return the file name of the TGZ archive */
|
|
@@ -205,7 +188,7 @@ char *strtime (time_t *t)
|
|
|
|
int setfiletime (char *fname,time_t ftime)
|
|
{
|
|
-#ifdef WIN32
|
|
+#ifdef _WIN32
|
|
static int isWinNT = -1;
|
|
SYSTEMTIME st;
|
|
FILETIME locft, modft;
|
|
@@ -590,12 +573,6 @@ void help(int exitval)
|
|
exit(exitval);
|
|
}
|
|
|
|
-void error(const char *msg)
|
|
-{
|
|
- fprintf(stderr, "%s: %s\n", prog, msg);
|
|
- exit(1);
|
|
-}
|
|
-
|
|
|
|
/* ============================================================ */
|
|
|
|
@@ -608,7 +585,7 @@ int main(int argc,char **argv)
|
|
int action = TGZ_EXTRACT;
|
|
int arg = 1;
|
|
char *TGZfile;
|
|
- gzFile *f;
|
|
+ gzFile f;
|
|
|
|
prog = strrchr(argv[0],'\\');
|
|
if (prog == NULL)
|