util: update termios to replace nl with cr-nl

This change enables OPOST to enable output post-processing. It then
enables ONLCR to prepend newline characters with carriage return so
that start of each line is always left aligned. Note that on some
terminals this might display a redundant ^M.

Change-Id: Ia0b4c61725ab7478e7341273a8279b96e53d9f26
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/65152
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
diff --git a/util/term/term.c b/util/term/term.c
index ca88ad4..529712c 100644
--- a/util/term/term.c
+++ b/util/term/term.c
@@ -302,8 +302,8 @@
     memcpy(&saved_ios, &ios, sizeof(struct termios));
 
     ios.c_iflag &= ~(ISTRIP|ICRNL|IGNCR|ICRNL|IXOFF|IXON);
-    ios.c_oflag &= ~(OPOST);
-    ios.c_oflag &= (ONLCR);
+    ios.c_oflag |= OPOST;
+    ios.c_oflag |= ONLCR;
     ios.c_lflag &= ~(ISIG|ICANON|ECHO);
     ios.c_cc[VMIN] = 1;
     ios.c_cc[VTIME] = 0;