X-Git-Url: https://git.draconx.ca/gitweb/cdecl99.git/blobdiff_plain/4ef59e97312cf3e8f537643c65bc2fef057b786b..HEAD:/src/cdecl99.c?ds=sidebyside diff --git a/src/cdecl99.c b/src/cdecl99.c index 3eb7cc1..0622e67 100644 --- a/src/cdecl99.c +++ b/src/cdecl99.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -116,6 +117,21 @@ static void print_help(const struct option *lopts) printf(_("Report bugs to <%s>.\n"), PACKAGE_BUGREPORT); } +static int do_getline(char **linebuf, size_t *n) +{ + int rc; + + if ((rc = dx_getline(linebuf, n, stdin)) < 0) { + if (rc == DX_GETLINE_ENOMEM) + print_error("%s", _("failed to allocate memory")); + else + print_error("%s", strerror(errno)); + return 0; + } + + return rc; +} + static int do_readline(char **linebuf, size_t *n, bool batch) { #if !HAVE_READLINE