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

[augeas-devel] augeas: master - Postfix_main: handle continuation lines



Gitweb:        http://git.fedorahosted.org/git/augeas.git?p=augeas.git;a=commitdiff;h=d1a0221cfc29a7631e5b343c0dd0f2b99b07672c
Commit:        d1a0221cfc29a7631e5b343c0dd0f2b99b07672c
Parent:        e76b6219320ac2691d1b30699d2f0e48204493e6
Author:        David Lutterkort <lutter redhat com>
AuthorDate:    Tue Mar 3 15:48:44 2009 -0800
Committer:     David Lutterkort <lutter redhat com>
CommitterDate: Tue Mar 3 15:48:44 2009 -0800

Postfix_main: handle continuation lines

---
 lenses/postfix_main.aug            |   21 +++++++++++++--------
 lenses/tests/test_postfix_main.aug |   10 ++++++++--
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/lenses/postfix_main.aug b/lenses/postfix_main.aug
index 8c290de..35e834f 100644
--- a/lenses/postfix_main.aug
+++ b/lenses/postfix_main.aug
@@ -15,23 +15,28 @@ module Postfix_Main =
  *************************************************************************)
 
 let eol        = Util.eol
-let spc        = Util.del_ws_spc
-let indent     = del /[ \t]*/ " "
+let indent     = del /[ \t]*(\n[ \t]+)?/ " "
 let comment    = Util.comment
 let empty      = Util.empty
 let eq         = del /[ \t]*=/ " ="
-
-let sto_to_eol = store /([^ \t\n].*[^ \t\n]|[^ \t\n])/
-let sto_to_spc = store /[^ \t\n]+/
-
 let word       = /[A-Za-z0-9_.-]+/
-let value      = [ key word . spc . sto_to_eol . eol ]
+
+(* The value of a parameter, after the '=' sign. Postfix allows that
+ * lines are continued by starting continuation lines with spaces.
+ * The definition needs to make sure we don't add indented comment lines
+ * into values *)
+let value =
+  let chr = /[^# \t\n]/ in
+  let any = /.*/ in
+  let line = (chr . any* . chr | chr) in
+  let lines = line . (/\n[ \t]+/ . line)* in
+    store lines
 
 (************************************************************************
  *                               ENTRIES
  *************************************************************************)
 
-let entry     = [ key word . eq . (indent . sto_to_eol)? . eol ]
+let entry     = [ key word . eq . (indent . value)? . eol ]
 
 (************************************************************************
  *                                LENS
diff --git a/lenses/tests/test_postfix_main.aug b/lenses/tests/test_postfix_main.aug
index 6a9f7d4..a4d6fe6 100644
--- a/lenses/tests/test_postfix_main.aug
+++ b/lenses/tests/test_postfix_main.aug
@@ -5,8 +5,7 @@ myorigin = /etc/mailname
 
 smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
 mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
-relayhost = 
-"
+relayhost = \n"
 
 test Postfix_Main.lns get conf =
    { "#comment"  = "main.cf" }
@@ -15,3 +14,10 @@ test Postfix_Main.lns get conf =
    { "smtpd_banner" = "$myhostname ESMTP $mail_name (Ubuntu)" }
    { "mynetworks" = "127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128" }
    { "relayhost"  }
+
+test Postfix_main.lns get "debugger_command =
+\t PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
+\t ddd $daemon_directory/$process_name $process_id & sleep 5\n"
+     =
+  { "debugger_command" = "PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
+	 ddd $daemon_directory/$process_name $process_id & sleep 5" }



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