Overview
Comment: | OFZIP: Make -x/-l, -f/-n, -v/-q mutually exclusive |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
5a782d2c746a2201b584560653ca66d9 |
User & Date: | js on 2014-05-25 23:42:22 |
Other Links: | manifest | tags |
Context
2014-05-25
| ||
23:53 | OFZIP: Show hex dump of extra field with -vvv check-in: 240658fd6c user: js tags: trunk | |
23:42 | OFZIP: Make -x/-l, -f/-n, -v/-q mutually exclusive check-in: 5a782d2c74 user: js tags: trunk | |
23:10 | OFZIP: Fix q missing in first line of help check-in: 03db213022 user: js tags: trunk | |
Changes
Modified utils/OFZIP.m from [76a72899a1] to [d89e8cb4a7].
︙ | ︙ | |||
53 54 55 56 57 58 59 | static void help(OFStream *stream, bool full, int status) { [stream writeFormat: @"Usage: %@ -[flnqvx] archive.zip [file1 file2 ...]\n", [OFApplication programName]]; | | < > > > > > > > > > > > > > > > > > | > > > | | | 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: |
︙ | ︙ |