Fix setupterm error evaluation.
This commit is contained in:
parent
3036697004
commit
0f4a66f5d3
@ -129,16 +129,19 @@ const char *mpw_hex_l(uint32_t number) {
|
|||||||
#ifdef COLOR
|
#ifdef COLOR
|
||||||
static int putvari;
|
static int putvari;
|
||||||
static char *putvarc = NULL;
|
static char *putvarc = NULL;
|
||||||
static int termsetup = ERR;
|
static int termsetup;
|
||||||
static int initputvar() {
|
static int initputvar() {
|
||||||
if (!isatty(STDERR_FILENO))
|
if (!isatty(STDERR_FILENO))
|
||||||
return 0;
|
return 0;
|
||||||
if (putvarc)
|
if (putvarc)
|
||||||
free(putvarc);
|
free(putvarc);
|
||||||
if (termsetup != OK)
|
if (!termsetup) {
|
||||||
setupterm(NULL, STDERR_FILENO, &termsetup);
|
int status;
|
||||||
if (termsetup != OK)
|
if (! (termsetup = (setupterm(NULL, STDERR_FILENO, &status) == OK && status == 1))) {
|
||||||
return 0;
|
wrn( "Terminal doesn't support color (setupterm errno %d).\n", status );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
putvarc=(char *)calloc(256, sizeof(char));
|
putvarc=(char *)calloc(256, sizeof(char));
|
||||||
putvari=0;
|
putvari=0;
|
||||||
|
Loading…
Reference in New Issue
Block a user