Added a check for unresolved references

This commit is contained in:
ceriel 1987-01-29 17:13:37 +00:00
parent 59a08bb733
commit bfb89ae937
2 changed files with 12 additions and 3 deletions

View file

@ -41,6 +41,9 @@ convert ()
int i; int i;
rd_ohead(&head); rd_ohead(&head);
if (head.oh_flags & HF_LINK) {
fatal("%s contains unresolved references\n",s);
}
rd_sect(sect, head.oh_nsect); rd_sect(sect, head.oh_nsect);
for (i = 0; i < head.oh_nsect; i++) { for (i = 0; i < head.oh_nsect; i++) {
rd_outsect(i); rd_outsect(i);
@ -107,8 +110,9 @@ int b;
} }
fatal (s,a) fatal (s,a)
char *s, *a;
{ {
printf (s,a); fprintf (stderr,s,a);
exit (-1); exit (-1);
} }

View file

@ -2,6 +2,7 @@
* Download Z80 load module into the NASCOM * Download Z80 load module into the NASCOM
* *
* Johan Stevenson, Vrije Universiteit, Amsterdam * Johan Stevenson, Vrije Universiteit, Amsterdam
* Adapted (untested) to new ack.out format by
* Ceriel Jacobs, Vrije Universiteit, Amsterdam * Ceriel Jacobs, Vrije Universiteit, Amsterdam
*/ */
#include <stdio.h> #include <stdio.h>
@ -63,11 +64,11 @@ main(argc,argv) char **argv; {
if (argc == 2) if (argc == 2)
s = argv[1]; s = argv[1];
else if (argc != 1) { else if (argc != 1) {
fprintf(stderr,"usage: %s [flags] [object file]\n",argv[0]); fprintf(stderr,"usage: %s [flags] [object file]\n",progname);
stop(-1); stop(-1);
} }
if (! rd_open(s)) { if (! rd_open(s)) {
fprintf(stderr,"%s: can't open %s\n",argv[0],s); fprintf(stderr,"%s: can't open %s\n",progname,s);
stop(-1); stop(-1);
} }
if (nascom) { if (nascom) {
@ -88,6 +89,10 @@ main(argc,argv) char **argv; {
sleep(5); sleep(5);
} }
rd_ohead(&ohead); rd_ohead(&ohead);
if (ohead.oh_flags & HF_LINK) {
fprintf(stderr,"%s: %s contains unresolved references\n",progname,s);
stop(-1);
}
rd_sect(sect, ohead.oh_nsect); rd_sect(sect, ohead.oh_nsect);
for (i = 0; i < ohead.oh_nsect; i++) { for (i = 0; i < ohead.oh_nsect; i++) {
rd_outsect(i); rd_outsect(i);