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