]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/lib_slkset.c
ncurses 5.7 - patch 20090419
[ncurses.git] / ncurses / base / lib_slkset.c
index 47ef3823797d08e7ed74316601d70a20e3ae3680..fa09bbf5a5ed9501f9a5185bd28a22d453094404 100644 (file)
@@ -1,5 +1,5 @@
 /****************************************************************************
- * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc.              *
+ * Copyright (c) 1998-2007,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            *
 #include <ctype.h>
 
 #if USE_WIDEC_SUPPORT
+#if HAVE_WCTYPE_H
 #include <wctype.h>
 #endif
+#endif
 
-MODULE_ID("$Id: lib_slkset.c,v 1.15 2005/04/16 17:47:34 tom Exp $")
+MODULE_ID("$Id: lib_slkset.c,v 1.19 2009/02/21 17:34:06 tom Exp $")
 
 NCURSES_EXPORT(int)
-slk_set(int i, const char *astr, int format)
+NCURSES_SP_NAME(slk_set) (NCURSES_SP_DCLx int i, const char *astr, int format)
 {
-    SLK *slk = SP->_slk;
+    SLK *slk;
     int offset;
     int numchrs;
     int numcols;
@@ -55,15 +57,20 @@ slk_set(int i, const char *astr, int format)
     const char *str = astr;
     const char *p;
 
-    T((T_CALLED("slk_set(%d, \"%s\", %d)"), i, str, format));
+    T((T_CALLED("slk_set(%p, %d, \"%s\", %d)"), SP_PARM, i, str, format));
 
-    if (slk == NULL || i < 1 || i > slk->labcnt || format < 0 || format > 2)
+    if (SP_PARM == 0
+       || (slk = SP_PARM->_slk) == 0
+       || i < 1
+       || i > slk->labcnt
+       || format < 0
+       || format > 2)
        returnCode(ERR);
-    if (str == NULL)
+    if (str == 0)
        str = "";
     --i;                       /* Adjust numbering of labels */
 
-    limit = MAX_SKEY_LEN(SP->slk_format);
+    limit = MAX_SKEY_LEN(SP_PARM->slk_format);
     while (isspace(UChar(*str)))
        str++;                  /* skip over leading spaces  */
     p = str;
@@ -140,3 +147,11 @@ slk_set(int i, const char *astr, int format)
     slk->ent[i].dirty = TRUE;
     returnCode(OK);
 }
+
+#if NCURSES_SP_FUNCS
+NCURSES_EXPORT(int)
+slk_set(int i, const char *astr, int format)
+{
+    return NCURSES_SP_NAME(slk_set) (CURRENT_SCREEN, i, astr, format);
+}
+#endif