- byte buf[1024];
- struct oattr **last = &o->attrs;
- struct oattr *a, *la;
-
- la = NULL;
- *last = NULL;
- while (bgets(f, buf, sizeof(buf)))
- {
- if (!buf[0])
- return 1;
- a = oa_new(o, buf[0], buf+1);
- if (!la || la->attr != a->attr)
- for(la=o->attrs; la && la->attr != a->attr; la=la->next)
- ;
- if (la)
- {
- la->last_same->same = a;
- la->last_same = a;
- }
- else
- {
- *last = a;
- last = &a->next;
- la = a;
- }
- }
- return 0;
-}
-
-void
-obj_write(struct fastbuf *f, struct odes *d)
-{
- struct oattr *a, *b;
- byte *z;
-
- for(a=d->attrs; a; a=a->next)
- for(b=a; b; b=b->same)
- {
- bputc(f, a->attr);
- for(z = b->val; *z; z++)
- if (*z >= ' ')
- bputc(f, *z);
- else
- {
- bputc(f, '?');
- log(L_ERROR, "obj_dump: Found non-ASCII characters (URL might be %s)", obj_find_aval(d, 'U'));
- }
- bputc(f, '\n');
- }