--- /dev/null
+#include <errno.h>
+#include <stdio.h>
+
+char temp_asm[] = "/tmp/atmaXXXXXX.asm";
+char temp_rel[] = "/tmp/atmrXXXXXX.rel";
+char *args[] = {
+ "/bin/aspdp11",
+ "-o",
+ temp_rel,
+ temp_asm,
+ NULL
+};
+
+mktemp_with_ext(as)
+char *as;
+{
+ register char *s;
+ register unsigned pid;
+ register i;
+
+ pid = getpid();
+ s = as;
+ while (*s++)
+ ;
+ s--;
+ while (*--s != 'X')
+ ;
+ s++;
+ while (*--s == 'X') {
+ *s = (pid % 10) + '0';
+ pid /= 10;
+ }
+ s++;
+ i = 'a';
+ while (access(as, 0) != -1) {
+ if (i == 'z') {
+ fprintf(stderr, "cannot create temporary file\n");
+ exit(1);
+ }
+ *s = i++;
+ }
+}
+
+copy(path_in, path_out)
+char *path_in, *path_out;
+{
+ FILE *fp_in, *fp_out;
+ int c;
+
+ fp_in = fopen(path_in, "r");
+ if (fp_in == NULL) {
+ perror(path_in);
+ exit(1);
+ }
+
+ fp_out = fopen(path_out, "w");
+ if (fp_out == NULL) {
+ perror(path_out);
+ exit(1);
+ }
+
+ while ((c = getc(fp_in)) != EOF)
+ putc(c, fp_out);
+
+ fclose(fp_in);
+ fclose(fp_out);
+}
+
+callsys(f, v)
+char *f, **v;
+{
+ int t, status;
+
+ t = fork();
+ switch (t) {
+ case 0:
+ execv(f, v);
+ perror(f);
+ exit(1);
+ case -1:
+ perror("fork()");
+ exit(1);
+ }
+ while (wait(&status) != t)
+ ;
+ t = status & 0xff;
+ if (t) {
+ printf("status %d\n", t);
+ exit(1);
+ }
+ return (status >> 8) & 0xff;
+}
+
+int main(argc, argv)
+char *argc, **argv;
+{
+ int i;
+ char *dest, *src;
+
+ dest = "a.out";
+ for (i = 1; i < argc && argv[i][0] == '-'; ++i)
+ switch (argv[i][1]) {
+ case 'u':
+ /* allow undefined variable (not supported; ignore) */
+ break;
+ case 'o':
+ if (++i >= argc) {
+ fprintf(stderr, "-o requires argument\n");
+ exit(1);
+ }
+ dest = argv[i];
+ break;
+ default:
+ fprintf(stderr, "unknown switch -%c\n", argv[i][1]);
+ exit(1);
+ }
+
+ if (i >= argc) {
+ fprintf(stderr, "usage: %s [-u] [-o outfile] infile.s\n");
+ exit(1);
+ }
+ src = argv[i];
+
+ mktemp_with_ext(temp_asm);
+ copy(src, temp_asm);
+
+ mktemp_with_ext(temp_rel);
+ if (callsys(args[0], args))
+ exit(1);
+
+ copy(temp_rel, dest);
+ return 0;
+}
#!/bin/sh
-git checkout ../../../lib/c[012]
-mkdir --parents ../../../tmp
+git checkout ../../../bin/as ../../../lib/c[012]
+if ! test -d ../../../tmp
+then
+ ln -s /tmp ../../../tmp
+fi
export APOUT_ROOT=`pwd`/../../..
export PATH=`pwd`/../../../bin:`pwd`
+cc -n -s -O as.c -o as
(echo ==== c =====; cd c; make cp)
+mv as ../../../bin
#!/bin/sh
-mkdir --parents ../../../tmp
+if ! test -d ../../../tmp
+then
+ ln -s /tmp ../../../tmp
+fi
export APOUT_ROOT=`pwd`/../../..
export PATH=`pwd`/../../../bin:`pwd`
#sh cmake dump.c
export APOUT_ROOT=`pwd`/../../..
export PATH=`pwd`/../../../bin:`pwd`
cc -S -O /usr/src/libc/stdio/filbuf.c
+as -o filbuf.o filbuf.s
+#cc -c -O /usr/src/libc/stdio/filbuf.c
#!/bin/sh
-mkdir --parents ../../../tmp
+if ! test -d ../../../tmp
+then
+ ln -s /tmp ../../../tmp
+fi
export APOUT_ROOT=`pwd`/../../..
export PATH=`pwd`/../../../bin:`pwd`
./compall
#!/bin/sh
-mkdir --parents ../../../tmp
+if ! test -d ../../../tmp
+then
+ ln -s /tmp ../../../tmp
+fi
export APOUT_ROOT=`pwd`/../../..
export PATH=`pwd`/../../../bin:`pwd`
./mkconf <rktmconf