From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kay Sievers Date: Sat, 31 Jan 2004 01:35:42 +0000 Subject: Re: udev patch for attributes with trailing spaces in the values Message-Id: <20040131013542.GA20937@vrfy.org> List-Id: References: <200401301014.51387.meaton@vasco.com> In-Reply-To: <200401301014.51387.meaton@vasco.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: linux-hotplug@vger.kernel.org On Fri, Jan 30, 2004 at 10:14:51AM +1000, Mark Eaton wrote: > The following patch strips off spaces that are often contained at the end of > SYSFS_ attributes. (ie lots of printers etc do this). > I'm not sure if this should actually be added to udev but I would be curious > to hear peoples thoughts as I find it extremly annoying and pointless to have > to hexdump the sysfs values to check if there are trailing spaces to write > the various rules. You may use udevinfo that prints the ready formated attribute for you or use the pattern matching if you don't want to count the number of spaces. :) > diff -Nru udev-015-orig/namedev.c udev-015/namedev.c > --- udev-015-orig/namedev.c 2004-01-23 09:28:36.000000000 +1000 > +++ udev-015/namedev.c 2004-01-30 08:59:10.000000000 +1000 > @@ -427,7 +427,10 @@ > label_found: > c = tmpattr->value + strlen(tmpattr->value)-1; > if (*c = '\n') > - *c = 0x00; > + *c-- = 0x00; Huh, what if the value is only the '\n'? > + while (*c = ' ') > + *c-- = 0x00; thanks, Kay ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net Linux-hotplug-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel