1 /*
2 Copyright (c) 1990-2001 Info-ZIP. All rights reserved.
3
4 See the accompanying file LICENSE, version 2000-Apr-09 or later
5 (the contents of which are also included in unzip.h) for terms of use.
6 If, for some reason, all these files are missing, the Info-ZIP license
7 also may be found at: ftp://ftp.info-zip.org/pub/infozip/license.html
8 */
9 /*****************************************************************************/
10 /* Includes */
11 /*****************************************************************************/
12
13 #include <string.h>
14 #include "unzvers.h"
15 #include <stdio.h>
16
17
18 #ifdef USE_SIOUX
19 # include <sioux.h>
20 # include <signal.h>
21 # include <stdlib.h>
22 # include <console.h>
23 #endif /* USE_SIOUX */
24
25
26 /*****************************************************************************/
27 /* Global Vars */
28 /*****************************************************************************/
29
30 char fileList[256];
31
32
33 /*****************************************************************************/
34 /* Prototypes */
35 /*****************************************************************************/
36
37 int UzpMain(int argc,char **argv);
38
39 char *GetUnZipLocalVersion(void);
40 char *GetUnZipInfoVersions(void);
41 int macgetch(void);
42 void UserStop(void);
43
44
45
46 /*****************************************************************************/
47 /* Functions */
48 /*****************************************************************************/
49
50 #ifndef MacStaticLib
51 #ifndef MACUNZIP_STANDALONE
52
53 /*
54 Program execution starts here with Metrowerks SIOUX-Console */
main(int argc,char ** argv)55 int main(int argc,char **argv)
56 {
57 int return_code;
58
59 SIOUXSettings.asktosaveonclose = FALSE;
60 SIOUXSettings.showstatusline = TRUE;
61
62 SIOUXSettings.columns = 100;
63 SIOUXSettings.rows = 40;
64
65 argc = ccommand(&argv);
66
67 return_code = UzpMain(argc,argv);
68
69 printf("\n\n Finish %d",return_code);
70
71 return return_code;
72 }
73
74
75
macgetch(void)76 int macgetch(void)
77 {
78 WindowPtr whichWindow;
79 EventRecord theEvent;
80 char c; /* one-byte buffer for read() to use */
81
82 do {
83 SystemTask();
84 if (!GetNextEvent(everyEvent, &theEvent))
85 theEvent.what = nullEvent;
86 else {
87 switch (theEvent.what) {
88 case keyDown:
89 c = theEvent.message & charCodeMask;
90 break;
91 case mouseDown:
92 if (FindWindow(theEvent.where, &whichWindow) ==
93 inSysWindow)
94 SystemClick(&theEvent, whichWindow);
95 break;
96 case updateEvt:
97 break;
98 }
99 }
100 } while (theEvent.what != keyDown);
101
102 printf("*");
103 fflush(stdout);
104
105 return (int)c;
106 }
107
108
109 /* SIOUX needs no extra event handling */
UserStop(void)110 void UserStop(void)
111 {
112 }
113
114 #endif /* #ifndef MACUNZIP_STANDALONE */
115 #endif /* #ifndef MacStaticLib */
116
117
118
119
GetUnZipLocalVersion(void)120 char *GetUnZipLocalVersion(void)
121 {
122 static char UnZipVersionLocal[50];
123
124 memset(UnZipVersionLocal,0,sizeof(UnZipVersionLocal));
125
126 sprintf(UnZipVersionLocal, "[%s %s]", __DATE__, __TIME__);
127
128 return UnZipVersionLocal;
129 }
130
131
132
133
GetUnZipInfoVersions(void)134 char *GetUnZipInfoVersions(void)
135 {
136 static char UnzipVersion[200];
137
138 memset(UnzipVersion,0,sizeof(UnzipVersion));
139
140 sprintf(UnzipVersion, "Unzip Module\n%d.%d%d%s of %s", UZ_MAJORVER,
141 UZ_MINORVER, UZ_PATCHLEVEL, UZ_BETALEVEL, UZ_VERSION_DATE);
142
143 return UnzipVersion;
144 }
145