Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libcurses Fix a bug that prevented instr and friends ret...



details:   https://anonhg.NetBSD.org/src/rev/165369901832
branches:  trunk
changeset: 768052:165369901832
user:      blymn <blymn%NetBSD.org@localhost>
date:      Sun Aug 07 10:54:53 2011 +0000

description:
Fix a bug that prevented instr and friends returning OK.

diffstat:

 lib/libcurses/instr.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (41 lines):

diff -r 7326839a5634 -r 165369901832 lib/libcurses/instr.c
--- a/lib/libcurses/instr.c     Sun Aug 07 10:52:18 2011 +0000
+++ b/lib/libcurses/instr.c     Sun Aug 07 10:54:53 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: instr.c,v 1.3 2009/07/22 16:57:15 roy Exp $    */
+/*     $NetBSD: instr.c,v 1.4 2011/08/07 10:54:53 blymn Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: instr.c,v 1.3 2009/07/22 16:57:15 roy Exp $");
+__RCSID("$NetBSD: instr.c,v 1.4 2011/08/07 10:54:53 blymn Exp $");
 #endif                         /* not lint */
 
 #include "curses.h"
@@ -137,11 +137,12 @@
 winnstr(WINDOW *win, char *str, int n)
 {
        __LDATA *end, *start;
-       int epos;
+       int epos, sn;
 
        if (str == NULL)
                return ERR;
 
+       sn = n;
        start = &win->alines[win->cury]->line[win->curx];
        /* (n - 1) to leave room for the trailing NUL */
        if (n < 0 || (n - 1) > win->maxx - win->curx - 1) {
@@ -161,7 +162,7 @@
        }
        *str = '\0';
 
-       if (n < 0)
+       if (sn < 0)
                return OK;
        else
                return n;



Home | Main Index | Thread Index | Old Index