ObjFW  Diff

Differences From Artifact [76a72899a1]:

To Artifact [d89e8cb4a7]:


53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73








74
75
76
77
78
79
80
81
82
83
84
85
86
87



88
89
90



91
92
93



94
95
96



97
98
99
100
101
102
103
104
105
106
107
108
109
static void
help(OFStream *stream, bool full, int status)
{
	[stream writeFormat:
	    @"Usage: %@ -[flnqvx] archive.zip [file1 file2 ...]\n",
	    [OFApplication programName]];

	if (full) {
		[stream writeString:
		    @"\nOptions:\n"
		    @"    -f  Force / override files\n"
		    @"    -h  Show this help\n"
		    @"    -l  List all files in the archive\n"
		    @"    -n  Never override files\n"
		    @"    -q  Quiet mode (no output, except errors)\n"
		    @"    -v  Verbose output for file list\n"
		    @"    -x  Extract files\n"];
	}

	[OFApplication terminateWithStatus: status];
}









@implementation OFZIP
- (void)applicationDidFinishLaunching
{
	OFOptionsParser *optionsParser =
	    [OFOptionsParser parserWithOptions: @"fhlnqvx"];
	of_unichar_t option, mode = '\0';
	OFArray *remainingArguments;
	OFZIPArchive *archive;
	OFArray *files;

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



			_override = 1;
			break;
		case 'n':



			_override = -1;
			break;
		case 'v':



			_outputLevel = 1;
			break;
		case 'q':



			_outputLevel = -1;
			break;
		case 'l':
		case 'x':
			if (mode != '\0')
				help(of_stdout, false, 1);

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







|









<



>
>
>
>
>
>
>
>














>
>
>



>
>
>



>
>
>
|


>
>
>
|




|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
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
static void
help(OFStream *stream, bool full, int status)
{
	[stream writeFormat:
	    @"Usage: %@ -[flnqvx] archive.zip [file1 file2 ...]\n",
	    [OFApplication programName]];

	if (full)
		[stream writeString:
		    @"\nOptions:\n"
		    @"    -f  Force / override files\n"
		    @"    -h  Show this help\n"
		    @"    -l  List all files in the archive\n"
		    @"    -n  Never override files\n"
		    @"    -q  Quiet mode (no output, except errors)\n"
		    @"    -v  Verbose output for file list\n"
		    @"    -x  Extract files\n"];


	[OFApplication terminateWithStatus: status];
}

static void
mutuallyExclusiveError(of_unichar_t option1, of_unichar_t option2)
{
	[of_stderr writeFormat: @"Error: -%C and -%C are mutually exclusive!\n",
				option1, option2];
	[OFApplication terminateWithStatus: 1];
}

@implementation OFZIP
- (void)applicationDidFinishLaunching
{
	OFOptionsParser *optionsParser =
	    [OFOptionsParser parserWithOptions: @"fhlnqvx"];
	of_unichar_t option, mode = '\0';
	OFArray *remainingArguments;
	OFZIPArchive *archive;
	OFArray *files;

	while ((option = [optionsParser nextOption]) != '\0') {
		switch (option) {
		case 'f':
			if (_override < 0)
				mutuallyExclusiveError('f', 'n');

			_override = 1;
			break;
		case 'n':
			if (_override > 0)
				mutuallyExclusiveError('f', 'n');

			_override = -1;
			break;
		case 'v':
			if (_outputLevel < 0)
				mutuallyExclusiveError('v', 'q');

			_outputLevel++;
			break;
		case 'q':
			if (_outputLevel > 0)
				mutuallyExclusiveError('v', 'q');

			_outputLevel--;
			break;
		case 'l':
		case 'x':
			if (mode != '\0')
				mutuallyExclusiveError('x', 'l');

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