Example #1
0
static const char *check_mydomainname(void)
{
    char   *dot;

    /*
     * Use the hostname when it is not a FQDN ("foo"), or when the hostname
     * actually is a domain name ("foo.com").
     */
    if (var_myhostname == 0)
	get_myhostname();
    if ((dot = strchr(var_myhostname, '.')) == 0 || strchr(dot + 1, '.') == 0)
	return (DEF_MYDOMAIN);
    return (dot + 1);
}
Example #2
0
static const char *pc_check_mydomainname(void)
{
    static const char *domain;
    char   *dot;

    /*
     * Use cached result.
     */
    if (domain)
	return (domain);

    /*
     * Use the hostname when it is not a FQDN ("foo"), or when the hostname
     * actually is a domain name ("foo.com").
     */
    if (var_myhostname == 0)
	get_myhostname();
    if ((dot = strchr(var_myhostname, '.')) == 0 || strchr(dot + 1, '.') == 0)
	return (domain = DEF_MYDOMAIN);
    return (domain = mystrdup(dot + 1));
}