1 /* vi: set sw=4 ts=4: */
3 * echo.c - echo supporting -n and -e.
5 * See http://www.opengroup.org/onlinepubs/009695399/utilities/echo.html
13 char *arg, *from = "\\abfnrtv", *to = "\\\a\b\f\n\r\t\v";
16 arg = toys.optargs[i];
22 if (toys.optflags&2) {
34 found = strchr(from, d);
35 if (found) c = to[found-from];
36 else if (d == 'c') goto done;
39 while (arg[j]>='0' && arg[j]<='7')
40 c = (c*8)+arg[j++]-'0';
46 } else xprintf("%s", arg);
49 // Output "\n" if no -n
50 if (!(toys.optflags&1)) xputc('\n');