+#if DATA1_USING_XATTR
+data1_xattr *data1_read_xattr (data1_handle dh, NMEM m,
+ int (*get_byte)(void *fh), void *fh,
+ WRBUF wrbuf, int *ch)
+{
+ data1_xattr *p_first = 0;
+ data1_xattr **pp = &p_first;
+ int c = *ch;
+ for (;;)
+ {
+ data1_xattr *p;
+ int len;
+ while (c && d1_isspace(c))
+ c = (*get_byte)(fh);
+ if (!c || c == '>' || c == '/')
+ break;
+ *pp = p = (data1_xattr *) nmem_malloc (m, sizeof(*p));
+ p->next = 0;
+ pp = &p->next;
+ p->value = 0;
+
+ wrbuf_rewind(wrbuf);
+ while (c && c != '=' && c != '>' && c != '/' && !d1_isspace(c))
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ wrbuf_putc (wrbuf, '\0');
+ len = wrbuf_len(wrbuf);
+ p->name = (char*) nmem_malloc (m, len);
+ strcpy (p->name, wrbuf_buf(wrbuf));
+ if (c == '=')
+ {
+ c = (*get_byte)(fh);
+ if (c == '"')
+ {
+ c = (*get_byte)(fh);
+ wrbuf_rewind(wrbuf);
+ while (c && c != '"')
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ if (c)
+ c = (*get_byte)(fh);
+ }
+ else
+ {
+ wrbuf_rewind(wrbuf);
+ while (c && c != '>' && c != '/')
+ {
+ wrbuf_putc (wrbuf, c);
+ c = (*get_byte)(fh);
+ }
+ }
+ wrbuf_putc (wrbuf, '\0');
+ len = wrbuf_len(wrbuf);
+ p->value = (char*) nmem_malloc (m, len);
+ strcpy (p->value, wrbuf_buf(wrbuf));
+ }
+ }
+ *ch = c;
+ return p_first;
+}
+#endif
+