GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libcurses/base/lib_printw.c Lines: 0 22 0.0 %
Date: 2016-12-06 Branches: 0 6 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: lib_printw.c,v 1.3 2010/01/12 23:22:06 nicm Exp $ */
2
3
/****************************************************************************
4
 * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc.              *
5
 *                                                                          *
6
 * Permission is hereby granted, free of charge, to any person obtaining a  *
7
 * copy of this software and associated documentation files (the            *
8
 * "Software"), to deal in the Software without restriction, including      *
9
 * without limitation the rights to use, copy, modify, merge, publish,      *
10
 * distribute, distribute with modifications, sublicense, and/or sell       *
11
 * copies of the Software, and to permit persons to whom the Software is    *
12
 * furnished to do so, subject to the following conditions:                 *
13
 *                                                                          *
14
 * The above copyright notice and this permission notice shall be included  *
15
 * in all copies or substantial portions of the Software.                   *
16
 *                                                                          *
17
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
18
 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
19
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
20
 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
21
 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
22
 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
23
 * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
24
 *                                                                          *
25
 * Except as contained in this notice, the name(s) of the above copyright   *
26
 * holders shall not be used in advertising or otherwise to promote the     *
27
 * sale, use or other dealings in this Software without prior written       *
28
 * authorization.                                                           *
29
 ****************************************************************************/
30
31
/****************************************************************************
32
 *  Author: Thomas E. Dickey <dickey@clark.net> 1997                        *
33
 ****************************************************************************/
34
35
/*
36
**	lib_printw.c
37
**
38
**	The routines printw(), wprintw() and friends.
39
**
40
*/
41
42
#include <curses.priv.h>
43
44
MODULE_ID("$Id: lib_printw.c,v 1.3 2010/01/12 23:22:06 nicm Exp $")
45
46
NCURSES_EXPORT(int)
47
printw(const char *fmt,...)
48
{
49
    va_list argp;
50
    int code;
51
52
#ifdef TRACE
53
    va_start(argp, fmt);
54
    T((T_CALLED("printw(%s%s)"),
55
       _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
56
    va_end(argp);
57
#endif
58
59
    va_start(argp, fmt);
60
    code = vwprintw(stdscr, fmt, argp);
61
    va_end(argp);
62
63
    returnCode(code);
64
}
65
66
NCURSES_EXPORT(int)
67
wprintw(WINDOW *win, const char *fmt,...)
68
{
69
    va_list argp;
70
    int code;
71
72
#ifdef TRACE
73
    va_start(argp, fmt);
74
    T((T_CALLED("wprintw(%p,%s%s)"),
75
       win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
76
    va_end(argp);
77
#endif
78
79
    va_start(argp, fmt);
80
    code = vwprintw(win, fmt, argp);
81
    va_end(argp);
82
83
    returnCode(code);
84
}
85
86
NCURSES_EXPORT(int)
87
mvprintw(int y, int x, const char *fmt,...)
88
{
89
    va_list argp;
90
    int code;
91
92
#ifdef TRACE
93
    va_start(argp, fmt);
94
    T((T_CALLED("mvprintw(%d,%d,%s%s)"),
95
       y, x, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
96
    va_end(argp);
97
#endif
98
99
    if ((code = move(y, x)) != ERR) {
100
	va_start(argp, fmt);
101
	code = vwprintw(stdscr, fmt, argp);
102
	va_end(argp);
103
    }
104
    returnCode(code);
105
}
106
107
NCURSES_EXPORT(int)
108
mvwprintw(WINDOW *win, int y, int x, const char *fmt,...)
109
{
110
    va_list argp;
111
    int code;
112
113
#ifdef TRACE
114
    va_start(argp, fmt);
115
    T((T_CALLED("mvwprintw(%d,%d,%p,%s%s)"),
116
       y, x, win, _nc_visbuf(fmt), _nc_varargs(fmt, argp)));
117
    va_end(argp);
118
#endif
119
120
    if ((code = wmove(win, y, x)) != ERR) {
121
	va_start(argp, fmt);
122
	code = vwprintw(win, fmt, argp);
123
	va_end(argp);
124
    }
125
    returnCode(code);
126
}
127
128
NCURSES_EXPORT(int)
129
vwprintw(WINDOW *win, const char *fmt, va_list argp)
130
{
131
    char *buf;
132
    int code = ERR;
133
134
    T((T_CALLED("vwprintw(%p,%s,va_list)"), win, _nc_visbuf(fmt)));
135
136
    if ((buf = _nc_printf_string(fmt, argp)) != 0) {
137
	code = waddstr(win, buf);
138
    }
139
    returnCode(code);
140
}