lib_colorset.c revision 76726
1255570Strasz/****************************************************************************
2255570Strasz * Copyright (c) 1998,2000 Free Software Foundation, Inc.                   *
3255570Strasz *                                                                          *
4255570Strasz * Permission is hereby granted, free of charge, to any person obtaining a  *
5255570Strasz * copy of this software and associated documentation files (the            *
6255570Strasz * "Software"), to deal in the Software without restriction, including      *
7255570Strasz * without limitation the rights to use, copy, modify, merge, publish,      *
8255570Strasz * distribute, distribute with modifications, sublicense, and/or sell       *
9255570Strasz * copies of the Software, and to permit persons to whom the Software is    *
10255570Strasz * furnished to do so, subject to the following conditions:                 *
11255570Strasz *                                                                          *
12255570Strasz * The above copyright notice and this permission notice shall be included  *
13255570Strasz * in all copies or substantial portions of the Software.                   *
14255570Strasz *                                                                          *
15255570Strasz * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
16255570Strasz * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
17255570Strasz * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
18255570Strasz * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
19255570Strasz * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
20255570Strasz * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
21255570Strasz * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
22255570Strasz *                                                                          *
23255570Strasz * Except as contained in this notice, the name(s) of the above copyright   *
24255570Strasz * holders shall not be used in advertising or otherwise to promote the     *
25255570Strasz * sale, use or other dealings in this Software without prior written       *
26255570Strasz * authorization.                                                           *
27255570Strasz ****************************************************************************/
28255570Strasz
29255570Strasz/****************************************************************************
30255570Strasz *  Author: Juergen Pfeifer <juergen.pfeifer@gmx.net> 1998                  *
31255570Strasz ****************************************************************************/
32255570Strasz
33255570Strasz/*
34255570Strasz**	lib_colorset.c
35255570Strasz**
36255570Strasz**	The routine wcolor_set().
37255570Strasz**
38255570Strasz*/
39255570Strasz
40255570Strasz#include <curses.priv.h>
41255570Strasz#include <ctype.h>
42255570Strasz
43255570StraszMODULE_ID("$Id: lib_colorset.c,v 1.7 2000/12/10 01:24:50 tom Exp $")
44255570Strasz
45255570StraszNCURSES_EXPORT(int)
46255570Straszwcolor_set
47255570Strasz(WINDOW *win, short color_pair_number, void *opts)
48255570Strasz{
49255570Strasz    T((T_CALLED("wcolor_set(%p,%d)"), win, color_pair_number));
50255570Strasz    if (win
51255570Strasz	&& !opts
52255570Strasz	&& (color_pair_number >= 0)
53255570Strasz	&& (color_pair_number < COLOR_PAIRS)) {
54255570Strasz	TR(TRACE_ATTRS, ("... current %ld", (long) PAIR_NUMBER(win->_attrs)));
55255570Strasz	toggle_attr_on(win->_attrs, COLOR_PAIR(color_pair_number));
56255570Strasz	returnCode(OK);
57255570Strasz    } else
58255570Strasz	returnCode(ERR);
59255570Strasz}
60263724Strasz