Differences From Artifact [45b5064c67]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[f3c452dfef]
at
2015-08-22 10:57:14
on branch trunk
— Move file management to its own class
This makes it possible to add support for delegates for file management
operations and on top makes it easier to add support for file management
operations on URLs. (user: js, size: 18805) [annotate] [blame] [check-ins using]
To Artifact [bdce356a5d]:
- File
utils/ofhttp/OFHTTP.m
— part of check-in
[bfa913aebe]
at
2015-11-28 18:56:19
on branch trunk
— OFOptionsParser: Reworked API
The new API allows long options and requires less manual parsing. (user: js, size: 19742) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
209 210 211 212 213 214 215 | [OFApplication programName]]; [OFApplication terminateWithStatus: 1]; } } - (void)applicationDidFinishLaunching { | > > > > > > > > > > > > > > | | < < < < < < < < < < | > > > > > > > > > > | > | > > > > | > | > | | | | < | | > | | > > > | 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 } }; OFOptionsParser *optionsParser = [OFOptionsParser parserWithOptions: options]; of_unichar_t option; while ((option = [optionsParser nextOption]) != '\0') { switch (option) { case 'b': [self setBody: [optionsParser argument]]; break; case 'h': help(of_stdout, true, 0); break; case 'H': [self addHeader: [optionsParser argument]]; break; case 'm': [self setMethod: [optionsParser argument]]; break; case 'P': [self setProxy: [optionsParser argument]]; break; case ':': if ([optionsParser lastLongOption] != nil) [of_stderr writeFormat: @"%@: Argument for option --%@ missing\n", [OFApplication programName], [optionsParser lastLongOption]]; else [of_stderr writeFormat: @"%@: Argument for option -%C missing\n", [OFApplication programName], [optionsParser lastOption]]; [OFApplication terminateWithStatus: 1]; break; case '=': [of_stderr writeFormat: @"%@: Option --%@ takes no " @"argument\n", [OFApplication programName], [optionsParser lastLongOption]]; [OFApplication terminateWithStatus: 1]; break; case '?': 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]; break; } } _outputPath = [outputPath copy]; _URLs = [[optionsParser remainingArguments] retain]; if ([_URLs count] < 1) help(of_stderr, false, 1); if (_quiet && _verbose) { [of_stderr writeFormat: @"%@: -q and -v are mutually " |
︙ | ︙ |