1*22761Smckusick /*
2*22761Smckusick  * Copyright (c) 1982 Regents of the University of California.
3*22761Smckusick  * All rights reserved.  The Berkeley software License Agreement
4*22761Smckusick  * specifies the terms and conditions for redistribution.
5*22761Smckusick  */
65473Slinton 
7*22761Smckusick #ifndef lint
8*22761Smckusick static char sccsid[] = "@(#)remake.c	5.1 (Berkeley) 06/07/85";
9*22761Smckusick #endif not lint
105473Slinton 
115473Slinton /*
125473Slinton  * Remake the object file from the source.
135473Slinton  */
145473Slinton 
155473Slinton #include "defs.h"
165473Slinton #include "command.h"
175473Slinton #include "object.h"
185473Slinton 
195473Slinton /*
205473Slinton  * Invoke "pi" on the dotpfile, then reread the symbol table information.
215473Slinton  *
225473Slinton  * We have to save tracing info before, and read it in after, because
235473Slinton  * it might contain symbol table pointers.
246071Slinton  *
256071Slinton  * We also have to restart the process so that px dependent information
266071Slinton  * is recomputed.
275473Slinton  */
285473Slinton 
295473Slinton remake()
305473Slinton {
316071Slinton     char *tmpfile;
325473Slinton 
336071Slinton     if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
346071Slinton 	if (strcmp(objname, "obj") != 0) {
356071Slinton 	    call("mv", stdin, stdout, "obj", objname, NIL);
365473Slinton 	}
376071Slinton 	tmpfile = mktemp("/tmp/pdxXXXX");
386071Slinton 	setout(tmpfile);
396071Slinton 	status();
406071Slinton 	unsetout();
416071Slinton 	bpfree();
426071Slinton 	objfree();
436071Slinton 	initstart();
446071Slinton 	readobj(objname);
456071Slinton 	setinput(tmpfile);
466071Slinton 	unlink(tmpfile);
476071Slinton     } else {
486071Slinton 	puts("pi unsuccessful");
496071Slinton     }
505473Slinton }
51