summaryrefslogtreecommitdiff
path: root/contrib/minizip/minizip.c
diff options
context:
space:
mode:
authorMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:10 -0700
committerMark Adler <madler@alumni.caltech.edu>2011-09-09 23:22:10 -0700
commit8e34b3a8024c028dd9fd21d70525fc6d215efde5 (patch)
tree896a32f54abdf42ae3c1bb3c5d5627668b481ce4 /contrib/minizip/minizip.c
parent13a294f044ef0a89b2dcbfbb5d4d4c792673348e (diff)
downloadzlib-1.2.0.2.tar.gz
zlib-1.2.0.2.tar.bz2
zlib-1.2.0.2.zip
zlib 1.2.0.2v1.2.0.2
Diffstat (limited to 'contrib/minizip/minizip.c')
-rw-r--r--contrib/minizip/minizip.c789
1 files changed, 397 insertions, 392 deletions
diff --git a/contrib/minizip/minizip.c b/contrib/minizip/minizip.c
index 5792a1e..79e541d 100644
--- a/contrib/minizip/minizip.c
+++ b/contrib/minizip/minizip.c
@@ -1,392 +1,397 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <string.h> 3#include <string.h>
4#include <time.h> 4#include <time.h>
5#include <errno.h> 5#include <errno.h>
6#include <fcntl.h> 6#include <fcntl.h>
7 7
8#ifdef unix 8#ifdef unix
9# include <unistd.h> 9# include <unistd.h>
10# include <utime.h> 10# include <utime.h>
11# include <sys/types.h> 11# include <sys/types.h>
12# include <sys/stat.h> 12# include <sys/stat.h>
13#else 13#else
14# include <direct.h> 14# include <direct.h>
15# include <io.h> 15# include <io.h>
16#endif 16#endif
17 17
18#include "zip.h" 18#include "zip.h"
19 19
20#ifdef WIN32 20#ifdef WIN32
21#define USEWIN32IOAPI 21#define USEWIN32IOAPI
22#include "iowin32.h" 22#include "iowin32.h"
23#endif 23#endif
24 24
25 25
26 26
27#define WRITEBUFFERSIZE (16384) 27#define WRITEBUFFERSIZE (16384)
28#define MAXFILENAME (256) 28#define MAXFILENAME (256)
29 29
30#ifdef WIN32 30#ifdef WIN32
31uLong filetime(f, tmzip, dt) 31uLong filetime(f, tmzip, dt)
32 char *f; /* name of file to get info on */ 32 char *f; /* name of file to get info on */
33 tm_zip *tmzip; /* return value: access, modific. and creation times */ 33 tm_zip *tmzip; /* return value: access, modific. and creation times */
34 uLong *dt; /* dostime */ 34 uLong *dt; /* dostime */
35{ 35{
36 int ret = 0; 36 int ret = 0;
37 { 37 {
38 FILETIME ftLocal; 38 FILETIME ftLocal;
39 HANDLE hFind; 39 HANDLE hFind;
40 WIN32_FIND_DATA ff32; 40 WIN32_FIND_DATA ff32;
41 41
42 hFind = FindFirstFile(f,&ff32); 42 hFind = FindFirstFile(f,&ff32);
43 if (hFind != INVALID_HANDLE_VALUE) 43 if (hFind != INVALID_HANDLE_VALUE)
44 { 44 {
45 FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal); 45 FileTimeToLocalFileTime(&(ff32.ftLastWriteTime),&ftLocal);
46 FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0); 46 FileTimeToDosDateTime(&ftLocal,((LPWORD)dt)+1,((LPWORD)dt)+0);
47 FindClose(hFind); 47 FindClose(hFind);
48 ret = 1; 48 ret = 1;
49 } 49 }
50 } 50 }
51 return ret; 51 return ret;
52} 52}
53#else 53#else
54#ifdef unix 54#ifdef unix
55uLong filetime(f, tmzip, dt) 55uLong filetime(f, tmzip, dt)
56 char *f; /* name of file to get info on */ 56 char *f; /* name of file to get info on */
57 tm_zip *tmzip; /* return value: access, modific. and creation times */ 57 tm_zip *tmzip; /* return value: access, modific. and creation times */
58 uLong *dt; /* dostime */ 58 uLong *dt; /* dostime */
59{ 59{
60 int ret=0; 60 int ret=0;
61 struct stat s; /* results of stat() */ 61 struct stat s; /* results of stat() */
62 struct tm* filedate; 62 struct tm* filedate;
63 time_t tm_t=0; 63 time_t tm_t=0;
64 64
65 if (strcmp(f,"-")!=0) 65 if (strcmp(f,"-")!=0)
66 { 66 {
67 char name[MAXFILENAME+1]; 67 char name[MAXFILENAME+1];
68 int len = strlen(f); 68 int len = strlen(f);
69 69
70 strncpy(name, f,MAXFILENAME-1); 70 strncpy(name, f,MAXFILENAME-1);
71 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 71 /* strncpy doesnt append the trailing NULL, of the string is too long. */
72 name[ MAXFILENAME ] = '\0'; 72 name[ MAXFILENAME ] = '\0';
73 73
74 if (name[len - 1] == '/') 74 if (name[len - 1] == '/')
75 name[len - 1] = '\0'; 75 name[len - 1] = '\0';
76 /* not all systems allow stat'ing a file with / appended */ 76 /* not all systems allow stat'ing a file with / appended */
77 if (stat(name,&s)==0) 77 if (stat(name,&s)==0)
78 { 78 {
79 tm_t = s.st_mtime; 79 tm_t = s.st_mtime;
80 ret = 1; 80 ret = 1;
81 } 81 }
82 } 82 }
83 filedate = localtime(&tm_t); 83 filedate = localtime(&tm_t);
84 84
85 tmzip->tm_sec = filedate->tm_sec; 85 tmzip->tm_sec = filedate->tm_sec;
86 tmzip->tm_min = filedate->tm_min; 86 tmzip->tm_min = filedate->tm_min;
87 tmzip->tm_hour = filedate->tm_hour; 87 tmzip->tm_hour = filedate->tm_hour;
88 tmzip->tm_mday = filedate->tm_mday; 88 tmzip->tm_mday = filedate->tm_mday;
89 tmzip->tm_mon = filedate->tm_mon ; 89 tmzip->tm_mon = filedate->tm_mon ;
90 tmzip->tm_year = filedate->tm_year; 90 tmzip->tm_year = filedate->tm_year;
91 91
92 return ret; 92 return ret;
93} 93}
94#else 94#else
95uLong filetime(f, tmzip, dt) 95uLong filetime(f, tmzip, dt)
96 char *f; /* name of file to get info on */ 96 char *f; /* name of file to get info on */
97 tm_zip *tmzip; /* return value: access, modific. and creation times */ 97 tm_zip *tmzip; /* return value: access, modific. and creation times */
98 uLong *dt; /* dostime */ 98 uLong *dt; /* dostime */
99{ 99{
100 return 0; 100 return 0;
101} 101}
102#endif 102#endif
103#endif 103#endif
104 104
105 105
106 106
107 107
108int check_exist_file(filename) 108int check_exist_file(filename)
109 const char* filename; 109 const char* filename;
110{ 110{
111 FILE* ftestexist; 111 FILE* ftestexist;
112 int ret = 1; 112 int ret = 1;
113 ftestexist = fopen(filename,"rb"); 113 ftestexist = fopen(filename,"rb");
114 if (ftestexist==NULL) 114 if (ftestexist==NULL)
115 ret = 0; 115 ret = 0;
116 else 116 else
117 fclose(ftestexist); 117 fclose(ftestexist);
118 return ret; 118 return ret;
119} 119}
120 120
121void do_banner() 121void do_banner()
122{ 122{
123 printf("MiniZip 0.15, demo of zLib + Zip package written by Gilles Vollant\n"); 123 printf("MiniZip 0.22, demo of zLib + Zip package written by Gilles Vollant\n");
124 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n"); 124 printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
125} 125}
126 126
127void do_help() 127void do_help()
128{ 128{
129 printf("Usage : minizip [-o] file.zip [files_to_add]\n\n") ; 129 printf("Usage : minizip [-o] [-a] [-0 to -9] [-p password] file.zip [files_to_add]\n\n" \
130} 130 " -o Overwrite existing file.zip\n" \
131 131 " -a Append to existing file.zip\n" \
132/* calculate the CRC32 of a file, 132 " -0 Store only\n" \
133 because to encrypt a file, we need known the CRC32 of the file before */ 133 " -1 Compress faster\n" \
134int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc) 134 " -9 Compress better\n\n");
135{ 135}
136 unsigned long calculate_crc=0; 136
137 int err=ZIP_OK; 137/* calculate the CRC32 of a file,
138 FILE * fin = fopen(filenameinzip,"rb"); 138 because to encrypt a file, we need known the CRC32 of the file before */
139 unsigned long size_read = 0; 139int getFileCrc(const char* filenameinzip,void*buf,unsigned long size_buf,unsigned long* result_crc)
140 unsigned long total_read = 0; 140{
141 if (fin==NULL) 141 unsigned long calculate_crc=0;
142 { 142 int err=ZIP_OK;
143 err = ZIP_ERRNO; 143 FILE * fin = fopen(filenameinzip,"rb");
144 } 144 unsigned long size_read = 0;
145 145 unsigned long total_read = 0;
146 if (err == ZIP_OK) 146 if (fin==NULL)
147 do 147 {
148 { 148 err = ZIP_ERRNO;
149 err = ZIP_OK; 149 }
150 size_read = (int)fread(buf,1,size_buf,fin); 150
151 if (size_read < size_buf) 151 if (err == ZIP_OK)
152 if (feof(fin)==0) 152 do
153 { 153 {
154 printf("error in reading %s\n",filenameinzip); 154 err = ZIP_OK;
155 err = ZIP_ERRNO; 155 size_read = (int)fread(buf,1,size_buf,fin);
156 } 156 if (size_read < size_buf)
157 157 if (feof(fin)==0)
158 if (size_read>0) 158 {
159 calculate_crc = crc32(calculate_crc,buf,size_read); 159 printf("error in reading %s\n",filenameinzip);
160 total_read += size_read; 160 err = ZIP_ERRNO;
161 161 }
162 } while ((err == ZIP_OK) && (size_read>0)); 162
163 163 if (size_read>0)
164 if (fin) 164 calculate_crc = crc32(calculate_crc,buf,size_read);
165 fclose(fin); 165 total_read += size_read;
166 166
167 *result_crc=calculate_crc; 167 } while ((err == ZIP_OK) && (size_read>0));
168 printf("file %s crc %x\n",filenameinzip,calculate_crc); 168
169 return err; 169 if (fin)
170} 170 fclose(fin);
171 171
172int main(argc,argv) 172 *result_crc=calculate_crc;
173 int argc; 173 printf("file %s crc %x\n",filenameinzip,calculate_crc);
174 char *argv[]; 174 return err;
175{ 175}
176 int i; 176
177 int opt_overwrite=0; 177int main(argc,argv)
178 int opt_compress_level=Z_DEFAULT_COMPRESSION; 178 int argc;
179 int zipfilenamearg = 0; 179 char *argv[];
180 char filename_try[MAXFILENAME+16]; 180{
181 int zipok; 181 int i;
182 int err=0; 182 int opt_overwrite=0;
183 int size_buf=0; 183 int opt_compress_level=Z_DEFAULT_COMPRESSION;
184 void* buf=NULL; 184 int zipfilenamearg = 0;
185 const char* password=NULL; 185 char filename_try[MAXFILENAME+16];
186 186 int zipok;
187 187 int err=0;
188 do_banner(); 188 int size_buf=0;
189 if (argc==1) 189 void* buf=NULL;
190 { 190 const char* password=NULL;
191 do_help(); 191
192 return 0; 192
193 } 193 do_banner();
194 else 194 if (argc==1)
195 { 195 {
196 for (i=1;i<argc;i++) 196 do_help();
197 { 197 return 0;
198 if ((*argv[i])=='-') 198 }
199 { 199 else
200 const char *p=argv[i]+1; 200 {
201 201 for (i=1;i<argc;i++)
202 while ((*p)!='\0') 202 {
203 { 203 if ((*argv[i])=='-')
204 char c=*(p++);; 204 {
205 if ((c=='o') || (c=='O')) 205 const char *p=argv[i]+1;
206 opt_overwrite = 1; 206
207 if ((c=='a') || (c=='A')) 207 while ((*p)!='\0')
208 opt_overwrite = 2; 208 {
209 if ((c>='0') && (c<='9')) 209 char c=*(p++);;
210 opt_compress_level = c-'0'; 210 if ((c=='o') || (c=='O'))
211 211 opt_overwrite = 1;
212 if (((c=='p') || (c=='P')) && (i+1<argc)) 212 if ((c=='a') || (c=='A'))
213 { 213 opt_overwrite = 2;
214 password=argv[i+1]; 214 if ((c>='0') && (c<='9'))
215 i++; 215 opt_compress_level = c-'0';
216 } 216
217 } 217 if (((c=='p') || (c=='P')) && (i+1<argc))
218 } 218 {
219 else 219 password=argv[i+1];
220 if (zipfilenamearg == 0) 220 i++;
221 zipfilenamearg = i ; 221 }
222 } 222 }
223 } 223 }
224 224 else
225 size_buf = WRITEBUFFERSIZE; 225 if (zipfilenamearg == 0)
226 buf = (void*)malloc(size_buf); 226 zipfilenamearg = i ;
227 if (buf==NULL) 227 }
228 { 228 }
229 printf("Error allocating memory\n"); 229
230 return ZIP_INTERNALERROR; 230 size_buf = WRITEBUFFERSIZE;
231 } 231 buf = (void*)malloc(size_buf);
232 232 if (buf==NULL)
233 if (zipfilenamearg==0) 233 {
234 zipok=0; 234 printf("Error allocating memory\n");
235 else 235 return ZIP_INTERNALERROR;
236 { 236 }
237 int i,len; 237
238 int dot_found=0; 238 if (zipfilenamearg==0)
239 239 zipok=0;
240 zipok = 1 ; 240 else
241 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1); 241 {
242 /* strncpy doesnt append the trailing NULL, of the string is too long. */ 242 int i,len;
243 filename_try[ MAXFILENAME ] = '\0'; 243 int dot_found=0;
244 244
245 len=(int)strlen(filename_try); 245 zipok = 1 ;
246 for (i=0;i<len;i++) 246 strncpy(filename_try, argv[zipfilenamearg],MAXFILENAME-1);
247 if (filename_try[i]=='.') 247 /* strncpy doesnt append the trailing NULL, of the string is too long. */
248 dot_found=1; 248 filename_try[ MAXFILENAME ] = '\0';
249 249
250 if (dot_found==0) 250 len=(int)strlen(filename_try);
251 strcat(filename_try,".zip"); 251 for (i=0;i<len;i++)
252 252 if (filename_try[i]=='.')
253 if (opt_overwrite==2) 253 dot_found=1;
254 { 254
255 /* if the file don't exist, we not append file */ 255 if (dot_found==0)
256 if (check_exist_file(filename_try)==0) 256 strcat(filename_try,".zip");
257 opt_overwrite=1; 257
258 } 258 if (opt_overwrite==2)
259 else 259 {
260 if (opt_overwrite==0) 260 /* if the file don't exist, we not append file */
261 if (check_exist_file(filename_try)!=0) 261 if (check_exist_file(filename_try)==0)
262 { 262 opt_overwrite=1;
263 char rep=0; 263 }
264 do 264 else
265 { 265 if (opt_overwrite==0)
266 char answer[128]; 266 if (check_exist_file(filename_try)!=0)
267 printf("The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try); 267 {
268 scanf("%1s",answer); 268 char rep=0;
269 rep = answer[0] ; 269 do
270 if ((rep>='a') && (rep<='z')) 270 {
271 rep -= 0x20; 271 char answer[128];
272 } 272 printf("The file %s exist. Overwrite ? [y]es, [n]o, [a]ppend : ",filename_try);
273 while ((rep!='Y') && (rep!='N') && (rep!='A')); 273 scanf("%1s",answer);
274 if (rep=='N') 274 rep = answer[0] ;
275 zipok = 0; 275 if ((rep>='a') && (rep<='z'))
276 if (rep=='A') 276 rep -= 0x20;
277 opt_overwrite = 2; 277 }
278 } 278 while ((rep!='Y') && (rep!='N') && (rep!='A'));
279 } 279 if (rep=='N')
280 280 zipok = 0;
281 if (zipok==1) 281 if (rep=='A')
282 { 282 opt_overwrite = 2;
283 zipFile zf; 283 }
284 int errclose; 284 }
285 #ifdef USEWIN32IOAPI 285
286 zlib_filefunc_def ffunc; 286 if (zipok==1)
287 fill_win32_filefunc(&ffunc); 287 {
288 zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc); 288 zipFile zf;
289 #else 289 int errclose;
290 zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0); 290 #ifdef USEWIN32IOAPI
291 #endif 291 zlib_filefunc_def ffunc;
292 292 fill_win32_filefunc(&ffunc);
293 if (zf == NULL) 293 zf = zipOpen2(filename_try,(opt_overwrite==2) ? 2 : 0,NULL,&ffunc);
294 { 294 #else
295 printf("error opening %s\n",filename_try); 295 zf = zipOpen(filename_try,(opt_overwrite==2) ? 2 : 0);
296 err= ZIP_ERRNO; 296 #endif
297 } 297
298 else 298 if (zf == NULL)
299 printf("creating %s\n",filename_try); 299 {
300 300 printf("error opening %s\n",filename_try);
301 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++) 301 err= ZIP_ERRNO;
302 { 302 }
303 if (((*(argv[i]))!='-') && ((*(argv[i]))!='/')) 303 else
304 { 304 printf("creating %s\n",filename_try);
305 FILE * fin; 305
306 int size_read; 306 for (i=zipfilenamearg+1;(i<argc) && (err==ZIP_OK);i++)
307 const char* filenameinzip = argv[i]; 307 {
308 zip_fileinfo zi; 308 if (((*(argv[i]))!='-') && ((*(argv[i]))!='/'))
309 unsigned long crcFile=0; 309 {
310 310 FILE * fin;
311 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour = 311 int size_read;
312 zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0; 312 const char* filenameinzip = argv[i];
313 zi.dosDate = 0; 313 zip_fileinfo zi;
314 zi.internal_fa = 0; 314 unsigned long crcFile=0;
315 zi.external_fa = 0; 315
316 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate); 316 zi.tmz_date.tm_sec = zi.tmz_date.tm_min = zi.tmz_date.tm_hour =
317 317 zi.tmz_date.tm_mday = zi.tmz_date.tm_mon = zi.tmz_date.tm_year = 0;
318/* 318 zi.dosDate = 0;
319 err = zipOpenNewFileInZip(zf,filenameinzip,&zi, 319 zi.internal_fa = 0;
320 NULL,0,NULL,0,NULL / * comment * /, 320 zi.external_fa = 0;
321 (opt_compress_level != 0) ? Z_DEFLATED : 0, 321 filetime(filenameinzip,&zi.tmz_date,&zi.dosDate);
322 opt_compress_level); 322
323*/ 323/*
324 if ((password != NULL) && (err==ZIP_OK)) 324 err = zipOpenNewFileInZip(zf,filenameinzip,&zi,
325 err = getFileCrc(filenameinzip,buf,size_buf,&crcFile); 325 NULL,0,NULL,0,NULL / * comment * /,
326 326 (opt_compress_level != 0) ? Z_DEFLATED : 0,
327 err = zipOpenNewFileInZip3(zf,filenameinzip,&zi, 327 opt_compress_level);
328 NULL,0,NULL,0,NULL /* comment*/, 328*/
329 (opt_compress_level != 0) ? Z_DEFLATED : 0, 329 if ((password != NULL) && (err==ZIP_OK))
330 opt_compress_level,0, 330 err = getFileCrc(filenameinzip,buf,size_buf,&crcFile);
331 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */ 331
332 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, 332 err = zipOpenNewFileInZip3(zf,filenameinzip,&zi,
333 password,crcFile); 333 NULL,0,NULL,0,NULL /* comment*/,
334 334 (opt_compress_level != 0) ? Z_DEFLATED : 0,
335 if (err != ZIP_OK) 335 opt_compress_level,0,
336 printf("error in opening %s in zipfile\n",filenameinzip); 336 /* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
337 else 337 -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
338 { 338 password,crcFile);
339 fin = fopen(filenameinzip,"rb"); 339
340 if (fin==NULL) 340 if (err != ZIP_OK)
341 { 341 printf("error in opening %s in zipfile\n",filenameinzip);
342 err=ZIP_ERRNO; 342 else
343 printf("error in opening %s for reading\n",filenameinzip); 343 {
344 } 344 fin = fopen(filenameinzip,"rb");
345 } 345 if (fin==NULL)
346 346 {
347 if (err == ZIP_OK) 347 err=ZIP_ERRNO;
348 do 348 printf("error in opening %s for reading\n",filenameinzip);
349 { 349 }
350 err = ZIP_OK; 350 }
351 size_read = (int)fread(buf,1,size_buf,fin); 351
352 if (size_read < size_buf) 352 if (err == ZIP_OK)
353 if (feof(fin)==0) 353 do
354 { 354 {
355 printf("error in reading %s\n",filenameinzip); 355 err = ZIP_OK;
356 err = ZIP_ERRNO; 356 size_read = (int)fread(buf,1,size_buf,fin);
357 } 357 if (size_read < size_buf)
358 358 if (feof(fin)==0)
359 if (size_read>0) 359 {
360 { 360 printf("error in reading %s\n",filenameinzip);
361 err = zipWriteInFileInZip (zf,buf,size_read); 361 err = ZIP_ERRNO;
362 if (err<0) 362 }
363 { 363
364 printf("error in writing %s in the zipfile\n", 364 if (size_read>0)
365 filenameinzip); 365 {
366 } 366 err = zipWriteInFileInZip (zf,buf,size_read);
367 367 if (err<0)
368 } 368 {
369 } while ((err == ZIP_OK) && (size_read>0)); 369 printf("error in writing %s in the zipfile\n",
370 370 filenameinzip);
371 if (fin) 371 }
372 fclose(fin); 372
373 373 }
374 if (err<0) 374 } while ((err == ZIP_OK) && (size_read>0));
375 err=ZIP_ERRNO; 375
376 else 376 if (fin)
377 { 377 fclose(fin);
378 err = zipCloseFileInZip(zf); 378
379 if (err!=ZIP_OK) 379 if (err<0)
380 printf("error in closing %s in the zipfile\n", 380 err=ZIP_ERRNO;
381 filenameinzip); 381 else
382 } 382 {
383 } 383 err = zipCloseFileInZip(zf);
384 } 384 if (err!=ZIP_OK)
385 errclose = zipClose(zf,NULL); 385 printf("error in closing %s in the zipfile\n",
386 if (errclose != ZIP_OK) 386 filenameinzip);
387 printf("error in closing %s\n",filename_try); 387 }
388 } 388 }
389 389 }
390 free(buf); 390 errclose = zipClose(zf,NULL);
391 return 0; 391 if (errclose != ZIP_OK)
392} 392 printf("error in closing %s\n",filename_try);
393 }
394
395 free(buf);
396 return 0;
397}