From 847b25bd08d4b062263e36cbe43b842920b855f1 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 25 Mar 2022 00:39:47 +0000 Subject: [PATCH] multiprogress.c: Get the `termcap' string after allocating the buffers. It works better that way, except with GNU `termcap'. --- multiprogress.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/multiprogress.c b/multiprogress.c index 0594f37..3d4ba8c 100644 --- a/multiprogress.c +++ b/multiprogress.c @@ -91,12 +91,12 @@ int progress_init(struct progress_state *progress) #elif defined(USE_TERMCAP) - term = getenv("TERM"); if (!term) return (-1); - if (tgetent(tty->termbuf, term) < 1) return (-1); - tty->termbuf = malloc(4096); if (!tty->termbuf) return (-1); tty->capbuf = malloc(4096); if (!tty->capbuf) return (-1); + term = getenv("TERM"); if (!term) return (-1); + if (tgetent(tty->termbuf, term) < 1) return (-1); + capcur = tty->capbuf; tty->cap.cr = tgetstr("cr", &capcur); tty->cap.nw = tgetstr("nw", &capcur); -- 2.11.0