changeset 5500:6f6637309b38

[MSDOS]: Don't #include <a.out.h>, but use other headers. (make_hdr) [MSDOS]: Cast a pointer for bzero. (write_segment) [EFAULT]: Check for before using. (adjust_lnnoptrs) [MSDOS]: Use provided descriptor. (adjust_lnnoptrs): Return 0 if ok.
author Richard M. Stallman <rms@gnu.org>
date Sat, 08 Jan 1994 09:19:22 +0000
parents da0a6ed995bd
children 902cd7024cfa
files src/unexec.c
diffstat 1 files changed, 40 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/unexec.c	Sat Jan 08 09:18:53 1994 +0000
+++ b/src/unexec.c	Sat Jan 08 09:19:22 1994 +0000
@@ -176,7 +176,31 @@
 int need_coff_header = 1;
 #include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */
 #else
+#ifdef MSDOS
+#include <../go32/gotypes.h>
+#include <../go32/ed/coff.h>
+#define filehdr external_filehdr
+#define scnhdr external_scnhdr
+#define syment external_syment
+#define auxent external_auxent
+#define n_numaux e_numaux
+#define n_type e_type
+struct aouthdr
+{
+  word16 	magic;		/* type of file				*/
+  word16	vstamp;		/* version stamp			*/
+  word32	tsize;		/* text size in bytes, padded to FW bdry*/
+  word32	dsize;		/* initialized data "  "		*/
+  word32	bsize;		/* uninitialized data "   "		*/
+  word32	entry;		/* entry pt.				*/
+  word32 	text_start;	/* base of text used for this file */
+  word32 	data_start;	/* base of data used for this file */
+};
+
+
+#else /* not MSDOS */
 #include <a.out.h>
+#endif /* not MSDOS */
 #endif
 
 /* Define getpagesize () if the system does not.
@@ -686,8 +710,12 @@
        */
       ERROR0 ("can't build a COFF file from scratch yet");
 #else
+#ifdef MSDOS	/* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
+      bzero ((void *)&hdr, sizeof hdr);
+#else
       bzero (&hdr, sizeof hdr);
 #endif
+#endif
     }
 
   unexec_text_start = (long) start_of_text ();
@@ -898,7 +926,11 @@
 	 a gap between the old text segment and the old data segment.
 	 This gap has probably been remapped into part of the text segment.
 	 So write zeros for it.  */
-      if (ret == -1 && errno == EFAULT)
+      if (ret == -1
+#ifdef EFAULT
+	  && errno == EFAULT
+#endif
+	  )
 	write (new, zeros, nwrite);
       else if (nwrite != ret)
 	{
@@ -1021,7 +1053,11 @@
   if (!lnnoptr || !f_hdr.f_symptr)
     return 0;
 
+#ifdef MSDOS
+  if ((new = writedesc) < 0)
+#else
   if ((new = open (new_name, 2)) < 0)
+#endif
     {
       PERROR (new_name);
       return -1;
@@ -1043,7 +1079,10 @@
 	    }
 	}
     }
+#ifndef MSDOS
   close (new);
+#endif
+  return 0;
 }
 
 #endif /* COFF_BSD_SYMBOLS */