* [PATCH] Allow tab in rules
@ 2005-02-24 10:13 Hannes Reinecke
2005-02-25 13:31 ` Tobias Klauser
0 siblings, 1 reply; 2+ messages in thread
From: Hannes Reinecke @ 2005-02-24 10:13 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 538 bytes --]
Hi all,
namedev_parse is a bit overzealous when in comes to handling backspaces;
it always eats up backspaces regardless of anything beyond that.
This means it is impossible to enter '\t' in a rule.
Quite a bit of fun when you're trying to write regexps.
The attached patch fixes that, so now you should be able to use
'\t' and '\\' within the rules file.
Cheers,
Hannes
--
Dr. Hannes Reinecke hare@suse.de
SuSE Linux AG S390 & zSeries
Maxfeldstraße 5 +49 911 74053 688
90409 Nürnberg http://www.suse.de
[-- Attachment #2: udev-allow-tab-in-rules.patch --]
[-- Type: text/x-patch, Size: 504 bytes --]
===== namedev_parse.c 1.51 vs edited =====
--- 1.51/namedev_parse.c 2005-02-21 06:05:51 +01:00
+++ edited/namedev_parse.c 2005-02-24 11:11:45 +01:00
@@ -153,7 +153,11 @@
/* skip backslash and newline from multi line rules */
for (i = j = 0; i < count; i++) {
- if (bufline[i] == '\\' || bufline[i] == '\n')
+ if ((bufline[i] == '\\') &&
+ (bufline[i+1] != 't') &&
+ (bufline[i+i] != '\\'))
+ continue;
+ if (bufline[i] == '\n')
continue;
line[j++] = bufline[i];
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] Allow tab in rules
2005-02-24 10:13 [PATCH] Allow tab in rules Hannes Reinecke
@ 2005-02-25 13:31 ` Tobias Klauser
0 siblings, 0 replies; 2+ messages in thread
From: Tobias Klauser @ 2005-02-25 13:31 UTC (permalink / raw)
To: linux-hotplug
On Thu, Feb 24, 2005 at 11:13:59AM +0100, Hannes Reinecke wrote:
> === namedev_parse.c 1.51 vs edited ==> --- 1.51/namedev_parse.c 2005-02-21 06:05:51 +01:00
> +++ edited/namedev_parse.c 2005-02-24 11:11:45 +01:00
> @@ -153,7 +153,11 @@
>
> /* skip backslash and newline from multi line rules */
> for (i = j = 0; i < count; i++) {
> - if (bufline[i] = '\\' || bufline[i] = '\n')
> + if ((bufline[i] = '\\') &&
> + (bufline[i+1] != 't') &&
> + (bufline[i+i] != '\\'))
^^^
Shouldn't that be i+1 too? Or hav I missed something?
> + continue;
> + if (bufline[i] = '\n')
> continue;
>
> line[j++] = bufline[i];
Cheers, Tobias
--
Tobias Klauser
Biochemisches Institut der Universtitaet Zuerich
Mail: <tklauser@access.unizh.ch>
GPG Public key: 0x3A445520
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_ide95&alloc_id\x14396&op=click
_______________________________________________
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-02-25 13:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-24 10:13 [PATCH] Allow tab in rules Hannes Reinecke
2005-02-25 13:31 ` Tobias Klauser
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).