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