From b51690ad06ee18d0e7dcfcb0574900556ba268cd Mon Sep 17 00:00:00 2001 From: "warren.toomey" Date: Mon, 19 May 2008 13:45:10 +0000 Subject: [PATCH] Another patch from Sergey Poznyakoff. A compile-time define allows Apout to run V1 binaries which do not have 0407 nor 0405 headers; this includes chmod, rm, ln. --- tools/apout/Makefile | 7 +++--- tools/apout/aout.c | 52 +++++++++++++++++++++++++++++++++++++------ tools/apout/aout.h | 8 ++++--- tools/apout/defines.h | 5 +++-- 4 files changed, 57 insertions(+), 15 deletions(-) diff --git a/tools/apout/Makefile b/tools/apout/Makefile index 657c4d0..90f06b6 100644 --- a/tools/apout/Makefile +++ b/tools/apout/Makefile @@ -1,7 +1,7 @@ # Makefile for Apout PDP-11 application emulator # -# $Revision: 1.30 $ -# $Date: 2008/05/09 14:04:51 $ +# $Revision: 1.31 $ +# $Date: 2008/05/19 13:42:39 $ # # You will need gcc if you choose the optimised compile below CC=gcc @@ -11,7 +11,8 @@ CC=gcc # Set up the LIBS if required for your system # # These flags for doing debugging -CFLAGS= -Wall -g -DEMU211 -DEMUV1 -DNATIVES -DDEBUG -DZERO_MEMORY -DWRITEBASE +CFLAGS= -Wall -g -DEMU211 -DEMUV1 -DNATIVES -DRUN_V1_RAW \ + -DDEBUG -DZERO_MEMORY -DWRITEBASE LDFLAGS= -g # These flags for speed diff --git a/tools/apout/aout.c b/tools/apout/aout.c index d2d3dd0..290dc01 100644 --- a/tools/apout/aout.c +++ b/tools/apout/aout.c @@ -1,8 +1,8 @@ /* aout.c - parse and load the contents of a UNIX a.out file, for * several flavours of PDP-11 UNIX * - * $Revision: 1.50 $ - * $Date: 2002/06/10 11:43:24 $ + * $Revision: 1.51 $ + * $Date: 2008/05/19 13:42:39 $ */ #include "defines.h" #include "aout.h" @@ -85,8 +85,8 @@ int load_aout_header(FILE * zin, struct exec * E) /* We can deal with this a.out, so */ /* read in the rest of the header */ cptr = (char *) &(E->a_text); - if (fread(cptr, sizeof(struct exec) - sizeof(u_int16_t), 1, zin) != 1) - return (-1); + if (fread(cptr, 1, sizeof(struct exec) - sizeof(u_int16_t), zin) + < 16 - sizeof (u_int16_t)) return (-1); switch (E->a_magic) { case A68_MAGIC: if (E->a_data==A68_DATA) return(IS_A68); @@ -189,6 +189,9 @@ int load_a_out(const char *file, const char *origpath, int want_env) #ifdef EMU211 int j; #endif +#ifdef RUN_V1_RAW + struct stat stb; +#endif for (i=0;i #define EIGHT_K 8192 @@ -16,7 +16,9 @@ #define BSD_ROVERLAY 0431 /* 2.11BSD overlay, separate */ #define ANY_SCRIPT 020443 /* Shell script, i.e #! */ #define A68_MAGIC 0 /* Algol68 binaries have these magic nums */ -#define A68_DATA 0107116 /* Algol68 binaries have these magic nums */ +#define A68_DATA 0107116 /* Algol68 binaries have these magic nums */ +#define V1_RAW 0104421 /* V1 'raw' binary: rm, ln, chmod from s2 + archive. */ #define UNKNOWN_AOUT 034567 /* An unknown a.out header */ diff --git a/tools/apout/defines.h b/tools/apout/defines.h index 7c70df0..1f27603 100644 --- a/tools/apout/defines.h +++ b/tools/apout/defines.h @@ -1,11 +1,12 @@ /* defines.h - Definitions of things needed in all C files * - * $Revision: 2.74 $ - * $Date: 2008/05/09 14:04:41 $ + * $Revision: 2.75 $ + * $Date: 2008/05/19 13:42:39 $ */ #include #include +#include #include #include #include