ObjFW  Check-in [c626b708a4]

Overview
Comment:utils: Minor style fix
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: c626b708a4320f0251873a5d46a514516b9427feaac8a647c5bac176c6a0ffb8
User & Date: js on 2023-10-08 08:18:12
Other Links: manifest | tags
Context
2023-10-08
11:36
Fix -[@"" stringByAppendingPathComponent:] check-in: 930f967649 user: js tags: trunk
08:18
utils: Minor style fix check-in: c626b708a4 user: js tags: trunk
08:03
ofhttp: Fix missing comma that caused a crash check-in: b21bacd5fd user: js tags: trunk
Changes

Modified utils/ofarc/GZIPArchive.m from [f5cd966d15] to [34447a01c5].

110
111
112
113
114
115
116
117
118


119
120
121
122
123
124
125
110
111
112
113
114
115
116


117
118
119
120
121
122
123
124
125







-
-
+
+








- (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files
{
	OFString *fileName;
	OFFile *output;

	if (files.count != 0) {
		[OFStdErr writeLine:
		    OF_LOCALIZED(@"cannot_extract_specific_file_from_gz",
		[OFStdErr writeLine: OF_LOCALIZED(
		    @"cannot_extract_specific_file_from_gz",
		    @"Cannot extract a specific file of a .gz archive!")];
		app->_exitStatus = 1;
		return;
	}

	fileName = app->_archivePath.lastPathComponent
	    .stringByDeletingPathExtension;

Modified utils/ofdns/OFDNS.m from [202b18cab3] to [12069c13e7].

32
33
34
35
36
37
38
39

40
41
42
43
44
45
46
47
32
33
34
35
36
37
38

39

40
41
42
43
44
45
46







-
+
-







@end

OF_APPLICATION_DELEGATE(OFDNS)

static void
help(OFStream *stream, bool full, int status)
{
	[OFStdErr writeLine:
	[OFStdErr writeLine: OF_LOCALIZED(@"usage",
	    OF_LOCALIZED(@"usage",
	    @"Usage: %[prog] -[chst] domain1 [domain2 ...]",
	    @"prog", [OFApplication programName])];

	if (full) {
		[stream writeString: @"\n"];
		[stream writeLine: OF_LOCALIZED(@"full_usage",
		    @"Options:\n    "
68
69
70
71
72
73
74
75

76
77
78
79
80
81
82
83
67
68
69
70
71
72
73

74

75
76
77
78
79
80
81







-
+
-







	exception: (id)exception
{
	_inFlight--;

	if (exception == nil)
		[OFStdOut writeFormat: @"%@\n", response];
	else {
		[OFStdErr writeLine: OF_LOCALIZED(
		[OFStdErr writeLine: OF_LOCALIZED(@"failed_to_resolve",
		    @"failed_to_resolve",
		    @"Failed to resolve: %[exception]",
		    @"exception", exception)];
		_errors++;
	}

	if (_inFlight == 0)
		[OFApplication terminateWithStatus: _errors];

Modified utils/ofhash/OFHash.m from [5b3e61635c] to [43297690e6].

103
104
105
106
107
108
109
110
111


112
113
114
115
116
117
118
119


120
121
122
123
124
125
126
103
104
105
106
107
108
109


110
111
112
113
114
115
116
117


118
119
120
121
122
123
124
125
126







-
-
+
+






-
-
+
+







	    [OFIRI fileIRIWithPath: @"PROGDIR:/share/ofhash/localization"]];
#endif

	while ((option = [optionsParser nextOption]) != '\0') {
		switch (option) {
		case '?':
			if (optionsParser.lastLongOption != nil)
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"unknown_long_option",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"unknown_long_option",
				    @"%[prog]: Unknown option: --%[opt]",
				    @"prog", [OFApplication programName],
				    @"opt", optionsParser.lastLongOption)];
			else {
				OFString *optStr = [OFString stringWithFormat:
				    @"%C", optionsParser.lastOption];
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"unknown_option",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"unknown_option",
				    @"%[prog]: Unknown option: -%[opt]",
				    @"prog", [OFApplication programName],
				    @"opt", optStr)];
			}

			[OFApplication terminateWithStatus: 1];
			break;

Modified utils/ofhttp/OFHTTP.m from [872ae0262a] to [d2650dbe5b].

94
95
96
97
98
99
100
101

102
103
104
105
106
107
108
109
94
95
96
97
98
99
100

101

102
103
104
105
106
107
108







-
+
-







#endif

OF_APPLICATION_DELEGATE(OFHTTP)

static void
help(OFStream *stream, bool full, int status)
{
	[OFStdErr writeLine:
	[OFStdErr writeLine: OF_LOCALIZED(@"usage",
	    OF_LOCALIZED(@"usage",
	    @"Usage: %[prog] -[cehHmoOPqv] iri1 [iri2 ...]",
	    @"prog", [OFApplication programName])];

	if (full) {
		[stream writeString: @"\n"];
		[stream writeLine: OF_LOCALIZED(@"full_usage",
		    @"Options:\n    "
477
478
479
480
481
482
483
484
485


486
487
488
489
490
491
492
493
494
495


496
497
498
499
500
501
502
503
504
505
506


507
508
509
510
511
512
513
514
515
516


517
518
519
520
521
522
523
524
525


526
527
528
529
530
531
532
476
477
478
479
480
481
482


483
484
485
486
487
488
489
490
491
492


493
494
495
496
497
498
499
500
501
502
503


504
505
506
507
508
509
510
511
512
513


514
515
516
517
518
519
520
521
522


523
524
525
526
527
528
529
530
531







-
-
+
+








-
-
+
+









-
-
+
+








-
-
+
+







-
-
+
+







			[self setMethod: optionsParser.argument];
			break;
		case 'P':
			[self setProxy: optionsParser.argument];
			break;
		case ':':
			if (optionsParser.lastLongOption != nil)
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"long_argument_missing",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"long_argument_missing",
				    @"%[prog]: Argument for option --%[opt] "
				    @"missing",
				    @"prog", [OFApplication programName],
				    @"opt", optionsParser.lastLongOption)];
			else {
				OFString *optStr = [OFString
				    stringWithFormat: @"%C",
				    optionsParser.lastOption];
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"argument_missing",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"argument_missing",
				    @"%[prog]: Argument for option -%[opt] "
				    @"missing",
				    @"prog", [OFApplication programName],
				    @"opt", optStr)];
			}

			[OFApplication terminateWithStatus: 1];
			break;
		case '=':
			[OFStdErr writeLine:
			    OF_LOCALIZED(@"option_takes_no_argument",
			[OFStdErr writeLine: OF_LOCALIZED(
			    @"option_takes_no_argument",
			    @"%[prog]: Option --%[opt] takes no argument",
			    @"prog", [OFApplication programName],
			    @"opt", optionsParser.lastLongOption)];

			[OFApplication terminateWithStatus: 1];
			break;
		case '?':
			if (optionsParser.lastLongOption != nil)
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"unknown_long_option",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"unknown_long_option",
				    @"%[prog]: Unknown option: --%[opt]",
				    @"prog", [OFApplication programName],
				    @"opt", optionsParser.lastLongOption)];
			else {
				OFString *optStr = [OFString
				    stringWithFormat: @"%C",
				    optionsParser.lastOption];
				[OFStdErr writeLine:
				    OF_LOCALIZED(@"unknown_option",
				[OFStdErr writeLine: OF_LOCALIZED(
				    @"unknown_option",
				    @"%[prog]: Unknown option: -%[opt]",
				    @"prog", [OFApplication programName],
				    @"opt", optStr)];
			}

			[OFApplication terminateWithStatus: 1];
			break;
569
570
571
572
573
574
575
576
577


578
579
580
581
582
583
584
568
569
570
571
572
573
574


575
576
577
578
579
580
581
582
583







-
-
+
+







		    @"%[prog]: -o / --output and -O / --detect-filename are "
		    @"mutually exclusive!",
		    @"prog", [OFApplication programName])];
		[OFApplication terminateWithStatus: 1];
	}

	if (_outputPath != nil && _IRIs.count > 1) {
		[OFStdErr writeLine:
		    OF_LOCALIZED(@"output_only_with_one_iri",
		[OFStdErr writeLine: OF_LOCALIZED(
		    @"output_only_with_one_iri",
		    @"%[prog]: Cannot use -o / --output when more than one IRI "
		    @"has been specified!",
		    @"prog", [OFApplication programName])];
		[OFApplication terminateWithStatus: 1];
	}

	if (_insecure)
815
816
817
818
819
820
821
822
823


824
825
826
827
828
829
830
831
832
833
834
835


836
837
838
839
840
841
842
814
815
816
817
818
819
820


821
822
823
824
825
826
827
828
829
830
831
832


833
834
835
836
837
838
839
840
841







-
-
+
+










-
-
+
+







{
	if (exception != nil) {
		if ([exception isKindOfClass:
		    [OFResolveHostFailedException class]]) {
			if (!_quiet)
				[OFStdOut writeString: @"\n"];

			[OFStdErr writeLine:
			    OF_LOCALIZED(@"download_resolve_host_failed",
			[OFStdErr writeLine: OF_LOCALIZED(
			    @"download_resolve_host_failed",
			    @"%[prog]: Failed to download <%[iri]>!\n"
			    @"  Failed to resolve host: %[exception]",
			    @"prog", [OFApplication programName],
			    @"iri", request.IRI.string,
			    @"exception", exception)];
		} else if ([exception isKindOfClass:
		    [OFConnectSocketFailedException class]]) {
			if (!_quiet)
				[OFStdOut writeString: @"\n"];

			[OFStdErr writeLine:
			    OF_LOCALIZED(@"download_failed_connection_failed",
			[OFStdErr writeLine: OF_LOCALIZED(
			    @"download_failed_connection_failed",
			    @"%[prog]: Failed to download <%[iri]>!\n"
			    @"  Connection failed: %[exception]",
			    @"prog", [OFApplication programName],
			    @"iri", request.IRI.string,
			    @"exception", exception)];
		} else if ([exception isKindOfClass:
		    [OFInvalidServerResponseException class]]) {