diff options
author | doktornotor <notordoktor@gmail.com> | 2017-02-23 14:04:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-23 14:04:45 +0100 |
commit | 117776e0c01e68a8b65584d86d7b8b56fe75c9d0 (patch) | |
tree | 321091527f83e053a4ba1bb0cf5c70ef40f3901f /src/etc/inc/util.inc | |
parent | 27d15a216fcc86cbeef4db4ced518438fc07378d (diff) | |
download | pfsense-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.inc | 6 |
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); +} + ?> |