-void
-extract_mangle(head)
-union record *head;
-{
- char *buf;
- char *fromtape;
- char *to;
- char *ptr,*ptrend;
- char *nam1,*nam1end;
- int size;
- int copied;
-
- size=hstat.st_size;
- buf=to=ck_malloc(size+1);
- buf[size]='\0';
- while(size>0) {
- fromtape=findrec()->charptr;
- if(fromtape==0) {
- msg("Unexpected EOF in mangled names!");
- return;
- }
- copied=endofrecs()->charptr-fromtape;
- if(copied>size)
- copied=size;
- bcopy(fromtape,to,copied);
- to+=copied;
- size-=copied;
- userec((union record *)(fromtape+copied-1));
+ if (!block)
+ {
+ ERROR ((0, 0, _("Unexpected EOF in mangled names")));
+ return;
+ }
+ available = available_space_after (block);
+ if (available > size)
+ available = size;
+ memcpy (copy, block->buffer, available);
+ copy += available;
+ size -= available;
+ set_next_block_after ((union block *) (block->buffer + available - 1));
+ }
+
+ while (*cursor)
+ {
+ char *next_cursor;
+ char *name;
+ char *name_end;
+
+ next_cursor = strchr (cursor, '\n');
+ *next_cursor++ = '\0';
+
+ if (!strncmp (cursor, "Rename ", 7))
+ {
+
+ name = cursor + 7;
+ name_end = strchr (name, ' ');
+ while (strncmp (name_end, " to ", 4))
+ {
+ name_end++;
+ name_end = strchr (name_end, ' ');
+ }
+ *name_end = '\0';
+ if (next_cursor[-2] == '/')
+ next_cursor[-2] = '\0';
+ unquote_string (name_end + 4);
+ if (rename (name, name_end + 4))
+ ERROR ((0, errno, _("Cannot rename %s to %s"), name, name_end + 4));
+ else if (verbose_option)
+ WARN ((0, 0, _("Renamed %s to %s"), name, name_end + 4));