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