]> code.delx.au - gnu-emacs/blobdiff - src/unexmips.c
(Fset_text_properties): Special case for getting
[gnu-emacs] / src / unexmips.c
index 292f0210c5343eb301dc5e98f026a109b91e04e0..598791098ea244e7737b1c94061797645a610ee9 100644 (file)
@@ -6,13 +6,13 @@
    we don't plan to think about it, or about whether other Emacs
    maintenance might break it.
 
-   Copyright (C) 1988 Free Software Foundation, Inc.
+   Copyright (C) 1988, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
+the Free Software Foundation; either version 2, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -25,7 +25,7 @@ along with GNU Emacs; see the file COPYING.  If not, write to
 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
 \f
-#include "config.h"
+#include <config.h>
 #include <sys/types.h>
 #include <sys/file.h>
 #include <sys/stat.h>
@@ -59,8 +59,7 @@ static void mark_x ();
          fatal_unexec (_error_message, _error_arg);
 
 extern int errno;
-extern int sys_nerr;
-extern char *sys_errlist[];
+extern char *strerror ();
 #define EEOF -1
 
 static struct scnhdr *text_section;
@@ -174,7 +173,8 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
   text_section->s_scnptr = 0;
 
   pagesize = getpagesize ();
-  brk = (sbrk (0) + pagesize - 1) & (-pagesize);
+  /* Casting to int avoids compiler error on NEWS-OS 5.0.2.  */
+  brk = (((int) (sbrk (0))) + pagesize - 1) & (-pagesize);
   hdr.aout.dsize = brk - DATA_START;
   hdr.aout.bsize = 0;
   if (entry_address == 0)
@@ -235,10 +235,10 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
       bss_section->s_scnptr = scnptr;
     }
 
-  WRITE (new, TEXT_START, hdr.aout.tsize,
-        "writing text section to %s", new_name);
-  WRITE (new, DATA_START, hdr.aout.dsize,
+  WRITE (new, (char *)TEXT_START, hdr.aout.tsize,
         "writing text section to %s", new_name);
+  WRITE (new, (char *)DATA_START, hdr.aout.dsize,
+        "writing data section to %s", new_name);
 
   SEEK (old, hdr.fhdr.f_symptr, "seeking to start of symbols in %s", a_name);
   errno = EEOF;
@@ -300,15 +300,13 @@ mark_x (name)
 
 static void
 fatal_unexec (s, va_alist)
-     va_dcl
+    va_dcl
 {
   va_list ap;
   if (errno == EEOF)
     fputs ("unexec: unexpected end of file, ", stderr);
-  else if (errno < sys_nerr)
-    fprintf (stderr, "unexec: %s, ", sys_errlist[errno]);
   else
-    fprintf (stderr, "unexec: error code %d, ", errno);
+    fprintf (stderr, "unexec: %s, ", strerror (errno));
   va_start (ap);
   _doprnt (s, ap, stderr);
   fputs (".\n", stderr);