all: remove deprecated sys_errlist[] and replace with ANSI C strerror()

This commit is contained in:
Peter Howkins
2020-11-02 05:30:08 +00:00
parent 0f3bcae232
commit 67f62e5a8a
12 changed files with 8 additions and 80 deletions

View File

@@ -72,10 +72,6 @@
static Bool lookForButton(Display *, XEvent *, XPointer);
#if !defined(__linux__) && !defined(CSRG_BASED)
extern char *sys_errlist[];
#endif
extern int drag_load_proc(char*, Calendar *);
static char dnd_filename[20];

View File

@@ -306,10 +306,7 @@ syserr(char *msg, int a1, int a2, int a3)
#if 0
/* print the error, if any */
if (saveerr != 0) {
if (saveerr < 0 || saveerr > sys_nerr)
(void) fprintf(stderr, ":Unknown error %d", saveerr);
else
(void) fprintf(stderr, ":%s", sys_errlist[saveerr]);
(void) fprintf(stderr, ":%s", strerror(saveerr));
}
#endif

View File

@@ -56,7 +56,6 @@
typedef int Boolean;
/* extern int errno; */
/* extern char *sys_errlist[]; */
/* extern int sys_nerr; */
static void GenTopicList (

View File

@@ -37,10 +37,6 @@
#include <X11/Xproto.h> /* for X_ChangeHosts */
#include <X11/Xatom.h> /* for XA_STRING */
#if !defined(__linux__) && !defined(CSRG_BASED)
extern char *sys_errlist[];
#endif
static char *conf_msg_id = STR_CONFDATA;
#define CONF_MSG_ID_LEN strlen(conf_msg_id)

View File

@@ -27,14 +27,10 @@
#include <sys/wait.h>
#include <setjmp.h>
#include <unistd.h>
#include <errno.h>
#if (defined(__linux__) || defined(CSRG_BASED)) && !defined(_NFILE)
#define _NFILE FOPEN_MAX
#endif
#if !defined(__linux__) && !defined(CSRG_BASED)
extern char *sys_errlist[];
extern int sys_nerr;
#endif
/* local functions */
@@ -599,8 +595,7 @@ static int invoke_ims(UserSelection *sel)
pid = fork();
if (pid == (pid_t) -1) {
put_xims_log("fork failed [%s]",
(errno <= sys_nerr) ? sys_errlist[errno] : NULL, 0, 0);
put_xims_log("fork failed [%s]", strerror(errno), 0, 0);
#ifdef DEBUG
perror("fork");
#endif
@@ -617,8 +612,7 @@ static int invoke_ims(UserSelection *sel)
#endif
execl(SH_PATH, "sh", "-c", renv->cmdbuf, NULL);
put_xims_log("%s: exec failed [%s]", SH_PATH,
(errno <= sys_nerr) ? sys_errlist[errno] : NULL, 0, 0);
put_xims_log("%s: exec failed [%s]", SH_PATH, strerror(errno) , 0, 0);
/* perror(SH_PATH); */
sleep(1);
_exit(1);

View File

@@ -53,9 +53,6 @@
#include <sys/select.h>
#endif
extern char *sys_errlist[];
static OliasEvent *current_event;
static int reply_status;
#define NO_REPLY 0
@@ -332,7 +329,7 @@ wait_for_reply (Widget toplevel)
XtAppWarningMsg (XtWidgetToApplicationContext (toplevel),
"communicationsError", "select",
"Olias API", "Select failed: %s",
&sys_errlist[errno], &num_params);
strerror(errno), &num_params);
continue;
}
continue;

View File

@@ -92,14 +92,7 @@
#endif
#include <ast.h>
extern __MANGLE__ int sys_nerr;
extern __MANGLE__ char* sys_errlist[];
char*
fmterror __PARAM__((int err), (err)) __OTORP__(int err;){
static char msg[28];
if (err > 0 && err <= sys_nerr) return(sys_errlist[err]);
sfsprintf(msg, sizeof(msg), "Error %d", err);
return(msg);
return strerror(err);
}

View File

@@ -108,18 +108,12 @@ NoN(strerror)
#include <ast.h>
extern __MANGLE__ int sys_nerr;
extern __MANGLE__ char* sys_errlist[];
char*
strerror __PARAM__((int err), (err)) __OTORP__(int err;)
#line 25
{
static char msg[28];
if (err > 0 && err <= sys_nerr) return(sys_errlist[err]);
sfsprintf(msg, sizeof(msg), "Error %d", err);
return(msg);
return strerror(err);
}
#endif

View File

@@ -68,8 +68,7 @@
# include <pwd.h> /* for passwd structure */
# include <stdio.h>
# include <stdlib.h> /* for exit(), malloc(), abort() */
# include <string.h> /* for string functions, bcopy(),
sys_errlist */
# include <string.h> /* for string functions, bcopy() */
# include <sys/param.h> /* for NGROUPS */
# include <sys/types.h> /* for fd_set */
# include <netinet/in.h> /* for Internet socket stuff */
@@ -475,10 +474,6 @@ struct verify_info {
*
***************************************************************************/
#if !defined(__linux__) && !defined(CSRG_BASED)
extern char *sys_errlist[]; /* system error msgs */
extern int sys_nerr; /* system error msgs */
#endif
extern XrmDatabase XresourceDB;