Differences From Artifact [6b66318439]:
- File utils/OFZIP.m — part of check-in [8e35da9d61] at 2013-12-21 01:10:35 on branch trunk — OFZIP: Add quiet mode. (user: js, size: 7695) [annotate] [blame] [check-ins using]
To Artifact [a3579a0193]:
- File
utils/OFZIP.m
— part of check-in
[7e6942f348]
at
2013-12-21 01:12:29
on branch trunk
— OFZIP: Keep going after non-fatal errors.
The error will be reported instantly, but the program will not terminate
instantly anymore, but instead remember the error and terminate with the
according status code after the operation finished. (user: js, size: 7694) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 | #import "macros.h" #define BUFFER_SIZE 4096 @interface OFZIP: OFObject { int_fast8_t _override, _outputLevel; } - (void)listFilesInArchive: (OFZIPArchive*)archive; - (void)extractFiles: (OFArray*)files fromArchive: (OFZIPArchive*)archive; @end | > | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #import "macros.h" #define BUFFER_SIZE 4096 @interface OFZIP: OFObject { int_fast8_t _override, _outputLevel; int _exitStatus; } - (void)listFilesInArchive: (OFZIPArchive*)archive; - (void)extractFiles: (OFArray*)files fromArchive: (OFZIPArchive*)archive; @end |
︙ | ︙ | |||
131 132 133 134 135 136 137 | fromArchive: archive]; break; default: help(of_stderr, true, 1); break; } | | | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | fromArchive: archive]; break; default: help(of_stderr, true, 1); break; } [OFApplication terminateWithStatus: _exitStatus]; } - (void)listFilesInArchive: (OFZIPArchive*)archive { OFEnumerator *enumerator = [[archive entries] objectEnumerator]; OFZIPArchiveEntry *entry; |
︙ | ︙ | |||
191 192 193 194 195 196 197 | if ([outFileName hasPrefix: @"/"]) { #else if ([outFileName hasPrefix: @"/"] || [outFileName containsString: @":"]) { #endif [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; | | > | > | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | if ([outFileName hasPrefix: @"/"]) { #else if ([outFileName hasPrefix: @"/"] || [outFileName containsString: @":"]) { #endif [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; _exitStatus = 1; continue; } componentEnumerator = [[outFileName pathComponents] objectEnumerator]; while ((component = [componentEnumerator nextObject]) != nil) { if ([component isEqual: OF_PATH_PARENT_DIRECTORY]) { [of_stderr writeFormat: @"Refusing to extract %@!\n", fileName]; _exitStatus = 1; continue; } } if (_outputLevel > -1) [of_stdout writeFormat: @"Extracting %@...", fileName]; if ([fileName hasSuffix: @"/"]) { |
︙ | ︙ | |||
296 297 298 299 300 301 302 | OFString *file; enumerator = [missing objectEnumerator]; while ((file = [enumerator nextObject]) != nil) [of_stderr writeFormat: @"File %@ is not in the archive!\n", file]; | | | 299 300 301 302 303 304 305 306 307 308 309 | OFString *file; enumerator = [missing objectEnumerator]; while ((file = [enumerator nextObject]) != nil) [of_stderr writeFormat: @"File %@ is not in the archive!\n", file]; _exitStatus = 1; } } @end |