int debug_scanf(const char *fmt_ptr, ...) { char temp_buf[IO_MAXLINE]; va_list ap; uint32_t i; char result; va_start(ap, fmt_ptr); temp_buf[0] = '\0'; for (i = 0; i < IO_MAXLINE; i++) { temp_buf[i] = result = debug_getchar(); if (result == '\n') { /* End of Line */ break; } temp_buf[i + 1] = '\0'; } result = scan_prv(temp_buf, (char *)fmt_ptr, ap); va_end(ap); return result; }
int debug_scanf(const char *fmt_ptr, ...) { char temp_buf[IO_MAXLINE]; va_list ap; uint32_t i; char result; /* Do nothing if the debug uart is not initialized.*/ if (s_debugConsole.type == kDebugConsoleNone) { return -1; } va_start(ap, fmt_ptr); temp_buf[0] = '\0'; for (i = 0; i < IO_MAXLINE; i++) { temp_buf[i] = result = debug_getchar(); if ((result == '\r') || (result == '\n')) { /* End of Line */ if (i == 0) { i = (uint32_t)-1; } else { break; } } temp_buf[i + 1] = '\0'; } result = scan_prv(temp_buf, (char *)fmt_ptr, ap); va_end(ap); return result; }