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

Marek Lindner
2010-04-04T14:42:27Z

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