aboutsummaryrefslogtreecommitdiff
path: root/src/input.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/input.c')
-rw-r--r--src/input.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/input.c b/src/input.c
index 94777bb..ec3a766 100644
--- a/src/input.c
+++ b/src/input.c
@@ -37,3 +37,13 @@ void remove_ending_newline(char *str)
assert(str[idx] == '\n');
str[idx] = '\0';
}
+
+char *readline_with_check(const char *prompt)
+{
+ char *input = readline(prompt);
+ if (input == NULL) {
+ perror("readline");
+ exit(EXIT_FAILURE);
+ }
+ return input;
+}