From 8f0f05ca44fdb3eff4a92b001d3d7ebbf08ff642 Mon Sep 17 00:00:00 2001 From: Valery Ushakov Date: Tue, 31 Oct 2017 16:48:35 +0800 Subject: [PATCH] Rewrite tparm_solaris_kludge to call tparm with default parameters Closes #4502. --- src/fallback.cpp | 41 +++-------------------------------------- src/fallback.h | 5 +++-- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/src/fallback.cpp b/src/fallback.cpp index b607c2482..40d468a5f 100644 --- a/src/fallback.cpp +++ b/src/fallback.cpp @@ -45,44 +45,9 @@ #ifdef TPARM_SOLARIS_KLUDGE #undef tparm -/// Checks for known string values and maps to correct number of parameters. -char *tparm_solaris_kludge(char *str, ...) { - long int param[9] = {}; - - va_list ap; - va_start(ap, str); - - if ((set_a_foreground && !strcmp(str, set_a_foreground)) || - (set_a_background && !strcmp(str, set_a_background)) || - (set_foreground && !strcmp(str, set_foreground)) || - (set_background && !strcmp(str, set_background)) || - (enter_underline_mode && !strcmp(str, enter_underline_mode)) || - (exit_underline_mode && !strcmp(str, exit_underline_mode)) || - (enter_standout_mode && !strcmp(str, enter_standout_mode)) || - (exit_standout_mode && !strcmp(str, exit_standout_mode)) || - (flash_screen && !strcmp(str, flash_screen)) || - (enter_subscript_mode && !strcmp(str, enter_subscript_mode)) || - (exit_subscript_mode && !strcmp(str, exit_subscript_mode)) || - (enter_superscript_mode && !strcmp(str, enter_superscript_mode)) || - (exit_superscript_mode && !strcmp(str, exit_superscript_mode)) || - (enter_blink_mode && !strcmp(str, enter_blink_mode)) || - (enter_italics_mode && !strcmp(str, enter_italics_mode)) || - (exit_italics_mode && !strcmp(str, exit_italics_mode)) || - (enter_reverse_mode && !strcmp(str, enter_reverse_mode)) || - (enter_shadow_mode && !strcmp(str, enter_shadow_mode)) || - (exit_shadow_mode && !strcmp(str, exit_shadow_mode)) || - (enter_secure_mode && !strcmp(str, enter_secure_mode)) || - (enter_bold_mode && !strcmp(str, enter_bold_mode))) { - param[0] = va_arg(ap, long int); - } else if (cursor_address && !strcmp(str, cursor_address)) { - param[0] = va_arg(ap, long int); - param[1] = va_arg(ap, long int); - } - - va_end(ap); - - return tparm(str, param[0], param[1], param[2], param[3], param[4], param[5], param[6], - param[7], param[8]); +char *tparm_solaris_kludge(char *str, long p1, long p2, long p3, long p4, + long p5, long p6, long p7, long p8, long p9) { + return tparm(str, p1, p2, p3, p4, p5, p6, p7, p8, p9); } // Re-defining just to make sure nothing breaks further down in this file. diff --git a/src/fallback.h b/src/fallback.h index 6d5ef8255..f0b3bb91f 100644 --- a/src/fallback.h +++ b/src/fallback.h @@ -55,9 +55,10 @@ struct winsize { #endif #ifdef TPARM_SOLARIS_KLUDGE -/// Solaris tparm has a set fixed of paramters in it's curses implementation, work around this here. +/// Solaris tparm has a set fixed of paramters in its curses implementation, work around this here. #define tparm tparm_solaris_kludge -char *tparm_solaris_kludge(char *str, ...); +char *tparm_solaris_kludge(char *str, long p1 = 0, long p2 = 0, long p3 = 0, long p4 = 0, + long p5 = 0, long p6 = 0, long p7 = 0, long p8 = 0, long p9 = 0); #endif /// On OS X, use weak linking for wcsdup and wcscasecmp. Weak linking allows you to call the