+ }
+ if (result != OK) {
+ if (r)
+ *r = 0;
+ if (g)
+ *g = 0;
+ if (b)
+ *b = 0;
+ }
+ returnCode(result);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(color_content) (NCURSES_SP_DCLx
+ NCURSES_COLOR_T color,
+ NCURSES_COLOR_T *r,
+ NCURSES_COLOR_T *g,
+ NCURSES_COLOR_T *b)
+{
+ int my_r, my_g, my_b;
+ int rc = _nc_color_content(SP_PARM, color, &my_r, &my_g, &my_b);
+ if (rc == OK) {
+ *r = limit_COLOR(my_r);
+ *g = limit_COLOR(my_g);
+ *b = limit_COLOR(my_b);
+ }
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+color_content(NCURSES_COLOR_T color,
+ NCURSES_COLOR_T *r,
+ NCURSES_COLOR_T *g,
+ NCURSES_COLOR_T *b)
+{
+ return NCURSES_SP_NAME(color_content) (CURRENT_SCREEN, color, r, g, b);
+}
+#endif
+
+NCURSES_EXPORT(int)
+_nc_pair_content(SCREEN *sp, int pair, int *f, int *b)
+{
+ int result;
+
+ T((T_CALLED("pair_content(%p,%d,%p,%p)"),
+ (void *) sp,
+ (int) pair,
+ (void *) f,
+ (void *) b));
+
+ if (!ValidPair(sp, pair)) {
+ result = ERR;
+ } else {
+ int fg;
+ int bg;
+
+ ReservePairs(sp, pair);
+ fg = FORE_OF(sp->_color_pairs[pair]);
+ bg = BACK_OF(sp->_color_pairs[pair]);
+#if NCURSES_EXT_FUNCS
+ if (isDefaultColor(fg))
+ fg = -1;
+ if (isDefaultColor(bg))
+ bg = -1;
+#endif
+
+ if (f)
+ *f = fg;
+ if (b)
+ *b = bg;
+
+ TR(TRACE_ATTRS, ("...pair_content(%p,%d,%d,%d)",
+ (void *) sp,
+ (int) pair,
+ (int) fg, (int) bg));
+ result = OK;
+ }
+ returnCode(result);
+}
+
+NCURSES_EXPORT(int)
+NCURSES_SP_NAME(pair_content) (NCURSES_SP_DCLx
+ NCURSES_PAIRS_T pair,
+ NCURSES_COLOR_T *f,
+ NCURSES_COLOR_T *b)
+{
+ int my_f, my_b;
+ int rc = _nc_pair_content(SP_PARM, pair, &my_f, &my_b);
+ if (rc == OK) {
+ *f = limit_COLOR(my_f);
+ *b = limit_COLOR(my_b);
+ }
+ return rc;
+}
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+pair_content(NCURSES_COLOR_T pair, NCURSES_COLOR_T *f, NCURSES_COLOR_T *b)
+{
+ return NCURSES_SP_NAME(pair_content) (CURRENT_SCREEN, pair, f, b);
+}
+#endif
+
+NCURSES_EXPORT(void)
+NCURSES_SP_NAME(_nc_do_color) (NCURSES_SP_DCLx
+ int old_pair,
+ int pair,
+ int reverse,
+ NCURSES_SP_OUTC outc)
+{
+#ifdef USE_TERM_DRIVER
+ CallDriver_4(SP_PARM, td_docolor, old_pair, pair, reverse, outc);
+#else
+ int fg = COLOR_DEFAULT;
+ int bg = COLOR_DEFAULT;
+ int old_fg = -1;
+ int old_bg = -1;
+
+ if (!ValidPair(SP_PARM, pair)) {
+ return;
+ } else if (pair != 0) {
+ if (set_color_pair) {