From b1611d9a4693f1dc8296ef44f7e0f6044032ce15 Mon Sep 17 00:00:00 2001 From: Pere Orga Date: Thu, 11 Aug 2011 13:42:00 +0200 Subject: hostid: fix behavior on identifiers starting with zeros Signed-off-by: Pere Orga Signed-off-by: Denys Vlasenko --- coreutils/Config.src | 7 ------- coreutils/Kbuild.src | 1 - coreutils/hostid.c | 13 ++++++++++++- 3 files changed, 12 insertions(+), 9 deletions(-) (limited to 'coreutils') diff --git a/coreutils/Config.src b/coreutils/Config.src index 65165d79b..a28449b11 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src @@ -269,13 +269,6 @@ config FEATURE_FANCY_HEAD help This enables the head options (-c, -q, and -v). -config HOSTID - bool "hostid" - default y - help - hostid prints the numeric identifier (in hexadecimal) for - the current host. - config INSTALL bool "install" default y diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src index 53d88b391..d6453f014 100644 --- a/coreutils/Kbuild.src +++ b/coreutils/Kbuild.src @@ -36,7 +36,6 @@ lib-$(CONFIG_FALSE) += false.o lib-$(CONFIG_FOLD) += fold.o lib-$(CONFIG_FSYNC) += fsync.o lib-$(CONFIG_HEAD) += head.o -lib-$(CONFIG_HOSTID) += hostid.o lib-$(CONFIG_INSTALL) += install.o #lib-$(CONFIG_LENGTH) += length.o lib-$(CONFIG_LN) += ln.o 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(); } -- cgit v1.2.3