[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] Re: hostname applet appends useless space
From:       basicer <basicer () gmail ! com>
Date:       2012-03-23 23:25:43
Message-ID: CAMEy_+zJ6NfP5tLwozKCv1NsNckNQ5CuQwAve+CbSmXO-6KWpQ () mail ! gmail ! com
[Download RAW message or body]

Ooff, that patch was incomplete; silly me.  Use this instead.

On Fri, Mar 23, 2012 at 7:17 PM, basicer <basicer@gmail.com> wrote:
> Seems easy enough to fix :]
>
> On Thu, Mar 22, 2012 at 11:54 AM, Robert Schumann
> <betulichergutmensch@googlemail.com> wrote:
>> Heyho guys,
>>
>> one small bug again :)
>>
>> [jazz@laptux ~]$ echo ">$(hostname -i)<"
>>>192.168.2.21<
>>
>> [jazz@laptux ~]$ echo ">$(busybox hostname -i)<"
>>>192.168.2.21 <
>>
>> Cheers
>> Robert
>> _______________________________________________
>> busybox mailing list
>> busybox@busybox.net
>> http://lists.busybox.net/mailman/listinfo/busybox

["extra_space_fix_fixed.patch" (application/octet-stream)]

diff --git a/networking/hostname.c b/networking/hostname.c
index 5f66390..d2e933e 100644
--- a/networking/hostname.c
+++ b/networking/hostname.c
@@ -153,8 +153,9 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
 			if (hp->h_length == sizeof(struct in_addr)) {
 				struct in_addr **h_addr_list = (struct in_addr **)hp->h_addr_list;
 				while (*h_addr_list) {
-					printf("%s ", inet_ntoa(**h_addr_list));
+					printf("%s", inet_ntoa(**h_addr_list));
 					h_addr_list++;
+					if (*h_addr_list) bb_putchar(' ');	
 				}
 				bb_putchar('\n');
 			}


_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic