ObjFW  Check-in [633d49030d]

Overview
Comment:ofzip: Add -C flag to change output directory
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 633d49030d3bd628bfcabce379e7da44007d37e51d9224ad0ad3665b549fff7d
User & Date: js on 2017-03-26 16:46:02
Other Links: manifest | tags
Context
2017-04-02
00:43
OFTimer: Add "repeating" property check-in: 13967106a5 user: js tags: trunk
2017-03-26
16:46
ofzip: Add -C flag to change output directory check-in: 633d49030d user: js tags: trunk
14:02
Call the right C++ personality for SEH exceptions check-in: 26d0e98438 user: js tags: trunk
Changes

Modified utils/ofzip/OFZIP.m from [c9acb9d620] to [88b38a444f].

42
43
44
45
46
47
48
49

50
51
52
53
54
55


56
57
58
59
60
61
62
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64







-
+






+
+








OF_APPLICATION_DELEGATE(OFZIP)

static void
help(OFStream *stream, bool full, int status)
{
	[stream writeLine: OF_LOCALIZED(@"usage",
	    @"Usage: %[prog] -[fhlnpqtvx] archive.zip [file1 file2 ...]",
	    @"Usage: %[prog] -[Cfhlnpqtvx] archive.zip [file1 file2 ...]",
	    @"prog", [OFApplication programName])];

	if (full) {
		[stream writeString: @"\n"];
		[stream writeLine: OF_LOCALIZED(@"full_usage",
		    @"Options:\n"
		    @"    -C  --directory  Extract into the specified directory"
		    @"\n"
		    @"    -f  --force      Force / overwrite files\n"
		    @"    -h  --help       Show this help\n"
		    @"    -l  --list       List all files in the archive\n"
		    @"    -n  --no-clober  Never overwrite files\n"
		    @"    -p  --print      Print one or more files from the "
		    @"archive\n"
		    @"    -q  --quiet      Quiet mode (no output, except "
113
114
115
116
117
118
119
120

121

122
123
124
125
126
127
128
115
116
117
118
119
120
121

122
123
124
125
126
127
128
129
130
131







-
+

+







	    @"longopt3", longOption3)];
	[OFApplication terminateWithStatus: 1];
}

@implementation OFZIP
- (void)applicationDidFinishLaunching
{
	OFString *type = nil;
	OFString *outputDir = nil, *type = nil;
	const of_options_parser_option_t options[] = {
		{ 'C', @"directory", 1, NULL, &outputDir },
		{ 'f', @"force", 0, NULL, NULL },
		{ 'h', @"help", 0, NULL, NULL },
		{ 'l', @"list", 0, NULL, NULL },
		{ 'n', @"no-clobber", 0, NULL, NULL },
		{ 'p', @"print", 0, NULL, NULL },
		{ 'q', @"quiet", 0, NULL, NULL },
		{ 't', @"type", 1, NULL, &type },
212
213
214
215
216
217
218




219
220
221
222
223
224
225
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232







+
+
+
+







		}
	}

	remainingArguments = [optionsParser remainingArguments];
	archive = [self openArchiveWithPath: [remainingArguments firstObject]
				       type: type];

	if (outputDir != nil)
		[[OFFileManager defaultManager]
		    changeCurrentDirectoryPath: outputDir];

	switch (mode) {
	case 'l':
		if ([remainingArguments count] != 1)
			help(of_stderr, false, 1);

		[archive listFiles];
		break;

Modified utils/ofzip/lang/de.json from [0196b6a721] to [8697410c11].

1
2
3

4
5
6

7
8
9
10
11
12
13
1
2

3
4
5
6
7
8
9
10
11
12
13
14


-
+



+







{
    "usage": [
        "Benutzung: %[prog] -[fhlnpqtvx] archiv.zip [datei1 datei2 ...]"
        "Benutzung: %[prog] -[Cfhlnpqtvx] archiv.zip [datei1 datei2 ...]"
    ],
    "full_usage": [
        "Optionen:\n",
        "    -C  --directory  In angegebenes Verzeichnis entpacken\n",
        "    -f  --force      Existierende Dateien überschreiben\n",
        "    -h  --help       Diese Hilfe anzeigen\n",
        "    -l  --list       Alle Dateien im Archiv auflisten\n",
        "    -n  --no-clober  Dateien niemals überschreiben\n",
        "    -p  --print      Eine oder mehr Dateien aus dem Archiv ausgeben\n",
        "    -q  --quiet      Ruhiger Modus (keine Ausgabe außer Fehler)\n",
        "    -t  --type       Archiv-Typ (gz, tar, tgz, zip)\n",