Re: [B.A.T.M.A.N.] [PATCH 4/4] Staging: batman-adv: fix whitespace style issues

Luis de Bethencourt
2010-04-04T15:02:52Z

On Sun, Apr 4, 2010 at 3:42 PM, Marek Lindner <lindner_marek@yahoo.de> wrote:
> On Sunday 04 April 2010 20:39:49 Luis de Bethencourt wrote:
>> Honestly, I don't understand the intention of the whitespaces you are
>> talking about. Userspace applications have to split the string after
>> each whitespace because there is a \n there, my fix just suggested to
>> split the line before the whitespace since I see no need for it.
>>
>> So am I missunderstanding and there is a need for that whitespace?
>> Same question asked differently: Will there be any difference in the
>> print out if the line is broken before the whitespace instead of
>> after?
>
> Let's take this string as an example:
> "commands: enable, disable, 0, 1 \n"
> The batctl code uses strchr() to jump to each whitespace location within the
> string and handle each word individually. By removing the last whitespace the
> code will not handle "1" because there is not more whitespace. See
> handle_sys_setting() in http://www.open-mesh.org/browser/trunk/batctl/sys.c
>
> That is not tragic but the batctl code needs to be changed as well if the
> whitespace is removed.
>
> Regards,
> Marek
>

Ohhhhhh... I wasn't aware of that.

In this case the whitespace is needed to separate 1 from \n. Being
this the case you are correct, I agree with you that keeping those
whitespaces is a small cost compared to changing the logic of how
batctl works.

I stand corrected :P

Thanks for taking the time of writing the example Marek.

Sven,

Should I redo the patch you sent taking out the changes that are
affected by the above?

Luis