data1 cleanup
[yaz-moved-to-github.git] / retrieval / d1_sutrs.c
index 7cf3e1f..2117408 100644 (file)
@@ -1,27 +1,9 @@
 /*
- * Copyright (c) 1995-1997, Index Data.
+ * Copyright (c) 1995-2002, Index Data.
  * See the file LICENSE for details.
  * Sebastian Hammer, Adam Dickmeiss
  *
- * $Log: d1_sutrs.c,v $
- * 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
- * Minor adjustments
- *
- * Revision 1.1  1995/11/01  11:56:09  quinn
- * Added Retrieval (data management) functions en masse.
- *
+ * $Id: d1_sutrs.c,v 1.7 2002-05-03 13:48:27 adam Exp $
  *
  */
 
 #define NTOBUF_INDENT   2
 #define NTOBUF_MARGIN 75
 
-static int wordlen(char *b)
+static int wordlen(char *b, int i)
 {
     int l = 0;
 
-    while (*b && !d1_isspace(*b))
-       l++, b++;
+    while (i && !d1_isspace(*b))
+       l++, b++, i--;
     return l;
 }
 
@@ -92,7 +74,7 @@ static int nodetobuf(data1_node *n, int select, WRBUF b, int indent, int col)
                    if (!l)
                        break;
                    /* break if we'll cross margin and word is not too long */
-                   if (col + (wlen = wordlen(p)) > NTOBUF_MARGIN && wlen <
+                   if (col + (wlen = wordlen(p, l)) > NTOBUF_MARGIN && wlen <
                        NTOBUF_MARGIN - indent * NTOBUF_INDENT)
                    {
                        sprintf(line, "\n%*s", indent * NTOBUF_INDENT, "");