- for (ep = lookupino(i); ep != NIL; ep = next) {
- next = ep->e_links;
- ep->e_parent = (struct entry *)ep->e_parent->e_newname;
- ep->e_links = (struct entry *)ep->e_links->e_newname;
- ep->e_sibling =
- (struct entry *)ep->e_sibling->e_newname;
- ep->e_entries =
- (struct entry *)ep->e_entries->e_newname;
- fwrite((char *)ep, sizeof(struct entry), 1, fd);
+ for (ep = lookupino(i); ep != NIL; ep = ep->e_links) {
+ bcopy((char *)ep, (char *)tep,
+ (long)sizeof(struct entry));
+ tep->e_name = (char *)stroff;
+ stroff += allocsize(ep->e_namlen);
+ tep->e_parent = (struct entry *)ep->e_parent->e_index;
+ if (ep->e_links != NIL)
+ tep->e_links =
+ (struct entry *)ep->e_links->e_index;
+ if (ep->e_sibling != NIL)
+ tep->e_sibling =
+ (struct entry *)ep->e_sibling->e_index;
+ if (ep->e_entries != NIL)
+ tep->e_entries =
+ (struct entry *)ep->e_entries->e_index;
+ if (ep->e_next != NIL)
+ tep->e_next =
+ (struct entry *)ep->e_next->e_index;
+ (void) fwrite((char *)tep, sizeof(struct entry), 1, fd);