+int yaz_marc_write_check(yaz_marc_t mt, WRBUF wr)
+{
+ struct yaz_marc_node *n;
+ int identifier_length;
+ const char *leader = 0;
+
+ for (n = mt->nodes; n; n = n->next)
+ if (n->which == YAZ_MARC_LEADER)
+ {
+ leader = n->u.leader;
+ break;
+ }
+
+ if (!leader)
+ return -1;
+ if (!atoi_n_check(leader+11, 1, &identifier_length))
+ return -1;
+
+ for (n = mt->nodes; n; n = n->next)
+ {
+ switch(n->which)
+ {
+ case YAZ_MARC_COMMENT:
+ wrbuf_iconv_write(wr, mt->iconv_cd,
+ n->u.comment, strlen(n->u.comment));
+ wrbuf_puts(wr, ")\n");
+ break;
+ default:
+ break;
+ }
+ }
+ return 0;
+}
+
+