-static int readTarHeader(int srcFd, headerL_t *current)
-{
- rawTarHeader_t rawTarHeader;
- unsigned char *temp = (unsigned char *) &rawTarHeader;
- long sum = 0;
- int i;
- off_t initialOffset;
-
- initialOffset = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, (char *) &rawTarHeader, 512) != 512) {
- lseek(srcFd, initialOffset, SEEK_SET);
- return(FALSE);
- }
- for (i = 0; i < 148 ; i++)
- sum += temp[i];
- sum += ' ' * 8;
- for (i = 156; i < 512 ; i++)
- sum += temp[i];
- if (sum!= strtol(rawTarHeader.chksum, NULL, 8))
- return(FALSE);
- sscanf(rawTarHeader.name, "%s", current->name);
- current->size = strtol(rawTarHeader.size, NULL, 8);
- current->uid = strtol(rawTarHeader.uid, NULL, 8);
- current->gid = strtol(rawTarHeader.gid, NULL, 8);
- current->mode = strtol(rawTarHeader.mode, NULL, 8);
- current->mtime = strtol(rawTarHeader.mtime, NULL, 8);
- current->offset = lseek(srcFd, 0 , SEEK_CUR);
-
- current->next = (headerL_t *) xmalloc(sizeof(headerL_t));
- current = current->next;
- return(TRUE);
-}
-#endif
-
-/*
- * identify Ar header (magic) and reset srcFd to entry position
- */
-static int checkArMagic(int srcFd)
-{
- off_t headerStart;
- char arMagic[8];
-
- headerStart = lseek(srcFd, 0, SEEK_CUR);
- if (fullRead(srcFd, arMagic, 8) != 8) {
- errorMsg("fatal error\n");
- return (FALSE);
- }
- lseek(srcFd, headerStart, SEEK_SET);
-
- if (strncmp(arMagic,"!<arch>",7) != 0)
- return(FALSE);
- return(TRUE);
-}
-
-/*
- * get, check and correct the converted header
- */
-static int readArEntry(int srcFd, headerL_t *entry)