- if (fullRead(arFd, arVersion, 8) <= 0) {
- errorMsg( "ar: Unexpected EOF in archive\n");
- return (FALSE);
- }
- if (strncmp(arVersion,"!<arch>",7) != 0) {
- errorMsg("ar header fails check ");
- return(FALSE);
- }
- return arFd;
-}
-
-/*
- * Step through the ar file and process it one entry at a time
- * fileList[0] is the name of the ar archive
- * fileList[1] and up are filenames to extract from the archive
- * funct contains flags to specify the actions to be performed
- */
-static int readArFile(char *fileList[16], int fileListSize, int funct)
-{
- int arFd, status, extFileFlag, i, lastOffset=0;
- ArHeader rawArHeader;
- ArInfo arEntry;
-
- /* open the ar archive */
- arFd=getArFd(fileList[0]);
-
- /* read the first header, then loop until ono more headers */
- while ((status = fullRead(arFd, (char *) &rawArHeader, AR_BLOCK_SIZE))
- == AR_BLOCK_SIZE) {
-
- /* check the header is valid, if not try reading the header
- agian with an offset of 1, needed as some ar archive end
- with a '\n' which isnt counted in specified file size */
- if ((status=processArHeader(&rawArHeader, &arEntry))==FALSE ) {
- if ((i=lseek(arFd, 0, SEEK_CUR))==(lastOffset+60))
- lseek(arFd, lastOffset+1, SEEK_SET);
- else
- return(FALSE);
- }
- else {
- extFileFlag=0;
-
- if (funct&AR_DISPLAY)
- displayEntry(&arEntry, funct);