From 0c317a065282c8f00c5277799e155aa58a55b7ca Mon Sep 17 00:00:00 2001 From: Tristan Riehs Date: Sun, 2 Aug 2026 20:01:28 +0200 Subject: Add readline_with_check readline wrapper --- src/input.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/input.c') 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; +} -- cgit v1.2.3