+void ccl_qual_buf(CCL_bibset bibset, const char *buf)
+{
+ const char *cp1 = buf;
+ char line[256];
+ while (1)
+ {
+ const char *cp2 = cp1;
+ int len;
+ while (*cp2 && !strchr("\r\n", *cp2))
+ cp2++;
+ len = cp2 - cp1;
+ if (len > 0)
+ {
+ if (len >= (sizeof(line)-1))
+ len = sizeof(line)-1;
+ memcpy(line, cp1, len);
+ line[len] = '\0';
+ ccl_qual_line(bibset, line);
+ }
+ if (!*cp2)
+ break;
+ cp1 = cp2+1;
+ }
+}
+
+void ccl_qual_line(CCL_bibset bibset, char *line)
+{
+ int no_scan = 0;
+ char qual_name[128];
+ char *cp1, *cp = line;
+
+ if (*cp == '#')
+ return; /* ignore lines starting with # */
+ if (sscanf (cp, "%100s%n", qual_name, &no_scan) < 1)
+ return; /* also ignore empty lines */
+ cp += no_scan;
+ cp1 = strchr(cp, '#');
+ if (cp1)
+ *cp1 = '\0';
+ ccl_qual_fitem (bibset, cp, qual_name);
+}
+