Make this build on macOS

This commit is contained in:
Přemysl Eric Janouch 2021-11-05 15:19:03 +01:00
parent a0953ef485
commit a3de2c367e
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 10 additions and 7 deletions

View File

@ -1,7 +1,7 @@
// //
// termtest: terminal evaluation tool // termtest: terminal evaluation tool
// //
// Copyright (c) 2020, Přemysl Eric Janouch <p@janouch.name> // Copyright (c) 2020 - 2021, Přemysl Eric Janouch <p@janouch.name>
// //
// Permission to use, copy, modify, and/or distribute this software for any // Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted. // purpose with or without fee is hereby granted.
@ -32,6 +32,9 @@
#include <curses.h> #include <curses.h>
#include <term.h> #include <term.h>
// 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 CSI "\x1b["
#define OSC "\x1b]" #define OSC "\x1b]"
#define DCS "\x1bP" #define DCS "\x1bP"
@ -295,16 +298,16 @@ int main(int argc, char *argv[]) {
&& set_a_foreground && set_a_background && exit_attribute_mode; && set_a_foreground && set_a_background && exit_attribute_mode;
printf("Terminfo: %d\n", bbc_supported); printf("Terminfo: %d\n", bbc_supported);
if (bbc_supported) { if (bbc_supported) {
tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar); tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar); tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Terminfo%s ", exit_attribute_mode); printf("Terminfo%s ", exit_attribute_mode);
tputs(enter_bold_mode, 1, putchar); tputs(enter_bold_mode, 1, putchar);
tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar); tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar); tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Bold%s ", exit_attribute_mode); printf("Bold%s ", exit_attribute_mode);
tputs(enter_blink_mode, 1, putchar); tputs(enter_blink_mode, 1, putchar);
tputs(tiparm(set_a_foreground, COLOR_GREEN), 1, putchar); tputs(TIPARM(set_a_foreground, COLOR_GREEN), 1, putchar);
tputs(tiparm(set_a_background, COLOR_BLUE), 1, putchar); tputs(TIPARM(set_a_background, COLOR_BLUE), 1, putchar);
printf("Blink%s ", exit_attribute_mode); printf("Blink%s ", exit_attribute_mode);
printf("\n"); printf("\n");
} }