19a7523dpeter/****************************************************************************
201cf73abapt * Copyright 2020 Thomas E. Dickey                                          *
301cf73abapt * Copyright 2002-2009,2016 Free Software Foundation, Inc.                  *
49a7523dpeter *                                                                          *
59a7523dpeter * Permission is hereby granted, free of charge, to any person obtaining a  *
69a7523dpeter * copy of this software and associated documentation files (the            *
79a7523dpeter * "Software"), to deal in the Software without restriction, including      *
89a7523dpeter * without limitation the rights to use, copy, modify, merge, publish,      *
99a7523dpeter * distribute, distribute with modifications, sublicense, and/or sell       *
109a7523dpeter * copies of the Software, and to permit persons to whom the Software is    *
119a7523dpeter * furnished to do so, subject to the following conditions:                 *
129a7523dpeter *                                                                          *
139a7523dpeter * The above copyright notice and this permission notice shall be included  *
149a7523dpeter * in all copies or substantial portions of the Software.                   *
159a7523dpeter *                                                                          *
169a7523dpeter * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS  *
179a7523dpeter * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF               *
189a7523dpeter * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.   *
199a7523dpeter * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,   *
209a7523dpeter * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR    *
219a7523dpeter * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR    *
229a7523dpeter * THE USE OR OTHER DEALINGS IN THE SOFTWARE.                               *
239a7523dpeter *                                                                          *
249a7523dpeter * Except as contained in this notice, the name(s) of the above copyright   *
259a7523dpeter * holders shall not be used in advertising or otherwise to promote the     *
269a7523dpeter * sale, use or other dealings in this Software without prior written       *
279a7523dpeter * authorization.                                                           *
289a7523dpeter ****************************************************************************/
299a7523dpeter
309a7523dpeter/****************************************************************************
31de9cbefrafan * Author: Thomas Dickey                                                    *
329a7523dpeter ****************************************************************************/
339a7523dpeter
349a7523dpeter/*
359a7523dpeter**	lib_in_wch.c
369a7523dpeter**
379a7523dpeter**	The routine win_wch().
389a7523dpeter**
399a7523dpeter*/
409a7523dpeter
419a7523dpeter#include <curses.priv.h>
429a7523dpeter
4301cf73abaptMODULE_ID("$Id: lib_in_wch.c,v 1.7 2020/02/02 23:34:34 tom Exp $")
449a7523dpeter
459a7523dpeterNCURSES_EXPORT(int)
46de9cbefrafanwin_wch(WINDOW *win, cchar_t *wcval)
479a7523dpeter{
489a7523dpeter    int code = OK;
499a7523dpeter
501034bfcdelphij    TR(TRACE_CCALLS, (T_CALLED("win_wch(%p,%p)"), (void *) win, (void *) wcval));
51f52ca6ebapt
529a7523dpeter    if (win != 0
539a7523dpeter	&& wcval != 0) {
54f52ca6ebapt	int row, col;
55f52ca6ebapt
569a7523dpeter	getyx(win, row, col);
579a7523dpeter
589a7523dpeter	*wcval = win->_line[row].text[col];
59de9cbefrafan	TR(TRACE_CCALLS, ("data %s", _tracecchar_t(wcval)));
609a7523dpeter    } else {
619a7523dpeter	code = ERR;
629a7523dpeter    }
63de9cbefrafan    TR(TRACE_CCALLS, (T_RETURN("%d"), code));
64de9cbefrafan    return (code);
659a7523dpeter}
66