|
Lines 1-33
Link Here
|
| 1 |
--- runtime/stream.c.orig 2015-06-30 12:26:24 UTC |
|
|
| 2 |
+++ runtime/stream.c |
| 3 |
@@ -1097,12 +1097,30 @@ doWriteCall(strm_t *pThis, uchar *pBuf, |
| 4 |
char *pWriteBuf; |
| 5 |
DEFiRet; |
| 6 |
ISOBJ_TYPE_assert(pThis, strm); |
| 7 |
+#ifdef __FreeBSD__ |
| 8 |
+ sbool crnlNow = 0; |
| 9 |
+#endif /* __FreeBSD__ */ |
| 10 |
|
| 11 |
lenBuf = *pLenBuf; |
| 12 |
pWriteBuf = (char*) pBuf; |
| 13 |
iTotalWritten = 0; |
| 14 |
do { |
| 15 |
+#ifdef __FreeBSD__ |
| 16 |
+ if (pThis->bIsTTY && !pThis->iZipLevel && !pThis->cryprov) { |
| 17 |
+ char *pNl = NULL; |
| 18 |
+ if (crnlNow == 0) pNl = strchr(pWriteBuf, '\n'); |
| 19 |
+ else crnlNow = 0; |
| 20 |
+ if (pNl == pWriteBuf) { |
| 21 |
+ iWritten = write(pThis->fd, "\r", 1); |
| 22 |
+ if (iWritten > 0) { |
| 23 |
+ crnlNow = 1; |
| 24 |
+ iWritten = 0; |
| 25 |
+ } |
| 26 |
+ } else iWritten = write(pThis->fd, pWriteBuf, pNl ? pNl - pWriteBuf : lenBuf); |
| 27 |
+ } else |
| 28 |
+#endif /* __FreeBSD__ */ |
| 29 |
iWritten = write(pThis->fd, pWriteBuf, lenBuf); |
| 30 |
+ |
| 31 |
if(iWritten < 0) { |
| 32 |
char errStr[1024]; |
| 33 |
int err = errno; |