new copyright; att/bsd/shared
[unix-history] / usr / src / usr.bin / pascal / pdx / command / remake.c
CommitLineData
505bf312
KB
1/*-
2 * Copyright (c) 1982 The Regents of the University of California.
3 * All rights reserved.
4 *
5 * %sccs.include.redist.c%
f6f0d0bf 6 */
ee3c797d 7
f6f0d0bf 8#ifndef lint
505bf312
KB
9static char sccsid[] = "@(#)remake.c 5.3 (Berkeley) %G%";
10#endif /* not lint */
ee3c797d
ML
11
12/*
13 * Remake the object file from the source.
14 */
15
16#include "defs.h"
17#include "command.h"
18#include "object.h"
19
20/*
21 * Invoke "pi" on the dotpfile, then reread the symbol table information.
22 *
23 * We have to save tracing info before, and read it in after, because
24 * it might contain symbol table pointers.
56106799
ML
25 *
26 * We also have to restart the process so that px dependent information
27 * is recomputed.
ee3c797d
ML
28 */
29
30remake()
31{
56106799 32 char *tmpfile;
ee3c797d 33
56106799
ML
34 if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
35 if (strcmp(objname, "obj") != 0) {
36 call("mv", stdin, stdout, "obj", objname, NIL);
ee3c797d 37 }
619abc33 38 tmpfile = mktemp(strdup("/tmp/pdxXXXX"));
56106799
ML
39 setout(tmpfile);
40 status();
41 unsetout();
42 bpfree();
43 objfree();
44 initstart();
45 readobj(objname);
46 setinput(tmpfile);
47 unlink(tmpfile);
48 } else {
49 puts("pi unsuccessful");
50 }
ee3c797d 51}