Differences From Artifact [5041325a54]:
- File
src/OFDNSResolverSettings.m
— part of check-in
[cb260c0ef2]
at
2023-07-30 23:48:02
on branch trunk
— OFDNSResolverSettings: Allow ; for comments
AmiTCP seems to use ; instead of # for comments in the hosts file. (user: js, size: 17223) [annotate] [blame] [check-ins using]
To Artifact [79088cc90b]:
- File
src/OFDNSResolverSettings.m
— part of check-in
[a703a4f200]
at
2023-07-31 00:00:52
on branch trunk
— OFDNSResolverSettings: Get nameserver on AmigaOS 3
Only tested with AmiTCP. (user: js, size: 17379) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
61 62 63 64 65 66 67 | #if defined(OF_HAIKU) # define HOSTS_PATH @"/system/settings/network/hosts" # define RESOLV_CONF_PATH @"/system/settings/network/resolv.conf" #elif defined(OF_AMIGAOS4) # define HOSTS_PATH @"DEVS:Internet/hosts" #elif defined(OF_AMIGAOS) # define HOSTS_PATH @"AmiTCP:db/hosts" | > > > > | | 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | #if defined(OF_HAIKU) # define HOSTS_PATH @"/system/settings/network/hosts" # define RESOLV_CONF_PATH @"/system/settings/network/resolv.conf" #elif defined(OF_AMIGAOS4) # define HOSTS_PATH @"DEVS:Internet/hosts" #elif defined(OF_AMIGAOS) # define HOSTS_PATH @"AmiTCP:db/hosts" /* * FIXME: The installer puts it there, but theoretically it could also be in * AmiTCP:db/netdb or any of the files included there. */ # define RESOLV_CONF_PATH @"AmiTCP:db/netdb-myhost" #else # define HOSTS_PATH @"/etc/hosts" # define RESOLV_CONF_PATH @"/etc/resolv.conf" #endif #ifndef HOST_NAME_MAX # define HOST_NAME_MAX 255 |
︙ | ︙ | |||
255 256 257 258 259 260 261 | #if defined(OF_HAVE_FILES) && !defined(OF_MORPHOS) && !defined(OF_NINTENDO_3DS) - (void)parseHosts: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFCharacterSet *whitespaceCharacterSet = [OFCharacterSet whitespaceCharacterSet]; | | | | 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 | #if defined(OF_HAVE_FILES) && !defined(OF_MORPHOS) && !defined(OF_NINTENDO_3DS) - (void)parseHosts: (OFString *)path { void *pool = objc_autoreleasePoolPush(); OFCharacterSet *whitespaceCharacterSet = [OFCharacterSet whitespaceCharacterSet]; OFCharacterSet *commentCharacters = [OFCharacterSet characterSetWithCharactersInString: @"#;"]; OFMutableDictionary *staticHosts; OFFile *file; OFString *line; @try { file = [OFFile fileWithPath: path mode: @"r"]; } @catch (OFOpenItemFailedException *e) { objc_autoreleasePoolPop(pool); return; } staticHosts = [OFMutableDictionary dictionary]; while ((line = [file readLineWithEncoding: [OFLocale encoding]]) != nil) { OFArray *components, *hosts; size_t pos; OFString *address; pos = [line indexOfCharacterFromSet: commentCharacters]; if (pos != OFNotFound) line = [line substringToIndex: pos]; components = [line componentsSeparatedByCharactersInSet: whitespaceCharacterSet options: OFStringSkipEmptyComponents]; |
︙ | ︙ | |||
393 394 395 396 397 398 399 | options: OFStringSkipEmptyComponents]; if (components.count < 2) { objc_autoreleasePoolPop(pool2); continue; } | | | 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | options: OFStringSkipEmptyComponents]; if (components.count < 2) { objc_autoreleasePoolPop(pool2); continue; } option = [components.firstObject lowercaseString]; arguments = [components objectsInRange: OFMakeRange(1, components.count - 1)]; if ([option isEqual: @"nameserver"]) { if (arguments.count != 1) { objc_autoreleasePoolPop(pool2); continue; |
︙ | ︙ |