ObjFW  Check-in [ea61899548]

Overview
Comment:objfw-new: Complain if the name contains dots
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ea61899548ad585106c2803e8867df30f4b3210291bc09e21ee0f488d41ee9c5
User & Date: js on 2022-10-18 17:21:57
Other Links: manifest | tags
Context
2022-10-18
17:59
GitHub Actions: Replace Ubuntu 18.04 with latest check-in: a62fba3dc8 user: js tags: trunk
17:21
objfw-new: Complain if the name contains dots check-in: ea61899548 user: js tags: trunk
15:34
Document more exceptions check-in: e9708e48e0 user: js tags: trunk
Changes

Modified utils/objfw-new/ObjFWNew.m from [6054a43bff] to [efa3835453].

39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	[OFApplication terminateWithStatus: 1];
}

@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
	bool app, class;
	OFString *superclass = nil;
	OFMutableArray OF_GENERIC(OFString *) *properties = nil;
	const OFOptionsParserOption options[] = {
		{ 'a', @"app", 0, &app, NULL },
		{ 'c', @"class", 0, &class, NULL },
		{ 's', @"superclass", 1, NULL, &superclass },
		{ 'p', @"property", 1, NULL, NULL },
		{ '\0', nil, 0, NULL, NULL }







|







39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
	[OFApplication terminateWithStatus: 1];
}

@implementation ObjFWNew
- (void)applicationDidFinishLaunching
{
	bool app, class;
	OFString *superclass = nil, *name;
	OFMutableArray OF_GENERIC(OFString *) *properties = nil;
	const OFOptionsParserOption options[] = {
		{ 'a', @"app", 0, &app, NULL },
		{ 'c', @"class", 0, &class, NULL },
		{ 's', @"superclass", 1, NULL, &superclass },
		{ 'p', @"property", 1, NULL, NULL },
		{ '\0', nil, 0, NULL, NULL }
73
74
75
76
77
78
79
80






81
82
83
84
85
86
87
88
89
90
91
	}

	if ((app ^ class) != 1 || optionsParser.remainingArguments.count != 1)
		showUsage();

	if ((superclass && !class)  || (properties != nil && !class))
		showUsage();







	if (app)
		newApp(optionsParser.remainingArguments.firstObject);
	else if (class)
		newClass(optionsParser.remainingArguments.firstObject,
		    superclass, properties);
	else
		showUsage();

	[OFApplication terminate];
}
@end








>
>
>
>
>
>

|

<
|






73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89

90
91
92
93
94
95
96
	}

	if ((app ^ class) != 1 || optionsParser.remainingArguments.count != 1)
		showUsage();

	if ((superclass && !class)  || (properties != nil && !class))
		showUsage();

	name = optionsParser.remainingArguments.firstObject;
	if ([name rangeOfString: @"."].location != OFNotFound) {
		[OFStdErr writeLine: @"Name must not contain dots!"];
		[OFApplication terminate];
	}

	if (app)
		newApp(name);
	else if (class)

		newClass(name, superclass, properties);
	else
		showUsage();

	[OFApplication terminate];
}
@end