Module Name: src
Committed By: blymn
Date: Sun Aug 7 10:54:53 UTC 2011
Modified Files:
src/lib/libcurses: instr.c
Log Message:
Fix a bug that prevented instr and friends returning OK.
To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/libcurses/instr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libcurses/instr.c
diff -u src/lib/libcurses/instr.c:1.3 src/lib/libcurses/instr.c:1.4
--- src/lib/libcurses/instr.c:1.3 Wed Jul 22 16:57:15 2009
+++ src/lib/libcurses/instr.c Sun Aug 7 10:54:53 2011
@@ -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;