[prev in list] [next in list] [prev in thread] [next in thread]
List: postfix-devel
Subject: ncurses stderr and qshape.pl screen clearing
From: "Jason Pyeron" <jpyeron () pdinc ! us>
Date: 2021-09-28 19:09:48
Message-ID: 03c001d7b49c$686a6520$393f2f60$ () pdinc ! us
[Download RAW message or body]
In some circumstances ncurses will emit messages on STDERR when calling clear. The below patch will ensure the "cls" does not add to the screen output.
clear.c:
setupterm(term, fd, (int *) 0);
lib_setup.c:
setupterm(const char *tname, int Filedes, int *errret)
...
return _nc_setupterm(tname, Filedes, errret, FALSE);
_nc_setupterm(const char *tname, int Filedes, int *errret, int reuse)
...
if (TINFO_SETUP_TERM(&termp, tname, Filedes, errret, reuse) == OK) {
TINFO_SETUP_TERM(TERMINAL **tp, const char *tname, int Filedes, int *errret, int reuse)
ret_error0(TGETENT_ERR, "Invalid parameter, internal error.\n");
curses.priv.h:
#define ret_error0(code, msg) if (errret) {\
*errret = code;\
returnCode(SETUP_FAIL);\
} else {\
fprintf(stderr, msg);\
ExitTerminfo(EXIT_FAILURE);\
}
Patch, redirects stderr to dev null
diff --git a/postfix/auxiliary/qshape/qshape.pl b/postfix/auxiliary/qshape/qshape.pl
index 2ad88e17..0cd9d847 100755
--- a/postfix/auxiliary/qshape/qshape.pl
+++ b/postfix/auxiliary/qshape/qshape.pl
@@ -186,7 +186,7 @@ $minsub = $opts{"m"} if (exists $opts{"m"} && $opts{"m"} > 0);
if ( -t STDOUT ) {
$batch_msg_count = 1000 unless defined($batch_msg_count = $opts{"N"});
$batch_top_domains = 20 unless defined ($batch_top_domains = $opts{"n"});
- $cls = `clear`;
+ $cls = `clear 2>/dev/null`;
} else {
$batch_msg_count = 0;
$batch_top_domains = 0;
-Jason
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic