summaryrefslogtreecommitdiff
path: root/networking/hostname.c
diff options
context:
space:
mode:
authorDenys Vlasenko2016-11-13 22:35:10 +0100
committerDenys Vlasenko2016-11-13 22:35:10 +0100
commit67fd2f2858ac63d46f42ef3c096b007ac7362849 (patch)
tree6ddad3566873d9874434cd5ad4a7e3eb9b251b8d /networking/hostname.c
parent9655f95d0f501b03b33c7896b7b0c23d090aff81 (diff)
downloadbusybox-67fd2f2858ac63d46f42ef3c096b007ac7362849.zip
busybox-67fd2f2858ac63d46f42ef3c096b007ac7362849.tar.gz
dnsdomainname: split it from "hostname", make it independently selectable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
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 b3e3522..04a051e 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -10,6 +10,24 @@
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config HOSTNAME
+//config: bool "hostname"
+//config: default y
+//config: help
+//config: Show or set the system's host name.
+//config:
+//config:config DNSDOMAINNAME
+//config: bool "dnsdomainname"
+//config: default y
+//config: help
+//config: Alias to "hostname -d".
+
+//applet:IF_DNSDOMAINNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
+//applet:IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild: lib-$(CONFIG_HOSTNAME) += hostname.o
+//kbuild: lib-$(CONFIG_DNSDOMAINNAME) += hostname.o
+
//usage:#define hostname_trivial_usage
//usage: "[OPTIONS] [HOSTNAME | -F FILE]"
//usage:#define hostname_full_usage "\n\n"
@@ -131,8 +149,12 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
opts = getopt32(argv, "dfisF:v", &hostname_str);
argv += optind;
buf = safe_gethostname();
- if (applet_name[0] == 'd') /* dnsdomainname? */
- opts = OPT_d;
+ if (ENABLE_DNSDOMAINNAME) {
+ if (!ENABLE_HOSTNAME || applet_name[0] == 'd') {
+ /* dnsdomainname */
+ opts = OPT_d;
+ }
+ }
if (opts & OPT_dfi) {
/* Cases when we need full hostname (or its part) */