void putc(const char c) { #ifdef CONFIG_SANDBOX if (!gd) { os_putc(c); return; } #endif #ifdef CONFIG_SILENT_CONSOLE if (gd->flags & GD_FLG_SILENT) return; #endif #ifdef CONFIG_DISABLE_CONSOLE if (gd->flags & GD_FLG_DISABLE_CONSOLE) return; #endif if (!gd->have_console) return pre_console_putc(c); if (gd->flags & GD_FLG_DEVINIT) { /* Send to the standard output */ fputc(stdout, c); } else { /* Send directly to the handler */ serial_putc(c); } }
/* Makes fprintf(stdout) and stderr work. */ _ssize_t _write_r(struct _reent *r, int fd, void *buf, size_t len) { if (fd == 1 || fd == 2) { size_t i; for (i = 0; i < len; i++) { os_putc(((char *) buf)[i]); } return len; } return -1; }
void ICACHE_FLASH_ATTR bi_print(const char *label, bigint *x) { int i, j; if (x == NULL) { ssl_printf("%s: (null)\n", label); return; } ssl_printf("%s: (size %d)\n", label, x->size); for (i = x->size - 1; i >= 0; i--) { for (j = COMP_NUM_NIBBLES - 1; j >= 0; j--) { comp mask = 0x0f << (j * 4); comp num = (x->comps[i] & mask) >> (j * 4); os_putc((num <= 9) ? (num + '0') : (num + 'A' - 10)); } } ssl_printf("\n"); }
/* * Read at most len-1 chars from the UART * last char will in buf will be a null */ char * ICACHE_FLASH_ATTR uart_gets(char *buf, int len) { int i=0; char *p=buf; int ch; while (i<len) { ch = uart_getchar(); if (ch == '\r' || ch == '\n' || ch == -1 || ch == 0x03) { *p='\0'; return buf; } *p=(char)ch; os_putc(*p); p++; i++; } *p='\0'; return buf; }
void os_puts(const char *str) { while (*str) os_putc(*str++); }