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