kopia lustrzana https://gitlab.com/sane-project/frontends
Added missing getenv, isfdtype, and vsyslog functions from sane-backends. Used
#include "../include/sane/config.h". Henning Meier-Geinitz <henning@meier-geinitz.de>DEVEL_2_0_BRANCH-1
rodzic
65fefb3ccc
commit
8083da3c40
|
@ -118,12 +118,18 @@
|
|||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getenv function. */
|
||||
#undef HAVE_GETENV
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the atexit function. */
|
||||
#undef HAVE_ATEXIT
|
||||
|
||||
/* Define if you have the isfdtype function. */
|
||||
#undef HAVE_ISFDTYPE
|
||||
|
||||
/* Define if you have the mkdir function. */
|
||||
#undef HAVE_MKDIR
|
||||
|
||||
|
@ -178,6 +184,9 @@
|
|||
/* Define if you have the valloc function. */
|
||||
#undef HAVE_VALLOC
|
||||
|
||||
/* Define if you have the vsyslog function. */
|
||||
#undef HAVE_VSYSLOG
|
||||
|
||||
/* Define if you have the snprintf function. */
|
||||
#undef HAVE_SNPRINTF
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@ COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
|
|||
@SET_MAKE@
|
||||
|
||||
LIBLIB_OBJS = alloca.o getopt.o getopt1.o strndup.o \
|
||||
strdup.o strsep.o snprintf.o usleep.o
|
||||
strdup.o strsep.o snprintf.o usleep.o isfdtype.o \
|
||||
vsyslog.o getenv.o
|
||||
LIBLIB_LTOBJS = alloca.lo getopt.lo getopt1.lo strndup.lo \
|
||||
strdup.lo strsep.lo snprintf.lo usleep.lo
|
||||
strdup.lo strsep.lo snprintf.lo usleep.lo isfdtype.lo \
|
||||
vsyslog.lo getenv.lo
|
||||
|
||||
TARGETS = $(LIBLIB_OBJS)
|
||||
TARGETS = liblib.a
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_ALLOCA
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
#include "../include/sane/config.h"
|
||||
|
||||
#ifndef HAVE_GETENV
|
||||
|
||||
char *
|
||||
getenv(const char *name)
|
||||
{
|
||||
char *retval = 0;
|
||||
#ifdef HAVE_OS2_H
|
||||
if (0 != DosScanEnv (buf, &retval))
|
||||
retval = 0;
|
||||
#else
|
||||
# error "Missing getenv() on this platform. Please implement."
|
||||
#endif
|
||||
return retval;
|
||||
}
|
||||
|
||||
#endif /* !HAVE_GETENV */
|
|
@ -27,7 +27,7 @@
|
|||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
#endif
|
||||
|
||||
#if !defined (__STDC__) || !__STDC__
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
#endif
|
||||
|
||||
#include "getopt.h"
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
#include "../include/sane/config.h"
|
||||
|
||||
#ifndef HAVE_ISFDTYPE
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int
|
||||
isfdtype(int fd, int fdtype)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
if (fstat(fd, &st) == -1) return 0; /* couldn't stat fd */
|
||||
|
||||
if (st.st_mode == 0)
|
||||
return 1; /* At least Irix doesn't seem to know socket type */
|
||||
#if defined(S_ISSOCK)
|
||||
return S_ISSOCK(st.st_mode) != 0;
|
||||
#elif defined(S_IFSOCK) && defined(S_IFMT)
|
||||
return (st.st_mode & S_IFMT) == S_IFSOCK;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* !HAVE_ISFDTYPE */
|
|
@ -1,4 +1,4 @@
|
|||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
|||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
|
|
@ -16,7 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
|||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
|
||||
#ifndef HAVE_STRNDUP
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
|||
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If
|
|||
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
|
||||
Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <config.h>
|
||||
#include <../include/sane/config.h>
|
||||
|
||||
#ifndef HAVE_USLEEP
|
||||
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
#include "../include/sane/config.h"
|
||||
|
||||
#include "stdio.h"
|
||||
#include <syslog.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
#ifndef HAVE_VSYSLOG
|
||||
|
||||
void
|
||||
vsyslog(int priority, const char *format, va_list args)
|
||||
{
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
syslog(priority, "%s", buf);
|
||||
}
|
||||
|
||||
#endif /* !HAVE_VSYSLOG */
|
Ładowanie…
Reference in New Issue