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
25
misc.c
25
misc.c
@ -29,7 +29,7 @@
|
||||
#include <grp.h>
|
||||
#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 */
|
||||
unsigned char chtypes[UCHAR_MAX + 1];
|
||||
@ -1101,6 +1101,10 @@ print_value_quoted(const char *s)
|
||||
c = 'f';
|
||||
if (0)
|
||||
/* FALLTHROUGH */
|
||||
case '\n':
|
||||
c = 'n';
|
||||
if (0)
|
||||
/* FALLTHROUGH */
|
||||
case '\r':
|
||||
c = 'r';
|
||||
if (0)
|
||||
@ -1119,17 +1123,18 @@ print_value_quoted(const char *s)
|
||||
/* FALLTHROUGH */
|
||||
case '\\':
|
||||
shf_putc('\\', shl_stdout);
|
||||
/* FALLTHROUGH */
|
||||
case '\n':
|
||||
dgk_regchar:
|
||||
shf_putc(c, shl_stdout);
|
||||
break;
|
||||
|
||||
if (0)
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
if (c >= 32 && c <= 0x7E)
|
||||
goto dgk_regchar;
|
||||
/* FALLTHROUGH */
|
||||
if (c < 32 || c > 0x7E) {
|
||||
/* FALLTHROUGH */
|
||||
case '\'':
|
||||
shf_fprintf(shl_stdout, "\\x%02X", c);
|
||||
shf_fprintf(shl_stdout, "\\x%02X", c);
|
||||
break;
|
||||
}
|
||||
|
||||
shf_putc(c, shl_stdout);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user