ObjFW  Diff

Differences From Artifact [9b11336043]:

To Artifact [6492307736]:


104
105
106
107
108
109
110










111
112
113
114
115
116
117
118
119
	}
#endif
}

@implementation OFZIP
- (void)applicationDidFinishLaunching
{










	OFOptionsParser *optionsParser =
	    [OFOptionsParser parserWithOptions: @"fhlnqvx"];
	of_unichar_t option, mode = '\0';
	OFArray OF_GENERIC(OFString*) *remainingArguments, *files;
	OFZIPArchive *archive;

	while ((option = [optionsParser nextOption]) != '\0') {
		switch (option) {
		case 'f':







>
>
>
>
>
>
>
>
>
>

|







104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
	}
#endif
}

@implementation OFZIP
- (void)applicationDidFinishLaunching
{
	const of_options_parser_option_t options[] = {
		{ 'f', @"force", 0, NULL, NULL },
		{ 'h', @"help", 0, NULL, NULL },
		{ 'l', @"list", 0, NULL, NULL },
		{ 'n', @"no-clobber", 0, NULL, NULL },
		{ 'q', @"quiet", 0, NULL, NULL },
		{ 'v', @"verbose", 0, NULL, NULL },
		{ 'x', @"extract", 0, NULL, NULL },
		{ '\0', nil, 0, NULL, NULL }
	};
	OFOptionsParser *optionsParser =
	    [OFOptionsParser parserWithOptions: options];
	of_unichar_t option, mode = '\0';
	OFArray OF_GENERIC(OFString*) *remainingArguments, *files;
	OFZIPArchive *archive;

	while ((option = [optionsParser nextOption]) != '\0') {
		switch (option) {
		case 'f':
146
147
148
149
150
151
152








153

154

155





156

157
158
159
160
161
162
163
				mutuallyExclusiveError('x', 'l');

			mode = option;
			break;
		case 'h':
			help(of_stdout, true, 0);
			break;








		default:

			[of_stderr writeFormat: @"%@: Unknown option: -%C\n",

						[OFApplication programName],





						[optionsParser lastOption]];

			[OFApplication terminateWithStatus: 1];
		}
	}

	remainingArguments = [optionsParser remainingArguments];

	switch (mode) {







>
>
>
>
>
>
>
>

>
|
>
|
>
>
>
>
>
|
>







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
				mutuallyExclusiveError('x', 'l');

			mode = option;
			break;
		case 'h':
			help(of_stdout, true, 0);
			break;
		case '=':
			[of_stderr writeFormat: @"%@: Option --%@ takes no "
						@"argument!\n",
						[OFApplication programName],
						[optionsParser lastLongOption]];

			[OFApplication terminateWithStatus: 1];
			break;
		default:
			if ([optionsParser lastLongOption] != nil)
				[of_stderr writeFormat:
				    @"%@: Unknown option: --%@\n",
				    [OFApplication programName],
				    [optionsParser lastLongOption]];
			else
				[of_stderr writeFormat:
				    @"%@: Unknown option: -%C\n",
				    [OFApplication programName],
				    [optionsParser lastOption]];

			[OFApplication terminateWithStatus: 1];
		}
	}

	remainingArguments = [optionsParser remainingArguments];

	switch (mode) {
355
356
357
358
359
360
361

362
363
364
365
366
367
368
369
370
		}

		directory = [outFileName stringByDeletingLastPathComponent];
		if (![fileManager directoryExistsAtPath: directory])
			[fileManager createDirectoryAtPath: directory
					     createParents: true];


		if ([fileManager fileExistsAtPath: outFileName] &&
		    _override != 1) {
			OFString *line;

			if (_override == -1) {
				if (_outputLevel >= 0)
					[of_stdout writeLine: @" skipped"];

				goto outer_loop_end;







>
|
<







381
382
383
384
385
386
387
388
389

390
391
392
393
394
395
396
		}

		directory = [outFileName stringByDeletingLastPathComponent];
		if (![fileManager directoryExistsAtPath: directory])
			[fileManager createDirectoryAtPath: directory
					     createParents: true];

		if (_override != 1 &&
		    [fileManager fileExistsAtPath: outFileName]) {

			OFString *line;

			if (_override == -1) {
				if (_outputLevel >= 0)
					[of_stdout writeLine: @" skipped"];

				goto outer_loop_end;