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