Improved installation. Moved header files to include/yaz.
[yaz-moved-to-github.git] / retrieval / d1_sutrs.c
index 2a56f26..7cf3e1f 100644 (file)
@@ -1,10 +1,19 @@
 /*
- * Copyright (c) 1995, Index Data.
+ * Copyright (c) 1995-1997, Index Data.
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: d1_sutrs.c,v $
- * Revision 1.3  1995-12-15 16:57:11  quinn
+ * Revision 1.6  1999-11-30 13:47:12  adam
+ * Improved installation. Moved header files to include/yaz.
+ *
+ * Revision 1.5  1999/10/21 12:06:29  adam
+ * Retrieval module no longer uses ctype.h - functions.
+ *
+ * Revision 1.4  1997/09/17 12:10:38  adam
+ * YAZ version 1.4.
+ *
+ * Revision 1.3  1995/12/15 16:57:11  quinn
  * Added formatted-text.
  *
  * Revision 1.2  1995/11/01  13:54:49  quinn
  *
  */
 
-#include <ctype.h>
-
-#include <wrbuf.h>
-
-#include <data1.h>
+#include <yaz/data1.h>
 
 #define NTOBUF_INDENT   2
 #define NTOBUF_MARGIN 75
@@ -29,7 +34,7 @@ static int wordlen(char *b)
 {
     int l = 0;
 
-    while (*b && !isspace(*b))
+    while (*b && !d1_isspace(*b))
        l++, b++;
     return l;
 }
@@ -82,7 +87,7 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
                {
                    int wlen;
 
-                   while (l && isspace(*p))
+                   while (l && d1_isspace(*p))
                        p++, l--;
                    if (!l)
                        break;
@@ -100,7 +105,7 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
                        wrbuf_putc(b, ' ');
                        col++;
                    }
-                   while (l && !isspace(*p))
+                   while (l && !d1_isspace(*p))
                    {
                        if (col > NTOBUF_MARGIN)
                        {
@@ -134,14 +139,11 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
  * need changing.
  */
 
-char *data1_nodetobuf(data1_node *n, int select, int *len)
+char *data1_nodetobuf (data1_handle dh, data1_node *n, int select, int *len)
 {
-    static WRBUF b = 0;
+    WRBUF b = data1_get_wrbuf (dh);
 
-    if (!b)
-       b = wrbuf_alloc();
-    else
-       wrbuf_rewind(b);
+    wrbuf_rewind(b);
     if (nodetobuf(n, select, b, 0, 0))
        return 0;
     wrbuf_putc(b, '\n');