diff options
author | ngie <ngie@FreeBSD.org> | 2014-10-02 23:26:49 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2014-10-02 23:26:49 +0000 |
commit | 3f09b8d0af642c2aeb96a4d667cefb7fe3bce443 (patch) | |
tree | 544932e2a2c5a5a202b752beefba0b3e327b3858 /contrib/netbsd-tests/lib/libcurses/slave | |
parent | b941fec92da62b0eab650295f4e8a381dbbc04b4 (diff) | |
parent | e1f2d32c0e0678782c353c48364cddedfae58b0a (diff) | |
download | FreeBSD-src-3f09b8d0af642c2aeb96a4d667cefb7fe3bce443.zip FreeBSD-src-3f09b8d0af642c2aeb96a4d667cefb7fe3bce443.tar.gz |
Import the NetBSD test suite from ^/vendor/NetBSD/tests/09.30.2014_20.45 ,
minus the vendor Makefiles
Provide directions for how to bootstrap the vendor sources in
FREEBSD-upgrade
MFC after 2 weeks
Discussed with: rpaulo
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'contrib/netbsd-tests/lib/libcurses/slave')
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/command_table.h | 397 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/commands.c | 243 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/curses_commands.c | 7165 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/curses_commands.h | 422 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/slave.c | 177 | ||||
-rw-r--r-- | contrib/netbsd-tests/lib/libcurses/slave/slave.h | 50 |
6 files changed, 8454 insertions, 0 deletions
diff --git a/contrib/netbsd-tests/lib/libcurses/slave/command_table.h b/contrib/netbsd-tests/lib/libcurses/slave/command_table.h new file mode 100644 index 0000000..ef57a00 --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/command_table.h @@ -0,0 +1,397 @@ +/* $NetBSD: command_table.h,v 1.3 2011/09/15 11:46:19 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#ifndef _COMMAND_TABLE_H_ +#define _COMMAND_TABLE_H_ + +#include "curses_commands.h" + +/* + * Curses commands + */ +struct command_def commands[] = { + {"DRAIN", cmd_DRAIN}, + {"addbytes", cmd_addbytes}, + {"addch", cmd_addch}, + {"addchnstr", cmd_addchnstr}, + {"addchstr", cmd_addchstr}, + {"addnstr", cmd_addnstr}, + {"addstr", cmd_addstr}, + {"attr_get", cmd_attr_get}, + {"attr_off", cmd_attr_off}, + {"attr_on", cmd_attr_on}, + {"attr_set", cmd_attr_set}, + {"attroff", cmd_attroff}, + {"attron", cmd_attron}, + {"attrset", cmd_attrset}, + {"bkgd", cmd_bkgd}, + {"bkgdset", cmd_bkgdset}, + {"border", cmd_border}, + {"clear", cmd_clear}, + {"clrtobot", cmd_clrtobot}, + {"clrtoeol", cmd_clrtoeol}, + {"color_set", cmd_color_set}, + {"delch", cmd_delch}, + {"deleteln", cmd_deleteln}, + {"echochar", cmd_echochar}, + {"erase", cmd_erase}, + {"getch", cmd_getch}, + {"getnstr", cmd_getnstr}, + {"getstr", cmd_getstr}, + {"inch", cmd_inch}, + {"inchnstr", cmd_inchnstr}, + {"inchstr", cmd_inchstr}, + {"innstr", cmd_innstr}, + {"insch", cmd_insch}, + {"insdelln", cmd_insdelln}, + {"insertln", cmd_insertln}, + {"instr", cmd_instr}, + {"move", cmd_move}, + {"refresh", cmd_refresh}, + {"scrl", cmd_scrl}, + {"setscrreg", cmd_setscrreg}, + {"standend", cmd_standend}, + {"standout", cmd_standout}, + {"timeout", cmd_timeout}, + {"underscore", cmd_underscore}, + {"underend", cmd_underend}, + {"waddbytes", cmd_waddbytes}, + {"waddstr", cmd_waddstr}, + {"mvaddbytes", cmd_mvaddbytes}, + {"mvaddch", cmd_mvaddch}, + {"mvaddchnstr", cmd_mvaddchnstr}, + {"mvaddchstr", cmd_mvaddchstr}, + {"mvaddnstr", cmd_mvaddnstr}, + {"mvaddstr", cmd_mvaddstr}, + {"mvdelch", cmd_mvdelch}, + {"mvgetch", cmd_mvgetch}, + {"mvgetnstr", cmd_mvgetnstr}, + {"mvgetstr", cmd_mvgetstr}, + {"mvinch", cmd_mvinch}, + {"mvinchnstr", cmd_mvinchnstr}, + {"mvinchstr", cmd_mvinchstr}, + {"mvinnstr", cmd_mvinnstr}, + {"mvinsch", cmd_mvinsch}, + {"mvinstr", cmd_mvinstr}, + {"mvwaddbytes", cmd_mvwaddbytes}, + {"mvwaddch", cmd_mvwaddch}, + {"mvwaddchnstr", cmd_mvwaddchnstr}, + {"mvwaddchstr", cmd_mvwaddchstr}, + {"mvwaddnstr", cmd_mvwaddnstr}, + {"mvwaddstr", cmd_mvwaddstr}, + {"mvwdelch", cmd_mvwdelch}, + {"mvwgetch", cmd_mvwgetch}, + {"mvwgetnstr", cmd_mvwgetnstr}, + {"mvwgetstr", cmd_mvwgetstr}, + {"mvwinch", cmd_mvwinch}, + {"mvwinsch", cmd_mvwinsch}, + {"assume_default_colors", cmd_assume_default_colors}, + {"baudrate", cmd_baudrate}, + {"beep", cmd_beep}, + {"box", cmd_box}, + {"can_change_color", cmd_can_change_color}, + {"cbreak", cmd_cbreak}, + {"clearok", cmd_clearok}, + {"color_content", cmd_color_content}, + {"copywin", cmd_copywin}, + {"curs_set", cmd_curs_set}, + {"def_prog_mode", cmd_def_prog_mode}, + {"def_shell_mode", cmd_def_shell_mode}, + {"define_key", cmd_define_key}, + {"delay_output", cmd_delay_output}, + {"delscreen", cmd_delscreen}, + {"delwin", cmd_delwin}, + {"derwin", cmd_derwin}, + {"dupwin", cmd_dupwin}, + {"doupdate", cmd_doupdate}, + {"echo", cmd_echo}, + {"endwin", cmd_endwin}, + {"erasechar", cmd_erasechar}, + {"flash", cmd_flash}, + {"flushinp", cmd_flushinp}, + {"flushok", cmd_flushok}, + {"fullname", cmd_fullname}, + {"getattrs", cmd_getattrs}, + {"getbkgd", cmd_getbkgd}, + {"getcury", cmd_getcury}, + {"getcurx", cmd_getcurx}, + {"getyx", cmd_getyx}, + {"getbegy", cmd_getbegy}, + {"getbegx", cmd_getbegx}, + {"getmaxy", cmd_getmaxy}, + {"getmaxx", cmd_getmaxx}, + {"getpary", cmd_getpary}, + {"getparx", cmd_getparx}, + {"getparyx", cmd_getparyx}, + {"gettmode", cmd_gettmode}, + {"getwin", cmd_getwin}, + {"halfdelay", cmd_halfdelay}, + {"has_colors", cmd_has_colors}, + {"has_ic", cmd_has_ic}, + {"has_il", cmd_has_il}, + {"hline", cmd_hline}, + {"idcok", cmd_idcok}, + {"idlok", cmd_idlok}, + {"init_color", cmd_init_color}, + {"init_pair", cmd_init_pair}, + {"initscr", cmd_initscr}, + {"intrflush", cmd_intrflush}, + {"isendwin", cmd_isendwin}, + {"is_linetouched", cmd_is_linetouched}, + {"is_wintouched", cmd_is_wintouched}, + {"keyok", cmd_keyok}, + {"keypad", cmd_keypad}, + {"keyname", cmd_keyname}, + {"killchar", cmd_killchar}, + {"leaveok", cmd_leaveok}, + {"meta", cmd_meta}, + {"mvcur", cmd_mvcur}, + {"mvderwin", cmd_mvderwin}, + {"mvhline", cmd_mvhline}, + {"mvprintw", cmd_mvprintw}, + {"mvscanw", cmd_mvscanw}, + {"mvvline", cmd_mvvline}, + {"mvwhline", cmd_mvwhline}, + {"mvwvline", cmd_mvwvline}, + {"mvwin", cmd_mvwin}, + {"mvwinchnstr", cmd_mvwinchnstr}, + {"mvwinchstr", cmd_mvwinchstr}, + {"mvwinnstr", cmd_mvwinnstr}, + {"mvwinstr", cmd_mvwinstr}, + {"mvwprintw", cmd_mvwprintw}, + {"mvwscanw", cmd_mvwscanw}, + {"napms", cmd_napms}, + {"newpad", cmd_newpad}, + {"newterm", cmd_newterm}, + {"newwin", cmd_newwin}, + {"nl", cmd_nl}, + {"no_color_attributes", cmd_no_color_attributes}, + {"nocbreak", cmd_nocbreak}, + {"nodelay", cmd_nodelay}, + {"noecho", cmd_noecho}, + {"nonl", cmd_nonl}, + {"noqiflush", cmd_noqiflush}, + {"noraw", cmd_noraw}, + {"notimeout", cmd_notimeout}, + {"overlay", cmd_overlay}, + {"overwrite", cmd_overwrite}, + {"pair_content", cmd_pair_content}, + {"pechochar", cmd_pechochar}, + {"pnoutrefresh", cmd_pnoutrefresh}, + {"prefresh", cmd_prefresh}, + {"printw", cmd_printw}, + {"putwin", cmd_putwin}, + {"qiflush", cmd_qiflush}, + {"raw", cmd_raw}, + {"redrawwin", cmd_redrawwin}, + {"reset_prog_mode", cmd_reset_prog_mode}, + {"reset_shell_mode", cmd_reset_shell_mode}, + {"resetty", cmd_resetty}, + {"resizeterm", cmd_resizeterm}, + {"savetty", cmd_savetty}, + {"scanw", cmd_scanw}, + {"scroll", cmd_scroll}, + {"scrollok", cmd_scrollok}, + {"setterm", cmd_setterm}, + {"set_term", cmd_set_term}, + {"start_color", cmd_start_color}, + {"subpad", cmd_subpad}, + {"subwin", cmd_subwin}, + {"termattrs", cmd_termattrs}, + {"term_attrs", cmd_term_attrs}, + {"touchline", cmd_touchline}, + {"touchoverlap", cmd_touchoverlap}, + {"touchwin", cmd_touchwin}, + {"ungetch", cmd_ungetch}, + {"untouchwin", cmd_untouchwin}, + {"use_default_colors", cmd_use_default_colors}, + {"vline", cmd_vline}, + {"vw_printw", cmd_vw_printw}, + {"vw_scanw", cmd_vw_scanw}, + {"vwprintw", cmd_vwprintw}, + {"vwscanw", cmd_vwscanw}, + {"waddch", cmd_waddch}, + {"waddchnstr", cmd_waddchnstr}, + {"waddchstr", cmd_waddchstr}, + {"waddnstr", cmd_waddnstr}, + {"wattr_get", cmd_wattr_get}, + {"wattr_off", cmd_wattr_off}, + {"wattr_on", cmd_wattr_on}, + {"wattr_set", cmd_wattr_set}, + {"wattroff", cmd_wattroff}, + {"wattron", cmd_wattron}, + {"wattrset", cmd_wattrset}, + {"wbkgd", cmd_wbkgd}, + {"wbkgdset", cmd_wbkgdset}, + {"wborder", cmd_wborder}, + {"wclear", cmd_wclear}, + {"wclrtobot", cmd_wclrtobot}, + {"wclrtoeol", cmd_wclrtoeol}, + {"wcolor_set", cmd_wcolor_set}, + {"wdelch", cmd_wdelch}, + {"wdeleteln", cmd_wdeleteln}, + {"wechochar", cmd_wechochar}, + {"werase", cmd_werase}, + {"wgetch", cmd_wgetch}, + {"wgetnstr", cmd_wgetnstr}, + {"wgetstr", cmd_wgetstr}, + {"whline", cmd_whline}, + {"winch", cmd_winch}, + {"winchnstr", cmd_winchnstr}, + {"winchstr", cmd_winchstr}, + {"winnstr", cmd_winnstr}, + {"winsch", cmd_winsch}, + {"winsdelln", cmd_winsdelln}, + {"winsertln", cmd_winsertln}, + {"winstr", cmd_winstr}, + {"wmove", cmd_wmove}, + {"wnoutrefresh", cmd_wnoutrefresh}, + {"wprintw", cmd_wprintw}, + {"wredrawln", cmd_wredrawln}, + {"wrefresh", cmd_wrefresh}, + {"wresize", cmd_wresize}, + {"wscanw", cmd_wscanw}, + {"wscrl", cmd_wscrl}, + {"wsetscrreg", cmd_wsetscrreg}, + {"wstandend", cmd_wstandend}, + {"wstandout", cmd_wstandout}, + {"wtimeout", cmd_wtimeout}, + {"wtouchln", cmd_wtouchln}, + {"wunderend", cmd_wunderend}, + {"wunderscore", cmd_wunderscore}, + {"wvline", cmd_wvline}, + {"insnstr", cmd_insnstr}, + {"insstr", cmd_insstr}, + {"mvinsnstr", cmd_mvinsnstr}, + {"mvinsstr", cmd_mvinsstr}, + {"mvwinsnstr", cmd_mvwinsnstr}, + {"mvwinsstr", cmd_mvwinsstr}, + {"winsnstr", cmd_winsnstr}, + {"winsstr", cmd_winsstr}, + {"chgat", cmd_chgat}, + {"wchgat", cmd_wchgat}, + {"mvchgat", cmd_mvchgat}, + {"mvwchgat", cmd_mvwchgat}, + {"add_wch", cmd_add_wch}, + {"wadd_wch", cmd_wadd_wch}, + {"mvadd_wch", cmd_mvadd_wch}, + {"mvwadd_wch", cmd_mvwadd_wch}, + {"add_wchnstr", cmd_add_wchnstr}, + {"add_wchstr", cmd_add_wchstr}, + {"wadd_wchnstr", cmd_wadd_wchnstr}, + {"wadd_wchstr", cmd_wadd_wchstr}, + {"mvadd_wchnstr", cmd_mvadd_wchnstr}, + {"mvadd_wchstr", cmd_mvadd_wchstr}, + {"mvwadd_wchnstr", cmd_mvwadd_wchnstr}, + {"mvwadd_wchstr", cmd_mvwadd_wchstr}, + {"addnwstr", cmd_addnwstr}, + {"addwstr", cmd_addwstr}, + {"mvaddnwstr", cmd_mvaddnwstr}, + {"mvaddwstr", cmd_mvaddwstr}, + {"mvwaddnwstr", cmd_mvwaddnwstr}, + {"mvwaddwstr", cmd_mvwaddwstr}, + {"waddnwstr", cmd_waddnwstr}, + {"waddwstr", cmd_waddwstr}, + {"echo_wchar", cmd_echo_wchar}, + {"wecho_wchar", cmd_wecho_wchar}, + {"pecho_wchar", cmd_pecho_wchar}, + {"ins_wch", cmd_ins_wch}, + {"wins_wch", cmd_wins_wch}, + {"mvins_wch", cmd_mvins_wch}, + {"mvwins_wch", cmd_mvwins_wch}, + {"ins_nwstr", cmd_ins_nwstr}, + {"ins_wstr", cmd_ins_wstr}, + {"mvins_nwstr", cmd_mvins_nwstr}, + {"mvins_wstr", cmd_mvins_wstr}, + {"mvwins_nwstr", cmd_mvwins_nwstr}, + {"mvwins_wstr", cmd_mvwins_wstr}, + {"wins_nwstr", cmd_wins_nwstr}, + {"wins_wstr", cmd_wins_wstr}, + {"get_wch", cmd_get_wch}, + {"unget_wch", cmd_unget_wch}, + {"mvget_wch", cmd_mvget_wch}, + {"mvwget_wch", cmd_mvwget_wch}, + {"wget_wch", cmd_wget_wch}, + {"getn_wstr", cmd_getn_wstr}, + {"get_wstr", cmd_get_wstr}, + {"mvgetn_wstr", cmd_mvgetn_wstr}, + {"mvget_wstr", cmd_mvget_wstr}, + {"mvwgetn_wstr", cmd_mvwgetn_wstr}, + {"mvwget_wstr", cmd_mvwget_wstr}, + {"wgetn_wstr", cmd_wgetn_wstr}, + {"wget_wstr", cmd_wget_wstr}, + {"in_wch", cmd_in_wch}, + {"mvin_wch", cmd_mvin_wch}, + {"mvwin_wch", cmd_mvwin_wch}, + {"win_wch", cmd_win_wch}, + {"in_wchnstr", cmd_in_wchnstr}, + {"in_wchstr", cmd_in_wchstr}, + {"mvin_wchnstr", cmd_mvin_wchnstr}, + {"mvin_wchstr", cmd_mvin_wchstr}, + {"mvwin_wchnstr", cmd_mvwin_wchnstr}, + {"mvwin_wchstr", cmd_mvwin_wchstr}, + {"win_wchnstr", cmd_win_wchnstr}, + {"win_wchstr", cmd_win_wchstr}, + {"innwstr", cmd_innwstr}, + {"inwstr", cmd_inwstr}, + {"mvinnwstr", cmd_mvinnwstr}, + {"mvinwstr", cmd_mvinwstr}, + {"mvwinnwstr", cmd_mvwinnwstr}, + {"mvwinwstr", cmd_mvwinwstr}, + {"winnwstr", cmd_winnwstr}, + {"winwstr", cmd_winwstr}, + {"setcchar", cmd_setcchar}, + {"getcchar", cmd_getcchar}, + {"key_name", cmd_key_name}, + {"border_set", cmd_border_set}, + {"wborder_set", cmd_wborder_set}, + {"box_set", cmd_box_set}, + {"erasewchar", cmd_erasewchar}, + {"killwchar", cmd_killwchar}, + {"hline_set", cmd_hline_set}, + {"mvhline_set", cmd_mvhline_set}, + {"mvvline_set", cmd_mvvline_set}, + {"mvwhline_set", cmd_mvwhline_set}, + {"mvwvline_set", cmd_mvwvline_set}, + {"vline_set", cmd_vline_set}, + {"whline_set", cmd_whline_set}, + {"wvline_set", cmd_wvline_set}, + {"bkgrnd", cmd_bkgrnd}, + {"bkgrndset", cmd_bkgrndset}, + {"getbkgrnd", cmd_getbkgrnd}, + {"wbkgrnd", cmd_wbkgrnd}, + {"wbkgrndset", cmd_wbkgrndset}, + {"wgetbkgrnd", cmd_wgetbkgrnd}, +}; + +size_t ncmds = sizeof(commands) / sizeof(struct command_def); + +#endif /* _COMMAND_TABLE_H */ diff --git a/contrib/netbsd-tests/lib/libcurses/slave/commands.c b/contrib/netbsd-tests/lib/libcurses/slave/commands.c new file mode 100644 index 0000000..2f26024 --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/commands.c @@ -0,0 +1,243 @@ +/* $NetBSD: commands.c,v 1.4 2011/09/15 11:46:19 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include <curses.h> +#include <string.h> +#include <stdlib.h> +#include <stdio.h> +#include <unistd.h> +#include <err.h> +#include <sys/types.h> +#include "returns.h" +#include "slave.h" +#include "command_table.h" + +extern int cmdpipe[2]; +extern int slvpipe[2]; + +static void report_type(returns_enum_t); +static void report_message(int, const char *); + +/* + * Match the passed command string and execute the associated test + * function. + */ +void +command_execute(char *func, int nargs, char **args) +{ + size_t i; + + i = 0; + while (i < ncmds) { + if (strcasecmp(func, commands[i].name) == 0) { + /* matched function */ + commands[i].func(nargs, args); + return; + } + i++; + } + + report_status("UNKNOWN_FUNCTION"); +} + +/* + * Report an pointer value back to the director + */ +void +report_ptr(void *ptr) +{ + char *string; + + if (ptr == NULL) + asprintf(&string, "NULL"); + else + asprintf(&string, "%p", ptr); + report_status(string); + free(string); +} + +/* + * Report an integer value back to the director + */ +void +report_int(int value) +{ + char *string; + + asprintf(&string, "%d", value); + report_status(string); + free(string); +} + +/* + * Report either an ERR or OK back to the director + */ +void +report_return(int status) +{ + if (status == ERR) + report_type(ret_err); + else if (status == OK) + report_type(ret_ok); + else + report_status("INVALID_RETURN"); +} + +/* + * Report the type back to the director via the command pipe + */ +static void +report_type(returns_enum_t return_type) +{ + int type; + + type = return_type; + if (write(slvpipe[WRITE_PIPE], &type, sizeof(int)) < 0) + err(1, "command pipe write for status type failed"); + +} + +/* + * Report the number of returns back to the director via the command pipe + */ +void +report_count(int count) +{ + int type; + + type = ret_count; + if (write(slvpipe[WRITE_PIPE], &type, sizeof(int)) < 0) + err(1, "command pipe write for count type failed"); + + if (write(slvpipe[WRITE_PIPE], &count, sizeof(int)) < 0) + err(1, "command pipe write for count"); +} + +/* + * Report the status back to the director via the command pipe + */ +void +report_status(const char *status) +{ + report_message(ret_string, status); +} + +/* + * Report an error message back to the director via the command pipe. + */ +void +report_error(const char *status) +{ + report_message(ret_slave_error, status); +} + +/* + * Report the message with the given type back to the director via the + * command pipe. + */ +static void +report_message(int type, const char *status) +{ + int len; + + len = strlen(status); + + if (write(slvpipe[WRITE_PIPE], &type, sizeof(int)) < 0) + err(1, "command pipe write for message type failed"); + + if (write(slvpipe[WRITE_PIPE], &len, sizeof(int)) < 0) + err(1, "command pipe write for message length failed"); + + if (write(slvpipe[WRITE_PIPE], status, len) < 0) + err(1, "command pipe write of message data failed"); +} + +/* + * Report a string of chtype back to the director via the command pipe. + */ +void +report_byte(chtype c) +{ + chtype string[2]; + + string[0] = c; + string[1] = A_NORMAL | '\0'; + report_nstr(string); +} + +/* + * Report a string of chtype back to the director via the command pipe. + */ +void +report_nstr(chtype *string) +{ + int len, type; + chtype *p; + + len = 0; + p = string; + + while ((*p++ & __CHARTEXT) != 0) { + len++; + } + + len++; /* add in the termination chtype */ + len *= sizeof(chtype); + + type = ret_byte; + if (write(slvpipe[WRITE_PIPE], &type, sizeof(int)) < 0) + err(1, "%s: command pipe write for status type failed", + __func__); + + if (write(slvpipe[WRITE_PIPE], &len, sizeof(int)) < 0) + err(1, "%s: command pipe write for status length failed", + __func__); + + if (write(slvpipe[WRITE_PIPE], string, len) < 0) + err(1, "%s: command pipe write of status data failed", + __func__); +} + +/* + * Check the number of args we received are what we expect. Return an + * error if they do not match. + */ +int +check_arg_count(int nargs, int expected) +{ + if (nargs != expected) { + report_count(1); + report_error("INCORRECT_ARGUMENT_NUMBER"); + return(1); + } + + return(0); +} diff --git a/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.c b/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.c new file mode 100644 index 0000000..9a6679a --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.c @@ -0,0 +1,7165 @@ +/* $NetBSD: curses_commands.c,v 1.7 2012/09/19 11:51:08 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#include <curses.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <termios.h> +#include <stdarg.h> + +#include "slave.h" +#include "curses_commands.h" + +void +cmd_DRAIN(int nargs, char **args) +{ + while (getch() != ERR); + report_count(1); + report_return(OK); +} + +void +cmd_addbytes(int nargs, char **args) +{ + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(addbytes(args[0], count)); +} + + +void +cmd_addch(int nargs, char **args) +{ + chtype *ch; + + if (check_arg_count(nargs, 1) == 1) + return; + + ch = (chtype *) args[0]; + report_count(1); + report_return(addch(ch[0])); +} + + +void +cmd_addchnstr(int nargs, char **args) +{ + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(addchnstr((chtype *) args[0], count)); +} + + +void +cmd_addchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_return(addchstr((chtype *) args[0])); +} + + +void +cmd_addnstr(int nargs, char **args) +{ + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(addnstr(args[0], count)); +} + + +void +cmd_addstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_return(addstr(args[0])); +} + + +void +cmd_attr_get(int nargs, char **args) +{ + attr_t attrs; + short colours; + int retval; + + if (check_arg_count(nargs, 0) == 1) + return; + + retval = attr_get(&attrs, &colours, NULL); + + /* XXXX - call3 */ + report_count(3); + report_return(retval); + report_int(attrs); + report_int(colours); +} + + +void +cmd_attr_off(int nargs, char **args) +{ + int attrib; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attr_off(attrib, NULL)); +} + + +void +cmd_attr_on(int nargs, char **args) +{ + int attrib; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attr_on(attrib, NULL)); +} + + +void +cmd_attr_set(int nargs, char **args) +{ + int attrib; + short pair; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%hd", &pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attr_set(attrib, pair, NULL)); +} + + +void +cmd_attroff(int nargs, char **args) +{ + int attrib; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attroff(attrib)); +} + + +void +cmd_attron(int nargs, char **args) +{ + int attrib; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attron(attrib)); +} + + +void +cmd_attrset(int nargs, char **args) +{ + int attrib; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &attrib) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(attrset(attrib)); +} + + +void +cmd_bkgd(int nargs, char **args) +{ + chtype *ch; + + if (check_arg_count(nargs, 1) == 1) + return; + + ch = (chtype *) args[0]; + report_count(1); + report_return(bkgd(ch[0])); +} + + +void +cmd_bkgdset(int nargs, char **args) +{ + chtype *ch; + + if (check_arg_count(nargs, 1) == 1) + return; + + ch = (chtype *) args[0]; + bkgdset(ch[0]); /* returns void */ + report_count(1); + report_return(OK); +} + + +void +cmd_border(int nargs, char **args) +{ + int ls, rs, ts, bs, tl, tr, bl, br; + + if (check_arg_count(nargs, 8) == 1) + return; + + if (sscanf(args[0], "%d", &ls) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[1], "%d", &rs) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[2], "%d", &ts) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[3], "%d", &bs) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[4], "%d", &tl) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[5], "%d", &tr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[6], "%d", &bl) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + if (sscanf(args[7], "%d", &br) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(border(ls, rs, ts, bs, tl, tr, bl, br)); +} + + +void +cmd_clear(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(clear()); +} + + +void +cmd_clrtobot(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(clrtobot()); +} + + +void +cmd_clrtoeol(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(clrtoeol()); +} + + +void +cmd_color_set(int nargs, char **args) +{ + short colour_pair; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%hd", &colour_pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(color_set(colour_pair, NULL)); +} + + +void +cmd_delch(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(delch()); +} + + +void +cmd_deleteln(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(deleteln()); +} + + +void +cmd_echochar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + /* XXX causes refresh */ + report_count(1); + report_return(echochar(args[0][0])); +} + + +void +cmd_erase(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(erase()); +} + + +void +cmd_getch(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX causes refresh */ + report_count(1); + report_int(getch()); +} + + +void +cmd_getnstr(int nargs, char **args) +{ + int limit; + char *string; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &limit) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(limit + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(getnstr(string, limit)); + report_status(string); + free(string); +} + + +void +cmd_getstr(int nargs, char **args) +{ + char string[256]; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX call2 */ + report_count(2); + report_return(getstr(string)); + report_status(string); +} + + +void +cmd_inch(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + + report_count(1); + report_byte(inch()); +} + + +void +cmd_inchnstr(int nargs, char **args) +{ + int limit; + chtype *string; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &limit) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc((limit + 1) * sizeof(chtype))) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(inchnstr(string, limit)); + report_nstr(string); + free(string); +} + + +void +cmd_inchstr(int nargs, char **args) +{ + chtype string[256]; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX call2 */ + report_count(2); + report_return(inchstr(string)); + report_nstr(string); +} + + +void +cmd_innstr(int nargs, char **args) +{ + int limit; + char *string; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &limit) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(limit + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_int(innstr(string, limit)); + report_status(string); + free(string); +} + + +void +cmd_insch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_return(insch(args[0][0])); +} + + +void +cmd_insdelln(int nargs, char **args) +{ + int nlines; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &nlines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(insdelln(nlines)); +} + + +void +cmd_insertln(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(insertln()); +} + + +void +cmd_instr(int nargs, char **args) +{ + char string[256]; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX call2 */ + report_count(2); + report_return(instr(string)); + report_status(string); +} + + +void +cmd_move(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(move(y, x)); +} + + +void +cmd_refresh(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(refresh()); +} + + +void +cmd_scrl(int nargs, char **args) +{ + int nlines; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &nlines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(scrl(nlines)); +} + + +void +cmd_setscrreg(int nargs, char **args) +{ + int top, bottom; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &top) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &bottom) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(setscrreg(top, bottom)); +} + + +void +cmd_standend(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(standend()); +} + + +void +cmd_standout(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(standout()); +} + + +void +cmd_timeout(int nargs, char **args) +{ + int tval; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &tval) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + timeout(tval); /* void return */ + report_count(1); + report_return(OK); +} + + +void +cmd_underscore(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(underscore()); +} + + +void +cmd_underend(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(underend()); +} + + +void +cmd_waddbytes(int nargs, char **args) +{ + WINDOW *win; + int count; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(waddbytes(win, args[1], count)); +} + + +void +cmd_waddstr(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(waddstr(win, args[1])); +} + + +void +cmd_mvaddbytes(int nargs, char **args) +{ + int y, x, count; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvaddbytes(y, x, args[2], count)); +} + + +void +cmd_mvaddch(int nargs, char **args) +{ + int y, x; + chtype *ch; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[2]; + report_count(1); + report_return(mvaddch(y, x, ch[0])); +} + + +void +cmd_mvaddchnstr(int nargs, char **args) +{ + int y, x, count; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvaddchnstr(y, x, (chtype *) args[2], count)); +} + + +void +cmd_mvaddchstr(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvaddchstr(y, x, (chtype *) args[2])); +} + + +void +cmd_mvaddnstr(int nargs, char **args) +{ + int y, x, count; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvaddnstr(y, x, args[2], count)); +} + + +void +cmd_mvaddstr(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvaddstr(y, x, args[2])); +} + + +void +cmd_mvdelch(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvdelch(y, x)); +} + + +void +cmd_mvgetch(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(mvgetch(y, x)); +} + + +void +cmd_mvgetnstr(int nargs, char **args) +{ + int y, x, count; + char *string; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(count + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvgetnstr(y, x, string, count)); + report_status(string); + free(string); +} + + +void +cmd_mvgetstr(int nargs, char **args) +{ + int y, x; + char string[256]; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvgetstr(y, x, string)); + report_status(string); +} + + +void +cmd_mvinch(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(mvinch(y, x)); +} + + +void +cmd_mvinchnstr(int nargs, char **args) +{ + int y, x, count; + chtype *string; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvinchnstr(y, x, string, count)); + report_nstr(string); + free(string); +} + + +void +cmd_mvinchstr(int nargs, char **args) +{ + int y, x; + chtype string[256]; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvinchstr(y, x, string)); + report_nstr(string); +} + + +void +cmd_mvinnstr(int nargs, char **args) +{ + int y, x, count; + char *string; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(count + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvinnstr(y, x, string, count)); + report_status(string); + free(string); +} + + +void +cmd_mvinsch(int nargs, char **args) +{ + int y, x, ch; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvinsch(y, x, ch)); +} + + +void +cmd_mvinstr(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvinstr(y, x, args[2])); +} + + + +void +cmd_mvwaddbytes(int nargs, char **args) +{ + int y, x, count; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddbytes(win, y, x, args[3], count)); +} + + +void +cmd_mvwaddch(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddch(win, y, x, args[3][0])); +} + + +void +cmd_mvwaddchnstr(int nargs, char **args) +{ + int y, x, count; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddchnstr(win, y, x, (chtype *) args[3], count)); +} + + +void +cmd_mvwaddchstr(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddchstr(win, y, x, (chtype *) args[3])); +} + + +void +cmd_mvwaddnstr(int nargs, char **args) +{ + int y, x, count; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddnstr(win, y, x, args[3], count)); +} + + +void +cmd_mvwaddstr(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwaddstr(win, y, x, args[3])); +} + + +void +cmd_mvwdelch(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwdelch(win, y, x)); +} + + +void +cmd_mvwgetch(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - implicit refresh */ + report_count(1); + report_int(mvwgetch(win, y, x)); +} + + +void +cmd_mvwgetnstr(int nargs, char **args) +{ + int y, x, count; + char *string; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(count + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvwgetnstr(win, y, x, string, count)); + report_status(string); + free(string); +} + + +void +cmd_mvwgetstr(int nargs, char **args) +{ + int y, x; + WINDOW *win; + char string[256]; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(mvwgetstr(win, y, x, string)); + report_status(string); +} + + +void +cmd_mvwinch(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(mvwinch(win, y, x)); +} + + +void +cmd_mvwinsch(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(mvwinsch(win, y, x, args[3][0])); +} + + +void +cmd_assume_default_colors(int nargs, char **args) +{ + short fore, back; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%hd", &fore) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%hd", &back) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(assume_default_colors(fore, back)); +} + + +void +cmd_baudrate(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(baudrate()); +} + + +void +cmd_beep(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(beep()); +} + + +void +cmd_box(int nargs, char **args) +{ + WINDOW *win; + chtype *vertical, *horizontal; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + vertical = (chtype *) args[1]; + horizontal = (chtype *) args[2]; + report_count(1); + report_return(box(win, vertical[0], horizontal[0])); +} + + +void +cmd_can_change_color(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(can_change_color()); +} + + +void +cmd_cbreak(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(cbreak()); +} + + +void +cmd_clearok(int nargs, char **args) +{ + WINDOW *win; + int flag; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(clearok(win, flag)); +} + + +void +cmd_color_content(int nargs, char **args) +{ + short colour, red, green, blue; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%hd", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call4 */ + report_count(4); + report_return(color_content(colour, &red, &green, &blue)); + report_int(red); + report_int(green); + report_int(blue); +} + + +void +cmd_copywin(int nargs, char **args) +{ + int sminrow, smincol, dminrow, dmincol, dmaxrow, dmaxcol, ovlay; + WINDOW *source, *destination; + + if (check_arg_count(nargs, 9) == 1) + return; + + if (sscanf(args[0], "%p", &source) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%p", &destination) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &sminrow) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &smincol) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &dminrow) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[5], "%d", &dmincol) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[6], "%d", &dmaxrow) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[7], "%d", &dmaxcol) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[8], "%d", &ovlay) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(copywin(source, destination, sminrow, smincol, dminrow, + dmincol, dmaxrow, dmaxcol, ovlay)); +} + + +void +cmd_curs_set(int nargs, char **args) +{ + int vis; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &vis) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(curs_set(vis)); +} + + +void +cmd_def_prog_mode(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(def_prog_mode()); +} + + +void +cmd_def_shell_mode(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(def_shell_mode()); +} + + +void +cmd_define_key(int nargs, char **args) +{ + int symbol; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[1], "%d", &symbol) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(define_key(args[0], symbol)); +} + + +void +cmd_delay_output(int nargs, char **args) +{ + int dtime; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &dtime) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(delay_output(dtime)); +} + + +void +cmd_delscreen(int nargs, char **args) +{ + SCREEN *scrn; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &scrn) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + delscreen(scrn); /* void return */ + report_count(1); + report_return(OK); +} + + +void +cmd_delwin(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(delwin(win)); +} + + +void +cmd_derwin(int nargs, char **args) +{ + int lines, cols, y, x; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(derwin(win, lines, cols, y, x)); +} + + +void +cmd_dupwin(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(dupwin(win)); +} + + +void +cmd_doupdate(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX - implicit refresh */ + report_count(1); + report_return(doupdate()); +} + + +void +cmd_echo(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(echo()); +} + + +void +cmd_endwin(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(endwin()); +} + + +void +cmd_erasechar(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(erasechar()); +} + + +void +cmd_flash(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(flash()); +} + + +void +cmd_flushinp(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(flushinp()); +} + + +void +cmd_flushok(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(flushok(win, flag)); +} + + +void +cmd_fullname(int nargs, char **args) +{ + char string[256]; + + if (check_arg_count(nargs, 1) == 1) + return; + + /* XXX - call2 */ + report_count(2); + report_status(fullname(args[0], string)); + report_status(string); +} + + +void +cmd_getattrs(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getattrs(win)); +} + + +void +cmd_getbkgd(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_byte(getbkgd(win)); +} + + +void +cmd_getcury(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getcury(win)); +} + + +void +cmd_getcurx(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getcurx(win)); +} + + +void +cmd_getyx(int nargs, char **args) +{ + WINDOW *win; + int y, x; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + getyx(win, y, x); + report_count(2); + report_int(y); + report_int(x); +} + + +void +cmd_getbegy(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getbegy(win)); +} + + +void +cmd_getbegx(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getbegx(win)); +} + + +void +cmd_getmaxy(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getmaxy(win)); +} + + +void +cmd_getmaxx(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getmaxx(win)); +} + + +void +cmd_getpary(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getpary(win)); +} + + +void +cmd_getparx(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(getparx(win)); +} + + +void +cmd_getparyx(int nargs, char **args) +{ + WINDOW *win; + int y, x; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(2); + getparyx(win, y, x); + report_int(y); + report_int(x); +} + + +void +cmd_gettmode(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(gettmode()); +} + + +void +cmd_getwin(int nargs, char **args) +{ + FILE *fp; + + if (check_arg_count(nargs, 1) == 1) + return; + + if ((fp = fopen(args[0], "r")) == NULL) { + report_count(1); + report_error("BAD FILE_ARGUMENT"); + return; + } + + report_count(1); + report_ptr(getwin(fp)); + fclose(fp); +} + + +void +cmd_halfdelay(int nargs, char **args) +{ + int ms; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &ms) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(halfdelay(ms)); +} + + +void +cmd_has_colors(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(has_colors()); +} + + +void +cmd_has_ic(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(has_ic()); +} + + +void +cmd_has_il(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(has_il()); +} + + +void +cmd_hline(int nargs, char **args) +{ + int count; + chtype *ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + ch = (chtype *) args[0]; + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(hline(ch[0], count)); +} + + +void +cmd_idcok(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(idcok(win, flag)); +} + + +void +cmd_idlok(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(idlok(win, flag)); +} + + +void +cmd_init_color(int nargs, char **args) +{ + short colour, red, green, blue; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%hd", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%hd", &red) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%hd", &green) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%hd", &blue) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(init_color(colour, red, green, blue)); +} + + +void +cmd_init_pair(int nargs, char **args) +{ + short pair, fore, back; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%hd", &pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%hd", &fore) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%hd", &back) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(init_pair(pair, fore, back)); +} + + +void +cmd_initscr(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_ptr(initscr()); +} + + +void +cmd_intrflush(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(intrflush(win, flag)); +} + + +void +cmd_isendwin(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(isendwin()); +} + + +void +cmd_is_linetouched(int nargs, char **args) +{ + int line; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &line) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(is_linetouched(win, line)); +} + + +void +cmd_is_wintouched(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(is_wintouched(win)); +} + + +void +cmd_keyok(int nargs, char **args) +{ + int keysym, flag; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &keysym) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(keyok(keysym, flag)); +} + + +void +cmd_keypad(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(keypad(win, flag)); +} + + +void +cmd_keyname(int nargs, char **args) +{ + unsigned int key; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &key) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_status(keyname(key)); +} + + +void +cmd_killchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(killchar()); +} + + +void +cmd_leaveok(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(leaveok(win, flag)); +} + + +void +cmd_meta(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(meta(win, flag)); +} + + +void +cmd_mvcur(int nargs, char **args) +{ + int oldy, oldx, y, x; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &oldy) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &oldx) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvcur(oldy, oldx, y, x)); +} + + +void +cmd_mvderwin(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvderwin(win, y, x)); +} + + +void +cmd_mvhline(int nargs, char **args) +{ + int y, x, n; + chtype *ch; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[2]; + + if (sscanf(args[3], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvhline(y, x, ch[0], n)); +} + + +void +cmd_mvprintw(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvprintw(y, x, args[2], args[3])); +} + + +void +cmd_mvscanw(int nargs, char **args) +{ + int y, x; + char string[256]; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(mvscanw(y, x, args[2], &string)); + report_status(string); +} + + +void +cmd_mvvline(int nargs, char **args) +{ + int y, x, n; + chtype *ch; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[2]; + + if (sscanf(args[3], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvvline(y, x, ch[0], n)); +} + + +void +cmd_mvwhline(int nargs, char **args) +{ + int y, x, ch, n; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwhline(win, y, x, ch, n)); +} + + +void +cmd_mvwvline(int nargs, char **args) +{ + int y, x, n; + WINDOW *win; + chtype *ch; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[3]; + + if (sscanf(args[4], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwvline(win, y, x, ch[0], n)); +} + + +void +cmd_mvwin(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwin(win, y, x)); +} + + +void +cmd_mvwinchnstr(int nargs, char **args) +{ + int y, x, count; + chtype *string; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvwinchnstr(win, y, x, string, count)); + report_nstr(string); + free(string); +} + + +void +cmd_mvwinchstr(int nargs, char **args) +{ + int y, x; + chtype string[256]; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvwinchstr(win, y, x, string)); + report_nstr(string); +} + + +void +cmd_mvwinnstr(int nargs, char **args) +{ + int y, x, count; + char *string; + WINDOW *win; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((string = malloc(count + 1)) == NULL) { + report_count(1); + report_error("MALLOC_FAILED"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvwinnstr(win, y, x, string, count)); + report_status(string); + free(string); +} + + +void +cmd_mvwinstr(int nargs, char **args) +{ + int y, x; + char string[256]; + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX call2 */ + report_count(2); + report_return(mvwinstr(win, y, x, string)); + report_status(string); +} + + +void +cmd_mvwprintw(int nargs, char **args) +{ + int y, x; + WINDOW *win; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwprintw(win, y, x, args[3], args[4])); +} + + +void +cmd_mvwscanw(int nargs, char **args) +{ + int y, x; + WINDOW *win; + char string[256]; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_int(mvwscanw(win, y, x, args[3], &string)); + report_status(string); +} + + +void +cmd_napms(int nargs, char **args) +{ + int naptime; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &naptime) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(napms(naptime)); +} + + +void +cmd_newpad(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(newpad(y, x)); +} + + +void +cmd_newterm(int nargs, char **args) +{ + FILE *in, *out; + + if (check_arg_count(nargs, 3) == 1) + return; + + if ((in = fopen(args[1], "rw")) == NULL) { + report_count(1); + report_error("BAD FILE_ARGUMENT"); + return; + } + + + if ((out = fopen(args[2], "rw")) == NULL) { + report_count(1); + report_error("BAD FILE_ARGUMENT"); + return; + } + + report_count(1); + report_ptr(newterm(args[0], out, in)); +} + + +void +cmd_newwin(int nargs, char **args) +{ + int lines, cols, begin_y, begin_x; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &begin_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &begin_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(newwin(lines, cols, begin_y, begin_x)); +} + + +void +cmd_nl(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(nl()); +} + + +void +cmd_no_color_attributes(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(no_color_attributes()); +} + + +void +cmd_nocbreak(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(nocbreak()); +} + + +void +cmd_nodelay(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(nodelay(win, flag)); +} + + +void +cmd_noecho(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(noecho()); +} + + +void +cmd_nonl(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(nonl()); +} + + +void +cmd_noqiflush(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + noqiflush(); + report_count(1); + report_return(OK); /* fake a return, the call returns void */ +} + + +void +cmd_noraw(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(noraw()); +} + + +void +cmd_notimeout(int nargs, char **args) +{ + int flag; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(notimeout(win, flag)); +} + + +void +cmd_overlay(int nargs, char **args) +{ + WINDOW *source, *dest; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &source) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%p", &dest) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(overlay(source, dest)); +} + + +void +cmd_overwrite(int nargs, char **args) +{ + WINDOW *source, *dest; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &source) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%p", &dest) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(overwrite(source, dest)); +} + + +void +cmd_pair_content(int nargs, char **args) +{ + short pair, fore, back; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%hd", &pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call3 */ + report_count(3); + report_return(pair_content(pair, &fore, &back)); + report_int(fore); + report_int(back); +} + + +void +cmd_pechochar(int nargs, char **args) +{ + int ch; + WINDOW *pad; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &pad) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(pechochar(pad, ch)); +} + + +void +cmd_pnoutrefresh(int nargs, char **args) +{ + int pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, smax_x; + WINDOW *pad; + + if (check_arg_count(nargs, 7) == 1) + return; + + if (sscanf(args[0], "%p", &pad) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &pbeg_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &pbeg_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &sbeg_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &sbeg_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[5], "%d", &smax_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[6], "%d", &smax_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(pnoutrefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, + smax_x)); +} + + +void +cmd_prefresh(int nargs, char **args) +{ + int pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, smax_x; + WINDOW *pad; + + if (check_arg_count(nargs, 7) == 1) + return; + + if (sscanf(args[0], "%p", &pad) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &pbeg_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &pbeg_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &sbeg_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &sbeg_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[5], "%d", &smax_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[6], "%d", &smax_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX causes refresh */ + report_count(1); + report_return(prefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y, + smax_x)); + +} + + +void +cmd_printw(int nargs, char **args) +{ + if (check_arg_count(nargs, 2) == 1) + return; + + + report_count(1); + report_return(printw(args[0], args[1])); +} + + +void +cmd_putwin(int nargs, char **args) +{ + FILE *fp; + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if ((fp = fopen(args[1], "rw")) == NULL) { + report_count(1); + report_error("BAD FILE_ARGUMENT"); + return; + } + + report_count(1); + report_return(putwin(win, fp)); +} + + +void +cmd_qiflush(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + qiflush(); + report_count(1); + report_return(OK); /* fake a return because call returns void */ +} + + +void +cmd_raw(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(raw()); +} + + +void +cmd_redrawwin(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(redrawwin(win)); +} + + +void +cmd_reset_prog_mode(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(reset_prog_mode()); +} + + +void +cmd_reset_shell_mode(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(reset_shell_mode()); +} + + +void +cmd_resetty(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(resetty()); +} + + +void +cmd_resizeterm(int nargs, char **args) +{ + int rows, cols; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%d", &rows) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(resizeterm(rows, cols)); +} + + +void +cmd_savetty(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(savetty()); +} + + +void +cmd_scanw(int nargs, char **args) +{ + char string[256]; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX call2 */ + report_count(2); + report_return(scanw("%s", string)); + report_status(string); +} + + +void +cmd_scroll(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(scroll(win)); +} + + +void +cmd_scrollok(int nargs, char **args) +{ + WINDOW *win; + int flag; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &flag) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(scrollok(win, flag)); +} + + +void +cmd_setterm(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_return(setterm(args[0])); +} + + +void +cmd_set_term(int nargs, char **args) +{ + SCREEN *scrn; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &scrn) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(set_term(scrn)); +} + + +void +cmd_start_color(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(start_color()); +} + + +void +cmd_subpad(int nargs, char **args) +{ + WINDOW *pad; + int lines, cols, begin_y, begin_x; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &pad) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &begin_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &begin_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(subpad(pad, lines, cols, begin_y, begin_x)); +} + + +void +cmd_subwin(int nargs, char **args) +{ + WINDOW *win; + int lines, cols, begin_y, begin_x; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &begin_y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &begin_x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_ptr(subwin(win, lines, cols, begin_y, begin_x)); +} + + +void +cmd_termattrs(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(termattrs()); +} + + +void +cmd_term_attrs(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_int(term_attrs()); +} + + +void +cmd_touchline(int nargs, char **args) +{ + WINDOW *win; + int start, count; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &start) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(touchline(win, start, count)); +} + + +void +cmd_touchoverlap(int nargs, char **args) +{ + WINDOW *win1, *win2; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win1) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%p", &win2) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(touchoverlap(win1, win2)); +} + + +void +cmd_touchwin(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(touchwin(win)); +} + + +void +cmd_ungetch(int nargs, char **args) +{ + int ch; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(ungetch(ch)); +} + + +void +cmd_untouchwin(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(untouchwin(win)); +} + + +void +cmd_use_default_colors(int nargs, char **args) +{ + if (check_arg_count(nargs, 0) == 1) + return; + + report_count(1); + report_return(use_default_colors()); +} + + +void +cmd_vline(int nargs, char **args) +{ + int count; + chtype *ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + ch = (chtype *) args[0]; + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(vline(ch[0], count)); +} + + +static int +internal_vw_printw(WINDOW *win, char *arg1, ...) +{ + va_list va; + int rv; + + va_start(va, arg1); + rv = vw_printw(win, arg1, va); + va_end(va); + + return rv; +} + +void +cmd_vw_printw(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(internal_vw_printw(win, args[1], args[2])); +} + + +static int +internal_vw_scanw(WINDOW *win, char *arg1, ...) +{ + va_list va; + int rv; + + va_start(va, arg1); + rv = vw_scanw(win, arg1, va); + va_end(va); + + return rv; +} + +void +cmd_vw_scanw(int nargs, char **args) +{ + WINDOW *win; + char string[256]; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_int(internal_vw_scanw(win, args[1], string)); + report_status(string); +} + + +void +cmd_vwprintw(int nargs, char **args) +{ + cmd_vw_printw(nargs, args); +} + + +void +cmd_vwscanw(int nargs, char **args) +{ + cmd_vw_scanw(nargs, args); +} + + +void +cmd_waddch(int nargs, char **args) +{ + WINDOW *win; + chtype *ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[1]; + + report_count(1); + report_return(waddch(win, ch[0])); +} + + +void +cmd_waddchnstr(int nargs, char **args) +{ + WINDOW *win; + int count; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(waddchnstr(win, (chtype *) args[1], count)); +} + + +void +cmd_waddchstr(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(waddchstr(win, (chtype *) args[1])); +} + + +void +cmd_waddnstr(int nargs, char **args) +{ + WINDOW *win; + int count; + + if (check_arg_count(nargs, 1) == 3) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(waddnstr(win, args[1], count)); + +} + + +void +cmd_wattr_get(int nargs, char **args) +{ + WINDOW *win; + int attr; + short pair; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call3 */ + report_count(3); + report_return(wattr_get(win, &attr, &pair, NULL)); + report_int(attr); + report_int(pair); +} + + +void +cmd_wattr_off(int nargs, char **args) +{ + WINDOW *win; + int attr; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattr_off(win, attr, NULL)); +} + + +void +cmd_wattr_on(int nargs, char **args) +{ + WINDOW *win; + int attr; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattr_on(win, attr, NULL)); +} + + +void +cmd_wattr_set(int nargs, char **args) +{ + WINDOW *win; + int attr; + short pair; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%hd", &pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattr_set(win, attr, pair, NULL)); +} + + +void +cmd_wattroff(int nargs, char **args) +{ + WINDOW *win; + int attr; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattroff(win, attr)); +} + + +void +cmd_wattron(int nargs, char **args) +{ + WINDOW *win; + int attr; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattron(win, attr)); +} + + +void +cmd_wattrset(int nargs, char **args) +{ + WINDOW *win; + int attr; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wattrset(win, attr)); +} + + +void +cmd_wbkgd(int nargs, char **args) +{ + WINDOW *win; + chtype *ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[1]; + report_count(1); + report_return(wbkgd(win, ch[0])); +} + + +void +cmd_wbkgdset(int nargs, char **args) +{ + WINDOW *win; + int ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + wbkgdset(win, ch); /* void return */ + report_count(1); + report_return(OK); +} + + +void +cmd_wborder(int nargs, char **args) +{ + WINDOW *win; + int ls, rs, ts, bs, tl, tr, bl, br; + + if (check_arg_count(nargs, 9) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ls) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &rs) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &ts) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &bs) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[5], "%d", &tl) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[6], "%d", &tr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[7], "%d", &bl) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[8], "%d", &br) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wborder(win, ls, rs, ts, bs, tl, tr, bl, br)); +} + + +void +cmd_wclear(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wclear(win)); +} + + +void +cmd_wclrtobot(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wclrtobot(win)); +} + + +void +cmd_wclrtoeol(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wclrtoeol(win)); + +} + + +void +cmd_wcolor_set(int nargs, char **args) +{ + WINDOW *win; + short pair; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%hd", &pair) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wcolor_set(win, pair, NULL)); +} + + +void +cmd_wdelch(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wdelch(win)); +} + + +void +cmd_wdeleteln(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wdeleteln(win)); + +} + + +void +cmd_wechochar(int nargs, char **args) +{ + WINDOW *win; + int ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wechochar(win, ch)); +} + + +void +cmd_werase(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(werase(win)); +} + + +void +cmd_wgetch(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(wgetch(win)); +} + + +void +cmd_wgetnstr(int nargs, char **args) +{ + WINDOW *win; + int count; + char string[256]; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(wgetnstr(win, string, count)); + report_status(string); +} + + +void +cmd_wgetstr(int nargs, char **args) +{ + WINDOW *win; + char string[256]; + + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + string[0] = '\0'; + + report_count(2); + report_return(wgetstr(win, string)); + report_status(string); +} + + +void +cmd_whline(int nargs, char **args) +{ + WINDOW *win; + int ch, count; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(whline(win, ch, count)); +} + + +void +cmd_winch(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_int(winch(win)); +} + + +void +cmd_winchnstr(int nargs, char **args) +{ + WINDOW *win; + chtype string[256]; + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(winchnstr(win, string, count)); + report_nstr(string); +} + + +void +cmd_winchstr(int nargs, char **args) +{ + WINDOW *win; + chtype string[256]; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(winchstr(win, string)); + report_nstr(string); +} + + +void +cmd_winnstr(int nargs, char **args) +{ + WINDOW *win; + char string[256]; + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(winnstr(win, string, count)); + report_status(string); +} + + +void +cmd_winsch(int nargs, char **args) +{ + WINDOW *win; + int ch; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &ch) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(winsch(win, ch)); +} + + +void +cmd_winsdelln(int nargs, char **args) +{ + WINDOW *win; + int count; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &count) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(winsdelln(win, count)); +} + + +void +cmd_winsertln(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(winsertln(win)); +} + + +void +cmd_winstr(int nargs, char **args) +{ + WINDOW *win; + char string[256]; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - call2 */ + report_count(2); + report_return(winstr(win, string)); + report_status(string); +} + + +void +cmd_wmove(int nargs, char **args) +{ + WINDOW *win; + int y, x; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wmove(win, y, x)); +} + + +void +cmd_wnoutrefresh(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wnoutrefresh(win)); +} + + +void +cmd_wprintw(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wprintw(win, args[1], args[2])); +} + + +void +cmd_wredrawln(int nargs, char **args) +{ + WINDOW *win; + int beg_line, num_lines; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &beg_line) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &num_lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wredrawln(win, beg_line, num_lines)); +} + + +void +cmd_wrefresh(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* XXX - generates output */ + report_count(1); + report_return(wrefresh(win)); +} + + +void +cmd_wresize(int nargs, char **args) +{ + WINDOW *win; + int lines, cols; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &lines) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &cols) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wresize(win, lines, cols)); +} + + +void +cmd_wscanw(int nargs, char **args) +{ + WINDOW *win; + char string[256]; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wscanw(win, args[1], &string)); +} + + +void +cmd_wscrl(int nargs, char **args) +{ + WINDOW *win; + int n; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wscrl(win, n)); +} + + +void +cmd_wsetscrreg(int nargs, char **args) +{ + WINDOW *win; + int top, bottom; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &top) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &bottom) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wsetscrreg(win, top, bottom)); +} + + +void +cmd_wstandend(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wstandend(win)); +} + + +void +cmd_wstandout(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wstandout(win)); +} + + +void +cmd_wtimeout(int nargs, char **args) +{ + WINDOW *win; + int tval; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &tval) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + wtimeout(win, tval); /* void return */ + report_count(1); + report_return(OK); +} + + +void +cmd_wtouchln(int nargs, char **args) +{ + WINDOW *win; + int line, n, changed; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &line) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &changed) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wtouchln(win, line, n, changed)); +} + + +void +cmd_wunderend(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wunderend(win)); +} + + +void +cmd_wunderscore(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wunderscore(win)); +} + + +void +cmd_wvline(int nargs, char **args) +{ + WINDOW *win; + int n; + chtype *ch; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + ch = (chtype *) args[1]; + + if (sscanf(args[2], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wvline(win, ch[0], n)); +} + + +void +cmd_insnstr(int nargs, char **args) +{ + int n; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[1], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(insnstr(args[0], n)); +} + + +void +cmd_insstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_return(insstr(args[0])); +} + + +void +cmd_mvinsnstr(int nargs, char **args) +{ + int y, x, n; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvinsnstr(y, x, args[2], n)); +} + + +void +cmd_mvinsstr(int nargs, char **args) +{ + int y, x; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvinsstr(y, x, args[2])); +} + + +void +cmd_mvwinsnstr(int nargs, char **args) +{ + WINDOW *win; + int y, x, n; + + if (check_arg_count(nargs, 5) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwinsnstr(win, y, x, args[3], n)); + +} + + +void +cmd_mvwinsstr(int nargs, char **args) +{ + WINDOW *win; + int y, x; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwinsstr(win, y, x, args[3])); +} + + +void +cmd_winsnstr(int nargs, char **args) +{ + WINDOW *win; + int n; + + if (check_arg_count(nargs, 3) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(winsnstr(win, args[1], n)); +} + + +void +cmd_winsstr(int nargs, char **args) +{ + WINDOW *win; + + if (check_arg_count(nargs, 2) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(winsstr(win, args[1])); +} + + + +void +cmd_chgat(int nargs, char **args) +{ + int n, attr, colour; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + /* Note: 4th argument unused in current curses implementation */ + report_count(1); + report_return(chgat(n, attr, colour, NULL)); +} + + +void +cmd_wchgat(int nargs, char **args) +{ + WINDOW *win; + int n, attr; + short colour; + + if (check_arg_count(nargs, 4) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%hd", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(wchgat(win, n, attr, colour, NULL)); +} + + +void +cmd_mvchgat(int nargs, char **args) +{ + int y, x, n, attr; + short colour; + + if (check_arg_count(nargs, 6) == 1) + return; + + if (sscanf(args[0], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%hd", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvchgat(y, x, n, attr, colour, NULL)); +} + + +void +cmd_mvwchgat(int nargs, char **args) +{ + WINDOW *win; + int y, x, n, attr, colour; + + if (check_arg_count(nargs, 6) == 1) + return; + + if (sscanf(args[0], "%p", &win) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[1], "%d", &y) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[2], "%d", &x) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[3], "%d", &n) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[4], "%d", &attr) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + if (sscanf(args[5], "%d", &colour) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_return(mvwchgat(win, y, x, n, attr, colour, NULL)); +} + + +void +cmd_add_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wadd_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvadd_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwadd_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_add_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_add_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wadd_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wadd_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvadd_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvadd_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwadd_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwadd_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_addnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_addwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvaddnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvaddwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwaddnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwaddwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_waddnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_waddwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_echo_wchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wecho_wchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_pecho_wchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +/* insert */ +void +cmd_ins_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wins_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvins_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwins_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_ins_nwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_ins_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvins_nwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvins_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwins_nwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwins_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wins_nwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wins_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +/* input */ +void +cmd_get_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_unget_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvget_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwget_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wget_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_getn_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_get_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvgetn_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvget_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwgetn_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwget_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wgetn_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wget_wstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_in_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvin_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwin_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_win_wch(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_in_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_in_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvin_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvin_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwin_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwin_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_win_wchnstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_win_wchstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +void +cmd_innwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_inwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvinnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvinwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwinnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwinwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_winnwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_winwstr(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +/* cchar handlgin */ +void +cmd_setcchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_getcchar(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + + +/* misc */ +void +cmd_key_name(int nargs, char **args) +{ + int w; + + if (check_arg_count(nargs, 1) == 1) + return; + + if (sscanf(args[0], "%d", &w) == 0) { + report_count(1); + report_error("BAD ARGUMENT"); + return; + } + + report_count(1); + report_status(key_name(w)); +} + + +void +cmd_border_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wborder_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_box_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_erasewchar(int nargs, char **args) +{ + wchar_t ch; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX - call2 */ + report_count(2); + report_return(erasewchar(&ch)); + report_int(ch); +} + + +void +cmd_killwchar(int nargs, char **args) +{ + wchar_t ch; + + if (check_arg_count(nargs, 0) == 1) + return; + + /* XXX - call2 */ + report_count(2); + report_return(erasewchar(&ch)); + report_int(ch); +} + + +void +cmd_hline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvhline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvvline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwhline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_mvwvline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_vline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_whline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wvline_set(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_bkgrnd(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_bkgrndset(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_getbkgrnd(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wbkgrnd(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wbkgrndset(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} + + +void +cmd_wgetbkgrnd(int nargs, char **args) +{ + if (check_arg_count(nargs, 1) == 1) + return; + + report_count(1); + report_error("UNSUPPORTED"); +} diff --git a/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.h b/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.h new file mode 100644 index 0000000..d7f2ad7 --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/curses_commands.h @@ -0,0 +1,422 @@ +/* $NetBSD: curses_commands.h,v 1.3 2011/09/15 11:46:19 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ + +#ifndef _CURSES_COMMANDS_H_ +#define _CURSES_COMMANDS_H_ + +struct command_def { + const char *name; + void (*func)(int, char **); +}; + +/* + * prototypes for test commands + */ +void cmd_DRAIN(int, char **); /* not a curses function */ + +void cmd_addbytes(int, char **); +void cmd_addch(int, char **); +void cmd_addchnstr(int, char **); +void cmd_addchstr(int, char **); +void cmd_addnstr(int, char **); +void cmd_addstr(int, char **); +void cmd_attr_get(int, char **); +void cmd_attr_off(int, char **); +void cmd_attr_on(int, char **); +void cmd_attr_set(int, char **); +void cmd_attroff(int, char **); +void cmd_attron(int, char **); +void cmd_attrset(int, char **); +void cmd_bkgd(int, char **); +void cmd_bkgdset(int, char **); +void cmd_border(int, char **); +void cmd_clear(int, char **); +void cmd_clrtobot(int, char **); +void cmd_clrtoeol(int, char **); +void cmd_color_set(int, char **); +void cmd_delch(int, char **); +void cmd_deleteln(int, char **); +void cmd_echochar(int, char **); +void cmd_erase(int, char **); +void cmd_getch(int, char **); +void cmd_getnstr(int, char **); +void cmd_getstr(int, char **); +void cmd_inch(int, char **); +void cmd_inchnstr(int, char **); +void cmd_inchstr(int, char **); +void cmd_innstr(int, char **); +void cmd_insch(int, char **); +void cmd_insdelln(int, char **); +void cmd_insertln(int, char **); +void cmd_instr(int, char **); +void cmd_move(int, char **); +void cmd_refresh(int, char **); +void cmd_scrl(int, char **); +void cmd_setscrreg(int, char **); +void cmd_standend(int, char **); +void cmd_standout(int, char **); +void cmd_timeout(int, char **); +void cmd_underscore(int, char **); +void cmd_underend(int, char **); +void cmd_waddbytes(int, char **); +void cmd_waddstr(int, char **); +void cmd_mvaddbytes(int, char **); +void cmd_mvaddch(int, char **); +void cmd_mvaddchnstr(int, char **); +void cmd_mvaddchstr(int, char **); +void cmd_mvaddnstr(int, char **); +void cmd_mvaddstr(int, char **); +void cmd_mvdelch(int, char **); +void cmd_mvgetch(int, char **); +void cmd_mvgetnstr(int, char **); +void cmd_mvgetstr(int, char **); +void cmd_mvinch(int, char **); +void cmd_mvinchnstr(int, char **); +void cmd_mvinchstr(int, char **); +void cmd_mvinnstr(int, char **); +void cmd_mvinsch(int, char **); +void cmd_mvinstr(int, char **); + +void cmd_mvwaddbytes(int, char **); +void cmd_mvwaddch(int, char **); +void cmd_mvwaddchnstr(int, char **); +void cmd_mvwaddchstr(int, char **); +void cmd_mvwaddnstr(int, char **); +void cmd_mvwaddstr(int, char **); +void cmd_mvwdelch(int, char **); +void cmd_mvwgetch(int, char **); +void cmd_mvwgetnstr(int, char **); +void cmd_mvwgetstr(int, char **); +void cmd_mvwinch(int, char **); +void cmd_mvwinsch(int, char **); +void cmd_assume_default_colors(int, char **); +void cmd_baudrate(int, char **); +void cmd_beep(int, char **); +void cmd_box(int, char **); +void cmd_can_change_color(int, char **); +void cmd_cbreak(int, char **); +void cmd_chgat(int, char **); +void cmd_clearok(int, char **); +void cmd_color_content(int, char **); +void cmd_copywin(int, char **); +void cmd_curs_set(int, char **); +void cmd_def_prog_mode(int, char **); +void cmd_def_shell_mode(int, char **); +void cmd_define_key(int, char **); +void cmd_delay_output(int, char **); +void cmd_delscreen(int, char **); +void cmd_delwin(int, char **); +void cmd_derwin(int, char **); +void cmd_dupwin(int, char **); +void cmd_doupdate(int, char **); +void cmd_echo(int, char **); +void cmd_endwin(int, char **); +void cmd_erasechar(int, char **); +void cmd_flash(int, char **); +void cmd_flushinp(int, char **); +void cmd_flushok(int, char **); +void cmd_fullname(int, char **); +void cmd_getattrs(int, char **); +void cmd_getbkgd(int, char **); +void cmd_getcury(int, char **); +void cmd_getcurx(int, char **); +void cmd_getyx(int, char **); +void cmd_getbegy(int, char **); +void cmd_getbegx(int, char **); +void cmd_getmaxy(int, char **); +void cmd_getmaxx(int, char **); +void cmd_getpary(int, char **); +void cmd_getparx(int, char **); +void cmd_getparyx(int, char **); +void cmd_gettmode(int, char **); +void cmd_getwin(int, char **); +void cmd_halfdelay(int, char **); +void cmd_has_colors(int, char **); +void cmd_has_ic(int, char **); +void cmd_has_il(int, char **); +void cmd_hline(int, char **); +void cmd_idcok(int, char **); +void cmd_idlok(int, char **); +void cmd_init_color(int, char **); +void cmd_init_pair(int, char **); +void cmd_initscr(int, char **); +void cmd_intrflush(int, char **); +void cmd_isendwin(int, char **); +void cmd_is_linetouched(int, char **); +void cmd_is_wintouched(int, char **); +void cmd_keyok(int, char **); +void cmd_keypad(int, char **); +void cmd_keyname(int, char **); +void cmd_killchar(int, char **); +void cmd_leaveok(int, char **); +void cmd_meta(int, char **); +void cmd_mvchgat(int, char **); +void cmd_mvcur(int, char **); +void cmd_mvderwin(int, char **); +void cmd_mvhline(int, char **); +void cmd_mvprintw(int, char **); +void cmd_mvscanw(int, char **); +void cmd_mvvline(int, char **); +void cmd_mvwchgat(int, char **); +void cmd_mvwhline(int, char **); +void cmd_mvwvline(int, char **); +void cmd_mvwin(int, char **); +void cmd_mvwinchnstr(int, char **); +void cmd_mvwinchstr(int, char **); +void cmd_mvwinnstr(int, char **); +void cmd_mvwinstr(int, char **); +void cmd_mvwprintw(int, char **); +void cmd_mvwscanw(int, char **); +void cmd_napms(int, char **); +void cmd_newpad(int, char **); +void cmd_newterm(int, char **); +void cmd_newwin(int, char **); +void cmd_nl(int, char **); +void cmd_no_color_attributes(int, char **); +void cmd_nocbreak(int, char **); +void cmd_nodelay(int, char **); +void cmd_noecho(int, char **); +void cmd_nonl(int, char **); +void cmd_noqiflush(int, char **); +void cmd_noraw(int, char **); +void cmd_notimeout(int, char **); +void cmd_overlay(int, char **); +void cmd_overwrite(int, char **); +void cmd_pair_content(int, char **); +void cmd_pechochar(int, char **); +void cmd_pnoutrefresh(int, char **); +void cmd_prefresh(int, char **); +void cmd_printw(int, char **); +void cmd_putwin(int, char **); +void cmd_qiflush(int, char **); +void cmd_raw(int, char **); +void cmd_redrawwin(int, char **); +void cmd_reset_prog_mode(int, char **); +void cmd_reset_shell_mode(int, char **); +void cmd_resetty(int, char **); +void cmd_resizeterm(int, char **); +void cmd_savetty(int, char **); +void cmd_scanw(int, char **); +void cmd_scroll(int, char **); +void cmd_scrollok(int, char **); +void cmd_setterm(int, char **); +void cmd_set_term(int, char **); +void cmd_start_color(int, char **); +void cmd_subpad(int, char **); +void cmd_subwin(int, char **); +void cmd_termattrs(int, char **); +void cmd_term_attrs(int, char **); +void cmd_touchline(int, char **); +void cmd_touchoverlap(int, char **); +void cmd_touchwin(int, char **); +void cmd_ungetch(int, char **); +void cmd_untouchwin(int, char **); +void cmd_use_default_colors(int, char **); +void cmd_vline(int, char **); +void cmd_vw_printw(int, char **); +void cmd_vw_scanw(int, char **); +void cmd_vwprintw(int, char **); +void cmd_vwscanw(int, char **); +void cmd_waddch(int, char **); +void cmd_waddchnstr(int, char **); +void cmd_waddchstr(int, char **); +void cmd_waddnstr(int, char **); +void cmd_wattr_get(int, char **); +void cmd_wattr_off(int, char **); +void cmd_wattr_on(int, char **); +void cmd_wattr_set(int, char **); +void cmd_wattroff(int, char **); +void cmd_wattron(int, char **); +void cmd_wattrset(int, char **); +void cmd_wbkgd(int, char **); +void cmd_wbkgdset(int, char **); +void cmd_wborder(int, char **); +void cmd_wchgat(int, char **); +void cmd_wclear(int, char **); +void cmd_wclrtobot(int, char **); +void cmd_wclrtoeol(int, char **); +void cmd_wcolor_set(int, char **); +void cmd_wdelch(int, char **); +void cmd_wdeleteln(int, char **); +void cmd_wechochar(int, char **); +void cmd_werase(int, char **); +void cmd_wgetch(int, char **); +void cmd_wgetnstr(int, char **); +void cmd_wgetstr(int, char **); +void cmd_whline(int, char **); +void cmd_winch(int, char **); +void cmd_winchnstr(int, char **); +void cmd_winchstr(int, char **); +void cmd_winnstr(int, char **); +void cmd_winsch(int, char **); +void cmd_winsdelln(int, char **); +void cmd_winsertln(int, char **); +void cmd_winstr(int, char **); +void cmd_wmove(int, char **); +void cmd_wnoutrefresh(int, char **); +void cmd_wprintw(int, char **); +void cmd_wredrawln(int, char **); +void cmd_wrefresh(int, char **); +void cmd_wresize(int, char **); +void cmd_wscanw(int, char **); +void cmd_wscrl(int, char **); +void cmd_wsetscrreg(int, char **); +void cmd_wstandend(int, char **); +void cmd_wstandout(int, char **); +void cmd_wtimeout(int, char **); +void cmd_wtouchln(int, char **); +void cmd_wunderend(int, char **); +void cmd_wunderscore(int, char **); +void cmd_wvline(int, char **); +void cmd_insnstr(int, char **); +void cmd_insstr(int, char **); +void cmd_mvinsnstr(int, char **); +void cmd_mvinsstr(int, char **); +void cmd_mvwinsnstr(int, char **); +void cmd_mvwinsstr(int, char **); +void cmd_winsnstr(int, char **); +void cmd_winsstr(int, char **); + +void cmd_chgat(int, char **); +void cmd_wchgat(int, char **); +void cmd_mvchgat(int, char **); +void cmd_mvwchgat(int, char **); +void cmd_add_wch(int, char **); +void cmd_wadd_wch(int, char **); +void cmd_mvadd_wch(int, char **); +void cmd_mvwadd_wch(int, char **); + +void cmd_add_wchnstr(int, char **); +void cmd_add_wchstr(int, char **); +void cmd_wadd_wchnstr(int, char **); +void cmd_wadd_wchstr(int, char **); +void cmd_mvadd_wchnstr(int, char **); +void cmd_mvadd_wchstr(int, char **); +void cmd_mvwadd_wchnstr(int, char **); +void cmd_mvwadd_wchstr(int, char **); + +void cmd_addnwstr(int, char **); +void cmd_addwstr(int, char **); +void cmd_mvaddnwstr(int, char **); +void cmd_mvaddwstr(int, char **); +void cmd_mvwaddnwstr(int, char **); +void cmd_mvwaddwstr(int, char **); +void cmd_waddnwstr(int, char **); +void cmd_waddwstr(int, char **); + +void cmd_echo_wchar(int, char **); +void cmd_wecho_wchar(int, char **); +void cmd_pecho_wchar(int, char **); + +/* insert */ +void cmd_ins_wch(int, char **); +void cmd_wins_wch(int, char **); +void cmd_mvins_wch(int, char **); +void cmd_mvwins_wch(int, char **); + +void cmd_ins_nwstr(int, char **); +void cmd_ins_wstr(int, char **); +void cmd_mvins_nwstr(int, char **); +void cmd_mvins_wstr(int, char **); +void cmd_mvwins_nwstr(int, char **); +void cmd_mvwins_wstr(int, char **); +void cmd_wins_nwstr(int, char **); +void cmd_wins_wstr(int, char **); + +/* input */ +void cmd_get_wch(int, char **); +void cmd_unget_wch(int, char **); +void cmd_mvget_wch(int, char **); +void cmd_mvwget_wch(int, char **); +void cmd_wget_wch(int, char **); + +void cmd_getn_wstr(int, char **); +void cmd_get_wstr(int, char **); +void cmd_mvgetn_wstr(int, char **); +void cmd_mvget_wstr(int, char **); +void cmd_mvwgetn_wstr(int, char **); +void cmd_mvwget_wstr(int, char **); +void cmd_wgetn_wstr(int, char **); +void cmd_wget_wstr(int, char **); + +void cmd_in_wch(int, char **); +void cmd_mvin_wch(int, char **); +void cmd_mvwin_wch(int, char **); +void cmd_win_wch(int, char **); + +void cmd_in_wchnstr(int, char **); +void cmd_in_wchstr(int, char **); +void cmd_mvin_wchnstr(int, char **); +void cmd_mvin_wchstr(int, char **); +void cmd_mvwin_wchnstr(int, char **); +void cmd_mvwin_wchstr(int, char **); +void cmd_win_wchnstr(int, char **); +void cmd_win_wchstr(int, char **); + +void cmd_innwstr(int, char **); +void cmd_inwstr(int, char **); +void cmd_mvinnwstr(int, char **); +void cmd_mvinwstr(int, char **); +void cmd_mvwinnwstr(int, char **); +void cmd_mvwinwstr(int, char **); +void cmd_winnwstr(int, char **); +void cmd_winwstr(int, char **); + +/* cchar handlgin */ +void cmd_setcchar(int, char **); +void cmd_getcchar(int, char **); + +/* misc */ +void cmd_key_name(int, char **); +void cmd_border_set(int, char **); +void cmd_wborder_set(int, char **); +void cmd_box_set(int, char **); +void cmd_erasewchar(int, char **); +void cmd_killwchar(int, char **); +void cmd_hline_set(int, char **); +void cmd_mvhline_set(int, char **); +void cmd_mvvline_set(int, char **); +void cmd_mvwhline_set(int, char **); +void cmd_mvwvline_set(int, char **); +void cmd_vline_set(int, char **); +void cmd_whline_set(int, char **); +void cmd_wvline_set(int, char **); +void cmd_bkgrnd(int, char **); +void cmd_bkgrndset(int, char **); +void cmd_getbkgrnd(int, char **); +void cmd_wbkgrnd(int, char **); +void cmd_wbkgrndset(int, char **); +void cmd_wgetbkgrnd(int, char **); + + + + +#endif /* !_CURSES_COMMAND_H_ */ diff --git a/contrib/netbsd-tests/lib/libcurses/slave/slave.c b/contrib/netbsd-tests/lib/libcurses/slave/slave.c new file mode 100644 index 0000000..b05a1da --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/slave.c @@ -0,0 +1,177 @@ +/* $NetBSD: slave.c,v 1.6 2011/09/15 11:46:19 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ +#include <fcntl.h> +#include <sys/ioctl.h> +#include <unistd.h> +#include <err.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <curses.h> +#include "returns.h" +#include "slave.h" + +int cmdpipe[2]; +int slvpipe[2]; + +#if 0 +static const char *returns_enum_names[] = { + "unused", "numeric", "string", "byte", "ERR", "OK", "NULL", "not NULL", + "variable" +}; +#endif + +/* + * Read the command pipe for the function to execute, gather the args + * and then process the command. + */ +static void +process_commands(WINDOW *mainscr) +{ + int len, maxlen, argslen, i, ret, type; + char *cmdbuf, *tmpbuf, **args, **tmpargs; + + len = maxlen = 30; + if ((cmdbuf = malloc(maxlen)) == NULL) + err(1, "slave cmdbuf malloc failed"); + + while(1) { + if (read(cmdpipe[READ_PIPE], &type, sizeof(int)) < 0) + err(1, "slave command type read failed"); + + if (type != ret_string) + errx(1, "Unexpected type for command, got %d", type); + + if (read(cmdpipe[READ_PIPE], &len, sizeof(int)) < 0) + err(1, "slave command len read failed"); + + if ((len + 1) > maxlen) { + maxlen = len + 1; + if ((tmpbuf = realloc(cmdbuf, maxlen)) == NULL) + err(1, "slave cmdbuf realloc to %d " + "bytes failed", maxlen); + cmdbuf = tmpbuf; + } + + if (read(cmdpipe[READ_PIPE], cmdbuf, len) < 0) + err(1, "slave command read failed"); + cmdbuf[len] = '\0'; + argslen = 0; + args = NULL; + + do { + if (read(cmdpipe[READ_PIPE], &type, sizeof(int)) < 0) + err(1, "slave arg type read failed"); + + if (read(cmdpipe[READ_PIPE], &len, sizeof(int)) < 0) + err(1, "slave arg len read failed"); + + if (len >= 0) { + tmpargs = realloc(args, + (argslen + 1) * sizeof(char *)); + if (tmpargs == NULL) + err(1, "slave realloc of args array " + "failed"); + + args = tmpargs; + if (type != ret_null) { + args[argslen] = malloc(len + 1); + + if (args[argslen] == NULL) + err(1, "slave alloc of %d bytes" + " for args failed", len); + } + + if (len == 0) { + if (type == ret_null) + args[argslen] = NULL; + else + args[argslen][0] = '\0'; + } else { + read(cmdpipe[READ_PIPE], args[argslen], + len); + if (type != ret_byte) + args[argslen][len] = '\0'; + + if (len == 6) { + if (strcmp(args[argslen], + "STDSCR") == 0) { + ret = asprintf(&tmpbuf, + "%p", + stdscr); + if (ret < 0) + err(2, + "asprintf of stdscr failed"); + free(args[argslen]); + args[argslen] = tmpbuf; + } + } + } + + argslen++; + } + } + while(len >= 0); + + command_execute(cmdbuf, argslen, args); + + if (args != NULL) { + for (i = 0; i < argslen; i++) + free(args[i]); + + free(args); + } + } +} + +int +main(int argc, char *argv[]) +{ + WINDOW *mainscr; + + if (argc != 5) { + fprintf(stderr, "Usage: %s <cmdin> <cmdout> <slvin> slvout>\n", + getprogname()); + return 0; + } + sscanf(argv[1], "%d", &cmdpipe[0]); + sscanf(argv[2], "%d", &cmdpipe[1]); + sscanf(argv[3], "%d", &slvpipe[0]); + sscanf(argv[4], "%d", &slvpipe[1]); + + mainscr = initscr(); + if (mainscr == NULL) + err(1, "initscr failed"); + + process_commands(mainscr); + + return 0; +} diff --git a/contrib/netbsd-tests/lib/libcurses/slave/slave.h b/contrib/netbsd-tests/lib/libcurses/slave/slave.h new file mode 100644 index 0000000..98e9971 --- /dev/null +++ b/contrib/netbsd-tests/lib/libcurses/slave/slave.h @@ -0,0 +1,50 @@ +/* $NetBSD: slave.h,v 1.3 2011/09/15 11:46:19 blymn Exp $ */ + +/*- + * Copyright 2009 Brett Lymn <blymn@NetBSD.org> + * + * All rights reserved. + * + * This code has been donated to The NetBSD Foundation by the Author. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. The name of the author may not be used to endorse or promote products + * derived from this software withough specific prior written permission + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + */ +#ifndef CURTEST_SLAVE_H +#define CURTEST_SLAVE_H + +#include <curses.h> + +#define READ_PIPE 0 +#define WRITE_PIPE 1 + +void command_execute(char *, int, char **); +void report_count(int); +void report_error(const char *); +void report_int(int); +void report_byte(chtype); +void report_return(int); +void report_nstr(chtype *); +void report_status(const char *); +void report_ptr(void *); +int check_arg_count(int, int); + +#endif |