Skip to contentSkip to conversation

Allow tab in rules

PATCH In review Hannes Reinecke 2 participants 2 messages Feb 24, 2005 – Feb 25, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow tab in rules

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

Signature · 4 lines
Dr. Hannes Reinecke			[email protected]
SuSE Linux AG				S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

===== namedev_parse.c 1.51 vs edited =====

namedev_parse.c +5 -1
@@ -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];
#1 lore raw

namedev_parse.c line 158

Quoted 10 lines · Hannes Reinecke

=== 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

namedev_parse.c +3 -1
@@ -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?

namedev_parse.c line 163

Quoted 5 lines
namedev_parse.c +2 -0
+				continue;
+			if (bufline[i] = '\n')
 				continue;
 
 			line[j++] = bufline[i];

Cheers, Tobias

Signature · 15 lines
Tobias Klauser		
Biochemisches Institut der Universtitaet Zuerich
Mail: <[email protected]>
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_id396&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel