summaryrefslogtreecommitdiffstats
path: root/src/etc
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2017-02-23 14:04:45 +0100
committerRenato Botelho <renato@netgate.com>2017-03-02 16:50:48 -0300
commite850b0a3c7b273e43ae1d3eada7e034c628c7d1c (patch)
treef1359cb33834f3d551d617a15bb6899c813712b4 /src/etc
parent230547af9887da12fa423360d0ff652be4b757e8 (diff)
downloadpfsense-e850b0a3c7b273e43ae1d3eada7e034c628c7d1c.zip
pfsense-e850b0a3c7b273e43ae1d3eada7e034c628c7d1c.tar.gz
Add a function to normalize CR and CRLF-style newlines to Unix LF
See Bug #5306. (cherry picked from commit 117776e0c01e68a8b65584d86d7b8b56fe75c9d0)
Diffstat (limited to 'src/etc')
-rw-r--r--src/etc/inc/util.inc6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc
index aac095c..e685c06 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -2613,4 +2613,10 @@ function validateipaddr(&$addr, $type, $label, &$err_msg, $alias=false) {
return false;
}
+
+/* Replaces the Mac OS 9 and earlier (\r) and DOS/Windows (\r\n) newlines with the Unix equivalent (\n). */
+function unixnewlines($text) {
+ return preg_replace('/\r\n?/', "\n", $text);
+}
+
?>
OpenPOWER on IntegriCloud