Now using arch.h, out.h and ranlib.h from ../../h
This commit is contained in:
parent
d0e857ddb2
commit
b391be598b
12 changed files with 55 additions and 31 deletions
|
@ -2,9 +2,9 @@
|
||||||
static char rcsid[] = "$Header$";
|
static char rcsid[] = "$Header$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "arch.h"
|
#include "../../h/arch.h"
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "ranlib.h"
|
#include "../../h/ranlib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -107,7 +107,7 @@ arch()
|
||||||
get_archive_header(&arhdr);
|
get_archive_header(&arhdr);
|
||||||
modulname = arhdr.ar_name;
|
modulname = arhdr.ar_name;
|
||||||
debug("%s defines %s\n", modulname, string, 0, 0);
|
debug("%s defines %s\n", modulname, string, 0, 0);
|
||||||
position = ran->ran_pos + SZ_ARCH;
|
position = ran->ran_pos + AR_SIZE;
|
||||||
resolved = TRUE;
|
resolved = TRUE;
|
||||||
/*
|
/*
|
||||||
* This archive member is going to be linked,
|
* This archive member is going to be linked,
|
||||||
|
@ -170,7 +170,7 @@ arch2()
|
||||||
get_archive_header(&arhdr);
|
get_archive_header(&arhdr);
|
||||||
modulname = arhdr.ar_name;
|
modulname = arhdr.ar_name;
|
||||||
debug("%s: archive member\n", modulname, 0, 0, 0);
|
debug("%s: archive member\n", modulname, 0, 0, 0);
|
||||||
position = *pos + SZ_ARCH;
|
position = *pos + AR_SIZE;
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
localpos += sizeof(long); /* Skip ENDLIB. */
|
localpos += sizeof(long); /* Skip ENDLIB. */
|
||||||
|
|
|
@ -4,7 +4,7 @@ static char rcsid[] = "$Header$";
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
|
|
||||||
static short nerrors = 0;
|
static short nerrors = 0;
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
static char rcsid[] = "$Header$";
|
static char rcsid[] = "$Header$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
static char rcsid[] = "$Header$";
|
static char rcsid[] = "$Header$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
|
@ -7,7 +7,7 @@ static char rcsid[] = "$Header$";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
|
|
@ -9,7 +9,7 @@ static char rcsid[] = "$Header$";
|
||||||
* is done and pieces after the one that requested the growth are moved up.
|
* is done and pieces after the one that requested the growth are moved up.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
static char rcsid[] = "$Header$";
|
static char rcsid[] = "$Header$";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
|
|
@ -6,9 +6,9 @@ static char rcsid[] = "$Header$";
|
||||||
* Routines to read in the various parts of the object file.
|
* Routines to read in the various parts of the object file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "arch.h"
|
#include "../../h/arch.h"
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "ranlib.h"
|
#include "../../h/ranlib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
|
|
||||||
|
@ -52,19 +52,43 @@ read_head(head)
|
||||||
fatal("bad magic number");
|
fatal("bad magic number");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
read1(fd, val)
|
||||||
* Someone inadvertently misaligned a long, thereby creating a hole.
|
char *val ; {
|
||||||
* Therefore we can't read the header in one chunk.
|
if ( read(fd, val, 1)!=1 ) return 0 ;
|
||||||
*/
|
return 1 ;
|
||||||
|
}
|
||||||
|
read2(fd, val)
|
||||||
|
int *val ; {
|
||||||
|
char rch[2] ;
|
||||||
|
if ( read(fd, rch, 2)!=2 ) return 0 ;
|
||||||
|
*val= (rch[0]&0377) + ((rch[1]&0377)<<8) ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
read4(fd, val)
|
||||||
|
long *val ; {
|
||||||
|
int v1,v2 ;
|
||||||
|
if ( !read2(fd, &v1) ) return 0 ;
|
||||||
|
if ( !read2(fd, &v2) ) return 0 ;
|
||||||
|
*val = ((long)v1<<16) + (unsigned)v2 ;
|
||||||
|
return 1 ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
read_arhdr(arhdr)
|
read_arhdr(arhdr)
|
||||||
register struct ar_hdr *arhdr;
|
register struct ar_hdr *arhdr;
|
||||||
{
|
{
|
||||||
if (read(infile, (char *)arhdr, 14) != 14)
|
if ( read(infile,arhdr->ar_name,sizeof arhdr->ar_name)!=
|
||||||
fatal("premature EOF");
|
sizeof arhdr->ar_name) {
|
||||||
if (read(infile, (char *)&arhdr->ar_date, SZ_ARCH - 14) != SZ_ARCH - 14)
|
goto peof ;
|
||||||
fatal("premature EOF");
|
}
|
||||||
if (bytes_reversed || words_reversed)
|
if ( !read4(infile,&arhdr->ar_date) ) goto peof ;
|
||||||
swap((char *)&arhdr->ar_date, SF_ARCH);
|
if ( !read1(infile,&arhdr->ar_uid) ) goto peof ;
|
||||||
|
if ( !read1(infile,&arhdr->ar_gid) ) goto peof ;
|
||||||
|
if ( !read2(infile,&arhdr->ar_mode) ) goto peof ;
|
||||||
|
if ( !read4(infile,&arhdr->ar_size) ) goto peof ;
|
||||||
|
return ;
|
||||||
|
peof:
|
||||||
|
fatal("Prematute EOF") ;
|
||||||
}
|
}
|
||||||
|
|
||||||
read_table(ran, cnt)
|
read_table(ran, cnt)
|
||||||
|
|
|
@ -6,8 +6,8 @@ static char rcsid[] = "$Header$";
|
||||||
* If everything is kept in core, we must save some things for the second pass.
|
* If everything is kept in core, we must save some things for the second pass.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "arch.h"
|
#include "../../h/arch.h"
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
|
@ -6,9 +6,9 @@ static char rcsid[] = "$Header$";
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#endif SYMDBUG
|
#endif SYMDBUG
|
||||||
#include "arch.h"
|
#include "../../h/arch.h"
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "ranlib.h"
|
#include "../../h/ranlib.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
|
@ -6,7 +6,7 @@ static char rcsid[] = "$Header$";
|
||||||
* Symbol table management.
|
* Symbol table management.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ static char rcsid[] = "$Header$";
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "out.h"
|
#include "../../h/out.h"
|
||||||
#include "const.h"
|
#include "const.h"
|
||||||
#include "assert.h"
|
#include "assert.h"
|
||||||
#include "memory.h"
|
#include "memory.h"
|
||||||
|
|
Loading…
Reference in a new issue