eval: trim CR+LF in backtick('') and $()
modified: eval.c
This commit is contained in:
19
eval.c
19
eval.c
@ -880,10 +880,27 @@ expand(
|
|||||||
c = '\n';
|
c = '\n';
|
||||||
--newlines;
|
--newlines;
|
||||||
} else {
|
} 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')
|
if (c == '\n')
|
||||||
/* save newlines */
|
/* save newlines */
|
||||||
newlines++;
|
newlines++;
|
||||||
|
#ifdef __OS2__
|
||||||
|
}
|
||||||
|
#endif
|
||||||
if (newlines && c != -1) {
|
if (newlines && c != -1) {
|
||||||
shf_ungetc(c, x.u.shf);
|
shf_ungetc(c, x.u.shf);
|
||||||
c = '\n';
|
c = '\n';
|
||||||
|
Reference in New Issue
Block a user