diff options
author | Mark Adler <madler@alumni.caltech.edu> | 2023-04-15 11:27:12 -0700 |
---|---|---|
committer | Mark Adler <madler@alumni.caltech.edu> | 2023-04-15 22:56:43 -0700 |
commit | 66588683b36042154ad35140bf9fcbb60c5d573c (patch) | |
tree | 60d725ebe6a8ffc4a976b53dfd6b648f5558fdeb | |
parent | bf2578be2d0566dc3ee47655d56b62063fe6bae6 (diff) | |
download | zlib-66588683b36042154ad35140bf9fcbb60c5d573c.tar.gz zlib-66588683b36042154ad35140bf9fcbb60c5d573c.tar.bz2 zlib-66588683b36042154ad35140bf9fcbb60c5d573c.zip |
Remove use of OF() from contrib/untgz and render it compilable.
-rw-r--r-- | contrib/untgz/untgz.c | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/contrib/untgz/untgz.c b/contrib/untgz/untgz.c index 2c391e5..3e53097 100644 --- a/contrib/untgz/untgz.c +++ b/contrib/untgz/untgz.c | |||
@@ -14,15 +14,10 @@ | |||
14 | 14 | ||
15 | #include "zlib.h" | 15 | #include "zlib.h" |
16 | 16 | ||
17 | #ifdef unix | 17 | #ifdef _WIN32 |
18 | # include <unistd.h> | ||
19 | #else | ||
20 | # include <direct.h> | 18 | # include <direct.h> |
21 | # include <io.h> | 19 | # include <io.h> |
22 | #endif | 20 | # include <windows.h> |
23 | |||
24 | #ifdef WIN32 | ||
25 | #include <windows.h> | ||
26 | # ifndef F_OK | 21 | # ifndef F_OK |
27 | # define F_OK 0 | 22 | # define F_OK 0 |
28 | # endif | 23 | # endif |
@@ -33,6 +28,8 @@ | |||
33 | # define strdup(str) _strdup(str) | 28 | # define strdup(str) _strdup(str) |
34 | # endif | 29 | # endif |
35 | #else | 30 | #else |
31 | # include <sys/stat.h> | ||
32 | # include <unistd.h> | ||
36 | # include <utime.h> | 33 | # include <utime.h> |
37 | #endif | 34 | #endif |
38 | 35 | ||
@@ -102,28 +99,14 @@ struct attr_item | |||
102 | 99 | ||
103 | enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }; | 100 | enum { TGZ_EXTRACT, TGZ_LIST, TGZ_INVALID }; |
104 | 101 | ||
105 | char *TGZfname OF((const char *)); | ||
106 | void TGZnotfound OF((const char *)); | ||
107 | |||
108 | int getoct OF((char *, int)); | ||
109 | char *strtime OF((time_t *)); | ||
110 | int setfiletime OF((char *, time_t)); | ||
111 | void push_attr OF((struct attr_item **, char *, int, time_t)); | ||
112 | void restore_attr OF((struct attr_item **)); | ||
113 | |||
114 | int ExprMatch OF((char *, char *)); | ||
115 | |||
116 | int makedir OF((char *)); | ||
117 | int matchname OF((int, int, char **, char *)); | ||
118 | |||
119 | void error OF((const char *)); | ||
120 | int tar OF((gzFile, int, int, int, char **)); | ||
121 | |||
122 | void help OF((int)); | ||
123 | int main OF((int, char **)); | ||
124 | |||
125 | char *prog; | 102 | char *prog; |
126 | 103 | ||
104 | void error(const char *msg) | ||
105 | { | ||
106 | fprintf(stderr, "%s: %s\n", prog, msg); | ||
107 | exit(1); | ||
108 | } | ||
109 | |||
127 | const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }; | 110 | const char *TGZsuffix[] = { "\0", ".tar", ".tar.gz", ".taz", ".tgz", NULL }; |
128 | 111 | ||
129 | /* return the file name of the TGZ archive */ | 112 | /* return the file name of the TGZ archive */ |
@@ -205,7 +188,7 @@ char *strtime (time_t *t) | |||
205 | 188 | ||
206 | int setfiletime (char *fname,time_t ftime) | 189 | int setfiletime (char *fname,time_t ftime) |
207 | { | 190 | { |
208 | #ifdef WIN32 | 191 | #ifdef _WIN32 |
209 | static int isWinNT = -1; | 192 | static int isWinNT = -1; |
210 | SYSTEMTIME st; | 193 | SYSTEMTIME st; |
211 | FILETIME locft, modft; | 194 | FILETIME locft, modft; |
@@ -590,12 +573,6 @@ void help(int exitval) | |||
590 | exit(exitval); | 573 | exit(exitval); |
591 | } | 574 | } |
592 | 575 | ||
593 | void error(const char *msg) | ||
594 | { | ||
595 | fprintf(stderr, "%s: %s\n", prog, msg); | ||
596 | exit(1); | ||
597 | } | ||
598 | |||
599 | 576 | ||
600 | /* ============================================================ */ | 577 | /* ============================================================ */ |
601 | 578 | ||
@@ -608,7 +585,7 @@ int main(int argc,char **argv) | |||
608 | int action = TGZ_EXTRACT; | 585 | int action = TGZ_EXTRACT; |
609 | int arg = 1; | 586 | int arg = 1; |
610 | char *TGZfile; | 587 | char *TGZfile; |
611 | gzFile *f; | 588 | gzFile f; |
612 | 589 | ||
613 | prog = strrchr(argv[0],'\\'); | 590 | prog = strrchr(argv[0],'\\'); |
614 | if (prog == NULL) | 591 | if (prog == NULL) |