aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Heinrich <heinrich.tomas@gmail.com>2009-11-05 08:42:47 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2009-11-05 08:42:47 +0100
commit85bb843f47342b19c4f0814331c1f4c78b0011ad (patch)
tree84bbb356114a9645981dbc39fe83cfc517151225
parent05ed00f09aef68f2b5f67c4f4a56dc7fcd50aefb (diff)
downloadbusybox-w32-85bb843f47342b19c4f0814331c1f4c78b0011ad.tar.gz
busybox-w32-85bb843f47342b19c4f0814331c1f4c78b0011ad.tar.bz2
busybox-w32-85bb843f47342b19c4f0814331c1f4c78b0011ad.zip
dumpleases: unicode spport
Signed-off-by: Tomas Heinrich <heinrich.tomas@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--networking/udhcp/dumpleases.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c
index cbf9f587a..017c801e6 100644
--- a/networking/udhcp/dumpleases.c
+++ b/networking/udhcp/dumpleases.c
@@ -5,6 +5,7 @@
5 5
6#include "common.h" 6#include "common.h"
7#include "dhcpd.h" 7#include "dhcpd.h"
8#include "unicode.h"
8 9
9#if BB_LITTLE_ENDIAN 10#if BB_LITTLE_ENDIAN
10static inline uint64_t hton64(uint64_t v) 11static inline uint64_t hton64(uint64_t v)
@@ -42,6 +43,8 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
42 43
43 applet_long_options = dumpleases_longopts; 44 applet_long_options = dumpleases_longopts;
44#endif 45#endif
46 check_unicode_in_env();
47
45 opt_complementary = "=0:a--r:r--a"; 48 opt_complementary = "=0:a--r:r--a";
46 opt = getopt32(argv, "arf:", &file); 49 opt = getopt32(argv, "arf:", &file);
47 50
@@ -67,7 +70,12 @@ int dumpleases_main(int argc UNUSED_PARAM, char **argv)
67 addr.s_addr = lease.lease_nip; 70 addr.s_addr = lease.lease_nip;
68 /* actually, 15+1 and 19+1, +1 is a space between columns */ 71 /* actually, 15+1 and 19+1, +1 is a space between columns */
69 /* lease.hostname is char[20] and is always NUL terminated */ 72 /* lease.hostname is char[20] and is always NUL terminated */
73#if ENABLE_FEATURE_ASSUME_UNICODE
74 printf(" %-16s%s%*s", inet_ntoa(addr), lease.hostname,
75 20 - (int)bb_mbstrlen(lease.hostname), "");
76#else
70 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname); 77 printf(" %-16s%-20s", inet_ntoa(addr), lease.hostname);
78#endif
71 expires_abs = ntohl(lease.expires) + written_at; 79 expires_abs = ntohl(lease.expires) + written_at;
72 if (expires_abs <= curr) { 80 if (expires_abs <= curr) {
73 puts("expired"); 81 puts("expired");