It sure would be nice to use printf with wide strings. Implement %S to
do that. The C_WIDEOUT flag indicates that the console supports it. Mark the EFI console as supporting this. MFC After: 3 days
This commit is contained in:
parent
c205f958b4
commit
d4d32e5899
@ -102,6 +102,7 @@ struct console
|
||||
#define C_PRESENTOUT (1<<1) /* console can provide output */
|
||||
#define C_ACTIVEIN (1<<2) /* user wants input from console */
|
||||
#define C_ACTIVEOUT (1<<3) /* user wants output to console */
|
||||
#define C_WIDEOUT (1<<4) /* c_out routine groks wide chars */
|
||||
void (* c_probe)(struct console *cp); /* set c_flags to match hardware */
|
||||
int (* c_init)(int arg); /* reinit XXX may need more args */
|
||||
void (* c_out)(int c); /* emit c */
|
||||
|
@ -120,6 +120,7 @@ printf(const char *fmt, ...)
|
||||
va_list ap;
|
||||
const char *hex = "0123456789abcdef";
|
||||
char buf[32], *s;
|
||||
uint16_t *S;
|
||||
unsigned long long u;
|
||||
int c, l;
|
||||
|
||||
@ -143,6 +144,10 @@ printf(const char *fmt, ...)
|
||||
for (s = va_arg(ap, char *); *s != '\0'; s++)
|
||||
putchar(*s);
|
||||
break;
|
||||
case 'S': /* Assume console can cope with wide chars */
|
||||
for (S = va_arg(ap, uint16_t *); *S != 0; S++)
|
||||
putchar(*S);
|
||||
break;
|
||||
case 'd': /* A lie, always prints unsigned */
|
||||
case 'u':
|
||||
case 'x':
|
||||
|
@ -61,7 +61,7 @@ int efi_cons_poll(void);
|
||||
struct console efi_console = {
|
||||
"efi",
|
||||
"EFI console",
|
||||
0,
|
||||
C_WIDEOUT,
|
||||
efi_cons_probe,
|
||||
efi_cons_init,
|
||||
efi_cons_putchar,
|
||||
|
Loading…
Reference in New Issue
Block a user