date and time created 82/01/18 19:20:07 by linton
authorMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 19 Jan 1982 11:20:07 +0000 (03:20 -0800)
committerMark Linton <linton@ucbvax.Berkeley.EDU>
Tue, 19 Jan 1982 11:20:07 +0000 (03:20 -0800)
SCCS-vsn: usr.bin/pascal/pdx/command/remake.c 1.1

usr/src/usr.bin/pascal/pdx/command/remake.c [new file with mode: 0644]

diff --git a/usr/src/usr.bin/pascal/pdx/command/remake.c b/usr/src/usr.bin/pascal/pdx/command/remake.c
new file mode 100644 (file)
index 0000000..ff412c2
--- /dev/null
@@ -0,0 +1,40 @@
+/* Copyright (c) 1982 Regents of the University of California */
+
+static char sccsid[] = "@(#)remake.c 1.1 %G%";
+
+/*
+ * Remake the object file from the source.
+ */
+
+#include "defs.h"
+#include "command.h"
+#include "object.h"
+
+/*
+ * Invoke "pi" on the dotpfile, then reread the symbol table information.
+ *
+ * We have to save tracing info before, and read it in after, because
+ * it might contain symbol table pointers.
+ */
+
+remake()
+{
+       char *tmpfile;
+
+       if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
+               if (strcmp(objname, "obj") != 0) {
+                       call("mv", stdin, stdout, "obj", objname, NIL);
+               }
+               tmpfile = mktemp("/tmp/pdxXXXX");
+               setout(tmpfile);
+               status();
+               unsetout();
+               bpfree();
+               objfree();
+               readobj(objname);
+               setinput(tmpfile);
+               unlink(tmpfile);
+       } else {
+               puts("pi unsuccessful");
+       }
+}