uintptr_t mcall_console_putchar(uint8_t ch) { do_putchar(ch); return 0; }
/* * Print SysV echo(1) style escape string * Halts processing string if a \c escape is encountered. */ static void conv_escape_str(char *str, void (*do_putchar)(int)) { int value; int ch; char c; while ((ch = *str++) != '\0') { if (ch != '\\') { do_putchar(ch); continue; } ch = *str++; if (ch == 'c') { /* \c as in SYSV echo - abort all processing.... */ rval |= 0x100; break; } /* * %b string octal constants are not like those in C. * They start with a \0, and are followed by 0, 1, 2, * or 3 octal digits. */ if (ch == '0') { int octnum = 0, i; for (i = 0; i < 3; i++) { if (!isdigit((unsigned char)*str) || *str > '7') break; octnum = (octnum << 3) | (*str++ - '0'); } do_putchar(octnum); continue; } /* \[M][^|-]C as defined by vis(3) */ if (ch == 'M' && *str == '-') { do_putchar(0200 | str[1]); str += 2; continue; } if (ch == 'M' && *str == '^') { str++; value = 0200; ch = '^'; } else value = 0; if (ch == '^') { ch = *str++; if (ch == '?') value |= 0177; else value |= ch & 037; do_putchar(value); continue; } /* Finally test for sequences valid in the format string */ str = conv_escape(str - 1, &c); do_putchar(c); } }
static void ABI_X86 send_to_console(unsigned char b) { do_putchar(b); }
static void wrap_putchar(unsigned char byte, void *data) { do_putchar(byte); }