From 5eddc12ca841772beab6f125d45aaa4873059c09 Mon Sep 17 00:00:00 2001 From: Thorsten Lockert Date: Fri, 21 Jun 1996 04:48:13 +0000 Subject: Accept a NULL buffer to tgetent(3) --- lib/libterm/termcap.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/libterm/termcap.c') diff --git a/lib/libterm/termcap.c b/lib/libterm/termcap.c index 2109744f990..2eb5d31cdd9 100644 --- a/lib/libterm/termcap.c +++ b/lib/libterm/termcap.c @@ -139,16 +139,18 @@ tgetent(bp, name) dummy = NULL; i = cgetent(&dummy, pathvec, name); - if (i == 0) { + if (i == 0 && bp != NULL) { strncpy(bp, dummy, 1023); bp[1023] = '\0'; if ((cp = strrchr(bp, ':')) != NULL) if (cp[1] != '\0') cp[1] = '\0'; } - - if (dummy) + else if (i == 0 && bp == NULL) + tbuf = dummy; + else if (dummy != NULL) free(dummy); + /* no tc reference loop return code in libterm XXX */ if (i == -3) return (-1); -- cgit v1.2.3