]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_inchstr.c
ncurses 5.7 - patch 20100424
[ncurses.git] / ncurses / base / lib_inchstr.c
index 4779ae09d75bc5a0abb09490dd41b30d0ff47909..884ea51fdb3bc8f0d4a21e825b464b6041b657d8 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright (c) 1998-2001,2009 Free Software Foundation, Inc.              *
  *                                                                          *
  * Permission is hereby granted, free of charge, to any person obtaining a  *
  * copy of this software and associated documentation files (the            *
@@ -31,7 +31,6 @@
  *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
  ****************************************************************************/
 
-
 /*
 **     lib_inchstr.c
 **
 
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_inchstr.c,v 1.7 1998/02/11 12:13:55 tom Exp $")
+MODULE_ID("$Id: lib_inchstr.c,v 1.11 2009/10/24 22:49:33 tom Exp $")
 
-int winchnstr(WINDOW *win, chtype *str, int n)
+NCURSES_EXPORT(int)
+winchnstr(WINDOW *win, chtype *str, int n)
 {
-       int     i = 0;
+    int i = 0;
 
-       T((T_CALLED("winchnstr(%p,%p,%d)"), win, str, n));
+    T((T_CALLED("winchnstr(%p,%p,%d)"), (void *) win, (void *) str, n));
 
-       if (!str)
-         returnCode(0);
+    if (!str)
+       returnCode(0);
 
-       if (win) {
-         for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++)
-           str[i] = win->_line[win->_cury].text[win->_curx + i];
-       }
-       str[i] = (chtype)0;
+    if (win) {
+       for (; (n < 0 || (i < n)) && (win->_curx + i <= win->_maxx); i++)
+           str[i] =
+               CharOf(win->_line[win->_cury].text[win->_curx + i]) |
+               AttrOf(win->_line[win->_cury].text[win->_curx + i]);
+    }
+    str[i] = (chtype) 0;
 
-       returnCode(i);
+    returnCode(i);
 }