1 /* Copyright (c) 1982 Regents of the University of California */
2 
3 static char sccsid[] = "@(#)remake.c 1.2 03/08/82";
4 
5 /*
6  * Remake the object file from the source.
7  */
8 
9 #include "defs.h"
10 #include "command.h"
11 #include "object.h"
12 
13 /*
14  * Invoke "pi" on the dotpfile, then reread the symbol table information.
15  *
16  * We have to save tracing info before, and read it in after, because
17  * it might contain symbol table pointers.
18  *
19  * We also have to restart the process so that px dependent information
20  * is recomputed.
21  */
22 
23 remake()
24 {
25     char *tmpfile;
26 
27     if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
28 	if (strcmp(objname, "obj") != 0) {
29 	    call("mv", stdin, stdout, "obj", objname, NIL);
30 	}
31 	tmpfile = mktemp("/tmp/pdxXXXX");
32 	setout(tmpfile);
33 	status();
34 	unsetout();
35 	bpfree();
36 	objfree();
37 	initstart();
38 	readobj(objname);
39 	setinput(tmpfile);
40 	unlink(tmpfile);
41     } else {
42 	puts("pi unsuccessful");
43     }
44 }
45