mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-22 05:33:23 +00:00
337 lines
10 KiB
Diff
337 lines
10 KiB
Diff
From 67f62e5a8acd70d30f7067f1f44ac7b15c67011a Mon Sep 17 00:00:00 2001
|
|
From: Peter Howkins <flibble@users.sf.net>
|
|
Date: Mon, 2 Nov 2020 05:30:08 +0000
|
|
Subject: [PATCH] all: remove deprecated sys_errlist[] and replace with ANSI C
|
|
strerror()
|
|
|
|
---
|
|
cde/config/imake/imake.c | 13 -------------
|
|
cde/lib/tt/bin/dbck/spec.C | 8 --------
|
|
cde/lib/tt/lib/tt_options.h | 12 ------------
|
|
cde/programs/dtcm/dtcm/dnd.c | 4 ----
|
|
cde/programs/dtcm/libDtCmP/util.c | 5 +----
|
|
.../dthelp/parser.ccdf/volumegen/Volumegen.c | 1 -
|
|
cde/programs/dtimsstart/remote.c | 4 ----
|
|
cde/programs/dtimsstart/start.c | 12 +++---------
|
|
cde/programs/dtinfo/dtinfo/src/external-api/comm.c | 5 +----
|
|
.../dtksh/ksh93/src/lib/libast/string/fmterror.c | 9 +--------
|
|
.../dtksh/ksh93/src/lib/libast/string/strerror.c | 8 +-------
|
|
cde/programs/dtlogin/dm.h | 7 +------
|
|
12 files changed, 8 insertions(+), 80 deletions(-)
|
|
|
|
diff --git a/cde/config/imake/imake.c b/cde/config/imake/imake.c
|
|
index 574af7c7..83834aa7 100644
|
|
--- a/cde/config/imake/imake.c
|
|
+++ b/config/imake/imake.c
|
|
@@ -242,19 +242,6 @@ extern int errno;
|
|
#include <stdarg.h>
|
|
#include "imakemdep.h"
|
|
|
|
-/*
|
|
- * This define of strerror is copied from (and should be identical to)
|
|
- * Xos.h, which we don't want to include here for bootstrapping reasons.
|
|
- */
|
|
-#if defined(X_NOT_STDC_ENV) || (defined(sun) && !defined(SVR4))
|
|
-# ifndef strerror
|
|
-extern char *sys_errlist[];
|
|
-extern int sys_nerr;
|
|
-# define strerror(n) \
|
|
- (((n) >= 0 && (n) < sys_nerr) ? sys_errlist[n] : "unknown error")
|
|
-# endif
|
|
-#endif
|
|
-
|
|
#define TRUE 1
|
|
#define FALSE 0
|
|
|
|
diff --git a/cde/lib/tt/bin/dbck/spec.C b/cde/lib/tt/bin/dbck/spec.C
|
|
index 18bba3fb..eaf2d6b7 100644
|
|
--- a/cde/lib/tt/bin/dbck/spec.C
|
|
+++ b/lib/tt/bin/dbck/spec.C
|
|
@@ -44,14 +44,6 @@
|
|
#include "ttdbck.h"
|
|
#include "tt_db_server_consts.h"
|
|
|
|
-#if !defined(OPT_STRERROR)
|
|
-// No strerror(), fake it
|
|
-char *
|
|
-strerror(int e)
|
|
-{
|
|
- return ((e<sys_nerr) ? sys_errlist[e] : "unknown");
|
|
-}
|
|
-#endif
|
|
|
|
Spec::
|
|
Spec()
|
|
diff --git a/cde/lib/tt/lib/tt_options.h b/cde/lib/tt/lib/tt_options.h
|
|
index e23bb9e5..de3a30e2 100644
|
|
--- a/cde/lib/tt/lib/tt_options.h
|
|
+++ b/lib/tt/lib/tt_options.h
|
|
@@ -107,10 +107,6 @@
|
|
* OPT_CPP_OPTIONS - string, options to pass to cpp. For example, on
|
|
* some platforms -B is used so C++ comments are processed by cpp.
|
|
*
|
|
- *
|
|
- * OPT_STRERROR - set if strerror() is available, otherwise we assume
|
|
- * global symbol sys_errlist is defined in errno.h.
|
|
- *
|
|
* OPT_SVR4_GETMNTENT - set to use new SVR4 flavor of getmntent.
|
|
*
|
|
* OPT_LOCKF_MNTTAB - set to hold a lockf lock on MNTTAB while doing
|
|
@@ -242,7 +238,6 @@
|
|
# undef OPT_SYSINFO
|
|
# define OPT_CPP_PATH "/usr/ccs/lib/cpp"
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_DEFINE_SIG_PF
|
|
@@ -273,7 +268,6 @@
|
|
# undef OPT_SYSINFO
|
|
# define OPT_CPP_PATH "/usr/lib/cpp"
|
|
# define OPT_CPP_OPTIONS "-B"
|
|
-# undef OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_42
|
|
@@ -302,7 +296,6 @@
|
|
# define OPT_CATGETS
|
|
# undef OPT_GETDTABLESIZE
|
|
# define OPT_SYSINFO
|
|
-# define OPT_STRERROR
|
|
# define OPT_CPP_PATH "/usr/ccs/lib/cpp"
|
|
# define OPT_CPP_OPTIONS "-B"
|
|
# define OPT_SVR4_GETMNTENT
|
|
@@ -389,7 +382,6 @@
|
|
# define OPT_CPP_PATH "/opt/langtools/lbin/cpp"
|
|
# endif
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_HFS
|
|
@@ -415,7 +407,6 @@
|
|
# undef OPT_SYSINFO
|
|
# define OPT_CPP_PATH "/usr/bin/cpp"
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE "ext2fs"
|
|
@@ -446,7 +437,6 @@
|
|
# undef OPT_SYSINFO
|
|
# define OPT_CPP_PATH "/usr/libexec/cpp"
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_UFS
|
|
@@ -479,7 +469,6 @@
|
|
# define OPT_CPP_PATH "/usr/libexec/cpp"
|
|
# endif
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_UFS
|
|
@@ -509,7 +498,6 @@
|
|
# undef OPT_SYSINFO
|
|
# define OPT_CPP_PATH "/usr/bin/cpp"
|
|
# define OPT_CPP_OPTIONS ""
|
|
-# define OPT_STRERROR
|
|
# undef OPT_SVR4_GETMNTENT
|
|
# undef OPT_LOCKF_MNTENT
|
|
# define OPT_LOCAL_MOUNT_TYPE MNTTYPE_UFS
|
|
diff --git a/cde/programs/dtcm/dtcm/dnd.c b/cde/programs/dtcm/dtcm/dnd.c
|
|
index abc58c12..f37f19a6 100644
|
|
--- a/cde/programs/dtcm/dtcm/dnd.c
|
|
+++ b/programs/dtcm/dtcm/dnd.c
|
|
@@ -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];
|
|
|
|
diff --git a/cde/programs/dtcm/libDtCmP/util.c b/cde/programs/dtcm/libDtCmP/util.c
|
|
index d33b8ba1..6de4739d 100644
|
|
--- a/cde/programs/dtcm/libDtCmP/util.c
|
|
+++ b/programs/dtcm/libDtCmP/util.c
|
|
@@ -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
|
|
|
|
diff --git a/cde/programs/dthelp/parser.ccdf/volumegen/Volumegen.c b/cde/programs/dthelp/parser.ccdf/volumegen/Volumegen.c
|
|
index d9a42943..08de4809 100644
|
|
--- a/cde/programs/dthelp/parser.ccdf/volumegen/Volumegen.c
|
|
+++ b/programs/dthelp/parser.ccdf/volumegen/Volumegen.c
|
|
@@ -56,7 +56,6 @@
|
|
typedef int Boolean;
|
|
|
|
/* extern int errno; */
|
|
-/* extern char *sys_errlist[]; */
|
|
/* extern int sys_nerr; */
|
|
|
|
static void GenTopicList (
|
|
diff --git a/cde/programs/dtimsstart/remote.c b/cde/programs/dtimsstart/remote.c
|
|
index 68773673..71d32977 100644
|
|
--- a/cde/programs/dtimsstart/remote.c
|
|
+++ b/programs/dtimsstart/remote.c
|
|
@@ -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)
|
|
diff --git a/cde/programs/dtimsstart/start.c b/cde/programs/dtimsstart/start.c
|
|
index 78fc2a38..1dafa189 100644
|
|
--- a/cde/programs/dtimsstart/start.c
|
|
+++ b/programs/dtimsstart/start.c
|
|
@@ -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);
|
|
diff --git a/cde/programs/dtinfo/dtinfo/src/external-api/comm.c b/cde/programs/dtinfo/dtinfo/src/external-api/comm.c
|
|
index d61ccb7a..6aa2fc91 100644
|
|
--- a/cde/programs/dtinfo/dtinfo/src/external-api/comm.c
|
|
+++ b/programs/dtinfo/dtinfo/src/external-api/comm.c
|
|
@@ -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;
|
|
diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/string/fmterror.c b/cde/programs/dtksh/ksh93/src/lib/libast/string/fmterror.c
|
|
index 313b67bc..8dd87ab8 100644
|
|
--- a/cde/programs/dtksh/ksh93/src/lib/libast/string/fmterror.c
|
|
+++ b/programs/dtksh/ksh93/src/lib/libast/string/fmterror.c
|
|
@@ -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);
|
|
}
|
|
diff --git a/cde/programs/dtksh/ksh93/src/lib/libast/string/strerror.c b/cde/programs/dtksh/ksh93/src/lib/libast/string/strerror.c
|
|
index 7686a54d..a6aa7ce8 100644
|
|
--- a/cde/programs/dtksh/ksh93/src/lib/libast/string/strerror.c
|
|
+++ b/programs/dtksh/ksh93/src/lib/libast/string/strerror.c
|
|
@@ -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
|
|
diff --git a/cde/programs/dtlogin/dm.h b/cde/programs/dtlogin/dm.h
|
|
index 3e0f2499..e67edc3c 100644
|
|
--- a/cde/programs/dtlogin/dm.h
|
|
+++ b/programs/dtlogin/dm.h
|
|
@@ -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;
|
|
|
|
|
|
--
|
|
2.28.0
|
|
|