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
|
# define RESOLV_CONF_PATH @"/etc/resolv.conf"
#endif
#ifndef OF_WII
static OFString *
domainFromHostname(OFString *hostname)
{
if (hostname == nil)
return nil;
@try {
OFSocketAddressParseIP(hostname, 0);
/*
* If we are still here, the host name is a valid IP address.
* We can't use that as local domain.
*/
return nil;
} @catch (OFInvalidFormatException *e) {
/* Not an IP address -> we can use it if it contains a dot. */
size_t pos = [hostname rangeOfString: @"."].location;
if (pos == OFNotFound)
return nil;
return [hostname substringFromIndex: pos + 1];
}
}
#endif
#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
obtainHostname(void)
{
|
>
>
|
|
>
>
|
|
<
|
>
|
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
|
# define RESOLV_CONF_PATH @"/etc/resolv.conf"
#endif
#ifndef OF_WII
static OFString *
domainFromHostname(OFString *hostname)
{
OFString *ret;
if (hostname == nil)
return nil;
@try {
OFSocketAddressParseIP(hostname, 0);
/*
* If we are still here, the host name is a valid IP address.
* We can't use that as local domain.
*/
ret = nil;
} @catch (OFInvalidFormatException *e) {
/* Not an IP address -> we can use it if it contains a dot. */
size_t pos = [hostname rangeOfString: @"."].location;
if (pos != OFNotFound)
ret = [hostname substringFromIndex: pos + 1];
else
ret = nil;
}
return ret;
}
#endif
#if !defined(OF_WII) && !defined(OF_MORPHOS)
static OFString *
obtainHostname(void)
{
|