Home | History | Annotate | Line # | Download | only in slave
curses_commands.c revision 1.24
      1 /*	$NetBSD: curses_commands.c,v 1.24 2021/04/04 09:42:08 rin Exp $	*/
      2 
      3 /*-
      4  * Copyright 2009 Brett Lymn <blymn (at) NetBSD.org>
      5  * Copyright 2021 Roland Illig <rillig (at) NetBSD.org>
      6  *
      7  * All rights reserved.
      8  *
      9  * This code has been donated to The NetBSD Foundation by the Author.
     10  *
     11  * Redistribution and use in source and binary forms, with or without
     12  * modification, are permitted provided that the following conditions
     13  * are met:
     14  * 1. Redistributions of source code must retain the above copyright
     15  *    notice, this list of conditions and the following disclaimer.
     16  * 2. The name of the author may not be used to endorse or promote products
     17  *    derived from this software without specific prior written permission
     18  *
     19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     29  */
     30 
     31 #include <curses.h>
     32 #include <stdio.h>
     33 #include <stdlib.h>
     34 #include <string.h>
     35 #include <termios.h>
     36 #include <stdarg.h>
     37 
     38 #include "slave.h"
     39 #include "curses_commands.h"
     40 
     41 int
     42 set_int(char *arg, int *x)
     43 {
     44 	if (sscanf(arg, "%d", x) == 0) {
     45 		report_count(1);
     46 		report_error("BAD ARGUMENT");
     47 		return -1;
     48 	}
     49 
     50 	return 0;
     51 }
     52 
     53 int
     54 set_uint(char *arg, unsigned int *x)
     55 {
     56 	if (sscanf(arg, "%u", x) == 0) {
     57 		report_count(1);
     58 		report_error("BAD ARGUMENT");
     59 		return -1;
     60 	}
     61 
     62 	return 0;
     63 }
     64 
     65 int
     66 set_short(char *arg, short *x)
     67 {
     68 	if (sscanf(arg, "%hd", x) == 0) {
     69 		report_count(1);
     70 		report_error("BAD ARGUMENT");
     71 		return -1;
     72 	}
     73 
     74 	return 0;
     75 }
     76 
     77 int
     78 set_win(char *arg, WINDOW **x)
     79 {
     80 	if (sscanf(arg, "%p", x) == 0) {
     81 		report_count(1);
     82 		report_error("BAD ARGUMENT");
     83 		return -1;
     84 	}
     85 
     86 	return 0;
     87 }
     88 
     89 int
     90 set_scrn(char *arg, SCREEN **x)
     91 {
     92 	if (sscanf(arg, "%p", x) == 0) {
     93 		report_count(1);
     94 		report_error("BAD ARGUMENT");
     95 		return -1;
     96 	}
     97 
     98 	return 0;
     99 }
    100 
    101 #define ARGC(n) \
    102 	if (check_arg_count(nargs, n) == 1)				\
    103 		return
    104 
    105 #define ARG_SHORT(i, arg) \
    106 	short arg;							\
    107 	if (set_short(args[i], &arg) != 0)				\
    108 		return
    109 
    110 #define ARG_INT(i, arg) \
    111 	int arg;							\
    112 	if (set_int(args[i], &arg) != 0)				\
    113 		return
    114 
    115 #define ARG_UINT(i, arg) \
    116 	unsigned int arg;						\
    117 	if (set_uint(args[i], &arg) != 0)				\
    118 		return
    119 
    120 #define ARG_CHTYPE(i, arg) \
    121 	chtype arg = ((const chtype *)args[i])[0]
    122 
    123 #define ARG_WCHAR(i, arg) \
    124 	wchar_t arg = ((const wchar_t *)args[i])[0]
    125 
    126 #define ARG_STRING(i, arg) \
    127 	const char *arg = args[i]
    128 
    129 /* Only used for legacy interfaces that are missing the 'const'. */
    130 #define ARG_MODIFIABLE_STRING(i, arg) \
    131 	char *arg = args[i]
    132 
    133 #define ARG_CHTYPE_STRING(i, arg) \
    134 	const chtype *arg = (const chtype *)args[i]
    135 
    136 #define ARG_CCHAR_STRING(i, arg) \
    137 	const cchar_t *arg = (const cchar_t *)args[i]
    138 
    139 #define ARG_WCHAR_STRING(i, arg) \
    140 	wchar_t *arg = (wchar_t *)args[i]
    141 
    142 #define ARG_WINDOW(i, arg) \
    143 	WINDOW *arg;							\
    144 	if (set_win(args[i], &arg) != 0)				\
    145 		return
    146 
    147 #define ARG_SCREEN(i, arg) \
    148 	SCREEN *arg;							\
    149 	if (set_scrn(args[i], &arg) != 0)				\
    150 		return
    151 
    152 /*
    153  * Required by the API, intended for future extensions, but this
    154  * implementation does not support the extension.
    155  */
    156 #define ARG_NULL(i) \
    157 	(void)0
    158 
    159 #define ARG_IGNORE(i) \
    160 	(void)0
    161 
    162 void
    163 cmd_DRAIN(int nargs, char **args)
    164 {
    165 	ARGC(1);
    166 	ARG_WINDOW(0, win);
    167 
    168 	while (wgetch(win) != ERR);
    169 	report_count(1);
    170 	report_return(OK);
    171 }
    172 
    173 void
    174 cmd_addbytes(int nargs, char **args)
    175 {
    176 	ARGC(2);
    177 	ARG_STRING(0, str);
    178 	ARG_INT(1, count);
    179 
    180 	report_count(1);
    181 	report_return(addbytes(str, count));
    182 }
    183 
    184 
    185 void
    186 cmd_addch(int nargs, char **args)
    187 {
    188 	ARGC(1);
    189 	ARG_CHTYPE(0, ch);
    190 
    191 	report_count(1);
    192 	report_return(addch(ch));
    193 }
    194 
    195 
    196 void
    197 cmd_addchnstr(int nargs, char **args)
    198 {
    199 	ARGC(2);
    200 	ARG_CHTYPE_STRING(0, chstr);
    201 	ARG_INT(1, count);
    202 
    203 	report_count(1);
    204 	report_return(addchnstr(chstr, count));
    205 }
    206 
    207 
    208 void
    209 cmd_addchstr(int nargs, char **args)
    210 {
    211 	ARGC(1);
    212 	ARG_CHTYPE_STRING(0, chstr);
    213 
    214 	report_count(1);
    215 	report_return(addchstr(chstr));
    216 }
    217 
    218 
    219 void
    220 cmd_addnstr(int nargs, char **args)
    221 {
    222 	ARGC(2);
    223 	ARG_STRING(0, str);
    224 	ARG_INT(1, count);
    225 
    226 	report_count(1);
    227 	report_return(addnstr(str, count));
    228 }
    229 
    230 
    231 void
    232 cmd_addstr(int nargs, char **args)
    233 {
    234 	ARGC(1);
    235 	ARG_STRING(0, str);
    236 
    237 	report_count(1);
    238 	report_return(addstr(str));
    239 }
    240 
    241 
    242 void
    243 cmd_attr_get(int nargs, char **args)
    244 {
    245 	attr_t attrs;
    246 	short colours;
    247 	int retval;
    248 
    249 	ARGC(0);
    250 
    251 	retval = attr_get(&attrs, &colours, NULL);
    252 
    253 	report_count(3);
    254 	report_return(retval);
    255 	report_int(attrs);
    256 	report_int(colours);
    257 }
    258 
    259 
    260 void
    261 cmd_attr_off(int nargs, char **args)
    262 {
    263 	ARGC(1);
    264 	ARG_INT(0, attrib);
    265 
    266 	report_count(1);
    267 	report_return(attr_off(attrib, NULL));
    268 }
    269 
    270 
    271 void
    272 cmd_attr_on(int nargs, char **args)
    273 {
    274 	ARGC(1);
    275 	ARG_INT(0, attrib);
    276 
    277 	report_count(1);
    278 	report_return(attr_on(attrib, NULL));
    279 }
    280 
    281 
    282 void
    283 cmd_attr_set(int nargs, char **args)
    284 {
    285 	ARGC(2);
    286 	ARG_INT(0, attrib);
    287 	ARG_SHORT(1, pair);
    288 
    289 	report_count(1);
    290 	report_return(attr_set(attrib, pair, NULL));
    291 }
    292 
    293 
    294 void
    295 cmd_attroff(int nargs, char **args)
    296 {
    297 	ARGC(1);
    298 	ARG_INT(0, attrib);
    299 
    300 	report_count(1);
    301 	report_return(attroff(attrib));
    302 }
    303 
    304 
    305 void
    306 cmd_attron(int nargs, char **args)
    307 {
    308 	ARGC(1);
    309 	ARG_INT(0, attrib);
    310 
    311 	report_count(1);
    312 	report_return(attron(attrib));
    313 }
    314 
    315 
    316 void
    317 cmd_attrset(int nargs, char **args)
    318 {
    319 	ARGC(1);
    320 	ARG_INT(0, attrib);
    321 
    322 	report_count(1);
    323 	report_return(attrset(attrib));
    324 }
    325 
    326 
    327 void
    328 cmd_bkgd(int nargs, char **args)
    329 {
    330 	ARGC(1);
    331 	ARG_CHTYPE(0, ch);
    332 
    333 	report_count(1);
    334 	report_return(bkgd(ch));
    335 }
    336 
    337 
    338 void
    339 cmd_bkgdset(int nargs, char **args)
    340 {
    341 	ARGC(1);
    342 	ARG_CHTYPE(0, ch);
    343 
    344 	bkgdset(ch);		/* returns void */
    345 	report_count(1);
    346 	report_return(OK);
    347 }
    348 
    349 
    350 void
    351 cmd_border(int nargs, char **args)
    352 {
    353 	ARGC(8);
    354 	ARG_INT(0, ls);
    355 	ARG_INT(1, rs);
    356 	ARG_INT(2, ts);
    357 	ARG_INT(3, bs);
    358 	ARG_INT(4, tl);
    359 	ARG_INT(5, tr);
    360 	ARG_INT(6, bl);
    361 	ARG_INT(7, br);
    362 
    363 	report_count(1);
    364 	report_return(border(ls, rs, ts, bs, tl, tr, bl, br));
    365 }
    366 
    367 
    368 void
    369 cmd_clear(int nargs, char **args)
    370 {
    371 	ARGC(0);
    372 
    373 	report_count(1);
    374 	report_return(clear());
    375 }
    376 
    377 
    378 void
    379 cmd_clrtobot(int nargs, char **args)
    380 {
    381 	ARGC(0);
    382 
    383 	report_count(1);
    384 	report_return(clrtobot());
    385 }
    386 
    387 
    388 void
    389 cmd_clrtoeol(int nargs, char **args)
    390 {
    391 	ARGC(0);
    392 
    393 	report_count(1);
    394 	report_return(clrtoeol());
    395 }
    396 
    397 
    398 void
    399 cmd_color_set(int nargs, char **args)
    400 {
    401 	ARGC(2);
    402 	ARG_SHORT(0, colour_pair);
    403 	ARG_NULL(1);
    404 
    405 	report_count(1);
    406 	report_return(color_set(colour_pair, NULL));
    407 }
    408 
    409 
    410 void
    411 cmd_delch(int nargs, char **args)
    412 {
    413 	ARGC(0);
    414 
    415 	report_count(1);
    416 	report_return(delch());
    417 }
    418 
    419 
    420 void
    421 cmd_deleteln(int nargs, char **args)
    422 {
    423 	ARGC(0);
    424 
    425 	report_count(1);
    426 	report_return(deleteln());
    427 }
    428 
    429 
    430 void
    431 cmd_echochar(int nargs, char **args)
    432 {
    433 	ARGC(1);
    434 	ARG_CHTYPE(0, ch);
    435 
    436 	/* XXX causes refresh */
    437 	report_count(1);
    438 	report_return(echochar(ch));
    439 }
    440 
    441 
    442 void
    443 cmd_erase(int nargs, char **args)
    444 {
    445 	ARGC(0);
    446 
    447 	report_count(1);
    448 	report_return(erase());
    449 }
    450 
    451 
    452 void
    453 cmd_getch(int nargs, char **args)
    454 {
    455 	ARGC(0);
    456 
    457 	/* XXX causes refresh */
    458 	report_count(1);
    459 	report_int(getch());
    460 }
    461 
    462 
    463 void
    464 cmd_getnstr(int nargs, char **args)
    465 {
    466 	char *string;
    467 
    468 	ARGC(1);
    469 	ARG_INT(0, limit);
    470 
    471 	if ((string = malloc(limit + 1)) == NULL) {
    472 		report_count(1);
    473 		report_error("MALLOC_FAILED");
    474 		return;
    475 	}
    476 
    477 	report_count(2);
    478 	report_return(getnstr(string, limit));
    479 	report_status(string);
    480 	free(string);
    481 }
    482 
    483 
    484 void
    485 cmd_getstr(int nargs, char **args)
    486 {
    487 	char string[256];
    488 
    489 	ARGC(0);
    490 
    491 	report_count(2);
    492 	report_return(getstr(string));
    493 	report_status(string);
    494 }
    495 
    496 
    497 void
    498 cmd_inch(int nargs, char **args)
    499 {
    500 	ARGC(0);
    501 
    502 	report_count(1);
    503 	report_byte(inch());
    504 }
    505 
    506 
    507 void
    508 cmd_inchnstr(int nargs, char **args)
    509 {
    510 	chtype *string;
    511 
    512 	ARGC(1);
    513 	ARG_INT(0, limit);
    514 
    515 	if ((string = malloc((limit + 1) * sizeof(chtype))) == NULL) {
    516 		report_count(1);
    517 		report_error("MALLOC_FAILED");
    518 		return;
    519 	}
    520 
    521 	report_count(2);
    522 	report_return(inchnstr(string, limit));
    523 	report_nstr(string);
    524 	free(string);
    525 }
    526 
    527 
    528 void
    529 cmd_inchstr(int nargs, char **args)
    530 {
    531 	chtype string[256];
    532 
    533 	ARGC(0);
    534 
    535 	report_count(2);
    536 	report_return(inchstr(string));
    537 	report_nstr(string);
    538 }
    539 
    540 
    541 void
    542 cmd_innstr(int nargs, char **args)
    543 {
    544 	char *string;
    545 
    546 	ARGC(1);
    547 	ARG_INT(0, limit);
    548 
    549 	if ((string = malloc(limit + 1)) == NULL) {
    550 		report_count(1);
    551 		report_error("MALLOC_FAILED");
    552 		return;
    553 	}
    554 
    555 	report_count(2);
    556 	report_int(innstr(string, limit));
    557 	report_status(string);
    558 	free(string);
    559 }
    560 
    561 
    562 void
    563 cmd_insch(int nargs, char **args)
    564 {
    565 	ARGC(1);
    566 	ARG_CHTYPE(0, ch);
    567 
    568 	report_count(1);
    569 	report_return(insch(ch));
    570 }
    571 
    572 
    573 void
    574 cmd_insdelln(int nargs, char **args)
    575 {
    576 	ARGC(1);
    577 	ARG_INT(0, nlines);
    578 
    579 	report_count(1);
    580 	report_return(insdelln(nlines));
    581 }
    582 
    583 
    584 void
    585 cmd_insertln(int nargs, char **args)
    586 {
    587 	ARGC(0);
    588 
    589 	report_count(1);
    590 	report_return(insertln());
    591 }
    592 
    593 
    594 void
    595 cmd_instr(int nargs, char **args)
    596 {
    597 	char string[256];
    598 
    599 	ARGC(0);
    600 
    601 	report_count(2);
    602 	report_return(instr(string));
    603 	report_status(string);
    604 }
    605 
    606 
    607 void
    608 cmd_move(int nargs, char **args)
    609 {
    610 	ARGC(2);
    611 	ARG_INT(0, y);
    612 	ARG_INT(1, x);
    613 
    614 	report_count(1);
    615 	report_return(move(y, x));
    616 }
    617 
    618 
    619 void
    620 cmd_refresh(int nargs, char **args)
    621 {
    622 	ARGC(0);
    623 
    624 	report_count(1);
    625 	report_return(refresh());
    626 }
    627 
    628 
    629 void
    630 cmd_scrl(int nargs, char **args)
    631 {
    632 	ARGC(1);
    633 	ARG_INT(0, nlines);
    634 
    635 	report_count(1);
    636 	report_return(scrl(nlines));
    637 }
    638 
    639 
    640 void
    641 cmd_setscrreg(int nargs, char **args)
    642 {
    643 	ARGC(2);
    644 	ARG_INT(0, top);
    645 	ARG_INT(1, bottom);
    646 
    647 	report_count(1);
    648 	report_return(setscrreg(top, bottom));
    649 }
    650 
    651 
    652 void
    653 cmd_standend(int nargs, char **args)
    654 {
    655 	ARGC(0);
    656 
    657 	report_count(1);
    658 	report_int(standend());
    659 }
    660 
    661 
    662 void
    663 cmd_standout(int nargs, char **args)
    664 {
    665 	ARGC(0);
    666 
    667 	report_count(1);
    668 	report_int(standout());
    669 }
    670 
    671 
    672 void
    673 cmd_timeout(int nargs, char **args)
    674 {
    675 	ARGC(1);
    676 	ARG_INT(0, tval);
    677 
    678 	timeout(tval);		/* void return */
    679 	report_count(1);
    680 	report_return(OK);
    681 }
    682 
    683 
    684 void
    685 cmd_underscore(int nargs, char **args)
    686 {
    687 	ARGC(0);
    688 
    689 	report_count(1);
    690 	report_int(underscore());
    691 }
    692 
    693 
    694 void
    695 cmd_underend(int nargs, char **args)
    696 {
    697 	ARGC(0);
    698 
    699 	report_count(1);
    700 	report_int(underend());
    701 }
    702 
    703 
    704 void
    705 cmd_waddbytes(int nargs, char **args)
    706 {
    707 	ARGC(3);
    708 	ARG_WINDOW(0, win);
    709 	ARG_STRING(1, str);
    710 	ARG_INT(2, count);
    711 
    712 	report_count(1);
    713 	report_return(waddbytes(win, str, count));
    714 }
    715 
    716 
    717 void
    718 cmd_waddstr(int nargs, char **args)
    719 {
    720 	ARGC(2);
    721 	ARG_WINDOW(0, win);
    722 	ARG_STRING(1, str);
    723 
    724 	report_count(1);
    725 	report_return(waddstr(win, str));
    726 }
    727 
    728 
    729 void
    730 cmd_mvaddbytes(int nargs, char **args)
    731 {
    732 	ARGC(4);
    733 	ARG_INT(0, y);
    734 	ARG_INT(1, x);
    735 	ARG_STRING(2, str);
    736 	ARG_INT(3, count);
    737 
    738 	report_count(1);
    739 	report_return(mvaddbytes(y, x, str, count));
    740 }
    741 
    742 
    743 void
    744 cmd_mvaddch(int nargs, char **args)
    745 {
    746 	ARGC(3);
    747 	ARG_INT(0, y);
    748 	ARG_INT(1, x);
    749 	ARG_CHTYPE(2, ch);
    750 
    751 	report_count(1);
    752 	report_return(mvaddch(y, x, ch));
    753 }
    754 
    755 
    756 void
    757 cmd_mvaddchnstr(int nargs, char **args)
    758 {
    759 	ARGC(4);
    760 	ARG_INT(0, y);
    761 	ARG_INT(1, x);
    762 	ARG_CHTYPE_STRING(2, chstr);
    763 	ARG_INT(3, count);
    764 
    765 	report_count(1);
    766 	report_return(mvaddchnstr(y, x, chstr, count));
    767 }
    768 
    769 
    770 void
    771 cmd_mvaddchstr(int nargs, char **args)
    772 {
    773 	ARGC(3);
    774 	ARG_INT(0, y);
    775 	ARG_INT(1, x);
    776 	ARG_CHTYPE_STRING(2, chstr);
    777 
    778 	report_count(1);
    779 	report_return(mvaddchstr(y, x, chstr));
    780 }
    781 
    782 
    783 void
    784 cmd_mvaddnstr(int nargs, char **args)
    785 {
    786 	ARGC(4);
    787 	ARG_INT(0, y);
    788 	ARG_INT(1, x);
    789 	ARG_STRING(2, str);
    790 	ARG_INT(3, count);
    791 
    792 	report_count(1);
    793 	report_return(mvaddnstr(y, x, str, count));
    794 }
    795 
    796 
    797 void
    798 cmd_mvaddstr(int nargs, char **args)
    799 {
    800 	ARGC(3);
    801 	ARG_INT(0, y);
    802 	ARG_INT(1, x);
    803 	ARG_STRING(2, str);
    804 
    805 	report_count(1);
    806 	report_return(mvaddstr(y, x, str));
    807 }
    808 
    809 
    810 void
    811 cmd_mvdelch(int nargs, char **args)
    812 {
    813 	ARGC(2);
    814 	ARG_INT(0, y);
    815 	ARG_INT(1, x);
    816 
    817 	report_count(1);
    818 	report_return(mvdelch(y, x));
    819 }
    820 
    821 
    822 void
    823 cmd_mvgetch(int nargs, char **args)
    824 {
    825 	ARGC(2);
    826 	ARG_INT(0, y);
    827 	ARG_INT(1, x);
    828 
    829 	report_count(1);
    830 	report_int(mvgetch(y, x));
    831 }
    832 
    833 
    834 void
    835 cmd_mvgetnstr(int nargs, char **args)
    836 {
    837 	char *string;
    838 
    839 	ARGC(3);
    840 	ARG_INT(0, y);
    841 	ARG_INT(1, x);
    842 	ARG_INT(2, count);
    843 
    844 	if ((string = malloc(count + 1)) == NULL) {
    845 		report_count(1);
    846 		report_error("MALLOC_FAILED");
    847 		return;
    848 	}
    849 
    850 	report_count(2);
    851 	report_return(mvgetnstr(y, x, string, count));
    852 	report_status(string);
    853 	free(string);
    854 }
    855 
    856 
    857 void
    858 cmd_mvgetstr(int nargs, char **args)
    859 {
    860 	char string[256];
    861 
    862 	ARGC(2);
    863 	ARG_INT(0, y);
    864 	ARG_INT(1, x);
    865 
    866 	report_count(2);
    867 	report_return(mvgetstr(y, x, string));
    868 	report_status(string);
    869 }
    870 
    871 
    872 void
    873 cmd_mvinch(int nargs, char **args)
    874 {
    875 	ARGC(2);
    876 	ARG_INT(0, y);
    877 	ARG_INT(1, x);
    878 
    879 	report_count(1);
    880 	report_byte(mvinch(y, x));
    881 }
    882 
    883 
    884 void
    885 cmd_mvinchnstr(int nargs, char **args)
    886 {
    887 	chtype *string;
    888 
    889 	ARGC(3);
    890 	ARG_INT(0, y);
    891 	ARG_INT(1, x);
    892 	ARG_INT(2, count);
    893 
    894 	if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) {
    895 		report_count(1);
    896 		report_error("MALLOC_FAILED");
    897 		return;
    898 	}
    899 
    900 	report_count(2);
    901 	report_return(mvinchnstr(y, x, string, count));
    902 	report_nstr(string);
    903 	free(string);
    904 }
    905 
    906 
    907 void
    908 cmd_mvinchstr(int nargs, char **args)
    909 {
    910 	chtype string[256];
    911 
    912 	ARGC(2);
    913 	ARG_INT(0, y);
    914 	ARG_INT(1, x);
    915 
    916 	report_count(2);
    917 	report_return(mvinchstr(y, x, string));
    918 	report_nstr(string);
    919 }
    920 
    921 
    922 void
    923 cmd_mvinnstr(int nargs, char **args)
    924 {
    925 	char *string;
    926 
    927 	ARGC(3);
    928 	ARG_INT(0, y);
    929 	ARG_INT(1, x);
    930 	ARG_INT(2, count);
    931 
    932 	if ((string = malloc(count + 1)) == NULL) {
    933 		report_count(1);
    934 		report_error("MALLOC_FAILED");
    935 		return;
    936 	}
    937 
    938 	report_count(2);
    939 	report_int(mvinnstr(y, x, string, count));
    940 	report_status(string);
    941 	free(string);
    942 }
    943 
    944 
    945 void
    946 cmd_mvinsch(int nargs, char **args)
    947 {
    948 	ARGC(3);
    949 	ARG_INT(0, y);
    950 	ARG_INT(1, x);
    951 	ARG_CHTYPE(2, ch);
    952 
    953 	report_count(1);
    954 	report_return(mvinsch(y, x, ch));
    955 }
    956 
    957 
    958 void
    959 cmd_mvinstr(int nargs, char **args)
    960 {
    961 	char string[256];
    962 
    963 	ARGC(2);
    964 	ARG_INT(0, y);
    965 	ARG_INT(1, x);
    966 
    967 	report_count(2);
    968 	report_return(mvinstr(y, x, string));
    969 	report_status(string);
    970 }
    971 
    972 
    973 void
    974 cmd_mvwaddbytes(int nargs, char **args)
    975 {
    976 	ARGC(5);
    977 	ARG_WINDOW(0, win);
    978 	ARG_INT(1, y);
    979 	ARG_INT(2, x);
    980 	ARG_STRING(3, str);
    981 	ARG_INT(4, count);
    982 
    983 	report_count(1);
    984 	report_return(mvwaddbytes(win, y, x, str, count));
    985 }
    986 
    987 
    988 void
    989 cmd_mvwaddch(int nargs, char **args)
    990 {
    991 	ARGC(4);
    992 	ARG_WINDOW(0, win);
    993 	ARG_INT(1, y);
    994 	ARG_INT(2, x);
    995 	ARG_CHTYPE(3, ch);
    996 
    997 	report_count(1);
    998 	report_return(mvwaddch(win, y, x, ch));
    999 }
   1000 
   1001 
   1002 void
   1003 cmd_mvwaddchnstr(int nargs, char **args)
   1004 {
   1005 	ARGC(5);
   1006 	ARG_WINDOW(0, win);
   1007 	ARG_INT(1, y);
   1008 	ARG_INT(2, x);
   1009 	ARG_CHTYPE_STRING(3, chstr);
   1010 	ARG_INT(4, count);
   1011 
   1012 	report_count(1);
   1013 	report_return(mvwaddchnstr(win, y, x, chstr, count));
   1014 }
   1015 
   1016 
   1017 void
   1018 cmd_mvwaddchstr(int nargs, char **args)
   1019 {
   1020 	ARGC(4);
   1021 	ARG_WINDOW(0, win);
   1022 	ARG_INT(1, y);
   1023 	ARG_INT(2, x);
   1024 	ARG_CHTYPE_STRING(3, chstr);
   1025 
   1026 	report_count(1);
   1027 	report_return(mvwaddchstr(win, y, x, chstr));
   1028 }
   1029 
   1030 
   1031 void
   1032 cmd_mvwaddnstr(int nargs, char **args)
   1033 {
   1034 	ARGC(5);
   1035 	ARG_WINDOW(0, win);
   1036 	ARG_INT(1, y);
   1037 	ARG_INT(2, x);
   1038 	ARG_STRING(3, str);
   1039 	ARG_INT(4, count);
   1040 
   1041 	report_count(1);
   1042 	report_return(mvwaddnstr(win, y, x, str, count));
   1043 }
   1044 
   1045 
   1046 void
   1047 cmd_mvwaddstr(int nargs, char **args)
   1048 {
   1049 	ARGC(4);
   1050 	ARG_WINDOW(0, win);
   1051 	ARG_INT(1, y);
   1052 	ARG_INT(2, x);
   1053 	ARG_STRING(3, str);
   1054 
   1055 	report_count(1);
   1056 	report_return(mvwaddstr(win, y, x, str));
   1057 }
   1058 
   1059 
   1060 void
   1061 cmd_mvwdelch(int nargs, char **args)
   1062 {
   1063 	ARGC(3);
   1064 	ARG_WINDOW(0, win);
   1065 	ARG_INT(1, y);
   1066 	ARG_INT(2, x);
   1067 
   1068 	report_count(1);
   1069 	report_return(mvwdelch(win, y, x));
   1070 }
   1071 
   1072 
   1073 void
   1074 cmd_mvwgetch(int nargs, char **args)
   1075 {
   1076 	ARGC(3);
   1077 	ARG_WINDOW(0, win);
   1078 	ARG_INT(1, y);
   1079 	ARG_INT(2, x);
   1080 
   1081 	/* XXX - implicit refresh */
   1082 	report_count(1);
   1083 	report_int(mvwgetch(win, y, x));
   1084 }
   1085 
   1086 
   1087 void
   1088 cmd_mvwgetnstr(int nargs, char **args)
   1089 {
   1090 	char *string;
   1091 
   1092 	ARGC(4);
   1093 	ARG_WINDOW(0, win);
   1094 	ARG_INT(1, y);
   1095 	ARG_INT(2, x);
   1096 	ARG_INT(3, count);
   1097 
   1098 	if ((string = malloc(count + 1)) == NULL) {
   1099 		report_count(1);
   1100 		report_error("MALLOC_FAILED");
   1101 		return;
   1102 	}
   1103 
   1104 	report_count(2);
   1105 	report_return(mvwgetnstr(win, y, x, string, count));
   1106 	report_status(string);
   1107 	free(string);
   1108 }
   1109 
   1110 
   1111 void
   1112 cmd_mvwgetstr(int nargs, char **args)
   1113 {
   1114 	char string[256];
   1115 
   1116 	ARGC(3);
   1117 	ARG_WINDOW(0, win);
   1118 	ARG_INT(1, y);
   1119 	ARG_INT(2, x);
   1120 
   1121 	report_count(2);
   1122 	report_return(mvwgetstr(win, y, x, string));
   1123 	report_status(string);
   1124 }
   1125 
   1126 
   1127 void
   1128 cmd_mvwinch(int nargs, char **args)
   1129 {
   1130 	ARGC(3);
   1131 	ARG_WINDOW(0, win);
   1132 	ARG_INT(1, y);
   1133 	ARG_INT(2, x);
   1134 
   1135 	report_count(1);
   1136 	report_byte(mvwinch(win, y, x));
   1137 }
   1138 
   1139 
   1140 void
   1141 cmd_mvwinsch(int nargs, char **args)
   1142 {
   1143 	ARGC(4);
   1144 	ARG_WINDOW(0, win);
   1145 	ARG_INT(1, y);
   1146 	ARG_INT(2, x);
   1147 	ARG_CHTYPE(3, ch);
   1148 
   1149 	report_count(1);
   1150 	report_return(mvwinsch(win, y, x, ch));
   1151 }
   1152 
   1153 
   1154 void
   1155 cmd_assume_default_colors(int nargs, char **args)
   1156 {
   1157 	ARGC(2);
   1158 	ARG_SHORT(0, fore);
   1159 	ARG_SHORT(1, back);
   1160 
   1161 	report_count(1);
   1162 	report_return(assume_default_colors(fore, back));
   1163 }
   1164 
   1165 
   1166 void
   1167 cmd_baudrate(int nargs, char **args)
   1168 {
   1169 	ARGC(0);
   1170 
   1171 	report_count(1);
   1172 	report_int(baudrate());
   1173 }
   1174 
   1175 
   1176 void
   1177 cmd_beep(int nargs, char **args)
   1178 {
   1179 	ARGC(0);
   1180 
   1181 	report_count(1);
   1182 	report_return(beep());
   1183 }
   1184 
   1185 
   1186 void
   1187 cmd_box(int nargs, char **args)
   1188 {
   1189 	ARGC(3);
   1190 	ARG_WINDOW(0, win);
   1191 	ARG_CHTYPE(1, vertical);
   1192 	ARG_CHTYPE(2, horizontal);
   1193 
   1194 	report_count(1);
   1195 	report_return(box(win, vertical, horizontal));
   1196 }
   1197 
   1198 
   1199 void
   1200 cmd_can_change_color(int nargs, char **args)
   1201 {
   1202 	ARGC(0);
   1203 
   1204 	report_count(1);
   1205 	report_int(can_change_color());
   1206 }
   1207 
   1208 
   1209 void
   1210 cmd_cbreak(int nargs, char **args)
   1211 {
   1212 	ARGC(0);
   1213 
   1214 	report_count(1);
   1215 	report_return(cbreak());
   1216 }
   1217 
   1218 
   1219 void
   1220 cmd_clearok(int nargs, char **args)
   1221 {
   1222 	ARGC(2);
   1223 	ARG_WINDOW(0, win);
   1224 	ARG_INT(1, flag);
   1225 
   1226 	report_count(1);
   1227 	report_return(clearok(win, flag));
   1228 }
   1229 
   1230 
   1231 void
   1232 cmd_color_content(int nargs, char **args)
   1233 {
   1234 	ARGC(1);
   1235 	ARG_SHORT(0, colour);
   1236 
   1237 	short red, green, blue;
   1238 	int ret = color_content(colour, &red, &green, &blue);
   1239 
   1240 	report_count(4);
   1241 	report_return(ret);
   1242 	report_int(red);
   1243 	report_int(green);
   1244 	report_int(blue);
   1245 }
   1246 
   1247 
   1248 void
   1249 cmd_copywin(int nargs, char **args)
   1250 {
   1251 	ARGC(9);
   1252 	ARG_WINDOW(0, source);
   1253 	ARG_WINDOW(1, destination);
   1254 	ARG_INT(2, sminrow);
   1255 	ARG_INT(3, smincol);
   1256 	ARG_INT(4, dminrow);
   1257 	ARG_INT(5, dmincol);
   1258 	ARG_INT(6, dmaxrow);
   1259 	ARG_INT(7, dmaxcol);
   1260 	ARG_INT(8, ovlay);
   1261 
   1262 	report_count(1);
   1263 	report_return(copywin(source, destination, sminrow, smincol, dminrow,
   1264 		dmincol, dmaxrow, dmaxcol, ovlay));
   1265 }
   1266 
   1267 
   1268 void
   1269 cmd_curs_set(int nargs, char **args)
   1270 {
   1271 	ARGC(1);
   1272 	ARG_INT(0, vis);
   1273 
   1274 	report_count(1);
   1275 	report_int(curs_set(vis));
   1276 }
   1277 
   1278 
   1279 void
   1280 cmd_def_prog_mode(int nargs, char **args)
   1281 {
   1282 	ARGC(0);
   1283 
   1284 	report_count(1);
   1285 	report_return(def_prog_mode());
   1286 }
   1287 
   1288 
   1289 void
   1290 cmd_def_shell_mode(int nargs, char **args)
   1291 {
   1292 	ARGC(0);
   1293 
   1294 	report_count(1);
   1295 	report_return(def_shell_mode());
   1296 }
   1297 
   1298 
   1299 void
   1300 cmd_define_key(int nargs, char **args)
   1301 {
   1302 	ARGC(2);
   1303 	ARG_MODIFIABLE_STRING(0, sequence);
   1304 	ARG_INT(1, symbol);
   1305 
   1306 	report_count(1);
   1307 	report_return(define_key(sequence, symbol));
   1308 }
   1309 
   1310 
   1311 void
   1312 cmd_delay_output(int nargs, char **args)
   1313 {
   1314 	ARGC(1);
   1315 	ARG_INT(0, dtime);
   1316 
   1317 	report_count(1);
   1318 	report_return(delay_output(dtime));
   1319 }
   1320 
   1321 
   1322 void
   1323 cmd_delscreen(int nargs, char **args)
   1324 {
   1325 	ARGC(1);
   1326 	ARG_SCREEN(0, scrn);
   1327 
   1328 	delscreen(scrn);	/* void return */
   1329 
   1330 	report_count(1);
   1331 	report_return(OK);
   1332 }
   1333 
   1334 
   1335 void
   1336 cmd_delwin(int nargs, char **args)
   1337 {
   1338 	ARGC(1);
   1339 	ARG_WINDOW(0, win);
   1340 
   1341 	report_count(1);
   1342 	report_return(delwin(win));
   1343 }
   1344 
   1345 
   1346 void
   1347 cmd_derwin(int nargs, char **args)
   1348 {
   1349 	ARGC(5);
   1350 	ARG_WINDOW(0, win);
   1351 	ARG_INT(1, lines);
   1352 	ARG_INT(2, cols);
   1353 	ARG_INT(3, y);
   1354 	ARG_INT(4, x);
   1355 
   1356 	report_count(1);
   1357 	report_ptr(derwin(win, lines, cols, y, x));
   1358 }
   1359 
   1360 
   1361 void
   1362 cmd_dupwin(int nargs, char **args)
   1363 {
   1364 	ARGC(1);
   1365 	ARG_WINDOW(0, win);
   1366 
   1367 	report_count(1);
   1368 	report_ptr(dupwin(win));
   1369 }
   1370 
   1371 
   1372 void
   1373 cmd_doupdate(int nargs, char **args)
   1374 {
   1375 	ARGC(0);
   1376 
   1377 	/* XXX - implicit refresh */
   1378 	report_count(1);
   1379 	report_return(doupdate());
   1380 }
   1381 
   1382 
   1383 void
   1384 cmd_echo(int nargs, char **args)
   1385 {
   1386 	ARGC(0);
   1387 
   1388 	report_count(1);
   1389 	report_return(echo());
   1390 }
   1391 
   1392 
   1393 void
   1394 cmd_endwin(int nargs, char **args)
   1395 {
   1396 	ARGC(0);
   1397 
   1398 	report_count(1);
   1399 	report_return(endwin());
   1400 }
   1401 
   1402 
   1403 void
   1404 cmd_erasechar(int nargs, char **args)
   1405 {
   1406 	ARGC(0);
   1407 
   1408 	report_count(1);
   1409 	report_int(erasechar());
   1410 }
   1411 
   1412 
   1413 void
   1414 cmd_flash(int nargs, char **args)
   1415 {
   1416 	ARGC(0);
   1417 
   1418 	report_count(1);
   1419 	report_return(flash());
   1420 }
   1421 
   1422 
   1423 void
   1424 cmd_flushinp(int nargs, char **args)
   1425 {
   1426 	ARGC(0);
   1427 
   1428 	report_count(1);
   1429 	report_return(flushinp());
   1430 }
   1431 
   1432 
   1433 void
   1434 cmd_flushok(int nargs, char **args)
   1435 {
   1436 	ARGC(2);
   1437 	ARG_WINDOW(0, win);
   1438 	ARG_INT(1, flag);
   1439 
   1440 	report_count(1);
   1441 	report_return(flushok(win, flag));
   1442 }
   1443 
   1444 
   1445 void
   1446 cmd_fullname(int nargs, char **args)
   1447 {
   1448 	char string[256];
   1449 
   1450 	ARGC(1);
   1451 	ARG_STRING(0, termbuf);
   1452 
   1453 	report_count(2);
   1454 	report_status(fullname(termbuf, string));
   1455 	report_status(string);
   1456 }
   1457 
   1458 
   1459 void
   1460 cmd_getattrs(int nargs, char **args)
   1461 {
   1462 	ARGC(1);
   1463 	ARG_WINDOW(0, win);
   1464 
   1465 	report_count(1);
   1466 	report_int(getattrs(win));
   1467 }
   1468 
   1469 
   1470 void
   1471 cmd_getbkgd(int nargs, char **args)
   1472 {
   1473 	ARGC(1);
   1474 	ARG_WINDOW(0, win);
   1475 
   1476 	report_count(1);
   1477 	report_byte(getbkgd(win));
   1478 }
   1479 
   1480 
   1481 void
   1482 cmd_getcury(int nargs, char **args)
   1483 {
   1484 	ARGC(1);
   1485 	ARG_WINDOW(0, win);
   1486 
   1487 	report_count(1);
   1488 	report_int(getcury(win));
   1489 }
   1490 
   1491 
   1492 void
   1493 cmd_getcurx(int nargs, char **args)
   1494 {
   1495 	ARGC(1);
   1496 	ARG_WINDOW(0, win);
   1497 
   1498 	report_count(1);
   1499 	report_int(getcurx(win));
   1500 }
   1501 
   1502 
   1503 void
   1504 cmd_getyx(int nargs, char **args)
   1505 {
   1506 	ARGC(1);
   1507 	ARG_WINDOW(0, win);
   1508 
   1509 	int y, x;
   1510 	getyx(win, y, x);
   1511 	report_count(2);
   1512 	report_int(y);
   1513 	report_int(x);
   1514 }
   1515 
   1516 
   1517 void
   1518 cmd_getbegy(int nargs, char **args)
   1519 {
   1520 	ARGC(1);
   1521 	ARG_WINDOW(0, win);
   1522 
   1523 	report_count(1);
   1524 	report_int(getbegy(win));
   1525 }
   1526 
   1527 
   1528 void
   1529 cmd_getbegx(int nargs, char **args)
   1530 {
   1531 	ARGC(1);
   1532 	ARG_WINDOW(0, win);
   1533 
   1534 	report_count(1);
   1535 	report_int(getbegx(win));
   1536 }
   1537 
   1538 
   1539 void
   1540 cmd_getmaxy(int nargs, char **args)
   1541 {
   1542 	ARGC(1);
   1543 	ARG_WINDOW(0, win);
   1544 
   1545 	report_count(1);
   1546 	report_int(getmaxy(win));
   1547 }
   1548 
   1549 
   1550 void
   1551 cmd_getmaxx(int nargs, char **args)
   1552 {
   1553 	ARGC(1);
   1554 	ARG_WINDOW(0, win);
   1555 
   1556 	report_count(1);
   1557 	report_int(getmaxx(win));
   1558 }
   1559 
   1560 
   1561 void
   1562 cmd_getpary(int nargs, char **args)
   1563 {
   1564 	ARGC(1);
   1565 	ARG_WINDOW(0, win);
   1566 
   1567 	report_count(1);
   1568 	report_int(getpary(win));
   1569 }
   1570 
   1571 
   1572 void
   1573 cmd_getparx(int nargs, char **args)
   1574 {
   1575 	ARGC(1);
   1576 	ARG_WINDOW(0, win);
   1577 
   1578 	report_count(1);
   1579 	report_int(getparx(win));
   1580 }
   1581 
   1582 
   1583 void
   1584 cmd_getparyx(int nargs, char **args)
   1585 {
   1586 	ARGC(1);
   1587 	ARG_WINDOW(0, win);
   1588 
   1589 	int y, x;
   1590 	report_count(2);
   1591 	getparyx(win, y, x);
   1592 	report_int(y);
   1593 	report_int(x);
   1594 }
   1595 
   1596 void
   1597 cmd_getmaxyx(int nargs, char **args)
   1598 {
   1599 	ARGC(1);
   1600 	ARG_WINDOW(0, win);
   1601 
   1602 	int y, x;
   1603 	getmaxyx(win, y, x);
   1604 
   1605 	report_count(2);
   1606 	report_int(y);
   1607 	report_int(x);
   1608 }
   1609 
   1610 void
   1611 cmd_getbegyx(int nargs, char **args)
   1612 {
   1613 	ARGC(1);
   1614 	ARG_WINDOW(0, win);
   1615 
   1616 	int y, x;
   1617 	getbegyx(win, y, x);
   1618 
   1619 	report_count(2);
   1620 	report_int(y);
   1621 	report_int(x);
   1622 }
   1623 
   1624 void
   1625 cmd_setsyx(int nargs, char **args)
   1626 {
   1627 	ARGC(2);
   1628 	ARG_INT(0, y);
   1629 	ARG_INT(1, x);
   1630 
   1631 	report_count(1);
   1632 	setsyx(y, x);
   1633 	report_return(OK);
   1634 }
   1635 
   1636 void
   1637 cmd_getsyx(int nargs, char **args)
   1638 {
   1639 	int y, x;
   1640 
   1641 	ARGC(0);
   1642 
   1643 	report_count(3);
   1644 	getsyx(y, x);
   1645 	report_return(OK);
   1646 	report_int(y);
   1647 	report_int(x);
   1648 }
   1649 
   1650 void
   1651 cmd_gettmode(int nargs, char **args)
   1652 {
   1653 	ARGC(0);
   1654 
   1655 	report_count(1);
   1656 	report_return(gettmode());
   1657 }
   1658 
   1659 
   1660 void
   1661 cmd_getwin(int nargs, char **args)
   1662 {
   1663 	FILE *fp;
   1664 
   1665 	ARGC(1);
   1666 	ARG_STRING(0, filename);
   1667 
   1668 	if ((fp = fopen(filename, "r")) == NULL) {
   1669 		report_count(1);
   1670 		report_error("BAD FILE_ARGUMENT");
   1671 		return;
   1672 	}
   1673 	report_count(1);
   1674 	report_ptr(getwin(fp));
   1675 	fclose(fp);
   1676 }
   1677 
   1678 
   1679 void
   1680 cmd_halfdelay(int nargs, char **args)
   1681 {
   1682 	ARGC(1);
   1683 	ARG_INT(0, ms);
   1684 
   1685 	report_count(1);
   1686 	report_return(halfdelay(ms));
   1687 }
   1688 
   1689 
   1690 void
   1691 cmd_has_colors(int nargs, char **args)
   1692 {
   1693 	ARGC(0);
   1694 
   1695 	report_count(1);
   1696 	report_int(has_colors());
   1697 }
   1698 
   1699 
   1700 void
   1701 cmd_has_ic(int nargs, char **args)
   1702 {
   1703 	ARGC(0);
   1704 
   1705 	report_count(1);
   1706 	report_int(has_ic());
   1707 }
   1708 
   1709 
   1710 void
   1711 cmd_has_il(int nargs, char **args)
   1712 {
   1713 	ARGC(0);
   1714 
   1715 	report_count(1);
   1716 	report_int(has_il());
   1717 }
   1718 
   1719 
   1720 void
   1721 cmd_hline(int nargs, char **args)
   1722 {
   1723 	ARGC(2);
   1724 	ARG_CHTYPE(0, ch);
   1725 	ARG_INT(1, count);
   1726 
   1727 	report_count(1);
   1728 	report_return(hline(ch, count));
   1729 }
   1730 
   1731 
   1732 void
   1733 cmd_idcok(int nargs, char **args)
   1734 {
   1735 	ARGC(2);
   1736 	ARG_WINDOW(0, win);
   1737 	ARG_INT(1, flag);
   1738 
   1739 	report_count(1);
   1740 	report_return(idcok(win, flag));
   1741 }
   1742 
   1743 
   1744 void
   1745 cmd_idlok(int nargs, char **args)
   1746 {
   1747 	ARGC(2);
   1748 	ARG_WINDOW(0, win);
   1749 	ARG_INT(1, flag);
   1750 
   1751 	report_count(1);
   1752 	report_return(idlok(win, flag));
   1753 }
   1754 
   1755 
   1756 void
   1757 cmd_init_color(int nargs, char **args)
   1758 {
   1759 	ARGC(4);
   1760 	ARG_SHORT(0, colour);
   1761 	ARG_SHORT(1, red);
   1762 	ARG_SHORT(2, green);
   1763 	ARG_SHORT(3, blue);
   1764 
   1765 	report_count(1);
   1766 	report_return(init_color(colour, red, green, blue));
   1767 }
   1768 
   1769 
   1770 void
   1771 cmd_init_pair(int nargs, char **args)
   1772 {
   1773 	ARGC(3);
   1774 	ARG_SHORT(0, pair);
   1775 	ARG_SHORT(1, fore);
   1776 	ARG_SHORT(2, back);
   1777 
   1778 	report_count(1);
   1779 	report_return(init_pair(pair, fore, back));
   1780 }
   1781 
   1782 
   1783 void
   1784 cmd_initscr(int nargs, char **args)
   1785 {
   1786 	ARGC(0);
   1787 
   1788 	report_count(1);
   1789 	report_ptr(initscr());
   1790 }
   1791 
   1792 
   1793 void
   1794 cmd_intrflush(int nargs, char **args)
   1795 {
   1796 	ARGC(2);
   1797 	ARG_WINDOW(0, win);
   1798 	ARG_INT(1, flag);
   1799 
   1800 	report_count(1);
   1801 	report_return(intrflush(win, flag));
   1802 }
   1803 
   1804 
   1805 void
   1806 cmd_isendwin(int nargs, char **args)
   1807 {
   1808 	ARGC(0);
   1809 
   1810 	report_count(1);
   1811 	report_int(isendwin());
   1812 }
   1813 
   1814 
   1815 void
   1816 cmd_is_linetouched(int nargs, char **args)
   1817 {
   1818 	ARGC(2);
   1819 	ARG_WINDOW(0, win);
   1820 	ARG_INT(1, line);
   1821 
   1822 	report_count(1);
   1823 	report_int(is_linetouched(win, line));
   1824 }
   1825 
   1826 
   1827 void
   1828 cmd_is_wintouched(int nargs, char **args)
   1829 {
   1830 	ARGC(1);
   1831 	ARG_WINDOW(0, win);
   1832 
   1833 	report_count(1);
   1834 	report_int(is_wintouched(win));
   1835 }
   1836 
   1837 
   1838 void
   1839 cmd_keyok(int nargs, char **args)
   1840 {
   1841 	ARGC(2);
   1842 	ARG_INT(0, keysym);
   1843 	ARG_INT(1, flag);
   1844 
   1845 	report_count(1);
   1846 	report_return(keyok(keysym, flag));
   1847 }
   1848 
   1849 
   1850 void
   1851 cmd_keypad(int nargs, char **args)
   1852 {
   1853 	ARGC(2);
   1854 	ARG_WINDOW(0, win);
   1855 	ARG_INT(1, flag);
   1856 
   1857 	report_count(1);
   1858 	report_return(keypad(win, flag));
   1859 }
   1860 
   1861 void
   1862 cmd_is_keypad(int nargs, char **args)
   1863 {
   1864 	ARGC(1);
   1865 	ARG_WINDOW(0, win);
   1866 
   1867 	report_count(1);
   1868 	report_int(is_keypad(win));
   1869 }
   1870 
   1871 void
   1872 cmd_keyname(int nargs, char **args)
   1873 {
   1874 	ARGC(1);
   1875 	ARG_UINT(0, key);
   1876 
   1877 	report_count(1);
   1878 	report_status(keyname(key));
   1879 }
   1880 
   1881 
   1882 void
   1883 cmd_killchar(int nargs, char **args)
   1884 {
   1885 	ARGC(0);
   1886 
   1887 	report_count(1);
   1888 	report_int(killchar());
   1889 }
   1890 
   1891 
   1892 void
   1893 cmd_leaveok(int nargs, char **args)
   1894 {
   1895 	ARGC(2);
   1896 	ARG_WINDOW(0, win);
   1897 	ARG_INT(1, flag);
   1898 
   1899 	report_count(1);
   1900 	report_return(leaveok(win, flag));
   1901 }
   1902 
   1903 void
   1904 cmd_is_leaveok(int nargs, char **args)
   1905 {
   1906 	ARGC(1);
   1907 	ARG_WINDOW(0, win);
   1908 
   1909 	report_count(1);
   1910 	report_int(is_leaveok(win));
   1911 }
   1912 
   1913 void
   1914 cmd_meta(int nargs, char **args)
   1915 {
   1916 	ARGC(2);
   1917 	ARG_WINDOW(0, win);
   1918 	ARG_INT(1, flag);
   1919 
   1920 	report_count(1);
   1921 	report_return(meta(win, flag));
   1922 }
   1923 
   1924 
   1925 void
   1926 cmd_mvcur(int nargs, char **args)
   1927 {
   1928 	ARGC(4);
   1929 	ARG_INT(0, oldy);
   1930 	ARG_INT(1, oldx);
   1931 	ARG_INT(2, y);
   1932 	ARG_INT(3, x);
   1933 
   1934 	report_count(1);
   1935 	report_return(mvcur(oldy, oldx, y, x));
   1936 }
   1937 
   1938 
   1939 void
   1940 cmd_mvderwin(int nargs, char **args)
   1941 {
   1942 	ARGC(3);
   1943 	ARG_WINDOW(0, win);
   1944 	ARG_INT(1, y);
   1945 	ARG_INT(2, x);
   1946 
   1947 	report_count(1);
   1948 	report_return(mvderwin(win, y, x));
   1949 }
   1950 
   1951 
   1952 void
   1953 cmd_mvhline(int nargs, char **args)
   1954 {
   1955 	ARGC(4);
   1956 	ARG_INT(0, y);
   1957 	ARG_INT(1, x);
   1958 	ARG_CHTYPE(2, ch);
   1959 	ARG_INT(3, n);
   1960 
   1961 	report_count(1);
   1962 	report_return(mvhline(y, x, ch, n));
   1963 }
   1964 
   1965 
   1966 void
   1967 cmd_mvprintw(int nargs, char **args)
   1968 {
   1969 	ARGC(4);
   1970 	ARG_INT(0, y);
   1971 	ARG_INT(1, x);
   1972 	ARG_STRING(2, fmt);	/* Must have a single "%s" in this test. */
   1973 	ARG_STRING(3, arg);
   1974 
   1975 	report_count(1);
   1976 	report_return(mvprintw(y, x, fmt, arg));
   1977 }
   1978 
   1979 
   1980 void
   1981 cmd_mvscanw(int nargs, char **args)
   1982 {
   1983 	int ret;
   1984 	char string[256];
   1985 
   1986 	ARGC(3);
   1987 	ARG_INT(0, y);
   1988 	ARG_INT(1, x);
   1989 	ARG_STRING(2, fmt);	/* Must have a single "%s" in this test. */
   1990 
   1991 	report_count(2);
   1992 	report_return(ret = mvscanw(y, x, fmt, string));
   1993 	/*
   1994 	 * When mvscanw(3) fails, string is not modified.
   1995 	 * Let's ignore the 2nd result for this case.
   1996 	 */
   1997 	report_status(ret == ERR ? "ERR" : string);
   1998 }
   1999 
   2000 
   2001 void
   2002 cmd_mvvline(int nargs, char **args)
   2003 {
   2004 	ARGC(4);
   2005 	ARG_INT(0, y);
   2006 	ARG_INT(1, x);
   2007 	ARG_CHTYPE(2, ch);
   2008 	ARG_INT(3, n);
   2009 
   2010 	report_count(1);
   2011 	report_return(mvvline(y, x, ch, n));
   2012 }
   2013 
   2014 
   2015 void
   2016 cmd_mvwhline(int nargs, char **args)
   2017 {
   2018 	ARGC(5);
   2019 	ARG_WINDOW(0, win);
   2020 	ARG_INT(1, y);
   2021 	ARG_INT(2, x);
   2022 	ARG_CHTYPE(3, ch);
   2023 	ARG_INT(4, n);
   2024 
   2025 	report_count(1);
   2026 	report_return(mvwhline(win, y, x, ch, n));
   2027 }
   2028 
   2029 
   2030 void
   2031 cmd_mvwvline(int nargs, char **args)
   2032 {
   2033 	ARGC(5);
   2034 	ARG_WINDOW(0, win);
   2035 	ARG_INT(1, y);
   2036 	ARG_INT(2, x);
   2037 	ARG_CHTYPE(3, ch);
   2038 	ARG_INT(4, n);
   2039 
   2040 	report_count(1);
   2041 	report_return(mvwvline(win, y, x, ch, n));
   2042 }
   2043 
   2044 
   2045 void
   2046 cmd_mvwin(int nargs, char **args)
   2047 {
   2048 	ARGC(3);
   2049 	ARG_WINDOW(0, win);
   2050 	ARG_INT(1, y);
   2051 	ARG_INT(2, x);
   2052 
   2053 	report_count(1);
   2054 	report_return(mvwin(win, y, x));
   2055 }
   2056 
   2057 
   2058 void
   2059 cmd_mvwinchnstr(int nargs, char **args)
   2060 {
   2061 	chtype *string;
   2062 
   2063 	ARGC(4);
   2064 	ARG_WINDOW(0, win);
   2065 	ARG_INT(1, y);
   2066 	ARG_INT(2, x);
   2067 	ARG_INT(3, count);
   2068 
   2069 	if ((string = malloc((count + 1) * sizeof(chtype))) == NULL) {
   2070 		report_count(1);
   2071 		report_error("MALLOC_FAILED");
   2072 		return;
   2073 	}
   2074 
   2075 	report_count(2);
   2076 	report_return(mvwinchnstr(win, y, x, string, count));
   2077 	report_nstr(string);
   2078 	free(string);
   2079 }
   2080 
   2081 
   2082 void
   2083 cmd_mvwinchstr(int nargs, char **args)
   2084 {
   2085 	chtype string[256];
   2086 
   2087 	ARGC(3);
   2088 	ARG_WINDOW(0, win);
   2089 	ARG_INT(1, y);
   2090 	ARG_INT(2, x);
   2091 
   2092 	report_count(2);
   2093 	report_return(mvwinchstr(win, y, x, string));
   2094 	report_nstr(string);
   2095 }
   2096 
   2097 
   2098 void
   2099 cmd_mvwinnstr(int nargs, char **args)
   2100 {
   2101 	char *string;
   2102 
   2103 	ARGC(4);
   2104 	ARG_WINDOW(0, win);
   2105 	ARG_INT(1, y);
   2106 	ARG_INT(2, x);
   2107 	ARG_INT(3, count);
   2108 
   2109 	if ((string = malloc(count + 1)) == NULL) {
   2110 		report_count(1);
   2111 		report_error("MALLOC_FAILED");
   2112 		return;
   2113 	}
   2114 
   2115 	report_count(2);
   2116 	report_int(mvwinnstr(win, y, x, string, count));
   2117 	report_status(string);
   2118 	free(string);
   2119 }
   2120 
   2121 
   2122 void
   2123 cmd_mvwinstr(int nargs, char **args)
   2124 {
   2125 	char string[256];
   2126 
   2127 	ARGC(3);
   2128 	ARG_WINDOW(0, win);
   2129 	ARG_INT(1, y);
   2130 	ARG_INT(2, x);
   2131 
   2132 	report_count(2);
   2133 	report_return(mvwinstr(win, y, x, string));
   2134 	report_status(string);
   2135 }
   2136 
   2137 
   2138 void
   2139 cmd_mvwprintw(int nargs, char **args)
   2140 {
   2141 	ARGC(5);
   2142 	ARG_WINDOW(0, win);
   2143 	ARG_INT(1, y);
   2144 	ARG_INT(2, x);
   2145 	ARG_STRING(3, fmt);	/* Must have a single "%s" in this test. */
   2146 	ARG_STRING(4, arg);
   2147 
   2148 	report_count(1);
   2149 	report_return(mvwprintw(win, y, x, fmt, arg));
   2150 }
   2151 
   2152 
   2153 void
   2154 cmd_mvwscanw(int nargs, char **args)
   2155 {
   2156 	char string[256];
   2157 
   2158 	ARGC(4);
   2159 	ARG_WINDOW(0, win);
   2160 	ARG_INT(1, y);
   2161 	ARG_INT(2, x);
   2162 	ARG_STRING(3, fmt);	/* Must have a single "%s" in this test. */
   2163 
   2164 	report_count(2);
   2165 	report_int(mvwscanw(win, y, x, fmt, &string));
   2166 	report_status(string);
   2167 }
   2168 
   2169 
   2170 void
   2171 cmd_napms(int nargs, char **args)
   2172 {
   2173 	ARGC(1);
   2174 	ARG_INT(0, naptime);
   2175 
   2176 	report_count(1);
   2177 	report_return(napms(naptime));
   2178 }
   2179 
   2180 
   2181 void
   2182 cmd_newpad(int nargs, char **args)
   2183 {
   2184 	ARGC(2);
   2185 	ARG_INT(0, y);
   2186 	ARG_INT(1, x);
   2187 
   2188 	report_count(1);
   2189 	report_ptr(newpad(y, x));
   2190 }
   2191 
   2192 
   2193 void
   2194 cmd_newterm(int nargs, char **args)
   2195 {
   2196 	FILE *in, *out;
   2197 
   2198 	ARGC(3);
   2199 	ARG_MODIFIABLE_STRING(0, type);
   2200 	ARG_STRING(1, in_fname);
   2201 	ARG_STRING(2, out_fname);
   2202 
   2203 	if ((in = fopen(in_fname, "rw")) == NULL) {
   2204 		report_count(1);
   2205 		report_error("BAD FILE_ARGUMENT");
   2206 		return;
   2207 	}
   2208 	if ((out = fopen(out_fname, "rw")) == NULL) {
   2209 		report_count(1);
   2210 		report_error("BAD FILE_ARGUMENT");
   2211 		return;
   2212 	}
   2213 
   2214 	report_count(1);
   2215 	report_ptr(newterm(type, out, in));
   2216 }
   2217 
   2218 
   2219 void
   2220 cmd_newwin(int nargs, char **args)
   2221 {
   2222 	ARGC(4);
   2223 	ARG_INT(0, lines);
   2224 	ARG_INT(1, cols);
   2225 	ARG_INT(2, begin_y);
   2226 	ARG_INT(3, begin_x);
   2227 
   2228 	report_count(1);
   2229 	report_ptr(newwin(lines, cols, begin_y, begin_x));
   2230 }
   2231 
   2232 
   2233 void
   2234 cmd_nl(int nargs, char **args)
   2235 {
   2236 	ARGC(0);
   2237 
   2238 	report_count(1);
   2239 	report_return(nl());
   2240 }
   2241 
   2242 
   2243 void
   2244 cmd_no_color_attributes(int nargs, char **args)
   2245 {
   2246 	ARGC(0);
   2247 
   2248 	report_count(1);
   2249 	report_int(no_color_attributes());
   2250 }
   2251 
   2252 
   2253 void
   2254 cmd_nocbreak(int nargs, char **args)
   2255 {
   2256 	ARGC(0);
   2257 
   2258 	report_count(1);
   2259 	report_return(nocbreak());
   2260 }
   2261 
   2262 
   2263 void
   2264 cmd_nodelay(int nargs, char **args)
   2265 {
   2266 	ARGC(2);
   2267 	ARG_WINDOW(0, win);
   2268 	ARG_INT(1, flag);
   2269 
   2270 	report_count(1);
   2271 	report_return(nodelay(win, flag));
   2272 }
   2273 
   2274 
   2275 void
   2276 cmd_noecho(int nargs, char **args)
   2277 {
   2278 	ARGC(0);
   2279 
   2280 	report_count(1);
   2281 	report_return(noecho());
   2282 }
   2283 
   2284 
   2285 void
   2286 cmd_nonl(int nargs, char **args)
   2287 {
   2288 	ARGC(0);
   2289 
   2290 	report_count(1);
   2291 	report_return(nonl());
   2292 }
   2293 
   2294 
   2295 void
   2296 cmd_noqiflush(int nargs, char **args)
   2297 {
   2298 	ARGC(0);
   2299 
   2300 	noqiflush();
   2301 	report_count(1);
   2302 	report_return(OK);	/* fake a return, the call returns void */
   2303 }
   2304 
   2305 
   2306 void
   2307 cmd_noraw(int nargs, char **args)
   2308 {
   2309 	ARGC(0);
   2310 
   2311 	report_count(1);
   2312 	report_return(noraw());
   2313 }
   2314 
   2315 
   2316 void
   2317 cmd_notimeout(int nargs, char **args)
   2318 {
   2319 	ARGC(2);
   2320 	ARG_WINDOW(0, win);
   2321 	ARG_INT(1, flag);
   2322 
   2323 	report_count(1);
   2324 	report_return(notimeout(win, flag));
   2325 }
   2326 
   2327 
   2328 void
   2329 cmd_overlay(int nargs, char **args)
   2330 {
   2331 	ARGC(2);
   2332 	ARG_WINDOW(0, source);
   2333 	ARG_WINDOW(1, dest);
   2334 
   2335 	report_count(1);
   2336 	report_return(overlay(source, dest));
   2337 }
   2338 
   2339 
   2340 void
   2341 cmd_overwrite(int nargs, char **args)
   2342 {
   2343 	ARGC(2);
   2344 	ARG_WINDOW(0, source);
   2345 	ARG_WINDOW(1, dest);
   2346 
   2347 	report_count(1);
   2348 	report_return(overwrite(source, dest));
   2349 }
   2350 
   2351 
   2352 void
   2353 cmd_pair_content(int nargs, char **args)
   2354 {
   2355 	ARGC(1);
   2356 	ARG_SHORT(0, pair);
   2357 
   2358 	short fore, back;
   2359 	int ret = pair_content(pair, &fore, &back);
   2360 
   2361 	report_count(3);
   2362 	report_return(ret);
   2363 	report_int(fore);
   2364 	report_int(back);
   2365 }
   2366 
   2367 
   2368 void
   2369 cmd_pechochar(int nargs, char **args)
   2370 {
   2371 	ARGC(2);
   2372 	ARG_WINDOW(0, pad);
   2373 	ARG_CHTYPE(1, ch);
   2374 
   2375 	report_count(1);
   2376 	report_return(pechochar(pad, ch));
   2377 }
   2378 
   2379 
   2380 void
   2381 cmd_pnoutrefresh(int nargs, char **args)
   2382 {
   2383 	ARGC(7);
   2384 	ARG_WINDOW(0, pad);
   2385 	ARG_INT(1, pbeg_y);
   2386 	ARG_INT(2, pbeg_x);
   2387 	ARG_INT(3, sbeg_y);
   2388 	ARG_INT(4, sbeg_x);
   2389 	ARG_INT(5, smax_y);
   2390 	ARG_INT(6, smax_x);
   2391 
   2392 	report_count(1);
   2393 	report_return(pnoutrefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y,
   2394 		smax_x));
   2395 }
   2396 
   2397 
   2398 void
   2399 cmd_prefresh(int nargs, char **args)
   2400 {
   2401 	ARGC(7);
   2402 	ARG_WINDOW(0, pad);
   2403 	ARG_INT(1, pbeg_y);
   2404 	ARG_INT(2, pbeg_x);
   2405 	ARG_INT(3, sbeg_y);
   2406 	ARG_INT(4, sbeg_x);
   2407 	ARG_INT(5, smax_y);
   2408 	ARG_INT(6, smax_x);
   2409 
   2410 	/* XXX causes refresh */
   2411 	report_count(1);
   2412 	report_return(prefresh(pad, pbeg_y, pbeg_x, sbeg_y, sbeg_x, smax_y,
   2413 		smax_x));
   2414 }
   2415 
   2416 
   2417 void
   2418 cmd_printw(int nargs, char **args)
   2419 {
   2420 	ARGC(2);
   2421 	ARG_STRING(0, fmt);	/* Must have a single "%s" in this test. */
   2422 	ARG_STRING(1, arg);
   2423 
   2424 	report_count(1);
   2425 	report_return(printw(fmt, arg));
   2426 }
   2427 
   2428 
   2429 void
   2430 cmd_putwin(int nargs, char **args)
   2431 {
   2432 	ARGC(2);
   2433 	ARG_WINDOW(0, win);
   2434 	ARG_STRING(1, filename);
   2435 
   2436 	FILE *fp;
   2437 	if ((fp = fopen(filename, "w")) == NULL) {
   2438 		report_count(1);
   2439 		report_error("BAD FILE_ARGUMENT");
   2440 		return;
   2441 	}
   2442 
   2443 	report_count(1);
   2444 	report_return(putwin(win, fp));
   2445 	fclose(fp);
   2446 }
   2447 
   2448 
   2449 void
   2450 cmd_qiflush(int nargs, char **args)
   2451 {
   2452 	ARGC(0);
   2453 
   2454 	qiflush();
   2455 	report_count(1);
   2456 	report_return(OK);	/* fake a return because call returns void */
   2457 }
   2458 
   2459 
   2460 void
   2461 cmd_raw(int nargs, char **args)
   2462 {
   2463 	ARGC(0);
   2464 
   2465 	report_count(1);
   2466 	report_return(raw());
   2467 }
   2468 
   2469 
   2470 void
   2471 cmd_redrawwin(int nargs, char **args)
   2472 {
   2473 	ARGC(1);
   2474 	ARG_WINDOW(0, win);
   2475 
   2476 	report_count(1);
   2477 	report_return(redrawwin(win));
   2478 }
   2479 
   2480 
   2481 void
   2482 cmd_reset_prog_mode(int nargs, char **args)
   2483 {
   2484 	ARGC(0);
   2485 
   2486 	report_count(1);
   2487 	report_return(reset_prog_mode());
   2488 }
   2489 
   2490 
   2491 void
   2492 cmd_reset_shell_mode(int nargs, char **args)
   2493 {
   2494 	ARGC(0);
   2495 
   2496 	report_count(1);
   2497 	report_return(reset_shell_mode());
   2498 }
   2499 
   2500 
   2501 void
   2502 cmd_resetty(int nargs, char **args)
   2503 {
   2504 	ARGC(0);
   2505 
   2506 	report_count(1);
   2507 	report_return(resetty());
   2508 }
   2509 
   2510 
   2511 void
   2512 cmd_resizeterm(int nargs, char **args)
   2513 {
   2514 	ARGC(2);
   2515 	ARG_INT(0, rows);
   2516 	ARG_INT(1, cols);
   2517 
   2518 	report_count(1);
   2519 	report_return(resizeterm(rows, cols));
   2520 }
   2521 
   2522 
   2523 void
   2524 cmd_savetty(int nargs, char **args)
   2525 {
   2526 	ARGC(0);
   2527 
   2528 	report_count(1);
   2529 	report_return(savetty());
   2530 }
   2531 
   2532 
   2533 void
   2534 cmd_scanw(int nargs, char **args)
   2535 {
   2536 	char string[256];
   2537 
   2538 	ARGC(0);
   2539 
   2540 	report_count(2);
   2541 	report_return(scanw("%s", string));
   2542 	report_status(string);
   2543 }
   2544 
   2545 
   2546 void
   2547 cmd_scroll(int nargs, char **args)
   2548 {
   2549 	ARGC(1);
   2550 	ARG_WINDOW(0, win);
   2551 
   2552 	report_count(1);
   2553 	report_return(scroll(win));
   2554 }
   2555 
   2556 
   2557 void
   2558 cmd_scrollok(int nargs, char **args)
   2559 {
   2560 	ARGC(2);
   2561 	ARG_WINDOW(0, win);
   2562 	ARG_INT(1, flag);
   2563 
   2564 	report_count(1);
   2565 	report_return(scrollok(win, flag));
   2566 }
   2567 
   2568 
   2569 void
   2570 cmd_setterm(int nargs, char **args)
   2571 {
   2572 	ARGC(1);
   2573 	ARG_MODIFIABLE_STRING(0, name);
   2574 
   2575 	report_count(1);
   2576 	report_return(setterm(name));
   2577 }
   2578 
   2579 
   2580 void
   2581 cmd_set_term(int nargs, char **args)
   2582 {
   2583 	ARGC(1);
   2584 	ARG_SCREEN(0, scrn);
   2585 
   2586 	report_count(1);
   2587 	report_ptr(set_term(scrn));
   2588 }
   2589 
   2590 
   2591 void
   2592 cmd_start_color(int nargs, char **args)
   2593 {
   2594 	ARGC(0);
   2595 
   2596 	report_count(1);
   2597 	report_return(start_color());
   2598 }
   2599 
   2600 
   2601 void
   2602 cmd_subpad(int nargs, char **args)
   2603 {
   2604 	ARGC(5);
   2605 	ARG_WINDOW(0, pad);
   2606 	ARG_INT(1, lines);
   2607 	ARG_INT(2, cols);
   2608 	ARG_INT(3, begin_y);
   2609 	ARG_INT(4, begin_x);
   2610 
   2611 	report_count(1);
   2612 	report_ptr(subpad(pad, lines, cols, begin_y, begin_x));
   2613 }
   2614 
   2615 
   2616 void
   2617 cmd_subwin(int nargs, char **args)
   2618 {
   2619 	ARGC(5);
   2620 	ARG_WINDOW(0, win);
   2621 	ARG_INT(1, lines);
   2622 	ARG_INT(2, cols);
   2623 	ARG_INT(3, begin_y);
   2624 	ARG_INT(4, begin_x);
   2625 
   2626 	report_count(1);
   2627 	report_ptr(subwin(win, lines, cols, begin_y, begin_x));
   2628 }
   2629 
   2630 
   2631 void
   2632 cmd_termattrs(int nargs, char **args)
   2633 {
   2634 	ARGC(0);
   2635 
   2636 	report_count(1);
   2637 	report_int(termattrs());
   2638 }
   2639 
   2640 
   2641 void
   2642 cmd_term_attrs(int nargs, char **args)
   2643 {
   2644 	ARGC(0);
   2645 
   2646 	report_count(1);
   2647 	report_int(term_attrs());
   2648 }
   2649 
   2650 
   2651 void
   2652 cmd_touchline(int nargs, char **args)
   2653 {
   2654 	ARGC(3);
   2655 	ARG_WINDOW(0, win);
   2656 	ARG_INT(1, start);
   2657 	ARG_INT(2, count);
   2658 
   2659 	report_count(1);
   2660 	report_return(touchline(win, start, count));
   2661 }
   2662 
   2663 
   2664 void
   2665 cmd_touchoverlap(int nargs, char **args)
   2666 {
   2667 	ARGC(2);
   2668 	ARG_WINDOW(0, win1);
   2669 	ARG_WINDOW(1, win2);
   2670 
   2671 	report_count(1);
   2672 	report_return(touchoverlap(win1, win2));
   2673 }
   2674 
   2675 
   2676 void
   2677 cmd_touchwin(int nargs, char **args)
   2678 {
   2679 	ARGC(1);
   2680 	ARG_WINDOW(0, win);
   2681 
   2682 	report_count(1);
   2683 	report_return(touchwin(win));
   2684 }
   2685 
   2686 
   2687 void
   2688 cmd_ungetch(int nargs, char **args)
   2689 {
   2690 	ARGC(1);
   2691 	ARG_INT(0, ch);
   2692 
   2693 	report_count(1);
   2694 	report_return(ungetch(ch));
   2695 }
   2696 
   2697 
   2698 void
   2699 cmd_untouchwin(int nargs, char **args)
   2700 {
   2701 	ARGC(1);
   2702 	ARG_WINDOW(0, win);
   2703 
   2704 	report_count(1);
   2705 	report_return(untouchwin(win));
   2706 }
   2707 
   2708 
   2709 void
   2710 cmd_use_default_colors(int nargs, char **args)
   2711 {
   2712 	ARGC(0);
   2713 
   2714 	report_count(1);
   2715 	report_return(use_default_colors());
   2716 }
   2717 
   2718 
   2719 void
   2720 cmd_vline(int nargs, char **args)
   2721 {
   2722 	ARGC(2);
   2723 	ARG_CHTYPE(0, ch);
   2724 	ARG_INT(1, count);
   2725 
   2726 	report_count(1);
   2727 	report_return(vline(ch, count));
   2728 }
   2729 
   2730 
   2731 static int
   2732 internal_vw_printw(WINDOW * win, const char *fmt, ...)
   2733 {
   2734 	va_list va;
   2735 	int rv;
   2736 
   2737 	va_start(va, fmt);
   2738 	rv = vw_printw(win, fmt, va);
   2739 	va_end(va);
   2740 
   2741 	return rv;
   2742 }
   2743 
   2744 void
   2745 cmd_vw_printw(int nargs, char **args)
   2746 {
   2747 	ARGC(3);
   2748 	ARG_WINDOW(0, win);
   2749 	ARG_STRING(1, fmt);	/* Must have a single "%s" in this test. */
   2750 	ARG_STRING(2, arg);
   2751 
   2752 	report_count(1);
   2753 	report_return(internal_vw_printw(win, fmt, arg));
   2754 }
   2755 
   2756 
   2757 static int
   2758 internal_vw_scanw(WINDOW * win, const char *fmt, ...)
   2759 {
   2760 	va_list va;
   2761 	int rv;
   2762 
   2763 	va_start(va, fmt);
   2764 	rv = vw_scanw(win, fmt, va);
   2765 	va_end(va);
   2766 
   2767 	return rv;
   2768 }
   2769 
   2770 void
   2771 cmd_vw_scanw(int nargs, char **args)
   2772 {
   2773 	char string[256];
   2774 
   2775 	ARGC(2);
   2776 	ARG_WINDOW(0, win);
   2777 	ARG_STRING(1, fmt);
   2778 
   2779 	report_count(2);
   2780 	report_int(internal_vw_scanw(win, fmt, string));
   2781 	report_status(string);
   2782 }
   2783 
   2784 
   2785 void
   2786 cmd_vwprintw(int nargs, char **args)
   2787 {
   2788 	cmd_vw_printw(nargs, args);
   2789 }
   2790 
   2791 
   2792 void
   2793 cmd_vwscanw(int nargs, char **args)
   2794 {
   2795 	cmd_vw_scanw(nargs, args);
   2796 }
   2797 
   2798 
   2799 void
   2800 cmd_waddch(int nargs, char **args)
   2801 {
   2802 	ARGC(2);
   2803 	ARG_WINDOW(0, win);
   2804 	ARG_CHTYPE(1, ch);
   2805 
   2806 	report_count(1);
   2807 	report_return(waddch(win, ch));
   2808 }
   2809 
   2810 
   2811 void
   2812 cmd_waddchnstr(int nargs, char **args)
   2813 {
   2814 	ARGC(3);
   2815 	ARG_WINDOW(0, win);
   2816 	ARG_CHTYPE_STRING(1, chstr);
   2817 	ARG_INT(2, count);
   2818 
   2819 	report_count(1);
   2820 	report_return(waddchnstr(win, chstr, count));
   2821 }
   2822 
   2823 
   2824 void
   2825 cmd_waddchstr(int nargs, char **args)
   2826 {
   2827 	ARGC(2);
   2828 	ARG_WINDOW(0, win);
   2829 	ARG_CHTYPE_STRING(1, chstr);
   2830 
   2831 	report_count(1);
   2832 	report_return(waddchstr(win, chstr));
   2833 }
   2834 
   2835 
   2836 void
   2837 cmd_waddnstr(int nargs, char **args)
   2838 {
   2839 	ARGC(3);
   2840 	ARG_WINDOW(0, win);
   2841 	ARG_STRING(1, str);
   2842 	ARG_INT(2, count);
   2843 
   2844 	report_count(1);
   2845 	report_return(waddnstr(win, str, count));
   2846 
   2847 }
   2848 
   2849 
   2850 void
   2851 cmd_wattr_get(int nargs, char **args)
   2852 {
   2853 	int attr;
   2854 	short pair;
   2855 
   2856 	ARGC(1);
   2857 	ARG_WINDOW(0, win);
   2858 
   2859 	report_count(3);
   2860 	report_return(wattr_get(win, &attr, &pair, NULL));
   2861 	report_int(attr);
   2862 	report_int(pair);
   2863 }
   2864 
   2865 
   2866 void
   2867 cmd_wattr_off(int nargs, char **args)
   2868 {
   2869 	ARGC(2);
   2870 	ARG_WINDOW(0, win);
   2871 	ARG_INT(1, attr);
   2872 
   2873 	report_count(1);
   2874 	report_return(wattr_off(win, attr, NULL));
   2875 }
   2876 
   2877 
   2878 void
   2879 cmd_wattr_on(int nargs, char **args)
   2880 {
   2881 	ARGC(2);
   2882 	ARG_WINDOW(0, win);
   2883 	ARG_INT(1, attr);
   2884 
   2885 	report_count(1);
   2886 	report_return(wattr_on(win, attr, NULL));
   2887 }
   2888 
   2889 
   2890 void
   2891 cmd_wattr_set(int nargs, char **args)
   2892 {
   2893 	ARGC(3);
   2894 	ARG_WINDOW(0, win);
   2895 	ARG_INT(1, attr);
   2896 	ARG_SHORT(2, pair);
   2897 
   2898 	report_count(1);
   2899 	report_return(wattr_set(win, attr, pair, NULL));
   2900 }
   2901 
   2902 
   2903 void
   2904 cmd_wattroff(int nargs, char **args)
   2905 {
   2906 	ARGC(2);
   2907 	ARG_WINDOW(0, win);
   2908 	ARG_INT(1, attr);
   2909 
   2910 	report_count(1);
   2911 	report_return(wattroff(win, attr));
   2912 }
   2913 
   2914 
   2915 void
   2916 cmd_wattron(int nargs, char **args)
   2917 {
   2918 	ARGC(2);
   2919 	ARG_WINDOW(0, win);
   2920 	ARG_INT(1, attr);
   2921 
   2922 	report_count(1);
   2923 	report_return(wattron(win, attr));
   2924 }
   2925 
   2926 
   2927 void
   2928 cmd_wattrset(int nargs, char **args)
   2929 {
   2930 	ARGC(2);
   2931 	ARG_WINDOW(0, win);
   2932 	ARG_INT(1, attr);
   2933 
   2934 	report_count(1);
   2935 	report_return(wattrset(win, attr));
   2936 }
   2937 
   2938 
   2939 void
   2940 cmd_wbkgd(int nargs, char **args)
   2941 {
   2942 	ARGC(2);
   2943 	ARG_WINDOW(0, win);
   2944 	ARG_CHTYPE(1, ch);
   2945 
   2946 	report_count(1);
   2947 	report_return(wbkgd(win, ch));
   2948 }
   2949 
   2950 
   2951 void
   2952 cmd_wbkgdset(int nargs, char **args)
   2953 {
   2954 	ARGC(2);
   2955 	ARG_WINDOW(0, win);
   2956 	ARG_CHTYPE(1, ch);
   2957 
   2958 	wbkgdset(win, ch);	/* void return */
   2959 	report_count(1);
   2960 	report_return(OK);
   2961 }
   2962 
   2963 
   2964 void
   2965 cmd_wborder(int nargs, char **args)
   2966 {
   2967 	ARGC(9);
   2968 	ARG_WINDOW(0, win);
   2969 	ARG_INT(1, ls);
   2970 	ARG_INT(2, rs);
   2971 	ARG_INT(3, ts);
   2972 	ARG_INT(4, bs);
   2973 	ARG_INT(5, tl);
   2974 	ARG_INT(6, tr);
   2975 	ARG_INT(7, bl);
   2976 	ARG_INT(8, br);
   2977 
   2978 	report_count(1);
   2979 	report_return(wborder(win, ls, rs, ts, bs, tl, tr, bl, br));
   2980 }
   2981 
   2982 
   2983 void
   2984 cmd_wclear(int nargs, char **args)
   2985 {
   2986 	ARGC(1);
   2987 	ARG_WINDOW(0, win);
   2988 
   2989 	report_count(1);
   2990 	report_return(wclear(win));
   2991 }
   2992 
   2993 
   2994 void
   2995 cmd_wclrtobot(int nargs, char **args)
   2996 {
   2997 	ARGC(1);
   2998 	ARG_WINDOW(0, win);
   2999 
   3000 	report_count(1);
   3001 	report_return(wclrtobot(win));
   3002 }
   3003 
   3004 
   3005 void
   3006 cmd_wclrtoeol(int nargs, char **args)
   3007 {
   3008 	ARGC(1);
   3009 	ARG_WINDOW(0, win);
   3010 
   3011 	report_count(1);
   3012 	report_return(wclrtoeol(win));
   3013 
   3014 }
   3015 
   3016 
   3017 void
   3018 cmd_wcolor_set(int nargs, char **args)
   3019 {
   3020 	ARGC(3);
   3021 	ARG_WINDOW(0, win);
   3022 	ARG_SHORT(1, pair);
   3023 	ARG_NULL(2);
   3024 
   3025 	report_count(1);
   3026 	report_return(wcolor_set(win, pair, NULL));
   3027 }
   3028 
   3029 
   3030 void
   3031 cmd_wdelch(int nargs, char **args)
   3032 {
   3033 	ARGC(1);
   3034 	ARG_WINDOW(0, win);
   3035 
   3036 	report_count(1);
   3037 	report_return(wdelch(win));
   3038 }
   3039 
   3040 
   3041 void
   3042 cmd_wdeleteln(int nargs, char **args)
   3043 {
   3044 	ARGC(1);
   3045 	ARG_WINDOW(0, win);
   3046 
   3047 	report_count(1);
   3048 	report_return(wdeleteln(win));
   3049 
   3050 }
   3051 
   3052 
   3053 void
   3054 cmd_wechochar(int nargs, char **args)
   3055 {
   3056 	ARGC(2);
   3057 	ARG_WINDOW(0, win);
   3058 	ARG_CHTYPE(1, ch);
   3059 
   3060 	report_count(1);
   3061 	report_return(wechochar(win, ch));
   3062 }
   3063 
   3064 
   3065 void
   3066 cmd_werase(int nargs, char **args)
   3067 {
   3068 	ARGC(1);
   3069 	ARG_WINDOW(0, win);
   3070 
   3071 	report_count(1);
   3072 	report_return(werase(win));
   3073 }
   3074 
   3075 
   3076 void
   3077 cmd_wgetch(int nargs, char **args)
   3078 {
   3079 	ARGC(1);
   3080 	ARG_WINDOW(0, win);
   3081 
   3082 	report_count(1);
   3083 	report_int(wgetch(win));
   3084 }
   3085 
   3086 
   3087 void
   3088 cmd_wgetnstr(int nargs, char **args)
   3089 {
   3090 	char string[256];
   3091 
   3092 	ARGC(2);
   3093 	ARG_WINDOW(0, win);
   3094 	ARG_INT(1, count);
   3095 
   3096 	report_count(2);
   3097 	report_return(wgetnstr(win, string, count));
   3098 	report_status(string);
   3099 }
   3100 
   3101 
   3102 void
   3103 cmd_wgetstr(int nargs, char **args)
   3104 {
   3105 	char string[256];
   3106 
   3107 	ARGC(1);
   3108 	ARG_WINDOW(0, win);
   3109 
   3110 	string[0] = '\0';
   3111 
   3112 	report_count(2);
   3113 	report_return(wgetstr(win, string));
   3114 	report_status(string);
   3115 }
   3116 
   3117 
   3118 void
   3119 cmd_whline(int nargs, char **args)
   3120 {
   3121 	ARGC(3);
   3122 	ARG_WINDOW(0, win);
   3123 	ARG_CHTYPE(1, ch);
   3124 	ARG_INT(2, count);
   3125 
   3126 	report_count(1);
   3127 	report_return(whline(win, ch, count));
   3128 }
   3129 
   3130 
   3131 void
   3132 cmd_winch(int nargs, char **args)
   3133 {
   3134 	ARGC(1);
   3135 	ARG_WINDOW(0, win);
   3136 
   3137 	report_count(1);
   3138 	report_byte(winch(win));
   3139 }
   3140 
   3141 
   3142 void
   3143 cmd_winchnstr(int nargs, char **args)
   3144 {
   3145 	chtype string[256];
   3146 
   3147 	ARGC(2);
   3148 	ARG_WINDOW(0, win);
   3149 	ARG_INT(1, count);
   3150 
   3151 	report_count(2);
   3152 	report_return(winchnstr(win, string, count));
   3153 	report_nstr(string);
   3154 }
   3155 
   3156 
   3157 void
   3158 cmd_winchstr(int nargs, char **args)
   3159 {
   3160 	chtype string[256];
   3161 
   3162 	ARGC(1);
   3163 	ARG_WINDOW(0, win);
   3164 
   3165 	report_count(2);
   3166 	report_return(winchstr(win, string));
   3167 	report_nstr(string);
   3168 }
   3169 
   3170 
   3171 void
   3172 cmd_winnstr(int nargs, char **args)
   3173 {
   3174 	char string[256];
   3175 
   3176 	ARGC(2);
   3177 	ARG_WINDOW(0, win);
   3178 	ARG_INT(1, count);
   3179 
   3180 	report_count(2);
   3181 	report_int(winnstr(win, string, count));
   3182 	report_status(string);
   3183 }
   3184 
   3185 
   3186 void
   3187 cmd_winsch(int nargs, char **args)
   3188 {
   3189 	ARGC(2);
   3190 	ARG_WINDOW(0, win);
   3191 	ARG_CHTYPE(1, ch);
   3192 
   3193 	report_count(1);
   3194 	report_return(winsch(win, ch));
   3195 }
   3196 
   3197 
   3198 void
   3199 cmd_winsdelln(int nargs, char **args)
   3200 {
   3201 	ARGC(2);
   3202 	ARG_WINDOW(0, win);
   3203 	ARG_INT(1, count);
   3204 
   3205 	report_count(1);
   3206 	report_return(winsdelln(win, count));
   3207 }
   3208 
   3209 
   3210 void
   3211 cmd_winsertln(int nargs, char **args)
   3212 {
   3213 	ARGC(1);
   3214 	ARG_WINDOW(0, win);
   3215 
   3216 	report_count(1);
   3217 	report_return(winsertln(win));
   3218 }
   3219 
   3220 
   3221 void
   3222 cmd_winstr(int nargs, char **args)
   3223 {
   3224 	char string[256];
   3225 
   3226 	ARGC(1);
   3227 	ARG_WINDOW(0, win);
   3228 
   3229 	report_count(2);
   3230 	report_return(winstr(win, string));
   3231 	report_status(string);
   3232 }
   3233 
   3234 
   3235 void
   3236 cmd_wmove(int nargs, char **args)
   3237 {
   3238 	ARGC(3);
   3239 	ARG_WINDOW(0, win);
   3240 	ARG_INT(1, y);
   3241 	ARG_INT(2, x);
   3242 
   3243 	report_count(1);
   3244 	report_return(wmove(win, y, x));
   3245 }
   3246 
   3247 
   3248 void
   3249 cmd_wnoutrefresh(int nargs, char **args)
   3250 {
   3251 	ARGC(1);
   3252 	ARG_WINDOW(0, win);
   3253 
   3254 	report_count(1);
   3255 	report_return(wnoutrefresh(win));
   3256 }
   3257 
   3258 
   3259 void
   3260 cmd_wprintw(int nargs, char **args)
   3261 {
   3262 	ARGC(3);
   3263 	ARG_WINDOW(0, win);
   3264 	ARG_STRING(1, fmt);
   3265 	ARG_STRING(2, arg);
   3266 
   3267 	report_count(1);
   3268 	report_return(wprintw(win, fmt, arg));
   3269 }
   3270 
   3271 
   3272 void
   3273 cmd_wredrawln(int nargs, char **args)
   3274 {
   3275 	ARGC(3);
   3276 	ARG_WINDOW(0, win);
   3277 	ARG_INT(1, beg_line);
   3278 	ARG_INT(2, num_lines);
   3279 
   3280 	report_count(1);
   3281 	report_return(wredrawln(win, beg_line, num_lines));
   3282 }
   3283 
   3284 
   3285 void
   3286 cmd_wrefresh(int nargs, char **args)
   3287 {
   3288 	ARGC(1);
   3289 	ARG_WINDOW(0, win);
   3290 
   3291 	/* XXX - generates output */
   3292 	report_count(1);
   3293 	report_return(wrefresh(win));
   3294 }
   3295 
   3296 
   3297 void
   3298 cmd_wresize(int nargs, char **args)
   3299 {
   3300 	ARGC(3);
   3301 	ARG_WINDOW(0, win);
   3302 	ARG_INT(1, lines);
   3303 	ARG_INT(2, cols);
   3304 
   3305 	report_count(1);
   3306 	report_return(wresize(win, lines, cols));
   3307 }
   3308 
   3309 
   3310 void
   3311 cmd_wscanw(int nargs, char **args)
   3312 {
   3313 	char string[256];
   3314 
   3315 	ARGC(2);
   3316 	ARG_WINDOW(0, win);
   3317 	ARG_STRING(1, fmt);
   3318 
   3319 	report_count(1);
   3320 	report_return(wscanw(win, fmt, &string));
   3321 }
   3322 
   3323 
   3324 void
   3325 cmd_wscrl(int nargs, char **args)
   3326 {
   3327 	ARGC(2);
   3328 	ARG_WINDOW(0, win);
   3329 	ARG_INT(1, n);
   3330 
   3331 	report_count(1);
   3332 	report_return(wscrl(win, n));
   3333 }
   3334 
   3335 
   3336 void
   3337 cmd_wsetscrreg(int nargs, char **args)
   3338 {
   3339 	ARGC(3);
   3340 	ARG_WINDOW(0, win);
   3341 	ARG_INT(1, top);
   3342 	ARG_INT(2, bottom);
   3343 
   3344 	report_count(1);
   3345 	report_return(wsetscrreg(win, top, bottom));
   3346 }
   3347 
   3348 
   3349 void
   3350 cmd_wstandend(int nargs, char **args)
   3351 {
   3352 	ARGC(1);
   3353 	ARG_WINDOW(0, win);
   3354 
   3355 	report_count(1);
   3356 	report_int(wstandend(win));
   3357 }
   3358 
   3359 
   3360 void
   3361 cmd_wstandout(int nargs, char **args)
   3362 {
   3363 	ARGC(1);
   3364 	ARG_WINDOW(0, win);
   3365 
   3366 	report_count(1);
   3367 	report_int(wstandout(win));
   3368 }
   3369 
   3370 
   3371 void
   3372 cmd_wtimeout(int nargs, char **args)
   3373 {
   3374 	ARGC(2);
   3375 	ARG_WINDOW(0, win);
   3376 	ARG_INT(1, tval);
   3377 
   3378 	wtimeout(win, tval);	/* void return */
   3379 	report_count(1);
   3380 	report_return(OK);
   3381 }
   3382 
   3383 
   3384 void
   3385 cmd_wtouchln(int nargs, char **args)
   3386 {
   3387 	ARGC(4);
   3388 	ARG_WINDOW(0, win);
   3389 	ARG_INT(1, line);
   3390 	ARG_INT(2, n);
   3391 	ARG_INT(3, changed);
   3392 
   3393 	report_count(1);
   3394 	report_return(wtouchln(win, line, n, changed));
   3395 }
   3396 
   3397 
   3398 void
   3399 cmd_wunderend(int nargs, char **args)
   3400 {
   3401 	ARGC(1);
   3402 	ARG_WINDOW(0, win);
   3403 
   3404 	report_count(1);
   3405 	report_int(wunderend(win));
   3406 }
   3407 
   3408 
   3409 void
   3410 cmd_wunderscore(int nargs, char **args)
   3411 {
   3412 	ARGC(1);
   3413 	ARG_WINDOW(0, win);
   3414 
   3415 	report_count(1);
   3416 	report_int(wunderscore(win));
   3417 }
   3418 
   3419 
   3420 void
   3421 cmd_wvline(int nargs, char **args)
   3422 {
   3423 	ARGC(3);
   3424 	ARG_WINDOW(0, win);
   3425 	ARG_CHTYPE(1, ch);
   3426 	ARG_INT(2, n);
   3427 
   3428 	report_count(1);
   3429 	report_return(wvline(win, ch, n));
   3430 }
   3431 
   3432 
   3433 void
   3434 cmd_insnstr(int nargs, char **args)
   3435 {
   3436 	ARGC(2);
   3437 	ARG_STRING(0, str);
   3438 	ARG_INT(1, n);
   3439 
   3440 	report_count(1);
   3441 	report_return(insnstr(str, n));
   3442 }
   3443 
   3444 
   3445 void
   3446 cmd_insstr(int nargs, char **args)
   3447 {
   3448 	ARGC(1);
   3449 	ARG_STRING(0, str);
   3450 
   3451 	report_count(1);
   3452 	report_return(insstr(str));
   3453 }
   3454 
   3455 
   3456 void
   3457 cmd_mvinsnstr(int nargs, char **args)
   3458 {
   3459 	ARGC(4);
   3460 	ARG_INT(0, y);
   3461 	ARG_INT(1, x);
   3462 	ARG_STRING(2, str);
   3463 	ARG_INT(3, n);
   3464 
   3465 	report_count(1);
   3466 	report_return(mvinsnstr(y, x, str, n));
   3467 }
   3468 
   3469 
   3470 void
   3471 cmd_mvinsstr(int nargs, char **args)
   3472 {
   3473 	ARGC(3);
   3474 	ARG_INT(0, y);
   3475 	ARG_INT(1, x);
   3476 	ARG_STRING(2, str);
   3477 
   3478 	report_count(1);
   3479 	report_return(mvinsstr(y, x, str));
   3480 }
   3481 
   3482 
   3483 void
   3484 cmd_mvwinsnstr(int nargs, char **args)
   3485 {
   3486 	ARGC(5);
   3487 	ARG_WINDOW(0, win);
   3488 	ARG_INT(1, y);
   3489 	ARG_INT(2, x);
   3490 	ARG_STRING(3, str);
   3491 	ARG_INT(4, n);
   3492 
   3493 	report_count(1);
   3494 	report_return(mvwinsnstr(win, y, x, str, n));
   3495 
   3496 }
   3497 
   3498 
   3499 void
   3500 cmd_mvwinsstr(int nargs, char **args)
   3501 {
   3502 	ARGC(4);
   3503 	ARG_WINDOW(0, win);
   3504 	ARG_INT(1, y);
   3505 	ARG_INT(2, x);
   3506 	ARG_STRING(3, str);
   3507 
   3508 	report_count(1);
   3509 	report_return(mvwinsstr(win, y, x, str));
   3510 }
   3511 
   3512 
   3513 void
   3514 cmd_winsnstr(int nargs, char **args)
   3515 {
   3516 	ARGC(3);
   3517 	ARG_WINDOW(0, win);
   3518 	ARG_STRING(1, str);
   3519 	ARG_INT(2, n);
   3520 
   3521 	report_count(1);
   3522 	report_return(winsnstr(win, str, n));
   3523 }
   3524 
   3525 
   3526 void
   3527 cmd_winsstr(int nargs, char **args)
   3528 {
   3529 	ARGC(2);
   3530 	ARG_WINDOW(0, win);
   3531 	ARG_STRING(1, str);
   3532 
   3533 	report_count(1);
   3534 	report_return(winsstr(win, str));
   3535 }
   3536 
   3537 
   3538 void
   3539 cmd_chgat(int nargs, char **args)
   3540 {
   3541 	ARGC(4);
   3542 	ARG_INT(0, n);
   3543 	ARG_INT(1, attr);
   3544 	ARG_INT(2, colour);
   3545 	ARG_NULL(3);
   3546 
   3547 	report_count(1);
   3548 	report_return(chgat(n, attr, colour, NULL));
   3549 }
   3550 
   3551 
   3552 void
   3553 cmd_wchgat(int nargs, char **args)
   3554 {
   3555 	ARGC(5);
   3556 	ARG_WINDOW(0, win);
   3557 	ARG_INT(1, n);
   3558 	ARG_INT(2, attr);
   3559 	ARG_SHORT(3, colour);
   3560 	ARG_NULL(4);
   3561 
   3562 	report_count(1);
   3563 	report_return(wchgat(win, n, attr, colour, NULL));
   3564 }
   3565 
   3566 
   3567 void
   3568 cmd_mvchgat(int nargs, char **args)
   3569 {
   3570 	ARGC(6);
   3571 	ARG_INT(0, y);
   3572 	ARG_INT(1, x);
   3573 	ARG_INT(2, n);
   3574 	ARG_INT(3, attr);
   3575 	ARG_SHORT(4, colour);
   3576 	ARG_NULL(5);
   3577 
   3578 	report_count(1);
   3579 	report_return(mvchgat(y, x, n, attr, colour, NULL));
   3580 }
   3581 
   3582 
   3583 void
   3584 cmd_mvwchgat(int nargs, char **args)
   3585 {
   3586 	ARGC(7);
   3587 	ARG_WINDOW(0, win);
   3588 	ARG_INT(1, y);
   3589 	ARG_INT(2, x);
   3590 	ARG_INT(3, n);
   3591 	ARG_INT(4, attr);
   3592 	ARG_SHORT(5, colour);
   3593 	ARG_NULL(6);
   3594 
   3595 	report_count(1);
   3596 	report_return(mvwchgat(win, y, x, n, attr, colour, NULL));
   3597 }
   3598 
   3599 
   3600 void
   3601 cmd_add_wch(int nargs, char **args)
   3602 {
   3603 	ARGC(1);
   3604 	ARG_CCHAR_STRING(0, ch);
   3605 
   3606 	report_count(1);
   3607 	report_return(add_wch(ch));
   3608 }
   3609 
   3610 
   3611 void
   3612 cmd_wadd_wch(int nargs, char **args)
   3613 {
   3614 	ARGC(2);
   3615 	ARG_WINDOW(0, win);
   3616 	ARG_CCHAR_STRING(1, ch);
   3617 
   3618 	report_count(1);
   3619 	report_return(wadd_wch(win, ch));
   3620 }
   3621 
   3622 
   3623 void
   3624 cmd_mvadd_wch(int nargs, char **args)
   3625 {
   3626 	ARGC(3);
   3627 	ARG_INT(0, y);
   3628 	ARG_INT(1, x);
   3629 	ARG_CCHAR_STRING(2, ch);
   3630 
   3631 	report_count(1);
   3632 	report_return(mvadd_wch(y, x, ch));
   3633 }
   3634 
   3635 
   3636 void
   3637 cmd_mvwadd_wch(int nargs, char **args)
   3638 {
   3639 	ARGC(4);
   3640 	ARG_WINDOW(0, win);
   3641 	ARG_INT(1, y);
   3642 	ARG_INT(2, x);
   3643 	ARG_CCHAR_STRING(3, ch);
   3644 
   3645 	report_count(1);
   3646 	report_return(mvwadd_wch(win, y, x, ch));
   3647 }
   3648 
   3649 
   3650 void
   3651 cmd_add_wchnstr(int nargs, char **args)
   3652 {
   3653 	ARGC(1);
   3654 	ARG_IGNORE(0);
   3655 
   3656 	report_count(1);
   3657 	report_error("UNSUPPORTED");
   3658 }
   3659 
   3660 
   3661 void
   3662 cmd_add_wchstr(int nargs, char **args)
   3663 {
   3664 	ARGC(1);
   3665 	ARG_IGNORE(0);
   3666 
   3667 	report_count(1);
   3668 	report_error("UNSUPPORTED");
   3669 }
   3670 
   3671 
   3672 void
   3673 cmd_wadd_wchnstr(int nargs, char **args)
   3674 {
   3675 	ARGC(1);
   3676 	ARG_IGNORE(0);
   3677 
   3678 	report_count(1);
   3679 	report_error("UNSUPPORTED");
   3680 }
   3681 
   3682 
   3683 void
   3684 cmd_wadd_wchstr(int nargs, char **args)
   3685 {
   3686 	ARGC(1);
   3687 	ARG_IGNORE(0);
   3688 
   3689 	report_count(1);
   3690 	report_error("UNSUPPORTED");
   3691 }
   3692 
   3693 
   3694 void
   3695 cmd_mvadd_wchnstr(int nargs, char **args)
   3696 {
   3697 	ARGC(1);
   3698 	ARG_IGNORE(0);
   3699 
   3700 	report_count(1);
   3701 	report_error("UNSUPPORTED");
   3702 }
   3703 
   3704 
   3705 void
   3706 cmd_mvadd_wchstr(int nargs, char **args)
   3707 {
   3708 	ARGC(1);
   3709 	ARG_IGNORE(0);
   3710 
   3711 	report_count(1);
   3712 	report_error("UNSUPPORTED");
   3713 }
   3714 
   3715 
   3716 void
   3717 cmd_mvwadd_wchnstr(int nargs, char **args)
   3718 {
   3719 	ARGC(1);
   3720 	ARG_IGNORE(0);
   3721 
   3722 	report_count(1);
   3723 	report_error("UNSUPPORTED");
   3724 }
   3725 
   3726 
   3727 void
   3728 cmd_mvwadd_wchstr(int nargs, char **args)
   3729 {
   3730 	ARGC(1);
   3731 	ARG_IGNORE(0);
   3732 
   3733 	report_count(1);
   3734 	report_error("UNSUPPORTED");
   3735 }
   3736 
   3737 
   3738 void
   3739 cmd_addnwstr(int nargs, char **args)
   3740 {
   3741 	ARGC(2);
   3742 	ARG_WCHAR_STRING(0, wstr);
   3743 	ARG_INT(1, n);
   3744 
   3745 	report_count(1);
   3746 	report_return(addnwstr(wstr, n));
   3747 }
   3748 
   3749 
   3750 void
   3751 cmd_addwstr(int nargs, char **args)
   3752 {
   3753 	ARGC(1);
   3754 	ARG_WCHAR_STRING(0, wstr);
   3755 
   3756 	report_count(1);
   3757 	report_return(addwstr(wstr));
   3758 }
   3759 
   3760 
   3761 void
   3762 cmd_mvaddnwstr(int nargs, char **args)
   3763 {
   3764 	ARGC(4);
   3765 	ARG_INT(0, y);
   3766 	ARG_INT(1, x);
   3767 	ARG_WCHAR_STRING(2, wstr);
   3768 	ARG_INT(3, n);
   3769 
   3770 	report_count(1);
   3771 	report_return(mvaddnwstr(y, x, wstr, n));
   3772 }
   3773 
   3774 
   3775 void
   3776 cmd_mvaddwstr(int nargs, char **args)
   3777 {
   3778 	ARGC(3);
   3779 	ARG_INT(0, y);
   3780 	ARG_INT(1, x);
   3781 	ARG_WCHAR_STRING(2, wstr);
   3782 
   3783 	report_count(1);
   3784 	report_return(mvaddwstr(y, x, wstr));
   3785 }
   3786 
   3787 
   3788 void
   3789 cmd_mvwaddnwstr(int nargs, char **args)
   3790 {
   3791 	ARGC(5);
   3792 	ARG_WINDOW(0, win);
   3793 	ARG_INT(1, y);
   3794 	ARG_INT(2, x);
   3795 	ARG_WCHAR_STRING(3, wstr);
   3796 	ARG_INT(4, n);
   3797 
   3798 	report_count(1);
   3799 	report_return(mvwaddnwstr(win, y, x, wstr, n));
   3800 }
   3801 
   3802 
   3803 void
   3804 cmd_mvwaddwstr(int nargs, char **args)
   3805 {
   3806 	ARGC(4);
   3807 	ARG_WINDOW(0, win);
   3808 	ARG_INT(1, y);
   3809 	ARG_INT(2, x);
   3810 	ARG_WCHAR_STRING(3, wstr);
   3811 
   3812 	report_count(1);
   3813 	report_return(mvwaddwstr(win, y, x, wstr));
   3814 }
   3815 
   3816 
   3817 void
   3818 cmd_waddnwstr(int nargs, char **args)
   3819 {
   3820 	ARGC(3);
   3821 	ARG_WINDOW(0, win);
   3822 	ARG_WCHAR_STRING(1, wstr);
   3823 	ARG_INT(2, n);
   3824 
   3825 	report_count(1);
   3826 	report_return(waddnwstr(win, wstr, n));
   3827 }
   3828 
   3829 
   3830 void
   3831 cmd_waddwstr(int nargs, char **args)
   3832 {
   3833 	ARGC(2);
   3834 	ARG_WINDOW(0, win);
   3835 	ARG_WCHAR_STRING(1, wstr);
   3836 
   3837 	report_count(1);
   3838 	report_return(waddwstr(win, wstr));
   3839 }
   3840 
   3841 
   3842 void
   3843 cmd_echo_wchar(int nargs, char **args)
   3844 {
   3845 	ARGC(1);
   3846 	ARG_CCHAR_STRING(0, ch);
   3847 
   3848 	report_count(1);
   3849 	report_return(echo_wchar(ch));
   3850 }
   3851 
   3852 
   3853 void
   3854 cmd_wecho_wchar(int nargs, char **args)
   3855 {
   3856 	ARGC(2);
   3857 	ARG_WINDOW(0, win);
   3858 	ARG_CCHAR_STRING(1, ch);
   3859 
   3860 	report_count(1);
   3861 	report_return(wecho_wchar(win, ch));
   3862 }
   3863 
   3864 
   3865 void
   3866 cmd_pecho_wchar(int nargs, char **args)
   3867 {
   3868 	ARGC(2);
   3869 	ARG_WINDOW(0, pad);
   3870 	ARG_CCHAR_STRING(1, wch);
   3871 
   3872 	report_count(1);
   3873 	report_return(pecho_wchar(pad, wch));
   3874 }
   3875 
   3876 
   3877 /* insert */
   3878 void
   3879 cmd_ins_wch(int nargs, char **args)
   3880 {
   3881 	ARGC(1);
   3882 	ARG_CCHAR_STRING(0, wch);
   3883 
   3884 	report_count(1);
   3885 	report_return(ins_wch(wch));
   3886 }
   3887 
   3888 
   3889 void
   3890 cmd_wins_wch(int nargs, char **args)
   3891 {
   3892 	ARGC(2);
   3893 	ARG_WINDOW(0, win);
   3894 	ARG_CCHAR_STRING(1, wch);
   3895 
   3896 	report_count(1);
   3897 	report_return(wins_wch(win, wch));
   3898 }
   3899 
   3900 
   3901 void
   3902 cmd_mvins_wch(int nargs, char **args)
   3903 {
   3904 	ARGC(3);
   3905 	ARG_INT(0, y);
   3906 	ARG_INT(1, x);
   3907 	ARG_CCHAR_STRING(2, wch);
   3908 
   3909 	report_count(1);
   3910 	report_return(mvins_wch(y, x, wch));
   3911 }
   3912 
   3913 
   3914 void
   3915 cmd_mvwins_wch(int nargs, char **args)
   3916 {
   3917 	ARGC(4);
   3918 	ARG_WINDOW(0, win);
   3919 	ARG_INT(1, y);
   3920 	ARG_INT(2, x);
   3921 	ARG_CCHAR_STRING(3, wch);
   3922 
   3923 	report_count(1);
   3924 	report_return(mvwins_wch(win, y, x, wch));
   3925 }
   3926 
   3927 
   3928 void
   3929 cmd_ins_nwstr(int nargs, char **args)
   3930 {
   3931 	ARGC(2);
   3932 	ARG_WCHAR_STRING(0, wstr);
   3933 	ARG_INT(1, n);
   3934 
   3935 	report_count(1);
   3936 	report_return(ins_nwstr(wstr, n));
   3937 }
   3938 
   3939 
   3940 void
   3941 cmd_ins_wstr(int nargs, char **args)
   3942 {
   3943 	ARGC(1);
   3944 	ARG_WCHAR_STRING(0, wstr);
   3945 
   3946 	report_count(1);
   3947 	report_return(ins_wstr(wstr));
   3948 }
   3949 
   3950 
   3951 void
   3952 cmd_mvins_nwstr(int nargs, char **args)
   3953 {
   3954 	ARGC(4);
   3955 	ARG_INT(0, y);
   3956 	ARG_INT(1, x);
   3957 	ARG_WCHAR_STRING(2, wstr);
   3958 	ARG_INT(3, n);
   3959 
   3960 	report_count(1);
   3961 	report_return(mvins_nwstr(y, x, wstr, n));
   3962 }
   3963 
   3964 
   3965 void
   3966 cmd_mvins_wstr(int nargs, char **args)
   3967 {
   3968 	ARGC(3);
   3969 	ARG_INT(0, y);
   3970 	ARG_INT(1, x);
   3971 	ARG_WCHAR_STRING(2, wstr);
   3972 
   3973 	report_count(1);
   3974 	report_return(mvins_wstr(y, x, wstr));
   3975 }
   3976 
   3977 
   3978 void
   3979 cmd_mvwins_nwstr(int nargs, char **args)
   3980 {
   3981 	ARGC(5);
   3982 	ARG_WINDOW(0, win);
   3983 	ARG_INT(1, y);
   3984 	ARG_INT(2, x);
   3985 	ARG_WCHAR_STRING(3, wstr);
   3986 	ARG_INT(4, n);
   3987 
   3988 	report_count(1);
   3989 	report_return(mvwins_nwstr(win, y, x, wstr, n));
   3990 }
   3991 
   3992 
   3993 void
   3994 cmd_mvwins_wstr(int nargs, char **args)
   3995 {
   3996 	ARGC(4);
   3997 	ARG_WINDOW(0, win);
   3998 	ARG_INT(1, y);
   3999 	ARG_INT(2, x);
   4000 	ARG_WCHAR_STRING(3, wstr);
   4001 
   4002 	report_count(1);
   4003 	report_return(mvwins_wstr(win, y, x, wstr));
   4004 }
   4005 
   4006 
   4007 void
   4008 cmd_wins_nwstr(int nargs, char **args)
   4009 {
   4010 	ARGC(3);
   4011 	ARG_WINDOW(0, win);
   4012 	ARG_WCHAR_STRING(1, wstr);
   4013 	ARG_INT(2, n);
   4014 
   4015 	report_count(1);
   4016 	report_return(wins_nwstr(win, wstr, n));
   4017 }
   4018 
   4019 
   4020 void
   4021 cmd_wins_wstr(int nargs, char **args)
   4022 {
   4023 	ARGC(2);
   4024 	ARG_WINDOW(0, win);
   4025 	ARG_WCHAR_STRING(1, wstr);
   4026 
   4027 	report_count(1);
   4028 	report_return(wins_wstr(win, wstr));
   4029 }
   4030 
   4031 
   4032 /* input */
   4033 void
   4034 cmd_get_wch(int nargs, char **args)
   4035 {
   4036 	wchar_t ch;
   4037 	ARGC(0);
   4038 
   4039 	report_count(2);
   4040 	report_return(get_wch(&ch));
   4041 	report_wchar(ch);
   4042 }
   4043 
   4044 
   4045 void
   4046 cmd_unget_wch(int nargs, char **args)
   4047 {
   4048 	ARGC(1);
   4049 	ARG_WCHAR(0, wch);
   4050 
   4051 	report_count(1);
   4052 	report_return(unget_wch(wch));
   4053 }
   4054 
   4055 
   4056 void
   4057 cmd_mvget_wch(int nargs, char **args)
   4058 {
   4059 	wchar_t ch;
   4060 
   4061 	ARGC(2);
   4062 	ARG_INT(0, y);
   4063 	ARG_INT(1, x);
   4064 
   4065 	report_count(2);
   4066 	report_return(mvget_wch(y, x, &ch));
   4067 	report_wchar(ch);
   4068 }
   4069 
   4070 
   4071 void
   4072 cmd_mvwget_wch(int nargs, char **args)
   4073 {
   4074 	wchar_t ch;
   4075 
   4076 	ARGC(1);	/* FIXME: 3 */
   4077 	ARG_WINDOW(0, win);
   4078 	ARG_INT(1, y);
   4079 	ARG_INT(2, x);
   4080 
   4081 	report_count(2);
   4082 	report_return(mvwget_wch(win, y, x, &ch));
   4083 	report_wchar(ch);
   4084 }
   4085 
   4086 
   4087 void
   4088 cmd_wget_wch(int nargs, char **args)
   4089 {
   4090 	wchar_t ch;
   4091 
   4092 	ARGC(1);
   4093 	ARG_WINDOW(0, win);
   4094 
   4095 	report_count(2);
   4096 	report_return(wget_wch(win, &ch));
   4097 	report_wchar(ch);
   4098 }
   4099 
   4100 
   4101 void
   4102 cmd_getn_wstr(int nargs, char **args)
   4103 {
   4104 	wchar_t wstr[256];
   4105 
   4106 	ARGC(1);
   4107 	ARG_INT(0, n);
   4108 
   4109 	report_count(2);
   4110 	report_return(getn_wstr(wstr, n));
   4111 	report_wstr(wstr);
   4112 }
   4113 
   4114 
   4115 void
   4116 cmd_get_wstr(int nargs, char **args)
   4117 {
   4118 	wchar_t wstr[256];
   4119 
   4120 	ARGC(0);
   4121 
   4122 	report_count(2);
   4123 	report_return(get_wstr(wstr));
   4124 	report_wstr(wstr);
   4125 }
   4126 
   4127 void
   4128 cmd_mvgetn_wstr(int nargs, char **args)
   4129 {
   4130 	wchar_t wstr[256];
   4131 
   4132 	ARGC(3);
   4133 	ARG_INT(0, y);
   4134 	ARG_INT(1, x);
   4135 	ARG_INT(2, n);
   4136 
   4137 	report_count(2);
   4138 	report_return(mvgetn_wstr(y, x, wstr, n));
   4139 	report_wstr(wstr);
   4140 }
   4141 
   4142 void
   4143 cmd_mvget_wstr(int nargs, char **args)
   4144 {
   4145 	wchar_t wstr[256];
   4146 
   4147 	ARGC(2);
   4148 	ARG_INT(0, y);
   4149 	ARG_INT(1, x);
   4150 
   4151 	report_count(2);
   4152 	report_return(mvget_wstr(y, x, wstr));
   4153 	report_wstr(wstr);
   4154 }
   4155 
   4156 
   4157 void
   4158 cmd_mvwgetn_wstr(int nargs, char **args)
   4159 {
   4160 	wchar_t wstr[256];
   4161 
   4162 	ARGC(4);
   4163 	ARG_WINDOW(0, win);
   4164 	ARG_INT(1, y);
   4165 	ARG_INT(2, x);
   4166 	ARG_INT(3, n);
   4167 
   4168 	report_count(2);
   4169 	report_return(mvwgetn_wstr(win, y, x, wstr, n));
   4170 	report_wstr(wstr);
   4171 }
   4172 
   4173 
   4174 void
   4175 cmd_mvwget_wstr(int nargs, char **args)
   4176 {
   4177 	wchar_t wstr[256];
   4178 
   4179 	ARGC(3);
   4180 	ARG_WINDOW(0, win);
   4181 	ARG_INT(1, y);
   4182 	ARG_INT(2, x);
   4183 
   4184 	report_count(2);
   4185 	report_return(mvwget_wstr(win, y, x, wstr));
   4186 	report_wstr(wstr);
   4187 }
   4188 
   4189 
   4190 void
   4191 cmd_wgetn_wstr(int nargs, char **args)
   4192 {
   4193 	wchar_t wstr[256];
   4194 
   4195 	ARGC(2);
   4196 	ARG_WINDOW(0, win);
   4197 	ARG_INT(1, n);
   4198 
   4199 	report_count(2);
   4200 	report_return(wgetn_wstr(win, wstr, n));
   4201 	report_wstr(wstr);
   4202 }
   4203 
   4204 
   4205 void
   4206 cmd_wget_wstr(int nargs, char **args)
   4207 {
   4208 	wchar_t wstr[256];
   4209 
   4210 	ARGC(1);
   4211 	ARG_WINDOW(0, win);
   4212 
   4213 	report_count(2);
   4214 	report_return(wget_wstr(win, wstr));
   4215 	report_wstr(wstr);
   4216 }
   4217 
   4218 
   4219 void
   4220 cmd_in_wch(int nargs, char **args)
   4221 {
   4222 	cchar_t wcval;
   4223 	ARGC(0);
   4224 
   4225 	report_count(2);
   4226 	report_return(in_wch(&wcval));
   4227 	report_cchar(wcval);
   4228 }
   4229 
   4230 
   4231 void
   4232 cmd_mvin_wch(int nargs, char **args)
   4233 {
   4234 	cchar_t wcval;
   4235 
   4236 	ARGC(2);
   4237 	ARG_INT(0, y);
   4238 	ARG_INT(1, x);
   4239 
   4240 	report_count(2);
   4241 	report_return(mvin_wch(y, x, &wcval));
   4242 	report_cchar(wcval);
   4243 }
   4244 
   4245 
   4246 void
   4247 cmd_mvwin_wch(int nargs, char **args)
   4248 {
   4249 	cchar_t wcval;
   4250 
   4251 	ARGC(3);
   4252 	ARG_WINDOW(0, win);
   4253 	ARG_INT(1, y);
   4254 	ARG_INT(2, x);
   4255 
   4256 	report_count(2);
   4257 	report_return(mvwin_wch(win, y, x, &wcval));
   4258 	report_cchar(wcval);
   4259 }
   4260 
   4261 
   4262 void
   4263 cmd_win_wch(int nargs, char **args)
   4264 {
   4265 	cchar_t wcval;
   4266 
   4267 	ARGC(1);
   4268 	ARG_WINDOW(0, win);
   4269 
   4270 	report_count(2);
   4271 	report_return(win_wch(win, &wcval));
   4272 	report_cchar(wcval);
   4273 }
   4274 
   4275 
   4276 void
   4277 cmd_in_wchnstr(int nargs, char **args)
   4278 {
   4279 	ARGC(1);
   4280 	ARG_IGNORE(0);
   4281 
   4282 	report_count(1);
   4283 	report_error("UNSUPPORTED");
   4284 }
   4285 
   4286 
   4287 void
   4288 cmd_in_wchstr(int nargs, char **args)
   4289 {
   4290 	ARGC(1);
   4291 	ARG_IGNORE(0);
   4292 
   4293 	report_count(1);
   4294 	report_error("UNSUPPORTED");
   4295 }
   4296 
   4297 
   4298 void
   4299 cmd_mvin_wchnstr(int nargs, char **args)
   4300 {
   4301 	ARGC(1);
   4302 	ARG_IGNORE(0);
   4303 
   4304 	report_count(1);
   4305 	report_error("UNSUPPORTED");
   4306 }
   4307 
   4308 
   4309 void
   4310 cmd_mvin_wchstr(int nargs, char **args)
   4311 {
   4312 	ARGC(1);
   4313 	ARG_IGNORE(0);
   4314 
   4315 	report_count(1);
   4316 	report_error("UNSUPPORTED");
   4317 }
   4318 
   4319 
   4320 void
   4321 cmd_mvwin_wchnstr(int nargs, char **args)
   4322 {
   4323 	ARGC(1);
   4324 	ARG_IGNORE(0);
   4325 
   4326 	report_count(1);
   4327 	report_error("UNSUPPORTED");
   4328 }
   4329 
   4330 
   4331 void
   4332 cmd_mvwin_wchstr(int nargs, char **args)
   4333 {
   4334 	ARGC(1);
   4335 	ARG_IGNORE(0);
   4336 
   4337 	report_count(1);
   4338 	report_error("UNSUPPORTED");
   4339 }
   4340 
   4341 
   4342 void
   4343 cmd_win_wchnstr(int nargs, char **args)
   4344 {
   4345 	ARGC(1);
   4346 	ARG_IGNORE(0);
   4347 
   4348 	report_count(1);
   4349 	report_error("UNSUPPORTED");
   4350 }
   4351 
   4352 
   4353 void
   4354 cmd_win_wchstr(int nargs, char **args)
   4355 {
   4356 	ARGC(1);
   4357 	ARG_IGNORE(0);
   4358 
   4359 	report_count(1);
   4360 	report_error("UNSUPPORTED");
   4361 }
   4362 
   4363 
   4364 void
   4365 cmd_innwstr(int nargs, char **args)
   4366 {
   4367 	wchar_t wstr[256];
   4368 
   4369 	ARGC(1);
   4370 	ARG_INT(0, n);
   4371 
   4372 	report_count(2);
   4373 	report_int(innwstr(wstr, n));
   4374 	report_wstr(wstr);
   4375 }
   4376 
   4377 
   4378 void
   4379 cmd_inwstr(int nargs, char **args)
   4380 {
   4381 	wchar_t wstr[256];
   4382 	ARGC(0);
   4383 
   4384 	report_count(2);
   4385 	report_return(inwstr(wstr));
   4386 	report_wstr(wstr);
   4387 }
   4388 
   4389 
   4390 void
   4391 cmd_mvinnwstr(int nargs, char **args)
   4392 {
   4393 	wchar_t wstr[256];
   4394 
   4395 	ARGC(3);
   4396 	ARG_INT(0, y);
   4397 	ARG_INT(1, x);
   4398 	ARG_INT(2, n);
   4399 
   4400 	report_count(2);
   4401 	report_int(mvinnwstr(y, x, wstr, n));
   4402 	report_wstr(wstr);
   4403 }
   4404 
   4405 
   4406 void
   4407 cmd_mvinwstr(int nargs, char **args)
   4408 {
   4409 	wchar_t wstr[256];
   4410 
   4411 	ARGC(2);
   4412 	ARG_INT(0, y);
   4413 	ARG_INT(1, x);
   4414 
   4415 	report_count(2);
   4416 	report_return(mvinwstr(y, x, wstr));
   4417 	report_wstr(wstr);
   4418 }
   4419 
   4420 
   4421 void
   4422 cmd_mvwinnwstr(int nargs, char **args)
   4423 {
   4424 	wchar_t wstr[256];
   4425 
   4426 	ARGC(4);
   4427 	ARG_WINDOW(0, win);
   4428 	ARG_INT(1, y);
   4429 	ARG_INT(2, x);
   4430 	ARG_INT(3, n);
   4431 
   4432 	report_count(2);
   4433 	report_int(mvwinnwstr(win, y, x, wstr, n));
   4434 	report_wstr(wstr);
   4435 }
   4436 
   4437 
   4438 void
   4439 cmd_mvwinwstr(int nargs, char **args)
   4440 {
   4441 	wchar_t wstr[256];
   4442 
   4443 	ARGC(3);
   4444 	ARG_WINDOW(0, win);
   4445 	ARG_INT(1, y);
   4446 	ARG_INT(2, x);
   4447 
   4448 	report_count(2);
   4449 	report_return(mvwinwstr(win, y, x, wstr));
   4450 	report_wstr(wstr);
   4451 }
   4452 
   4453 
   4454 void
   4455 cmd_winnwstr(int nargs, char **args)
   4456 {
   4457 	wchar_t wstr[256];
   4458 
   4459 	ARGC(2);
   4460 	ARG_WINDOW(0, win);
   4461 	ARG_INT(1, n);
   4462 
   4463 	report_count(2);
   4464 	report_int(winnwstr(win, wstr, n));
   4465 	report_wstr(wstr);
   4466 }
   4467 
   4468 
   4469 void
   4470 cmd_winwstr(int nargs, char **args)
   4471 {
   4472 	wchar_t wstr[256];
   4473 
   4474 	ARGC(1);
   4475 	ARG_WINDOW(0, win);
   4476 
   4477 	report_count(2);
   4478 	report_return(winwstr(win, wstr));
   4479 	report_wstr(wstr);
   4480 }
   4481 
   4482 
   4483 /* cchar handling */
   4484 void
   4485 cmd_setcchar(int nargs, char **args)
   4486 {
   4487 	cchar_t wcval;
   4488 
   4489 	ARGC(4);
   4490 	ARG_WCHAR_STRING(0, wch);
   4491 	ARG_INT(1, attrs);
   4492 	ARG_SHORT(2, color_pair);
   4493 	ARG_NULL(3);
   4494 
   4495 	report_count(2);
   4496 	report_return(setcchar(&wcval, wch, attrs, color_pair, NULL));
   4497 	report_cchar(wcval);
   4498 }
   4499 
   4500 
   4501 void
   4502 cmd_getcchar(int nargs, char **args)
   4503 {
   4504 	wchar_t wch[256];
   4505 	attr_t attrs;
   4506 	short color_pair;
   4507 
   4508 	/*
   4509          * XXX - not handling passing of wch as NULL
   4510          */
   4511 
   4512 	ARGC(2);
   4513 	ARG_CCHAR_STRING(0, wcval);
   4514 	ARG_NULL(1);
   4515 
   4516 	report_count(4);
   4517 	report_return(getcchar(wcval, wch, &attrs, &color_pair, NULL));
   4518 	report_wstr(wch);
   4519 	report_int(attrs);
   4520 	report_int(color_pair);
   4521 }
   4522 
   4523 
   4524 /* misc */
   4525 void
   4526 cmd_key_name(int nargs, char **args)
   4527 {
   4528 	ARGC(1);
   4529 	ARG_WCHAR(0, w);
   4530 
   4531 	report_count(1);
   4532 	report_status(key_name(w));
   4533 }
   4534 
   4535 
   4536 void
   4537 cmd_border_set(int nargs, char **args)
   4538 {
   4539 	ARGC(8);
   4540 	ARG_CCHAR_STRING(0, ls);
   4541 	ARG_CCHAR_STRING(1, rs);
   4542 	ARG_CCHAR_STRING(2, ts);
   4543 	ARG_CCHAR_STRING(3, bs);
   4544 	ARG_CCHAR_STRING(4, tl);
   4545 	ARG_CCHAR_STRING(5, tr);
   4546 	ARG_CCHAR_STRING(6, bl);
   4547 	ARG_CCHAR_STRING(7, br);
   4548 
   4549 	report_count(1);
   4550 	report_return(border_set(ls, rs, ts, bs, tl, tr, bl, br));
   4551 }
   4552 
   4553 
   4554 void
   4555 cmd_wborder_set(int nargs, char **args)
   4556 {
   4557 	ARGC(9);
   4558 	ARG_WINDOW(0, win);
   4559 	ARG_CCHAR_STRING(1, ls);
   4560 	ARG_CCHAR_STRING(2, rs);
   4561 	ARG_CCHAR_STRING(3, ts);
   4562 	ARG_CCHAR_STRING(4, bs);
   4563 	ARG_CCHAR_STRING(5, tl);
   4564 	ARG_CCHAR_STRING(6, tr);
   4565 	ARG_CCHAR_STRING(7, bl);
   4566 	ARG_CCHAR_STRING(8, br);
   4567 
   4568 	report_count(1);
   4569 	report_return(wborder_set(win, ls, rs, ts, bs, tl, tr, bl, br));
   4570 }
   4571 
   4572 
   4573 void
   4574 cmd_box_set(int nargs, char **args)
   4575 {
   4576 	ARGC(3);
   4577 	ARG_WINDOW(0, win);
   4578 	ARG_CCHAR_STRING(1, verch);
   4579 	ARG_CCHAR_STRING(2, horch);
   4580 
   4581 	report_count(1);
   4582 	report_return(box_set(win, verch, horch));
   4583 }
   4584 
   4585 
   4586 void
   4587 cmd_erasewchar(int nargs, char **args)
   4588 {
   4589 	wchar_t ch;
   4590 
   4591 	ARGC(0);
   4592 
   4593 	report_count(2);
   4594 	report_return(erasewchar(&ch));
   4595 	report_wchar(ch);
   4596 }
   4597 
   4598 
   4599 void
   4600 cmd_killwchar(int nargs, char **args)
   4601 {
   4602 	wchar_t ch;
   4603 
   4604 	ARGC(0);
   4605 
   4606 	report_count(2);
   4607 	report_return(killwchar(&ch));
   4608 	report_wchar(ch);
   4609 }
   4610 
   4611 
   4612 void
   4613 cmd_hline_set(int nargs, char **args)
   4614 {
   4615 	ARGC(2);
   4616 	ARG_CCHAR_STRING(0, wch);
   4617 	ARG_INT(1, n);
   4618 
   4619 	report_count(1);
   4620 	report_return(hline_set(wch, n));
   4621 }
   4622 
   4623 
   4624 void
   4625 cmd_mvhline_set(int nargs, char **args)
   4626 {
   4627 	ARGC(4);
   4628 	ARG_INT(0, y);
   4629 	ARG_INT(1, x);
   4630 	ARG_CCHAR_STRING(2, wch);
   4631 	ARG_INT(3, n);
   4632 
   4633 	report_count(1);
   4634 	report_return(mvhline_set(y, x, wch, n));
   4635 }
   4636 
   4637 
   4638 void
   4639 cmd_mvvline_set(int nargs, char **args)
   4640 {
   4641 	ARGC(4);
   4642 	ARG_INT(0, y);
   4643 	ARG_INT(1, x);
   4644 	ARG_CCHAR_STRING(2, wch);
   4645 	ARG_INT(3, n);
   4646 
   4647 	report_count(1);
   4648 	report_return(mvvline_set(y, x, wch, n));
   4649 }
   4650 
   4651 
   4652 void
   4653 cmd_mvwhline_set(int nargs, char **args)
   4654 {
   4655 	ARGC(5);
   4656 	ARG_WINDOW(0, win);
   4657 	ARG_INT(1, y);
   4658 	ARG_INT(2, x);
   4659 	ARG_CCHAR_STRING(3, wch);
   4660 	ARG_INT(4, n);
   4661 
   4662 	report_count(1);
   4663 	report_return(mvwhline_set(win, y, x, wch, n));
   4664 }
   4665 
   4666 
   4667 void
   4668 cmd_mvwvline_set(int nargs, char **args)
   4669 {
   4670 	ARGC(5);
   4671 	ARG_WINDOW(0, win);
   4672 	ARG_INT(1, y);
   4673 	ARG_INT(2, x);
   4674 	ARG_CCHAR_STRING(3, wch);
   4675 	ARG_INT(4, n);
   4676 
   4677 	report_count(1);
   4678 	report_return(mvwvline_set(win, y, x, wch, n));
   4679 }
   4680 
   4681 
   4682 void
   4683 cmd_vline_set(int nargs, char **args)
   4684 {
   4685 	ARGC(2);
   4686 	ARG_CCHAR_STRING(0, wch);
   4687 	ARG_INT(1, n);
   4688 
   4689 	report_count(1);
   4690 	report_return(vline_set(wch, n));
   4691 }
   4692 
   4693 
   4694 void
   4695 cmd_whline_set(int nargs, char **args)
   4696 {
   4697 	ARGC(3);
   4698 	ARG_WINDOW(0, win);
   4699 	ARG_CCHAR_STRING(1, wch);
   4700 	ARG_INT(2, n);
   4701 
   4702 	report_count(1);
   4703 	report_return(whline_set(win, wch, n));
   4704 }
   4705 
   4706 
   4707 void
   4708 cmd_wvline_set(int nargs, char **args)
   4709 {
   4710 	ARGC(3);
   4711 	ARG_WINDOW(0, win);
   4712 	ARG_CCHAR_STRING(1, wch);
   4713 	ARG_INT(2, n);
   4714 
   4715 	report_count(1);
   4716 	report_return(wvline_set(win, wch, n));
   4717 }
   4718 
   4719 
   4720 void
   4721 cmd_bkgrnd(int nargs, char **args)
   4722 {
   4723 	ARGC(1);
   4724 	ARG_CCHAR_STRING(0, wch);
   4725 
   4726 	report_count(1);
   4727 	report_return(bkgrnd(wch));
   4728 }
   4729 
   4730 
   4731 void
   4732 cmd_bkgrndset(int nargs, char **args)
   4733 {
   4734 	ARGC(1);
   4735 	ARG_CCHAR_STRING(0, wch);
   4736 
   4737 	report_count(1);
   4738 	bkgrndset(wch);
   4739 	report_return(OK);
   4740 }
   4741 
   4742 
   4743 void
   4744 cmd_getbkgrnd(int nargs, char **args)
   4745 {
   4746 	cchar_t wch;
   4747 	ARGC(0);
   4748 
   4749 	report_count(2);
   4750 	report_return(getbkgrnd(&wch));
   4751 	report_cchar(wch);
   4752 }
   4753 
   4754 
   4755 void
   4756 cmd_wbkgrnd(int nargs, char **args)
   4757 {
   4758 	ARGC(2);
   4759 	ARG_WINDOW(0, win);
   4760 	ARG_CCHAR_STRING(1, wch);
   4761 
   4762 	report_count(1);
   4763 	report_return(wbkgrnd(win, wch));
   4764 }
   4765 
   4766 
   4767 void
   4768 cmd_wbkgrndset(int nargs, char **args)
   4769 {
   4770 	ARGC(2);
   4771 	ARG_WINDOW(0, win);
   4772 	ARG_CCHAR_STRING(1, wch);
   4773 
   4774 	report_count(1);
   4775 	wbkgrndset(win, wch);
   4776 	report_return(OK);
   4777 }
   4778 
   4779 
   4780 void
   4781 cmd_wgetbkgrnd(int nargs, char **args)
   4782 {
   4783 	cchar_t wch;
   4784 	ARGC(1);
   4785 	ARG_WINDOW(0, win);
   4786 
   4787 	report_count(2);
   4788 	report_return(wgetbkgrnd(win, &wch));
   4789 	report_cchar(wch);
   4790 }
   4791 
   4792 
   4793 void
   4794 cmd_immedok(int nargs, char **args)
   4795 {
   4796 	ARGC(2);
   4797 	ARG_WINDOW(0, win);
   4798 	ARG_INT(1, bf);
   4799 
   4800 	report_count(1);
   4801 	immedok(win, bf);
   4802 	report_return(OK);
   4803 }
   4804 
   4805 void
   4806 cmd_syncok(int nargs, char **args)
   4807 {
   4808 	ARGC(2);
   4809 	ARG_WINDOW(0, win);
   4810 	ARG_INT(1, bf);
   4811 
   4812 	report_count(1);
   4813 	report_return(syncok(win, bf));
   4814 }
   4815 
   4816 void
   4817 cmd_wcursyncup(int nargs, char **args)
   4818 {
   4819 	ARGC(1);
   4820 	ARG_WINDOW(0, win);
   4821 
   4822 	report_count(1);
   4823 	wcursyncup(win);
   4824 	report_return(OK);
   4825 }
   4826 
   4827 void
   4828 cmd_wsyncup(int nargs, char **args)
   4829 {
   4830 	ARGC(1);
   4831 	ARG_WINDOW(0, win);
   4832 
   4833 	report_count(1);
   4834 	wsyncup(win);
   4835 	report_return(OK);
   4836 }
   4837 
   4838 void
   4839 cmd_wsyncdown(int nargs, char **args)
   4840 {
   4841 	ARGC(1);
   4842 	ARG_WINDOW(0, win);
   4843 
   4844 	report_count(1);
   4845 	wsyncdown(win);
   4846 	report_return(OK);
   4847 }
   4848 
   4849 
   4850 /* Soft label key routines */
   4851 void
   4852 cmd_slk_attroff(int nargs, char **args)
   4853 {
   4854 	ARGC(1);
   4855 	ARG_CHTYPE(0, ch);
   4856 
   4857 	report_count(1);
   4858 	report_return(slk_attroff(ch));
   4859 }
   4860 
   4861 void
   4862 cmd_slk_attr_off(int nargs, char **args)
   4863 {
   4864 	ARGC(1);
   4865 	ARG_INT(0, attrs);
   4866 
   4867 	report_count(1);
   4868 	report_return(slk_attr_off(attrs, NULL));
   4869 }
   4870 
   4871 void
   4872 cmd_slk_attron(int nargs, char **args)
   4873 {
   4874 	ARGC(1);
   4875 	ARG_CHTYPE(0, ch);
   4876 
   4877 	report_count(1);
   4878 	report_return(slk_attron(ch));
   4879 }
   4880 
   4881 void
   4882 cmd_slk_attr_on(int nargs, char **args)
   4883 {
   4884 	ARGC(1);
   4885 	ARG_INT(0, attrs);
   4886 
   4887 	report_count(1);
   4888 	report_return(slk_attr_on(attrs, NULL));
   4889 }
   4890 
   4891 void
   4892 cmd_slk_attrset(int nargs, char **args)
   4893 {
   4894 	ARGC(1);
   4895 	ARG_CHTYPE(0, ch);
   4896 
   4897 	report_count(1);
   4898 	report_return(slk_attrset(ch));
   4899 }
   4900 
   4901 void
   4902 cmd_slk_attr_set(int nargs, char **args)
   4903 {
   4904 	ARGC(2);
   4905 	ARG_INT(0, attrs);
   4906 	ARG_SHORT(1, color_pair_number);
   4907 
   4908 	report_count(1);
   4909 	report_return(slk_attr_set(attrs, color_pair_number, NULL));
   4910 }
   4911 
   4912 void
   4913 cmd_slk_clear(int nargs, char **args)
   4914 {
   4915 	ARGC(0);
   4916 
   4917 	report_count(1);
   4918 	report_return(slk_clear());
   4919 }
   4920 
   4921 void
   4922 cmd_slk_color(int nargs, char **args)
   4923 {
   4924 	ARGC(1);
   4925 	ARG_SHORT(0, color_pair_number);
   4926 
   4927 	report_count(1);
   4928 	report_return(slk_color(color_pair_number));
   4929 }
   4930 
   4931 void
   4932 cmd_slk_label(int nargs, char **args)
   4933 {
   4934 	char *label;
   4935 
   4936 	ARGC(1);
   4937 	ARG_INT(0, labnum);
   4938 
   4939 	label = slk_label(labnum);
   4940 	report_count(1);
   4941 	if (label == NULL)
   4942 		report_status("NULL");
   4943 	else
   4944 		report_status(label);
   4945 }
   4946 
   4947 void
   4948 cmd_slk_noutrefresh(int nargs, char **args)
   4949 {
   4950 	ARGC(0);
   4951 
   4952 	report_count(1);
   4953 	report_return(slk_noutrefresh());
   4954 }
   4955 
   4956 void
   4957 cmd_slk_refresh(int nargs, char **args)
   4958 {
   4959 	ARGC(0);
   4960 
   4961 	report_count(1);
   4962 	report_return(slk_refresh());
   4963 }
   4964 
   4965 void
   4966 cmd_slk_restore(int nargs, char **args)
   4967 {
   4968 	ARGC(0);
   4969 
   4970 	report_count(1);
   4971 	report_return(slk_restore());
   4972 }
   4973 
   4974 void
   4975 cmd_slk_set(int nargs, char **args)
   4976 {
   4977 	ARGC(3);
   4978 	ARG_INT(0, labnum);
   4979 	ARG_STRING(1, label);
   4980 	ARG_INT(2, justify);
   4981 
   4982 	report_count(1);
   4983 	report_return(slk_set(labnum, label, justify));
   4984 }
   4985 
   4986 void
   4987 cmd_slk_touch(int nargs, char **args)
   4988 {
   4989 	ARGC(0);
   4990 
   4991 	report_count(1);
   4992 	report_return(slk_touch());
   4993 }
   4994 
   4995 void
   4996 cmd_slk_wset(int nargs, char **args)
   4997 {
   4998 	ARGC(3);
   4999 	ARG_INT(0, labnum);
   5000 	ARG_WCHAR_STRING(1, label);
   5001 	ARG_INT(2, justify);
   5002 
   5003 	report_count(1);
   5004 	report_return(slk_wset(labnum, label, justify));
   5005 }
   5006 
   5007 
   5008 void
   5009 cmd_slk_init(int nargs, char **args)
   5010 {
   5011 	ARGC(1);
   5012 	ARG_INT(0, fmt);
   5013 
   5014 	report_count(1);
   5015 	report_return(slk_init(fmt));
   5016 }
   5017 
   5018 void
   5019 cmd_use_env(int nargs, char **args)
   5020 {
   5021 	ARGC(1);
   5022 	ARG_IGNORE(0);
   5023 
   5024 	report_count(1);
   5025 	report_error("UNSUPPORTED");
   5026 }
   5027 
   5028 void
   5029 cmd_ripoffline(int nargs, char **args)
   5030 {
   5031 	ARGC(1);
   5032 	ARG_IGNORE(0);
   5033 
   5034 	report_count(1);
   5035 	report_error("UNSUPPORTED");
   5036 }
   5037 
   5038 void
   5039 cmd_filter(int nargs, char **args)
   5040 {
   5041 	ARGC(0);
   5042 
   5043 	report_count(1);
   5044 	filter();
   5045 	report_return(OK);
   5046 }
   5047