aboutsummaryrefslogtreecommitdiff
path: root/coreutils/hostid.c
diff options
context:
space:
mode:
authorPere Orga <gotrunks@gmail.com>2011-08-11 13:42:00 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-08-16 23:36:10 +0200
commitb1611d9a4693f1dc8296ef44f7e0f6044032ce15 (patch)
treeb3418ea24db0353d10c1e46cd3e4cd51af61f88f /coreutils/hostid.c
parent4619802a5f399119345ca339886b7b060f2c15aa (diff)
downloadbusybox-b1611d9a4693f1dc8296ef44f7e0f6044032ce15.tar.gz
hostid: fix behavior on identifiers starting with zeros
Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/hostid.c')
-rw-r--r--coreutils/hostid.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index 49409b9de..5c1a4e086 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -9,6 +9,17 @@
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
+//config:config HOSTID
+//config: bool "hostid"
+//config: default y
+//config: help
+//config: hostid prints the numeric identifier (in hexadecimal) for
+//config: the current host.
+
+//applet:IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
+
+//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
+
//usage:#define hostid_trivial_usage
//usage: ""
//usage:#define hostid_full_usage "\n\n"
@@ -25,7 +36,7 @@ int hostid_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
bb_show_usage();
}
- printf("%lx\n", gethostid());
+ printf("%08lx\n", gethostid());
return fflush_all();
}