summaryrefslogtreecommitdiffstats
path: root/src/etc/inc/util.inc
diff options
context:
space:
mode:
authordoktornotor <notordoktor@gmail.com>2017-02-23 14:04:45 +0100
committerGitHub <noreply@github.com>2017-02-23 14:04:45 +0100
commit117776e0c01e68a8b65584d86d7b8b56fe75c9d0 (patch)
tree321091527f83e053a4ba1bb0cf5c70ef40f3901f /src/etc/inc/util.inc
parent27d15a216fcc86cbeef4db4ced518438fc07378d (diff)
downloadpfsense-117776e0c01e68a8b65584d86d7b8b56fe75c9d0.zip
pfsense-117776e0c01e68a8b65584d86d7b8b56fe75c9d0.tar.gz
Add a function to normalize CR and CRLF-style newlines to Unix LF
See Bug #5306.
Diffstat (limited to 'src/etc/inc/util.inc')
-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 937f899..604c557 100644
--- a/src/etc/inc/util.inc
+++ b/src/etc/inc/util.inc
@@ -2689,4 +2689,10 @@ function get_duid_from_file() {
}
return($duid_ASCII);
}
+
+/* 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