Wed Sep 19 11:51:08 2012 UTC ()
* Fix mvscanw return
* Fix the *vline family of calls, one argument is chtype not int


(blymn)
diff -r1.6 -r1.7 src/tests/lib/libcurses/slave/curses_commands.c

cvs diff -r1.6 -r1.7 src/tests/lib/libcurses/slave/curses_commands.c (expand / switch to unified diff)

--- src/tests/lib/libcurses/slave/curses_commands.c 2011/09/15 11:46:19 1.6
+++ src/tests/lib/libcurses/slave/curses_commands.c 2012/09/19 11:51:08 1.7
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: curses_commands.c,v 1.6 2011/09/15 11:46:19 blymn Exp $ */ 1/* $NetBSD: curses_commands.c,v 1.7 2012/09/19 11:51:08 blymn Exp $ */
2 2
3/*- 3/*-
4 * Copyright 2009 Brett Lymn <blymn@NetBSD.org> 4 * Copyright 2009 Brett Lymn <blymn@NetBSD.org>
5 * 5 *
6 * All rights reserved. 6 * All rights reserved.
7 * 7 *
8 * This code has been donated to The NetBSD Foundation by the Author. 8 * This code has been donated to The NetBSD Foundation by the Author.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -2995,57 +2995,54 @@ cmd_mvderwin(int nargs, char **args) @@ -2995,57 +2995,54 @@ cmd_mvderwin(int nargs, char **args)
2995 report_count(1); 2995 report_count(1);
2996 report_error("BAD ARGUMENT"); 2996 report_error("BAD ARGUMENT");
2997 return; 2997 return;
2998 } 2998 }
2999 2999
3000 report_count(1); 3000 report_count(1);
3001 report_return(mvderwin(win, y, x)); 3001 report_return(mvderwin(win, y, x));
3002} 3002}
3003 3003
3004 3004
3005void 3005void
3006cmd_mvhline(int nargs, char **args) 3006cmd_mvhline(int nargs, char **args)
3007{ 3007{
3008 int y, x, ch, n; 3008 int y, x, n;
 3009 chtype *ch;
3009 3010
3010 if (check_arg_count(nargs, 4) == 1) 3011 if (check_arg_count(nargs, 4) == 1)
3011 return; 3012 return;
3012 3013
3013 if (sscanf(args[0], "%d", &y) == 0) { 3014 if (sscanf(args[0], "%d", &y) == 0) {
3014 report_count(1); 3015 report_count(1);
3015 report_error("BAD ARGUMENT"); 3016 report_error("BAD ARGUMENT");
3016 return; 3017 return;
3017 } 3018 }
3018 3019
3019 if (sscanf(args[1], "%d", &x) == 0) { 3020 if (sscanf(args[1], "%d", &x) == 0) {
3020 report_count(1); 3021 report_count(1);
3021 report_error("BAD ARGUMENT"); 3022 report_error("BAD ARGUMENT");
3022 return; 3023 return;
3023 } 3024 }
3024 3025
3025 if (sscanf(args[2], "%d", &ch) == 0) { 3026 ch = (chtype *) args[2];
3026 report_count(1); 
3027 report_error("BAD ARGUMENT"); 
3028 return; 
3029 } 
3030 3027
3031 if (sscanf(args[3], "%d", &n) == 0) { 3028 if (sscanf(args[3], "%d", &n) == 0) {
3032 report_count(1); 3029 report_count(1);
3033 report_error("BAD ARGUMENT"); 3030 report_error("BAD ARGUMENT");
3034 return; 3031 return;
3035 } 3032 }
3036 3033
3037 report_count(1); 3034 report_count(1);
3038 report_return(mvhline(y, x, ch, n)); 3035 report_return(mvhline(y, x, ch[0], n));
3039} 3036}
3040 3037
3041 3038
3042void 3039void
3043cmd_mvprintw(int nargs, char **args) 3040cmd_mvprintw(int nargs, char **args)
3044{ 3041{
3045 int y, x; 3042 int y, x;
3046 3043
3047 if (check_arg_count(nargs, 4) == 1) 3044 if (check_arg_count(nargs, 4) == 1)
3048 return; 3045 return;
3049 3046
3050 if (sscanf(args[0], "%d", &y) == 0) { 3047 if (sscanf(args[0], "%d", &y) == 0) {
3051 report_count(1); 3048 report_count(1);
@@ -3077,65 +3074,62 @@ cmd_mvscanw(int nargs, char **args) @@ -3077,65 +3074,62 @@ cmd_mvscanw(int nargs, char **args)
3077 report_count(1); 3074 report_count(1);
3078 report_error("BAD ARGUMENT"); 3075 report_error("BAD ARGUMENT");
3079 return; 3076 return;
3080 } 3077 }
3081 3078
3082 if (sscanf(args[1], "%d", &x) == 0) { 3079 if (sscanf(args[1], "%d", &x) == 0) {
3083 report_count(1); 3080 report_count(1);
3084 report_error("BAD ARGUMENT"); 3081 report_error("BAD ARGUMENT");
3085 return; 3082 return;
3086 } 3083 }
3087 3084
3088 /* XXX - call2 */ 3085 /* XXX - call2 */
3089 report_count(2); 3086 report_count(2);
3090 report_int(mvscanw(y, x, args[2], &string)); 3087 report_return(mvscanw(y, x, args[2], &string));
3091 report_status(string); 3088 report_status(string);
3092} 3089}
3093 3090
3094 3091
3095void 3092void
3096cmd_mvvline(int nargs, char **args) 3093cmd_mvvline(int nargs, char **args)
3097{ 3094{
3098 int y, x, ch, n; 3095 int y, x, n;
 3096 chtype *ch;
3099 3097
3100 if (check_arg_count(nargs, 4) == 1) 3098 if (check_arg_count(nargs, 4) == 1)
3101 return; 3099 return;
3102 3100
3103 if (sscanf(args[0], "%d", &y) == 0) { 3101 if (sscanf(args[0], "%d", &y) == 0) {
3104 report_count(1); 3102 report_count(1);
3105 report_error("BAD ARGUMENT"); 3103 report_error("BAD ARGUMENT");
3106 return; 3104 return;
3107 } 3105 }
3108 3106
3109 if (sscanf(args[1], "%d", &x) == 0) { 3107 if (sscanf(args[1], "%d", &x) == 0) {
3110 report_count(1); 3108 report_count(1);
3111 report_error("BAD ARGUMENT"); 3109 report_error("BAD ARGUMENT");
3112 return; 3110 return;
3113 } 3111 }
3114 3112
3115 if (sscanf(args[2], "%d", &ch) == 0) { 3113 ch = (chtype *) args[2];
3116 report_count(1); 
3117 report_error("BAD ARGUMENT"); 
3118 return; 
3119 } 
3120 3114
3121 if (sscanf(args[3], "%d", &n) == 0) { 3115 if (sscanf(args[3], "%d", &n) == 0) {
3122 report_count(1); 3116 report_count(1);
3123 report_error("BAD ARGUMENT"); 3117 report_error("BAD ARGUMENT");
3124 return; 3118 return;
3125 } 3119 }
3126 3120
3127 report_count(1); 3121 report_count(1);
3128 report_return(mvvline(y, x, ch, n)); 3122 report_return(mvvline(y, x, ch[0], n));
3129} 3123}
3130 3124
3131 3125
3132void 3126void
3133cmd_mvwhline(int nargs, char **args) 3127cmd_mvwhline(int nargs, char **args)
3134{ 3128{
3135 int y, x, ch, n; 3129 int y, x, ch, n;
3136 WINDOW *win; 3130 WINDOW *win;
3137 3131
3138 if (check_arg_count(nargs, 5) == 1) 3132 if (check_arg_count(nargs, 5) == 1)
3139 return; 3133 return;
3140 3134
3141 if (sscanf(args[0], "%p", &win) == 0) { 3135 if (sscanf(args[0], "%p", &win) == 0) {
@@ -3166,64 +3160,61 @@ cmd_mvwhline(int nargs, char **args) @@ -3166,64 +3160,61 @@ cmd_mvwhline(int nargs, char **args)
3166 report_count(1); 3160 report_count(1);
3167 report_error("BAD ARGUMENT"); 3161 report_error("BAD ARGUMENT");
3168 return; 3162 return;
3169 } 3163 }
3170 3164
3171 report_count(1); 3165 report_count(1);
3172 report_return(mvwhline(win, y, x, ch, n)); 3166 report_return(mvwhline(win, y, x, ch, n));
3173} 3167}
3174 3168
3175 3169
3176void 3170void
3177cmd_mvwvline(int nargs, char **args) 3171cmd_mvwvline(int nargs, char **args)
3178{ 3172{
3179 int y, x, ch, n; 3173 int y, x, n;
3180 WINDOW *win; 3174 WINDOW *win;
 3175 chtype *ch;
3181 3176
3182 if (check_arg_count(nargs, 5) == 1) 3177 if (check_arg_count(nargs, 5) == 1)
3183 return; 3178 return;
3184 3179
3185 if (sscanf(args[0], "%p", &win) == 0) { 3180 if (sscanf(args[0], "%p", &win) == 0) {
3186 report_count(1); 3181 report_count(1);
3187 report_error("BAD ARGUMENT"); 3182 report_error("BAD ARGUMENT");
3188 return; 3183 return;
3189 } 3184 }
3190 3185
3191 if (sscanf(args[1], "%d", &y) == 0) { 3186 if (sscanf(args[1], "%d", &y) == 0) {
3192 report_count(1); 3187 report_count(1);
3193 report_error("BAD ARGUMENT"); 3188 report_error("BAD ARGUMENT");
3194 return; 3189 return;
3195 } 3190 }
3196 3191
3197 if (sscanf(args[2], "%d", &x) == 0) { 3192 if (sscanf(args[2], "%d", &x) == 0) {
3198 report_count(1); 3193 report_count(1);
3199 report_error("BAD ARGUMENT"); 3194 report_error("BAD ARGUMENT");
3200 return; 3195 return;
3201 } 3196 }
3202 3197
3203 if (sscanf(args[3], "%d", &ch) == 0) { 3198 ch = (chtype *) args[3];
3204 report_count(1); 
3205 report_error("BAD ARGUMENT"); 
3206 return; 
3207 } 
3208 3199
3209 if (sscanf(args[4], "%d", &n) == 0) { 3200 if (sscanf(args[4], "%d", &n) == 0) {
3210 report_count(1); 3201 report_count(1);
3211 report_error("BAD ARGUMENT"); 3202 report_error("BAD ARGUMENT");
3212 return; 3203 return;
3213 } 3204 }
3214 3205
3215 report_count(1); 3206 report_count(1);
3216 report_return(mvwvline(win, y, x, ch, n)); 3207 report_return(mvwvline(win, y, x, ch[0], n));
3217} 3208}
3218 3209
3219 3210
3220void 3211void
3221cmd_mvwin(int nargs, char **args) 3212cmd_mvwin(int nargs, char **args)
3222{ 3213{
3223 int y, x; 3214 int y, x;
3224 WINDOW *win; 3215 WINDOW *win;
3225 3216
3226 if (check_arg_count(nargs, 3) == 1) 3217 if (check_arg_count(nargs, 3) == 1)
3227 return; 3218 return;
3228 3219
3229 if (sscanf(args[0], "%p", &win) == 0) { 3220 if (sscanf(args[0], "%p", &win) == 0) {
@@ -4411,45 +4402,42 @@ void @@ -4411,45 +4402,42 @@ void
4411cmd_use_default_colors(int nargs, char **args) 4402cmd_use_default_colors(int nargs, char **args)
4412{ 4403{
4413 if (check_arg_count(nargs, 0) == 1) 4404 if (check_arg_count(nargs, 0) == 1)
4414 return; 4405 return;
4415 4406
4416 report_count(1); 4407 report_count(1);
4417 report_return(use_default_colors()); 4408 report_return(use_default_colors());
4418} 4409}
4419 4410
4420 4411
4421void 4412void
4422cmd_vline(int nargs, char **args) 4413cmd_vline(int nargs, char **args)
4423{ 4414{
4424 int ch, count; 4415 int count;
 4416 chtype *ch;
4425 4417
4426 if (check_arg_count(nargs, 2) == 1) 4418 if (check_arg_count(nargs, 2) == 1)
4427 return; 4419 return;
4428 4420
4429 if (sscanf(args[0], "%d", &ch) == 0) { 4421 ch = (chtype *) args[0];
4430 report_count(1); 
4431 report_error("BAD ARGUMENT"); 
4432 return; 
4433 } 
4434 4422
4435 if (sscanf(args[1], "%d", &count) == 0) { 4423 if (sscanf(args[1], "%d", &count) == 0) {
4436 report_count(1); 4424 report_count(1);
4437 report_error("BAD ARGUMENT"); 4425 report_error("BAD ARGUMENT");
4438 return; 4426 return;
4439 } 4427 }
4440 4428
4441 report_count(1); 4429 report_count(1);
4442 report_return(vline(ch, count)); 4430 report_return(vline(ch[0], count));
4443} 4431}
4444 4432
4445 4433
4446static int 4434static int
4447internal_vw_printw(WINDOW *win, char *arg1, ...) 4435internal_vw_printw(WINDOW *win, char *arg1, ...)
4448{ 4436{
4449 va_list va; 4437 va_list va;
4450 int rv; 4438 int rv;
4451 4439
4452 va_start(va, arg1); 4440 va_start(va, arg1);
4453 rv = vw_printw(win, arg1, va); 4441 rv = vw_printw(win, arg1, va);
4454 va_end(va); 4442 va_end(va);
4455 4443
@@ -5752,51 +5740,48 @@ cmd_wunderscore(int nargs, char **args) @@ -5752,51 +5740,48 @@ cmd_wunderscore(int nargs, char **args)
5752 report_error("BAD ARGUMENT"); 5740 report_error("BAD ARGUMENT");
5753 return; 5741 return;
5754 } 5742 }
5755 5743
5756 report_count(1); 5744 report_count(1);
5757 report_return(wunderscore(win)); 5745 report_return(wunderscore(win));
5758} 5746}
5759 5747
5760 5748
5761void 5749void
5762cmd_wvline(int nargs, char **args) 5750cmd_wvline(int nargs, char **args)
5763{ 5751{
5764 WINDOW *win; 5752 WINDOW *win;
5765 int ch, n; 5753 int n;
 5754 chtype *ch;
5766 5755
5767 if (check_arg_count(nargs, 3) == 1) 5756 if (check_arg_count(nargs, 3) == 1)
5768 return; 5757 return;
5769 5758
5770 if (sscanf(args[0], "%p", &win) == 0) { 5759 if (sscanf(args[0], "%p", &win) == 0) {
5771 report_count(1); 5760 report_count(1);
5772 report_error("BAD ARGUMENT"); 5761 report_error("BAD ARGUMENT");
5773 return; 5762 return;
5774 } 5763 }
5775 5764
5776 if (sscanf(args[1], "%d", &ch) == 0) { 5765 ch = (chtype *) args[1];
5777 report_count(1); 
5778 report_error("BAD ARGUMENT"); 
5779 return; 
5780 } 
5781 5766
5782 if (sscanf(args[2], "%d", &n) == 0) { 5767 if (sscanf(args[2], "%d", &n) == 0) {
5783 report_count(1); 5768 report_count(1);
5784 report_error("BAD ARGUMENT"); 5769 report_error("BAD ARGUMENT");
5785 return; 5770 return;
5786 } 5771 }
5787 5772
5788 report_count(1); 5773 report_count(1);
5789 report_return(wvline(win, ch, n)); 5774 report_return(wvline(win, ch[0], n));
5790} 5775}
5791 5776
5792 5777
5793void 5778void
5794cmd_insnstr(int nargs, char **args) 5779cmd_insnstr(int nargs, char **args)
5795{ 5780{
5796 int n; 5781 int n;
5797 5782
5798 if (check_arg_count(nargs, 2) == 1) 5783 if (check_arg_count(nargs, 2) == 1)
5799 return; 5784 return;
5800 5785
5801 if (sscanf(args[1], "%d", &n) == 0) { 5786 if (sscanf(args[1], "%d", &n) == 0) {
5802 report_count(1); 5787 report_count(1);