aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath1994-01-08 21:47:36 +0000
committerRoland McGrath1994-01-08 21:47:36 +0000
commitbe06db9a3edd0cc9a68313286446e5cbc8cdb139 (patch)
tree874bf703197c96cce91b513c50309fefc2062cbc
parent92af894ffd42bbbfdbea693385b07e7faa5cf73f (diff)
downloademacs-be06db9a3edd0cc9a68313286446e5cbc8cdb139.tar.gz
emacs-be06db9a3edd0cc9a68313286446e5cbc8cdb139.zip
(main): Call strerror instead of using sys_errlist.
-rw-r--r--lib-src/env.c15
-rw-r--r--src/emacs.c11
2 files changed, 9 insertions, 17 deletions
diff --git a/lib-src/env.c b/lib-src/env.c
index 853cb5bfb22..282a94069df 100644
--- a/lib-src/env.c
+++ b/lib-src/env.c
@@ -1,5 +1,5 @@
1/* env - manipulate environment and execute a program in that environment 1/* env - manipulate environment and execute a program in that environment
2 Copyright (C) 1986 Free Software Foundation, Inc. 2 Copyright (C) 1986, 1994 Free Software Foundation, Inc.
3 3
4 This program is free software; you can redistribute it and/or modify 4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by 5 it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@
59 { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks } 59 { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks }
60 60
61 * "env DISPLAY=gnu:0 nemacs" 61 * "env DISPLAY=gnu:0 nemacs"
62 calls "nemacs" in the envionment 62 calls "nemacs" in the environment
63 { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks DISPLAY=gnu:0 } 63 { USER=rms EDITOR=emacs PATH=.:/gnubin:/hacks DISPLAY=gnu:0 }
64 64
65 * "env - USER=foo /hacks/hack bar baz" 65 * "env - USER=foo /hacks/hack bar baz"
@@ -194,17 +194,14 @@ main (argc, argv, envp)
194 } 194 }
195 else 195 else
196 { 196 {
197 extern int errno, sys_nerr; 197 extern int errno;
198 extern char *sys_errlist[]; 198 extern char *strerror ();
199 199
200 environ = nenv; 200 environ = nenv;
201 (void) execvp (*argv, argv); 201 (void) execvp (*argv, argv);
202 202
203 fprintf (stderr, "%s: cannot execute `%s'", progname, *argv); 203 fprintf (stderr, "%s: cannot execute `%s': %s\n",
204 if (errno < sys_nerr) 204 progname, *argv, strerror (errno));
205 fprintf (stderr, ": %s\n", sys_errlist[errno]);
206 else
207 putc ('\n', stderr);
208 exit (errno != 0 ? errno : 1); 205 exit (errno != 0 ? errno : 1);
209 } 206 }
210} 207}
diff --git a/src/emacs.c b/src/emacs.c
index e20f488e8cc..143a85020c5 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1,5 +1,5 @@
1/* Fully extensible Emacs, running on Unix, intended for GNU. 1/* Fully extensible Emacs, running on Unix, intended for GNU.
2 Copyright (C) 1985, 1986, 1987, 1993 Free Software Foundation, Inc. 2 Copyright (C) 1985, 1986, 1987, 1993, 1994 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -260,7 +260,7 @@ main (argc, argv, envp)
260 int skip_args = 0; 260 int skip_args = 0;
261 extern int errno; 261 extern int errno;
262 extern sys_nerr; 262 extern sys_nerr;
263 extern char *sys_errlist[]; 263 extern char *strerror ();
264 extern void malloc_warning (); 264 extern void malloc_warning ();
265 265
266/* Map in shared memory, if we are using that. */ 266/* Map in shared memory, if we are using that. */
@@ -397,12 +397,7 @@ main (argc, argv, envp)
397 result = open (argv[skip_args], O_RDWR, 2 ); 397 result = open (argv[skip_args], O_RDWR, 2 );
398 if (result < 0) 398 if (result < 0)
399 { 399 {
400 char *errstring; 400 char *errstring = strerror (errno);
401
402 if (errno >= 0 && errno < sys_nerr)
403 errstring = sys_errlist[errno];
404 else
405 errstring = "undocumented error code";
406 fprintf (stderr, "emacs: %s: %s\n", argv[skip_args], errstring); 401 fprintf (stderr, "emacs: %s: %s\n", argv[skip_args], errstring);
407 exit (1); 402 exit (1);
408 } 403 }