From: em Date: Mon, 22 Apr 1985 15:13:24 +0000 (+0000) Subject: The reading of the input is now machine independent. X-Git-Tag: release-5-5~5475 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=a0a7a48c3b110e6823b3484822c26bdd10ccc071;p=ack.git The reading of the input is now machine independent. --- diff --git a/mach/m68k2/cv/cv.prev.c b/mach/m68k2/cv/cv.prev.c index 890874158..ba342fb9e 100644 --- a/mach/m68k2/cv/cv.prev.c +++ b/mach/m68k2/cv/cv.prev.c @@ -1,6 +1,10 @@ #include #include "out.h" +#ifndef NORCSID +static char rcs_id[] = "$Header$" ; +#endif + #define ASSERT(x) switch (2) { case 0: case (x): ; } /* @@ -12,6 +16,8 @@ struct outsect outsect[S_MAX]; char *output_file; int output_file_created; +char *program ; + main(argc, argv) int argc; char *argv[]; @@ -25,6 +31,7 @@ main(argc, argv) ASSERT(sizeof(struct outsect) == SZ_SECT); input = stdin; output = stdout; + program= argv[0] ; switch (argc) { case 1: break; case 3: if ((output = fopen(argv[2], "w")) == (FILE *)0) @@ -37,15 +44,16 @@ main(argc, argv) break; default:fatal("Usage: %s
.\n", argv[0]); } - if (fread((char *)&outhead, SZ_HEAD, 1, input) != 1) + if ( !rhead(input,&outhead) ) fatal("Reading header failed.\n"); if (BADMAGIC(outhead)) fatal("Not an ack object file.\n"); if (outhead.oh_nrelo > 0) fprintf(stderr, "Warning: relocation information present.\n"); + for ( nsect=0 ; nsect9 ) fatal("illegal out.h format string\n"); + value=0 ; + i=last ; + while ( i-- ) { + value = (value<<8) + (ni[i]&0xFF) ; + } + switch ( last ) { + case 0 : break ; + case 1 : *no= value ; break ; + case 2 : *(unsigned short *)no = value ; break ; + case 4 : *(long *)no = value ; break ; + default : + fatal("illegal out.h format string\n"); + } + ni += last ; no += last ; + } +} + /* VARARGS1 */ fatal(s, a1, a2) char *s; { + fprintf(stderr,"%s: ",program) ; fprintf(stderr, s, a1, a2); if (output_file_created) unlink(output_file);