mirror of
https://git.zap.org.au/git/trader.git
synced 2024-11-03 17:27:29 -05:00
Remove the superfluous argument attr_end from attrpr()
Instead of using attr_end, simply restore the old window attributes after printing the string.
This commit is contained in:
parent
5e912e6e14
commit
1995a6a7b0
15
src/intf.c
15
src/intf.c
@ -353,29 +353,30 @@ int center (WINDOW *win, int y, const bool clrline, const char *format, ...)
|
|||||||
/*-----------------------------------------------------------------------
|
/*-----------------------------------------------------------------------
|
||||||
Function: attrpr - Print a string with special attributes
|
Function: attrpr - Print a string with special attributes
|
||||||
Arguments: win - Window to use
|
Arguments: win - Window to use
|
||||||
attr_start - Attribute to set at the start of wprintw()
|
attr - Attribute to use for the string
|
||||||
attr_end - Attribute to set at the end of wprintw()
|
|
||||||
format - printf()-like format string
|
format - printf()-like format string
|
||||||
... - printf()-like arguments
|
... - printf()-like arguments
|
||||||
Returns: int - Return code from wprintw()
|
Returns: int - Return code from wprintw()
|
||||||
|
|
||||||
This function sets the window attribute to attr_start, then prints the
|
This function sets the window attributes to attr, then prints the given
|
||||||
given string (using wprintw()), then sets the attribute to attr_end.
|
string (using wprintw()), then restores the previous window attributes.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int attrpr (WINDOW *win, int attr_start, int attr_end, const char *format, ...)
|
int attrpr (WINDOW *win, int attr, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
int oldattr;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
|
||||||
wattrset(win, attr_start);
|
oldattr = getbkgd(win) & ~A_CHARTEXT;
|
||||||
|
wattrset(win, attr);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
ret = vwprintw(win, format, args);
|
ret = vwprintw(win, format, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
wattrset(win, attr_end);
|
wattrset(win, oldattr);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -117,9 +117,8 @@ extern int center (WINDOW *win, int y, const bool clrline,
|
|||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
__attribute__((format (printf, 4, 5)));
|
__attribute__((format (printf, 4, 5)));
|
||||||
|
|
||||||
extern int attrpr (WINDOW *win, int attr_start, int attr_end,
|
extern int attrpr (WINDOW *win, int attr, const char *format, ...)
|
||||||
const char *format, ...)
|
__attribute__((format (printf, 3, 4)));
|
||||||
__attribute__((format (printf, 4, 5)));
|
|
||||||
|
|
||||||
// Input routines
|
// Input routines
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user