From 9047e907e4d5e818c9da27285f208ec959457e12 Mon Sep 17 00:00:00 2001
From: Dumez <dumez>
Date: Wed, 29 Apr 2015 08:52:08 +0000
Subject: [PATCH] Bash read built-in function behaves differently with 0x0a
 symbols for bash >=4.3-alpha. This fix accommodates the behavior of both
 versions

---
 tools/quartus/run_mif | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/quartus/run_mif b/tools/quartus/run_mif
index 244879681e..c0421cbb97 100755
--- a/tools/quartus/run_mif
+++ b/tools/quartus/run_mif
@@ -121,9 +121,13 @@ echo "CONTENT BEGIN" >> ${quartusdir}/${project_rev}.mif
 
 unb_info $0 "Writing ${quartusdir}/${project_rev}.reg contents to ${quartusdir}/${project_rev}.mif"
 
+tr '\n' '\0' < ${quartusdir}/${project_rev}.reg > ${quartusdir}/${project_rev}.reg_tmp
+cat ${quartusdir}/${project_rev}.reg_tmp > ${quartusdir}/${project_rev}.reg
+rm -f ${quartusdir}/${project_rev}.reg_tmp
+
 address=0
 charcnt=0
-while IFS= read -r -n1 char
+while IFS= read -r -d $'\0' -n1 char
 do
   # 4 bytes per word address: print one address per 4 chars
   if [ $charcnt -eq 0 ] ; then
-- 
GitLab