Module Name:    src
Committed By:   rin
Date:           Sun Apr  4 09:42:08 UTC 2021

Modified Files:
        src/tests/lib/libcurses/slave: curses_commands.c
        src/tests/lib/libcurses/tests: mvscanw

Log Message:
When mvscanw(3) fails, string is not modified.
Let's ignore the 2nd result for this case.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libcurses/slave/curses_commands.c
cvs rdiff -u -r1.5 -r1.6 src/tests/lib/libcurses/tests/mvscanw

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/lib/libcurses/slave/curses_commands.c
diff -u src/tests/lib/libcurses/slave/curses_commands.c:1.23 src/tests/lib/libcurses/slave/curses_commands.c:1.24
--- src/tests/lib/libcurses/slave/curses_commands.c:1.23	Sun Apr  4 09:34:24 2021
+++ src/tests/lib/libcurses/slave/curses_commands.c	Sun Apr  4 09:42:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: curses_commands.c,v 1.23 2021/04/04 09:34:24 rin Exp $	*/
+/*	$NetBSD: curses_commands.c,v 1.24 2021/04/04 09:42:08 rin Exp $	*/
 
 /*-
  * Copyright 2009 Brett Lymn <bl...@netbsd.org>
@@ -1980,6 +1980,7 @@ cmd_mvprintw(int nargs, char **args)
 void
 cmd_mvscanw(int nargs, char **args)
 {
+	int ret;
 	char string[256];
 
 	ARGC(3);
@@ -1988,8 +1989,12 @@ cmd_mvscanw(int nargs, char **args)
 	ARG_STRING(2, fmt);	/* Must have a single "%s" in this test. */
 
 	report_count(2);
-	report_return(mvscanw(y, x, fmt, string));
-	report_status(string);
+	report_return(ret = mvscanw(y, x, fmt, string));
+	/*
+	 * When mvscanw(3) fails, string is not modified.
+	 * Let's ignore the 2nd result for this case.
+	 */
+	report_status(ret == ERR ? "ERR" : string);
 }
 
 

Index: src/tests/lib/libcurses/tests/mvscanw
diff -u src/tests/lib/libcurses/tests/mvscanw:1.5 src/tests/lib/libcurses/tests/mvscanw:1.6
--- src/tests/lib/libcurses/tests/mvscanw:1.5	Sat Oct 24 04:46:17 2020
+++ src/tests/lib/libcurses/tests/mvscanw	Sun Apr  4 09:42:08 2021
@@ -8,4 +8,4 @@ input "50 12\n"
 call2 OK "2" mvscanw 3 5 "%d"
 input "aa bb 50 12\n"
 # expect ERR because input has alpha and scanw wants integer
-call2 ERR "2" mvscanw 3 5 "%d"
+call2 ERR "ERR" mvscanw 3 5 "%d"

Reply via email to