This fix make sysutils/contool and editors/textedit work again
(contool cores dump at startup, textedit when you write a few words).
 Ok ?
  Giovanni
diff -urNx CVS x11/xview/config/patches/p-libxview-textsw-txt_again_c 
mystuff/x11/xview/config/patches/p-libxview-textsw-txt_again_c
--- x11/xview/config/patches/p-libxview-textsw-txt_again_c      Mon Apr 18 
13:48:20 2005
+++ mystuff/x11/xview/config/patches/p-libxview-textsw-txt_again_c      Sat Jun 
 2 10:56:32 2007
@@ -1,7 +1,6 @@
-$OpenBSD: p-libxview-textsw-txt_again_c,v 1.3 2005/04/18 11:48:20 espie Exp $
---- lib/libxview/textsw/txt_again.c.orig       Tue Jun 29 07:17:32 1993
-+++ lib/libxview/textsw/txt_again.c    Sun Apr 17 23:59:11 2005
-@@ -28,6 +28,8 @@ Pkg_private CHAR    *STRNCPY();
+--- txt_again.c.orig   Tue Jun 29 07:17:32 1993
++++ txt_again.c        Sat Jun  2 10:55:43 2007
+@@ -28,6 +28,8 @@
  Pkg_private Es_index textsw_do_input();
  Pkg_private Es_index textsw_do_pending_delete();
  
@@ -10,7 +9,7 @@
  string_t        null_string = {0, 0, 0};
  
  #define       TEXT_DELIMITER  "\\"
-@@ -182,6 +184,7 @@ textsw_string_min_free(ptr_to_string, mi
+@@ -182,6 +184,7 @@
   * Following is stolen from 3.2ALPHA sprintf(str, fmt, va_alist) SIDE_EFFECT:
   * TXTSW_STRING_FREE(ptr_to_string) is modified by this routine.
   */
@@ -18,31 +17,23 @@
  #ifndef SVR4
  
  /* VARARGS2 */
-@@ -325,6 +328,31 @@ va_dcl
+@@ -325,6 +328,23 @@
  
  #endif /* SVR4 */
  
 +#else /* __OpenBSD__ */
-+/*inspiration taken from sprintf.c */
 +
 +static int
 +textsw_printf(register string_t *ptr_to_string, char  *fmt, ...)
-+{ 
-+    FILE            _strbuf;
-+    int             result;
-+    va_list         args;
-+    _strbuf._flags = __SWR | __SSTR;
-+    _strbuf._bf._base = _strbuf._p = (char *) 
TXTSW_STRING_FREE(ptr_to_string);
-+    _strbuf._bf._size = _strbuf._w = ptr_to_string->max_length - 
TXTSW_STRING_LENGTH(ptr_to_string);
++{
++    int result;
++    va_list args;
++
 +    VA_START(args, fmt);
-+    result = vfprintf (&_strbuf, fmt, args);
-+    va_end(args);
-+    TXTSW_STRING_FREE(ptr_to_string) = (char *) _strbuf._p;
-+#ifndef lint
-+    if (result >= 0)
-+    putc('\0', &_strbuf);
-+#endif
-+    return (result); 
++    result = vsnprintf(TXTSW_STRING_FREE(ptr_to_string), 
ptr_to_string->max_length - TXTSW_STRING_LENGTH(ptr_to_string), fmt, args);
++    if (result >=0)
++       TXTSW_STRING_FREE(ptr_to_string) += result;
++    return(result);
 +}
 +
 +#endif /* __OpenBSD__ */
@@ -50,7 +41,7 @@
  static        void
  textsw_record_buf(again, buffer, buffer_length)
      register string_t *again;
-@@ -619,6 +647,8 @@ textsw_record_trash_insert(textsw)
+@@ -619,6 +639,8 @@
   */
  /* VARARGS2 */
  
@@ -59,12 +50,11 @@
  static int
  #ifdef ANSI_FUNC_PROTO
  textsw_scanf(register string_t *ptr_to_string, register char  *fmt, ...)
-@@ -705,6 +735,38 @@ va_dcl
+@@ -705,6 +727,36 @@
  
  #endif /* OW_I18N */
  }
 +#else /* __OpenBSD__ */
-+/*inspiration/code taken from sscanf.c */
 +
 +static int
 +eofread(cookie, buf, len)
@@ -79,21 +69,20 @@
 +static int
 +textsw_scanf(register string_t *ptr_to_string, char  *fmt, ...)
 +{
-+    FILE            _strbuf;
-+    int             result;
-+    va_list         args;
-+
-+    memset(&_strbuf, 0, sizeof _strbuf);
-+    _strbuf._flags = __SRD;
-+    _strbuf._bf._base = _strbuf._p = (char *) 
TXTSW_STRING_BASE(ptr_to_string);
-+    _strbuf._bf._size = _strbuf._r = TXTSW_STRING_LENGTH(ptr_to_string);
-+    _strbuf._read = eofread;
-+    VA_START(args, fmt);
-+    result = __svfscanf(&_strbuf, fmt, args);
-+    va_end(args);
-+    TXTSW_STRING_BASE(ptr_to_string) = (char *) _strbuf._p;
-+    return (result);
-+}       
++       va_list args;
++       int result;
++       size_t len = TXTSW_STRING_LENGTH(ptr_to_string);
++       char *str = malloc(len + 1);
++       if (str == NULL)
++           return -1;
++       memcpy(str, TXTSW_STRING_BASE(ptr_to_string), len);
++       str[len] = '\0';
++       VA_START(args, fmt);
++       result = vsscanf(str, fmt, args);
++       va_end(args);
++       free(str);
++       return(result);
++}
 +#endif /* __OpenBSD__ */
  
  static int
diff -urNx CVS x11/xview/lib/Makefile mystuff/x11/xview/lib/Makefile
--- x11/xview/lib/Makefile      Sun Jan  1 21:57:03 2006
+++ mystuff/x11/xview/lib/Makefile      Sat Jun  2 10:51:10 2007
@@ -2,7 +2,7 @@
 
 COMMENT=       "OpenLook Toolkit libs, includes, and man pages"
 
-PKGNAME=       xview-lib-${XVIEW_VERSION}p1
+PKGNAME=       xview-lib-${XVIEW_VERSION}p2
 SHARED_LIBS=   olgx    3.2 \
                xview   3.2
 EXTRACT_ONLY=  

Reply via email to