Imported Upstream version 1.6.0
[platform/upstream/augeas.git] / src / put.c
index 6888ef9..99cf2e1 100644 (file)
--- a/src/put.c
+++ b/src/put.c
@@ -1,7 +1,7 @@
 /*
  * put.c:
  *
- * Copyright (C) 2007-2011 David Lutterkort
+ * Copyright (C) 2007-2015 David Lutterkort
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -111,18 +111,18 @@ static char *encpcpy(char *e, const char *key, const char *value) {
 
 static void regexp_match_error(struct state *state, struct lens *lens,
                                int count, struct split *split) {
-    // FIXME: Split the regexp and encoding back
-    // into something resembling a tree level
     char *text = NULL;
     char *pat = NULL;
 
     lns_format_atype(lens, &pat);
-    text = enc_format(split->enc + split->start, split->end - split->start);
+    text = enc_format_indent(split->enc + split->start,
+                             split->end - split->start,
+                             4);
 
     if (count == -1) {
         put_error(state, lens,
-                  "Failed to match \n    %s\n  with tree\n   %s",
-                  pat, text);
+                  "Failed to match tree\n\n%s\n  with pattern\n   %s",
+                  text, pat);
     } else if (count == -2) {
         put_error(state, lens,
                   "Internal error matching\n    %s\n  with tree\n   %s",