Commit 63f8c16f authored by jim warner's avatar jim warner Committed by Craig Small

top: make compilation possible under netbsd-curses too

Whoa, I had never considered an alternative to ncurses
until the issue referenced below was raised. Thus, I'm
surprised to find that 'tparm' was the only impediment
to ultimately utilizing this alternate curses library.

And, while we could have substituted that non-standard
'tiparm' with only 2 arguments, we'll utilize the full
parms compliment in the spirit of that original patch.

Frankly, the task of developing an alternative library
to that ncurses implementation really boggles my mind.

Congratulations to rofl0r, whoever that masked man is.

. issue raised
. netbsd-curses home jim warner's avatarJim Warner <>
parent bf7e7280
......@@ -661,6 +661,9 @@ static void capsmk (WIN_t *q) {
/* macro to test if a basic (non-color) capability is valid
thanks: Floyd Davidson <> */
#define tIF(s) s ? s : ""
/* macro to make compatible with netbsd-curses too
thanks: rofl0r <> */
#define tPM(a,b) tparm(a, b, 0, 0, 0, 0, 0, 0, 0, 0)
static int capsdone = 0;
// we must NOT disturb our 'empty' terminfo strings!
......@@ -703,15 +706,15 @@ static void capsmk (WIN_t *q) {
the job's done until he/she/it has a change-of-heart */
STRLCPY(q->cap_bold, CHKw(q, View_NOBOLD) ? Cap_norm : tIF(enter_bold_mode))
if (CHKw(q, Show_COLORS) && max_colors > 0) {
STRLCPY(q->capclr_sum, tparm(set_a_foreground, q->rc.summclr))
STRLCPY(q->capclr_sum, tPM(set_a_foreground, q->rc.summclr))
snprintf(q->capclr_msg, sizeof(q->capclr_msg), "%s%s"
, tparm(set_a_foreground, q->rc.msgsclr), Cap_reverse);
, tPM(set_a_foreground, q->rc.msgsclr), Cap_reverse);
snprintf(q->capclr_pmt, sizeof(q->capclr_pmt), "%s%s"
, tparm(set_a_foreground, q->rc.msgsclr), q->cap_bold);
, tPM(set_a_foreground, q->rc.msgsclr), q->cap_bold);
snprintf(q->capclr_hdr, sizeof(q->capclr_hdr), "%s%s"
, tparm(set_a_foreground, q->rc.headclr), Cap_reverse);
, tPM(set_a_foreground, q->rc.headclr), Cap_reverse);
snprintf(q->capclr_rownorm, sizeof(q->capclr_rownorm), "%s%s"
, Caps_off, tparm(set_a_foreground, q->rc.taskclr));
, Caps_off, tPM(set_a_foreground, q->rc.taskclr));
} else {
q->capclr_sum[0] = '\0';
......@@ -729,6 +732,7 @@ static void capsmk (WIN_t *q) {
snprintf(q->capclr_rowhigh, sizeof(q->capclr_rowhigh), "%s%s"
, q->capclr_rownorm, CHKw(q, Show_HIBOLD) ? q->cap_bold : Cap_reverse);
#undef tIF
#undef tPM
} // end: capsmk
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment