/*
- * 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.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 $
*
*/
-#include <data1.h>
+#include <yaz/data1.h>
#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;
}
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, "");