Remake the CLI tool #4
@@ -145,6 +145,7 @@ static char* read_stdin() {
|
|||||||
static int read_prompt(char* buf, int buf_size, char* prompt, const int required) {
|
static int read_prompt(char* buf, int buf_size, char* prompt, const int required) {
|
||||||
do {
|
do {
|
||||||
printf("%s", prompt);
|
printf("%s", prompt);
|
||||||
|
fflush(stdout);
|
||||||
if (!fgets(buf, buf_size, stdin)) return 1;
|
if (!fgets(buf, buf_size, stdin)) return 1;
|
||||||
const size_t len = noom_strlen(buf);
|
const size_t len = noom_strlen(buf);
|
||||||
if (len > 0 && buf[len - 1] != '\n') {
|
if (len > 0 && buf[len - 1] != '\n') {
|
||||||
|
|||||||
Reference in New Issue
Block a user