aboutsummaryrefslogtreecommitdiff
path: root/src/cli.c
diff options
context:
space:
mode:
authorTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-20 20:39:08 +0900
committerTristan Riehs <tristan.riehs@bordeaux-inp.fr>2024-06-20 20:39:08 +0900
commit82b1cce1bc5c91c0b56501f5dab912390206ace5 (patch)
treeccb0b9b293b6dccfdc95cbd657fb63227274dc41 /src/cli.c
parent685ec81e127c9409a91299a5ac8415bb94f55ad9 (diff)
Use cli and gui as shared libraries
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/cli.c b/src/cli.c
index 902a693..af8522b 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -17,21 +17,28 @@
#include "config.h"
#include <stdlib.h>
+#include <stdio.h>
+#include <limits.h>
#include "_readline.h"
+#include "disp.h"
void init(void) {}
void
display_calc(int x, int y)
{
- printf(prompt, "%d + %d = ", x, y);
+ printf("%d + %d = ", x, y);
}
int
read_input(void)
{
char *txt = readline("");
+
+ if ((!txt) || (*txt == '\0'))
+ return INT_MAX;
+
return atoi(txt);
}