Re: [PATCH] iio_trigger_find_by_name: Skip trailing newline if available

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/23/10 12:23, Hennerich, Michael wrote:
> Jonathan Cameron wrote on 2010-03-22:
>> On 03/08/10 09:31, Hennerich, Michael wrote:
>>> Skip trailing newline if available.
>>>
>>> From: Michael Hennerich <Michael.Hennerich@xxxxxxxxxx>
>>
>> Dear Michael,
>>
>> Just found this one whilst trying to sort out a clean iio tree.
>> (sorry I completely failed to reply originally)
>>
>> Anyhow, I agree with the principal that we should be ignoring the
>> newline.  Actually we should be ignoring whitespace before and after
>> the string we are actually after.
> 
> Well - in most cases people use #echo so there shouldn't be a problem with white space before and after.
> However the newline is going to bug in case you don't use #echo -n.
> I've seen many sysfs_set functions also stripping the '\n' from the string.
Actually most uses beyond the debugging drivers stage are likely to be via
userspace libraries, but admittedly these aren't going to have excess white
space so it doesn't matter!


> 
>> Perhaps a cleaner approach is to
>> use sscanf to pull out the string alone?
> 
> sscanf() is certainly a alternative here.
> 
>> I don't think we need to
>> allow for whitespace in the trigger name (though obviously it should
>> be documented if we do not).  Technically I believe (via the
>> convenient lwn article last week on the topic) we should ignore white
>> space but return -EINVAL if there is say one word, some white space
>> and then another word...  Not sure if there is a particularly clean
>> way to do that however.
>>
>> What do you think?
> 
> I agree - Don't allow whitespace in the trigger name.

Alright, I don't really care how we do it, though agree dealing with the newline
is useful, so please send this onto Greg KH (if you haven't?) 

Jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-iio" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux