aboutsummaryrefslogtreecommitdiff
path: root/networking/hostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'networking/hostname.c')
-rw-r--r--networking/hostname.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/networking/hostname.c b/networking/hostname.c
index b3e352242..04a051ede 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -10,6 +10,24 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13//config:config HOSTNAME
14//config: bool "hostname"
15//config: default y
16//config: help
17//config: Show or set the system's host name.
18//config:
19//config:config DNSDOMAINNAME
20//config: bool "dnsdomainname"
21//config: default y
22//config: help
23//config: Alias to "hostname -d".
24
25//applet:IF_DNSDOMAINNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
26//applet:IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
27
28//kbuild: lib-$(CONFIG_HOSTNAME) += hostname.o
29//kbuild: lib-$(CONFIG_DNSDOMAINNAME) += hostname.o
30
13//usage:#define hostname_trivial_usage 31//usage:#define hostname_trivial_usage
14//usage: "[OPTIONS] [HOSTNAME | -F FILE]" 32//usage: "[OPTIONS] [HOSTNAME | -F FILE]"
15//usage:#define hostname_full_usage "\n\n" 33//usage:#define hostname_full_usage "\n\n"
@@ -131,8 +149,12 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
131 opts = getopt32(argv, "dfisF:v", &hostname_str); 149 opts = getopt32(argv, "dfisF:v", &hostname_str);
132 argv += optind; 150 argv += optind;
133 buf = safe_gethostname(); 151 buf = safe_gethostname();
134 if (applet_name[0] == 'd') /* dnsdomainname? */ 152 if (ENABLE_DNSDOMAINNAME) {
135 opts = OPT_d; 153 if (!ENABLE_HOSTNAME || applet_name[0] == 'd') {
154 /* dnsdomainname */
155 opts = OPT_d;
156 }
157 }
136 158
137 if (opts & OPT_dfi) { 159 if (opts & OPT_dfi) {
138 /* Cases when we need full hostname (or its part) */ 160 /* Cases when we need full hostname (or its part) */