]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_slkattr.c
ncurses 5.6 - patch 20080308
[ncurses.git] / ncurses / base / lib_slkattr.c
index a13240324e5136c53bdbb0ed3584ad78be767ff3..da82ee5b623ec64fbbd5419092c6cb8122046003 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998 Free Software Foundation, Inc.                        *
+ * Copyright (c) 1998,2000 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            *
@@ -27,8 +27,8 @@
  ****************************************************************************/
 
 /****************************************************************************
- *  Author: Zeyd M. Ben-Halim <zmbenhal@netcom.com> 1992,1995               *
- *     and: Eric S. Raymond <esr@snark.thyrsus.com>                         *
+ *  Author:  Juergen Pfeifer, 1997                                          *
+ *     and:  Thomas E. Dickey 2005                                          *
  ****************************************************************************/
 
 /*
  */
 #include <curses.priv.h>
 
-MODULE_ID("$Id: lib_slkattr.c,v 1.3 1998/02/11 12:13:56 tom Exp $")
+MODULE_ID("$Id: lib_slkattr.c,v 1.6 2005/01/08 21:44:28 tom Exp $")
 
-attr_t
+NCURSES_EXPORT(attr_t)
 slk_attr(void)
 {
-  T((T_CALLED("slk_attr()")));
+    T((T_CALLED("slk_attr()")));
 
-  if (SP!=0 && SP->_slk!=0)
-    {
-      returnAttr(SP->_slk->attr);
-    }
-  else
-    returnAttr(0);
+    if (SP != 0 && SP->_slk != 0) {
+       attr_t result = AttrOf(SP->_slk->attr) & ALL_BUT_COLOR;
+       int pair = GetPair(SP->_slk->attr);
+
+       result |= COLOR_PAIR(pair);
+       returnAttr(result);
+    } else
+       returnAttr(0);
 }