Postfix3.3.1
総合概要
データ構造
ファイル
ファイル一覧
大域各種
postfix-3.3.1
src
util
get_domainname.c
[詳解]
1
/*++
2
/* NAME
3
/* get_domainname 3
4
/* SUMMARY
5
/* network domain name lookup
6
/* SYNOPSIS
7
/* #include <get_domainname.h>
8
/*
9
/* const char *get_domainname()
10
/* DESCRIPTION
11
/* get_domainname() returns the local domain name as obtained
12
/* by stripping the hostname component from the result from
13
/* get_hostname(). The result is the hostname when get_hostname()
14
/* does not return a FQDN form ("foo"), or its result has only two
15
/* components ("foo.com").
16
/* DIAGNOSTICS
17
/* Fatal errors: no hostname, invalid hostname.
18
/* SEE ALSO
19
/* get_hostname(3)
20
/* LICENSE
21
/* .ad
22
/* .fi
23
/* The Secure Mailer license must be distributed with this software.
24
/* AUTHOR(S)
25
/* Wietse Venema
26
/* IBM T.J. Watson Research
27
/* P.O. Box 704
28
/* Yorktown Heights, NY 10598, USA
29
/*--*/
30
31
/* System library. */
32
33
#include <
sys_defs.h
>
34
#include <string.h>
35
36
/* Utility library. */
37
38
#include "
mymalloc.h
"
39
#include "
get_hostname.h
"
40
#include "
get_domainname.h
"
41
42
/* Local stuff. */
43
44
static
char
*my_domain_name;
45
46
/* get_domainname - look up my domain name */
47
48
const
char
*
get_domainname
(
void
)
49
{
50
const
char
*host;
51
const
char
*dot;
52
53
/*
54
* Use the hostname when it is not a FQDN ("foo"), or when the hostname
55
* actually is a domain name ("foo.com").
56
*/
57
if
(my_domain_name == 0) {
58
host =
get_hostname
();
59
if
((dot = strchr(host,
'.'
)) == 0 || strchr(dot + 1,
'.'
) == 0) {
60
my_domain_name =
mystrdup
(host);
61
}
else
{
62
my_domain_name =
mystrdup
(dot + 1);
63
}
64
}
65
return
(my_domain_name);
66
}
mystrdup
char * mystrdup(const char *str)
Definition:
mymalloc.c:225
get_domainname
const char * get_domainname(void)
Definition:
get_domainname.c:48
get_domainname.h
sys_defs.h
get_hostname
const char * get_hostname(void)
Definition:
get_hostname.c:55
mymalloc.h
get_hostname.h
2018年11月10日(土) 18時59分56秒作成 - Postfix3.3.1 / 構成:
1.8.9.1