]> git.eshelyaron.com Git - emacs.git/commitdiff
(main): Call strerror instead of using sys_errlist.
authorRoland McGrath <roland@gnu.org>
Sat, 8 Jan 1994 21:47:36 +0000 (21:47 +0000)
committerRoland McGrath <roland@gnu.org>
Sat, 8 Jan 1994 21:47:36 +0000 (21:47 +0000)
lib-src/env.c
src/emacs.c

index 853cb5bfb22c27bfa0b0dba1f9465b2cfd08c593..282a94069df227bbe556245a3461ae04ab64c959 100644 (file)
@@ -1,5 +1,5 @@
 /* env - manipulate environment and execute a program in that environment
-   Copyright (C) 1986 Free Software Foundation, Inc.
+   Copyright (C) 1986, 1994 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@
      { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks }
 
      * "env DISPLAY=gnu:0 nemacs"
-        calls "nemacs" in the envionment
+        calls "nemacs" in the environment
        { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks DISPLAY=gnu:0 }
 
      * "env - USER=foo /hacks/hack bar baz"
@@ -194,17 +194,14 @@ main (argc, argv, envp)
     }
   else
     {
-      extern int errno, sys_nerr;
-      extern char *sys_errlist[];
+      extern int errno;
+      extern char *strerror ();
 
       environ = nenv;
       (void) execvp (*argv, argv);
 
-      fprintf (stderr, "%s: cannot execute `%s'", progname, *argv);
-      if (errno < sys_nerr)
-       fprintf (stderr, ": %s\n", sys_errlist[errno]);
-      else
-       putc ('\n', stderr);
+      fprintf (stderr, "%s: cannot execute `%s': %s\n",
+              progname, *argv, strerror (errno));
       exit (errno != 0 ? errno : 1);
     }
 }
index e20f488e8cc8b276d00698c1e3d835827e3bb9ea..143a85020c580386810486e0df4f229bdcf6ed5f 100644 (file)
@@ -1,5 +1,5 @@
 /* Fully extensible Emacs, running on Unix, intended for GNU.
-   Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc.
+   Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -260,7 +260,7 @@ main (argc, argv, envp)
   int skip_args = 0;
   extern int errno;
   extern sys_nerr;
-  extern char *sys_errlist[];
+  extern char *strerror ();
   extern void malloc_warning ();
 
 /* Map in shared memory, if we are using that.  */
@@ -397,12 +397,7 @@ main (argc, argv, envp)
       result = open (argv[skip_args], O_RDWR, 2 );
       if (result < 0)
        {
-         char *errstring;
-
-         if (errno >= 0 && errno < sys_nerr)
-           errstring = sys_errlist[errno];
-         else
-           errstring = "undocumented error code";
+         char *errstring = strerror (errno);
          fprintf (stderr, "emacs: %s: %s\n", argv[skip_args], errstring);
          exit (1);
        }