1
0
mirror of https://github.com/DoctorWkt/unix-jun72.git synced 2026-04-12 15:16:44 +00:00

I added the APOUT_UNIX_VERSION variable, so we can recompile/reassemble

V2 source code and then run it, without having to muck with the magic.c.
This commit is contained in:
warren.toomey
2008-05-15 03:21:46 +00:00
parent eab480f677
commit 66655be6e2
2 changed files with 30 additions and 5 deletions

View File

@@ -1,7 +1,7 @@
.\" Copyright Warren Toomey
.\"
.\" $Revision: 1.9 $
.\" $Date: 2002/06/10 12:08:27 $
.\" $Revision: 1.10 $
.\" $Date: 2008/05/15 03:20:52 $
.\"
.Dd December, 2000
.Dt APOUT 1
@@ -104,6 +104,17 @@ Note that you must set
.Ev APOUT_ROOT
before you can run
.Nm apout.
.Pp
There is one other optional environment variable:
.Ev APOUT_UNIX_VERSION.
This is mainly required for UNIX binaries that use the 0407 header,
which was used across several versions of UNIX, each with a different set
of system calls. If APOUT_UNIX_VERSION is set,
.Nm apout
will use the given version when it cannot determine which version of UNIX a
binary belongs to. The available values are "V1", "V2", "V3", "V4", "V5", "V6",
"V7", "2.9BSD" and "2.11BSD".
.Pp
.Sh EMULATED ENVIRONMENT VARIABLES
Initially, PDP-11 binaries run via
.Nm apout

View File

@@ -6,8 +6,8 @@
* a.out header. If it matches any of the checksums below, it returns
* the appropriate environment value. Otherwise, it returns IS_UNKNOWN.
*
* $Revision: 1.14 $
* $Date: 2008/05/06 23:31:53 $
* $Revision: 1.15 $
* $Date: 2008/05/15 03:20:52 $
*/
#include "defines.h"
@@ -118,6 +118,7 @@ int special_magic(u_int16_t *cptr)
{
u_int32_t cksum=0;
int i;
char *unix_version;
if (cptr==NULL) return(IS_UNKNOWN);
/* Calculate the checksum */
@@ -129,7 +130,20 @@ int special_magic(u_int16_t *cptr)
return(S[i].environment);
}
/* None, return 0 */
/* See if user tells us what version to use */
if ((unix_version = getenv("APOUT_UNIX_VERSION"))) {
if (!strcmp(unix_version, "V1")) return(IS_V1);
if (!strcmp(unix_version, "V2")) return(IS_V2);
if (!strcmp(unix_version, "V3")) return(IS_V3);
if (!strcmp(unix_version, "V4")) return(IS_V4);
if (!strcmp(unix_version, "V5")) return(IS_V5);
if (!strcmp(unix_version, "V6")) return(IS_V6);
if (!strcmp(unix_version, "V7")) return(IS_V7);
if (!strcmp(unix_version, "2.9BSD")) return(IS_29BSD);
if (!strcmp(unix_version, "2.11BSD")) return(IS_211BSD);
}
/* We can't tell what version of Unix, give up */
(void)printf("Apout - unknown magic in header: 0x%x\n",cksum);
return(IS_UNKNOWN);
}