From: keie Date: Thu, 18 Apr 1985 15:21:16 +0000 (+0000) Subject: Now using arch.h, out.h and ranlib.h from ../../h X-Git-Tag: release-5-5~5479 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=b391be598bcc80fe3c9bd1b1a4840738d86b3211;p=ack.git Now using arch.h, out.h and ranlib.h from ../../h --- diff --git a/util/led/archive.c b/util/led/archive.c index f453256e6..57e6fbdf1 100644 --- a/util/led/archive.c +++ b/util/led/archive.c @@ -2,9 +2,9 @@ static char rcsid[] = "$Header$"; #endif -#include "arch.h" -#include "out.h" -#include "ranlib.h" +#include "../../h/arch.h" +#include "../../h/out.h" +#include "../../h/ranlib.h" #include "const.h" #include "debug.h" #include "defs.h" @@ -107,7 +107,7 @@ arch() get_archive_header(&arhdr); modulname = arhdr.ar_name; debug("%s defines %s\n", modulname, string, 0, 0); - position = ran->ran_pos + SZ_ARCH; + position = ran->ran_pos + AR_SIZE; resolved = TRUE; /* * This archive member is going to be linked, @@ -170,7 +170,7 @@ arch2() get_archive_header(&arhdr); modulname = arhdr.ar_name; debug("%s: archive member\n", modulname, 0, 0, 0); - position = *pos + SZ_ARCH; + position = *pos + AR_SIZE; finish(); } localpos += sizeof(long); /* Skip ENDLIB. */ diff --git a/util/led/error.c b/util/led/error.c index 59c011e27..689dfd6e0 100644 --- a/util/led/error.c +++ b/util/led/error.c @@ -4,7 +4,7 @@ static char rcsid[] = "$Header$"; #include #include -#include "out.h" +#include "../../h/out.h" #include "const.h" static short nerrors = 0; diff --git a/util/led/extract.c b/util/led/extract.c index 1b186f3ae..ef2b83ab0 100644 --- a/util/led/extract.c +++ b/util/led/extract.c @@ -2,7 +2,7 @@ static char rcsid[] = "$Header$"; #endif -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "debug.h" #include "defs.h" diff --git a/util/led/finish.c b/util/led/finish.c index 00125f679..57db0aa2d 100644 --- a/util/led/finish.c +++ b/util/led/finish.c @@ -2,7 +2,7 @@ static char rcsid[] = "$Header$"; #endif -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "defs.h" #include "memory.h" diff --git a/util/led/main.c b/util/led/main.c index 9f47cd167..e8a334207 100644 --- a/util/led/main.c +++ b/util/led/main.c @@ -7,7 +7,7 @@ static char rcsid[] = "$Header$"; */ #include -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "debug.h" #include "defs.h" diff --git a/util/led/memory.c b/util/led/memory.c index 8069af18c..8f4f527d6 100644 --- a/util/led/memory.c +++ b/util/led/memory.c @@ -9,7 +9,7 @@ static char rcsid[] = "$Header$"; * 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 "assert.h" #include "debug.h" diff --git a/util/led/output.c b/util/led/output.c index 9547e9eb7..42fc3a376 100644 --- a/util/led/output.c +++ b/util/led/output.c @@ -2,7 +2,7 @@ static char rcsid[] = "$Header$"; #endif -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "memory.h" diff --git a/util/led/read.c b/util/led/read.c index f888a71a1..d33da712f 100644 --- a/util/led/read.c +++ b/util/led/read.c @@ -6,9 +6,9 @@ static char rcsid[] = "$Header$"; * Routines to read in the various parts of the object file. */ -#include "arch.h" -#include "out.h" -#include "ranlib.h" +#include "../../h/arch.h" +#include "../../h/out.h" +#include "../../h/ranlib.h" #include "const.h" #include "assert.h" @@ -52,19 +52,43 @@ read_head(head) fatal("bad magic number"); } -/* - * Someone inadvertently misaligned a long, thereby creating a hole. - * Therefore we can't read the header in one chunk. - */ +read1(fd, val) +char *val ; { + 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) register struct ar_hdr *arhdr; { - if (read(infile, (char *)arhdr, 14) != 14) - fatal("premature EOF"); - if (read(infile, (char *)&arhdr->ar_date, SZ_ARCH - 14) != SZ_ARCH - 14) - fatal("premature EOF"); - if (bytes_reversed || words_reversed) - swap((char *)&arhdr->ar_date, SF_ARCH); + if ( read(infile,arhdr->ar_name,sizeof arhdr->ar_name)!= + sizeof arhdr->ar_name) { + goto peof ; + } + if ( !read4(infile,&arhdr->ar_date) ) goto peof ; + 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) diff --git a/util/led/save.c b/util/led/save.c index 807c79e69..261819961 100644 --- a/util/led/save.c +++ b/util/led/save.c @@ -6,8 +6,8 @@ static char rcsid[] = "$Header$"; * If everything is kept in core, we must save some things for the second pass. */ -#include "arch.h" -#include "out.h" +#include "../../h/arch.h" +#include "../../h/out.h" #include "const.h" #include "assert.h" #include "memory.h" diff --git a/util/led/scan.c b/util/led/scan.c index 32ed1efde..c98e51e93 100644 --- a/util/led/scan.c +++ b/util/led/scan.c @@ -6,9 +6,9 @@ static char rcsid[] = "$Header$"; #include #include #endif SYMDBUG -#include "arch.h" -#include "out.h" -#include "ranlib.h" +#include "../../h/arch.h" +#include "../../h/out.h" +#include "../../h/ranlib.h" #include "const.h" #include "assert.h" #include "memory.h" diff --git a/util/led/sym.c b/util/led/sym.c index b257fba6b..335c404fd 100644 --- a/util/led/sym.c +++ b/util/led/sym.c @@ -6,7 +6,7 @@ static char rcsid[] = "$Header$"; * Symbol table management. */ -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "memory.h" diff --git a/util/led/write.c b/util/led/write.c index bb4014dcc..c73d9b66b 100644 --- a/util/led/write.c +++ b/util/led/write.c @@ -11,7 +11,7 @@ static char rcsid[] = "$Header$"; */ #include -#include "out.h" +#include "../../h/out.h" #include "const.h" #include "assert.h" #include "memory.h"