- strncpy(listentry, p, sizeof(listentry));
- p = strchr(listentry, ' ');
- if (p)
- *p = '\t';
- p = strchr(listentry, ' ');
- if (p)
- *p = '\t';
- len = strlen(listentry);
- if (len < sizeof(listentry) - 2) {
- listentry[len] = '\t';
- strncpy(listentry + len + 1, skey->comment,
- sizeof(listentry) - len - 1);
- }
+ listentry = dupprintf("%s\t%s", p, skey->comment);
+ fp_len = strlen(listentry);
+ sfree(p);
+
+ pos = 0;
+ while (1) {
+ pos += strcspn(listentry + pos, " :");
+ if (listentry[pos] == ':')
+ break;
+ listentry[pos++] = '\t';
+ }
+