#include <stdio.h>
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
#include <locale.h>
int
main(int argc, char *argv[])
{
register char *cp;
register int i, wd;
int j;
wchar_t wc;
int b_len;
char *ep;
(void) setlocale(LC_ALL, "");
if (--argc == 0) {
(void) putchar('\n');
if (fflush(stdout) != 0)
return (1);
return (0);
}
for (i = 1; i <= argc; i++) {
for (cp = argv[i], ep = cp + (int)strlen(cp);
cp < ep; cp += b_len) {
if ((b_len = mbtowc(&wc, cp, MB_CUR_MAX)) <= 0) {
(void) putchar(*cp);
b_len = 1;
continue;
}
if (wc != '\\') {
(void) putwchar(wc);
continue;
}
cp += b_len;
b_len = 1;
switch (*cp) {
case 'a':
(void) putchar('\a');
continue;
case 'b':
(void) putchar('\b');
continue;
case 'c':
if (fflush(stdout) != 0)
return (1);
return (0);
case 'f':
(void) putchar('\f');
continue;
case 'n':
(void) putchar('\n');
continue;
case 'r':
(void) putchar('\r');
continue;
case 't':
(void) putchar('\t');
continue;
case 'v':
(void) putchar('\v');
continue;
case '\\':
(void) putchar('\\');
continue;
case '0':
j = wd = 0;
while ((*++cp >= '0' && *cp <= '7') &&
j++ < 3) {
wd <<= 3;
wd |= (*cp - '0');
}
(void) putchar(wd);
--cp;
continue;
default:
cp--;
(void) putchar(*cp);
}
}
(void) putchar(i == argc? '\n': ' ');
if (fflush(stdout) != 0)
return (1);
}
return (0);
}