dumpleases: unicode spport
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
parent
05ed00f09a
commit
85bb843f47
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
|
#include "unicode.h"
|
||||||
|
|
||||||
#if BB_LITTLE_ENDIAN
|
#if BB_LITTLE_ENDIAN
|
||||||
static inline uint64_t hton64(uint64_t v)
|
static inline uint64_t hton64(uint64_t v)
|
||||||
@ -42,6 +43,8 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
|
|
||||||
applet_long_options = dumpleases_longopts;
|
applet_long_options = dumpleases_longopts;
|
||||||
#endif
|
#endif
|
||||||
|
check_unicode_in_env();
|
||||||
|
|
||||||
opt_complementary = "=0:a--r:r--a";
|
opt_complementary = "=0:a--r:r--a";
|
||||||
opt = getopt32(argv, "arf:", &file);
|
opt = getopt32(argv, "arf:", &file);
|
||||||
|
|
||||||
@ -67,7 +70,12 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
|
|||||||
addr.s_addr = lease.lease_nip;
|
addr.s_addr = lease.lease_nip;
|
||||||
/* actually, 15+1 and 19+1, +1 is a space between columns */
|
/* actually, 15+1 and 19+1, +1 is a space between columns */
|
||||||
/* lease.hostname is char[20] and is always NUL terminated */
|
/* lease.hostname is char[20] and is always NUL terminated */
|
||||||
|
#if ENABLE_FEATURE_ASSUME_UNICODE
|
||||||
|
printf(" %-16s%s%*s", inet_ntoa(addr), lease.hostname,
|
||||||
|
20 - (int)bb_mbstrlen(lease.hostname), "");
|
||||||
|
#else
|
||||||
printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
|
printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
|
||||||
|
#endif
|
||||||
expires_abs = ntohl(lease.expires) + written_at;
|
expires_abs = ntohl(lease.expires) + written_at;
|
||||||
if (expires_abs <= curr) {
|
if (expires_abs <= curr) {
|
||||||
puts("expired");
|
puts("expired");
|
||||||
|
Loading…
Reference in New Issue
Block a user