- register st, sd;
-
- dseek(&text, loc, sizeof filhdr);
- mget((int *)&filhdr, sizeof filhdr);
- if (filhdr.fmagic != FMAGIC)
- error(2, "Bad format");
- st = (filhdr.tsize+01) & ~01;
- filhdr.tsize = st;
- cdrel = -st;
- sd = (filhdr.dsize+01) & ~01;
- cbrel = - (st+sd);
- filhdr.bsize = (filhdr.bsize+01) & ~01;
+ long *p; int i;
+ dseek(&text, loc, (long)sizeof(filhdr));
+ mget((short *)&filhdr, sizeof(filhdr), &text);
+#ifndef vax
+ for (p= &filhdr,i=8;--i>=0;) fixl(p++);
+#endif
+ if (filhdr.a_magic!=A_MAGIC1 && filhdr.a_magic!=A_MAGIC2 &&
+ filhdr.a_magic!=A_MAGIC3 && filhdr.a_magic!=A_MAGIC4)
+ error(1,"Bad magic number");
+ if (filhdr.a_text&01 || filhdr.a_data&01) {
+ printf("tsize=%X dsize=%X\n",filhdr.a_text,filhdr.a_data);
+ error(1, "Text/data size odd");
+ }
+ filhdr.a_bss = round(filhdr.a_bss, FW);
+ if (filhdr.a_magic == NMAGIC) {
+ cdrel = -round(filhdr.a_text, PAGRND);
+ cbrel = cdrel - filhdr.a_data;
+ } else if (filhdr.a_magic == OMAGIC) {
+ cdrel = -filhdr.a_text;
+ cbrel = cdrel - filhdr.a_data;
+ } else
+ error(1, "Bad format");