Commit bdc70135 authored by Erwin Janssen's avatar Erwin Janssen

Remove definition and usage of HAVE_STRERROR

This function is part of the standard C library, checking is therefore not
needed. With this change, check that sets HAVE_ERRNO_DECLS and the file
lib/ast/strerror.c can both be removed.
parent 31daeae0
......@@ -62,18 +62,6 @@
#include <stdio.h>
#include <errno.h>
#ifndef HAVE_STRERROR
# ifndef HAVE_ERRNO_DECL
extern int errno;
extern int sys_nerr;
# if (linux)
extern const char *const sys_errlist[];
# else
extern char *sys_errlist[];
# endif
# endif
#endif
#include <sys/param.h>
#include <X11/cursorfont.h>
#include <X11/Intrinsic.h>
......@@ -609,7 +597,6 @@ FILE *SFopenFile (char *name, char *mode, char *prompt, char *failed) {
SFchdir (SFstartDir);
if ((fp = fopen (name, mode)) == NULL) {
char *buf;
#ifdef HAVE_STRERROR
char *errormsg = strerror (errno);
if (errormsg) {
buf = XtMalloc (
......@@ -618,17 +605,6 @@ FILE *SFopenFile (char *name, char *mode, char *prompt, char *failed) {
strcpy (buf, failed);
strcat (buf, errormsg);
strcat (buf, "\n");
#else
if (errno < sys_nerr) {
buf = XtMalloc (
strlen (failed) + strlen (sys_errlist[errno]) +
strlen (prompt) + 2
);
strcpy (buf, failed);
strcat (buf, sys_errlist[errno]);
strcat (buf, "\n");
strcat (buf, prompt);
#endif
} else {
buf = XtMalloc (strlen (failed) + strlen (prompt) + 2);
strcpy (buf, failed);
......
......@@ -19,7 +19,6 @@ lib srand48
lib sincos
lib strcasecmp
lib strncasecmp
lib strerror
hdr dirent
hdr dlfcn
......@@ -48,11 +47,6 @@ sys fpu
sys ndir
cat{ }end
dat errno stdio.h errno.h yes{
/* Define if errno is declared in system include files. */
#define HAVE_ERRNO_DECL 1
}end
# Specify internal structure of FILE.
# This is used to determine if more characters are waiting in the stream.
if mem - FILE._cnt stdio.h {
......
......@@ -461,7 +461,7 @@ AC_SUBST([LIBGEN_LIBS])
# Checks for library functions
AC_CHECK_FUNCS([lrand48 drand48 srand48 setmode setenv getenv \
strerror cbrt vsnprintf _NSGetEnviron])
cbrt vsnprintf _NSGetEnviron])
AC_REPLACE_FUNCS([strcasecmp strncasecmp strcasestr])
......@@ -3024,17 +3024,6 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
# -----------------------------------
AC_MSG_CHECKING(if errno externs are declared)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdio.h>
#include <errno.h>
]], [[if ( errno < sys_nerr ) return sys_errlist[errno];
]])],[AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_ERRNO_DECL,1,Define if errno externs are declared)
],[AC_MSG_RESULT(no)
])
# -----------------------------------
AC_MSG_CHECKING(if intptr_t is declared)
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <stdlib.h>
#include <stdint.h>
......
......@@ -9,6 +9,6 @@ noinst_LTLIBRARIES = libast_C.la
libast_C_la_SOURCES = pathpath.c sfstr.h chresc.c chrtoi.c error.c \
fmtbuf.c fmtesc.c pathaccess.c pathbin.c pathcanon.c pathcat.c \
pathexists.c pathfind.c pathgetlink.c \
strcopy.c stresc.c strmatch.c strton.c strerror.c
strcopy.c stresc.c strmatch.c strton.c
EXTRA_DIST = compat_unistd.h ast.vcxproj*
......@@ -99,7 +99,6 @@
<ClCompile Include="pathgetlink.c" />
<ClCompile Include="pathpath.c" />
<ClCompile Include="strcopy.c" />
<ClCompile Include="strerror.c" />
<ClCompile Include="stresc.c" />
<ClCompile Include="strmatch.c" />
<ClCompile Include="strton.c" />
......
......@@ -77,9 +77,6 @@
<ClCompile Include="strcopy.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="strerror.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stresc.c">
<Filter>Source Files</Filter>
</ClCompile>
......
/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
#include "config.h"
#ifndef HAVE_STRERROR
#include <errno.h>
extern int sys_nerr;
extern char *sys_errlist[];
char *strerror(int errorNumber)
{
if (errorNumber > 0 && errorNumber < sys_nerr) {
return sys_errlist[errorNumber];
} else {
return "";
}
}
#endif
......@@ -56,9 +56,6 @@
/* Define to 1 if you have the `drand48' function. */
/* #undef HAVE_DRAND48 */
/* Define if errno externs are declared */
/* #undef HAVE_ERRNO_DECL */
/* Define if you have the expat library */
#define HAVE_EXPAT 1
......@@ -228,9 +225,6 @@
/* Define to 1 if you have the `strcasecmp' function. */
//#define HAVE_STRCASECMP 1
/* Define to 1 if you have the `strerror' function. */
#define HAVE_STRERROR 1
/* Define to 1 if you have the <strings.h> header file. */
//#define HAVE_STRINGS_H 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment