From e0355b78a9a51f49e01498bf040f2199de59ce82 Mon Sep 17 00:00:00 2001 From: KO Myung-Hun Date: Tue, 10 Jan 2017 17:29:41 +0900 Subject: [PATCH] eval: trim CR+LF in backtick('') and $() modified: eval.c --- eval.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/eval.c b/eval.c index a9980c7..42637a6 100644 --- a/eval.c +++ b/eval.c @@ -880,10 +880,27 @@ expand( c = '\n'; --newlines; } else { - while ((c = shf_getc(x.u.shf)) == 0 || c == '\n') + while ((c = shf_getc(x.u.shf)) == 0 || +#ifdef __OS2__ + c == '\r' || +#endif + c == '\n') +#ifdef __OS2__ + { + if (c == '\r') { + c = shf_getc(x.u.shf); + if (c == -1) + c == '\r'; + else if (c != '\n') + shf_ungetc(c, x.u.shf); + } +#endif if (c == '\n') /* save newlines */ newlines++; +#ifdef __OS2__ + } +#endif if (newlines && c != -1) { shf_ungetc(c, x.u.shf); c = '\n';