From a3de2c367ecaa7579a3aeb0f8811a691f092d48c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?=
Date: Fri, 5 Nov 2021 15:19:03 +0100
Subject: [PATCH] Make this build on macOS
---
termtest.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/termtest.c b/termtest.c
index 48ddd63..437760e 100644
--- a/termtest.c
+++ b/termtest.c
@@ -1,7 +1,7 @@
//
// termtest: terminal evaluation tool
//
-// Copyright (c) 2020, Přemysl Eric Janouch
+// Copyright (c) 2020 - 2021, Přemysl Eric Janouch
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted.
@@ -32,6 +32,9 @@
#include
#include
+// tiparm is ncurses-specific, let's make this a tiny bit more portable.
+#define TIPARM(s, v1) tparm((s), (long) (v1))
+
#define CSI "\x1b["
#define OSC "\x1b]"
#define DCS "\x1bP"
@@ -295,16 +298,16 @@ int main(int argc, char *argv[]) {
&& set_a_foreground && set_a_background && exit_attribute_mode;
printf("Terminfo: %d\n", bbc_supported);
if (bbc_supported) {
- tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar);
- tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar);
+ tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
+ tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Terminfo%s ", exit_attribute_mode);
tputs(enter_bold_mode, 1, putchar);
- tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar);
- tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar);
+ tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
+ tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Bold%s ", exit_attribute_mode);
tputs(enter_blink_mode, 1, putchar);
- tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar);
- tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar);
+ tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
+ tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Blink%s ", exit_attribute_mode);
printf("\n");
}