在 Thu, 06 Sep 2012 00:48:59 +0800, Thorsten Glaser <[email protected]> 寫道:
Roy dixit:
separated patch for MSYS users.
OK, but as I explained, also in IRC, I will not accept such a
behavioural difference patch in mksh itself. I request that
people scripting for MSYS make up for the environment’s mistakes
in their scripts instead, in places where needed, which I expect
are not too many.
Privately, of course, you are all free to do what you want ;-)
but I ask that, *if* you distribute binaries of that, you change
the KSH_VERSION similar to what PLD Linux and Debian wheezy do.
I will if I really want to distribute binary.
That should be in separated patch, not here. ;)
Patch v4 takes care the EOF, so it works in this situation:
ca=$(echo \\001)
cm=$(printf \\r)
Index: eval.c
===================================================================
RCS file: /cvs/src/bin/mksh/eval.c,v
retrieving revision 1.128
diff -u -r1.128 eval.c
--- eval.c 24 Aug 2012 21:16:06 -0000 1.128
+++ eval.c 6 Sep 2012 00:34:30 -0000
@@ -844,7 +844,11 @@
c = '\n';
--newlines;
} else {
+#ifdef __MSYS__
+ while ((c = shf_getc(x.u.shf)) == 0 || c == '\n' || (c == '\r' &&
x.u.shf->rnleft && *(x.u.shf->rp)=='\n'))
+#else
while ((c = shf_getc(x.u.shf)) == 0 || c ==
'\n')
+#endif
if (c == '\n')
/* Save newlines */
newlines++;