Overview
Comment: | OFOptionsParser: Reworked API
The new API allows long options and requires less manual parsing. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
bfa913aebe57b299ec08629c673f3459 |
User & Date: | js on 2015-11-28 18:56:19 |
Other Links: | manifest | tags |
Context
2015-11-28
| ||
19:47 | Minor documentation improvements check-in: 650b4be224 user: js tags: trunk | |
18:56 | OFOptionsParser: Reworked API check-in: bfa913aebe user: js tags: trunk | |
2015-11-22
| ||
22:35 | lookup-asm-sparc*.S: Add prediction to branches check-in: 8838387d21 user: js tags: trunk | |
Changes
Modified src/OFOptionsParser.h from [bff8d10a51] to [d487046e69].
︙ | |||
11 12 13 14 15 16 17 | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + - + + + + + + + + - - - + + + - + - - - + + + - + + + + + + - + + + + + - + + + + + + + + + + + + + + + + + + + + + + - + | * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFObject.h" |
︙ |
Modified src/OFOptionsParser.m from [3c15f89aa9] to [fbe9ab7d4c].
︙ | |||
15 16 17 18 19 20 21 22 23 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 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 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 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 190 191 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 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | + + + + + + + + + + + + + + + - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + - - + - - + + + + + + + + + + + - + | */ #include "config.h" #import "OFOptionsParser.h" #import "OFApplication.h" #import "OFArray.h" #import "OFMapTable.h" #import "OFInvalidArgumentException.h" static uint32_t stringHash(void *value) { return [(OFString*)value hash]; } static bool stringEqual(void *value1, void *value2) { return [(OFString*)value1 isEqual: (OFString*)value2]; } @implementation OFOptionsParser |
Modified utils/ofhttp/OFHTTP.m from [45b5064c67] to [bdce356a5d].
︙ | |||
209 210 211 212 213 214 215 | 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 | + + + + + + + + + + + + + + - - + + - - - - - - - - - - - - + + + + + + + + + + + + + - - + + + + + + + - - - - - + + + + + + - - - - - + + + + + + + + | [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } } - (void)applicationDidFinishLaunching { OFString *outputPath; const of_options_parser_option_t options[] = { { 'b', @"body", 1, NULL, NULL }, { 'c', @"continue", 0, &_continue, NULL }, { 'h', @"help", 0, NULL, NULL }, { 'H', @"header", 1, NULL, NULL }, { 'm', @"method", 1, NULL, NULL }, { 'o', @"output", 1, NULL, &outputPath }, { 'O', @"detect-filename", 0, &_detectFileName, NULL }, { 'P', @"socks5-proxy", 1, NULL, NULL }, { 'q', @"quiet", 0, &_quiet, NULL }, { 'v', @"verbose", 0, &_verbose, NULL }, { '\0', nil, 0, NULL, NULL } }; |
︙ |
Modified utils/ofzip/OFZIP.m from [9b11336043] to [6492307736].
︙ | |||
104 105 106 107 108 109 110 111 | 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 = |
︙ | |||
146 147 148 149 150 151 152 153 | 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) |
︙ | |||
355 356 357 358 359 360 361 | 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 && |
︙ |