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

[augeas-devel] augeas: master - Modprobe: handle comments at the end of a line



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=8346abdb552978dc37ef6c7e5874f4907ddf8e64
Commit:        8346abdb552978dc37ef6c7e5874f4907ddf8e64
Parent:        e290edeb935cdc5f963c0a3e524952621ad1d1db
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Thu May 14 09:25:18 2009 -0700
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Thu May 14 09:25:18 2009 -0700

Modprobe: handle comments at the end of a line

---
 lenses/modprobe.aug            |    6 +++---
 lenses/tests/test_modprobe.aug |    4 ++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/lenses/modprobe.aug b/lenses/modprobe.aug
index d61b7a0..4f3a487 100644
--- a/lenses/modprobe.aug
+++ b/lenses/modprobe.aug
@@ -7,7 +7,7 @@ autoload xfm
 
 let comment = Util.comment
 let empty = Util.empty
-let eol = Util.eol
+let eol = Util.eol | Util.comment
 
 (* modprobe.conf allows continuing a line by ending it with backslash +
    newline; the backslash + newline token is suppressed We handle an
@@ -18,7 +18,7 @@ let eol = Util.eol
 (* A separator is either whitespace or \ followed by newline *)
 let sep_ch = /[ \t]|\\\\\n/
 (* Anything that's not a separator is part of a token *)
-let tok_ch = /[^ \t\n\\]|\\\\[^ \t\n]/
+let tok_ch = /[^ \t\n#\\]|\\\\[^ \t\n]/
 
 let spc = del sep_ch+ " "
 let token = store tok_ch+
@@ -26,7 +26,7 @@ let indent = Util.del_opt_ws ""
 
 let cmd (n:regexp) = key n . spc
 let arg (n:string) = [ label n . token ]
-let token_to_eol = store (tok_ch . /([^\n\\]|\\\\\n)*/ . tok_ch | tok_ch)
+let token_to_eol = store (tok_ch . /([^#\n\\]|\\\\\n)*/ . tok_ch | tok_ch)
 
 let options =
   let opt_ch = /[A-Za-z0-9_]/ in
diff --git a/lenses/tests/test_modprobe.aug b/lenses/tests/test_modprobe.aug
index e358d61..dea9db7 100644
--- a/lenses/tests/test_modprobe.aug
+++ b/lenses/tests/test_modprobe.aug
@@ -71,3 +71,7 @@ test Modprobe.lns get conf =
   { "remove" = "bar echo Removing bar" }
   { "remove" = "foo echo Removing foo" }
   { "remove" = "export_nodep-$BITNESS echo Removing export_nodep" }
+
+test Modprobe.lns get "blacklist brokenmodule # never worked\n" =
+  { "blacklist" = "brokenmodule"
+    { "#comment" = "never worked" } }



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