also emit newline as backslash-n to align with GNU bash (and to keep everything on one line)
This commit is contained in:
parent
5416abb2d0
commit
3b9ec6c3c4
19
misc.c
19
misc.c
@ -29,7 +29,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.173 2011/10/24 19:40:46 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.174 2011/10/24 19:40:58 tg Exp $");
|
||||||
|
|
||||||
/* type bits for unsigned char */
|
/* type bits for unsigned char */
|
||||||
unsigned char chtypes[UCHAR_MAX + 1];
|
unsigned char chtypes[UCHAR_MAX + 1];
|
||||||
@ -1101,6 +1101,10 @@ print_value_quoted(const char *s)
|
|||||||
c = 'f';
|
c = 'f';
|
||||||
if (0)
|
if (0)
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
|
case '\n':
|
||||||
|
c = 'n';
|
||||||
|
if (0)
|
||||||
|
/* FALLTHROUGH */
|
||||||
case '\r':
|
case '\r':
|
||||||
c = 'r';
|
c = 'r';
|
||||||
if (0)
|
if (0)
|
||||||
@ -1119,19 +1123,20 @@ print_value_quoted(const char *s)
|
|||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case '\\':
|
case '\\':
|
||||||
shf_putc('\\', shl_stdout);
|
shf_putc('\\', shl_stdout);
|
||||||
|
|
||||||
|
if (0)
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case '\n':
|
|
||||||
dgk_regchar:
|
|
||||||
shf_putc(c, shl_stdout);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (c >= 32 && c <= 0x7E)
|
if (c < 32 || c > 0x7E) {
|
||||||
goto dgk_regchar;
|
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
case '\'':
|
case '\'':
|
||||||
shf_fprintf(shl_stdout, "\\x%02X", c);
|
shf_fprintf(shl_stdout, "\\x%02X", c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
shf_putc(c, shl_stdout);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
inquote = true;
|
inquote = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user