-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Milestone
Description
Some users reported that they wanted to be able to use newlines inside the configuration etc., e.g. for NetApp one may need
Meta="newline
seperated
list"
inside the fileset (see https://bugs.bareos.org/view.php?id=1431). Currently such a thing is not possible but it would be easy to add: either add seperate multiline strings, maybe delimited by single quotes
Meta='newline
seperated
list'
or we stop ignoring newlines inside normal strings -- code change is minimal
modified core/src/lib/lex.cc
@@ -765,6 +765,10 @@ int LexGetToken(LEX* lf, int expect)
break;
}
if (ch == L_EOL) {
+#if HAVE_WIN32
+ add_str(lf, '\r');
+#endif
+ add_str(lf, '\n');
esc_next = false;
break;
}Old behaviour could be restored manually:
Option = "A
B
C"
would need to become
Option = "A"
"B"
"C"
A less disruptive option would be to only add the newline if it is preceded by a backslash, i.e. only
"a\
b"
gets parsed as "a\nb". This is also very easy to implement
modified core/src/lib/lex.cc
@@ -765,6 +765,12 @@ int LexGetToken(LEX* lf, int expect)
break;
}
if (ch == L_EOL) {
+ if (esc_next) {
+#if HAVE_WIN32
+ add_str(lf, '\r');
+#endif
+ add_str(lf, '\n');
+ }
esc_next = false;
break;
}Reactions are currently unavailable