From: Peter Maydell Date: Sun, 4 May 2008 16:09:08 +0000 (+0000) Subject: * bug #23163: various minor fixes for the benefit of older Unixes X-Git-Tag: PRE_POSIX_CONVERSION~67 X-Git-Url: http://git.marmaro.de/?p=mmh;a=commitdiff_plain;h=faa066cb24d3308ab5d2c40ed145ecb3940461bf * bug #23163: various minor fixes for the benefit of older Unixes (specifically SunOS 4): reintroduce strerror() substitute implementation; provide memmove() substitute implementation * bug #23163: fix broken 'build outside source directory' feature * bug #23162: sbr/dtime.c: fix stray HAVE_TM_GMTOFF that wasn't updated to the new macro name. --- diff --git a/ChangeLog b/ChangeLog index 620f47e..d4efbc6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2008-05-04 Peter Maydell + + * bug #23163: various minor fixes for the benefit of + older Unixes (specifically SunOS 4): + reintroduce strerror() substitute implementation + provide memmove() substitute implementation + + * bug #23163: fix accidentally broken 'build outside + source directory' feature + + * bug #23162: sbr/dtime.c: fix stray HAVE_TM_GMTOFF that + wasn't updated to the new macro name. + 2008-04-30 Peter Maydell * mts/smtp/smtp.c: provide a callback for SASL_CB_AUTHNAME diff --git a/config/Makefile.in b/config/Makefile.in index 6ca8308..482bca2 100644 --- a/config/Makefile.in +++ b/config/Makefile.in @@ -58,7 +58,7 @@ version.c: ${srcdir}/version.sh $(VERSION) > version.c config.o: config.c - $(COMPILE2) config.c + $(COMPILE2) $< install: diff --git a/configure.in b/configure.in index 6b21a32..c5a9050 100644 --- a/configure.in +++ b/configure.in @@ -534,7 +534,7 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [Define to 1 if you have the `sigsetjmp'.]) AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)]) -AC_REPLACE_FUNCS(snprintf strdup) +AC_REPLACE_FUNCS(memmove snprintf strerror strdup) dnl Look for the initgroups() declaration. On AIX 4.[13], Solaris 4.1.3, and dnl ULTRIX 4.2A the function is defined in libc but there's no declaration in diff --git a/sbr/Makefile.in b/sbr/Makefile.in index 37434d9..2927e3c 100644 --- a/sbr/Makefile.in +++ b/sbr/Makefile.in @@ -34,6 +34,8 @@ GNU_LIBTOOL = @GNU_LIBTOOL@ LINT = @LINT@ LINTFLAGS = @LINTFLAGS@ +LIBOBJS = @LIBOBJS@ + mailspool = @mailspool@ sendmailpath = @sendmailpath@ @@ -78,9 +80,9 @@ SRCS = addrsbr.c ambigsw.c atooi.c brkstring.c \ m_msgdef.c mf.c utils.c # source for compatibility functions -COMPAT = snprintf.c strdup.c +COMPAT = memmove.c snprintf.c strdup.c strerror.c -OBJS = $(SRCS:.c=.o) +OBJS = $(SRCS:.c=.o) $(LIBOBJS) # auxiliary files AUX = Makefile.in sigmsg.awk dtimep.lex @@ -102,13 +104,13 @@ lint: sigmsg.h # Note that some lexes (for example flex 2.5.4) require that there # be no space between -o and the output filename. dtimep.c: dtimep.lex - $(LEX) -o$@ dtimep.lex + $(LEX) -o$@ $< client.o: client.c - $(COMPILE2) client.c + $(COMPILE2) $< mts.o: mts.c - $(COMPILE2) mts.c + $(COMPILE2) $< pidstatus.o: sigmsg.h diff --git a/sbr/dtime.c b/sbr/dtime.c index 8cb4c79..1435955 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -169,7 +169,7 @@ dlocaltime (time_t *clock) if (tm->tm_isdst) tw.tw_flags |= TW_DST; -#ifdef HAVE_TM_GMTOFF +#ifdef HAVE_STRUCT_TM_TM_GMTOFF tw.tw_zone = tm->tm_gmtoff / 60; if (tm->tm_isdst) /* if DST is in effect */ tw.tw_zone -= 60; /* reset to normal offset */ diff --git a/sbr/memmove.c b/sbr/memmove.c new file mode 100644 index 0000000..62a303f --- /dev/null +++ b/sbr/memmove.c @@ -0,0 +1,11 @@ +/* public domain function from Jan Wolter Unix Incompatibility Notes */ +/* http://unixpapa.com/incnote/ */ +char *memmove(char *dst, char *src, int n) +{ + if (src > dst) + for ( ; n > 0; n--) + *(dst++)= *(src++); + else + for (dst+= n-1, src+= n-1; n > 0; n--) + *(dst--)= *(src--); +} diff --git a/sbr/strerror.c b/sbr/strerror.c new file mode 100644 index 0000000..d780955 --- /dev/null +++ b/sbr/strerror.c @@ -0,0 +1,21 @@ + +/* + * strerror.c -- get error message string + * + * $Id$ + */ + +#include + +extern int sys_nerr; +extern char *sys_errlist[]; + + +char * +strerror (int errnum) +{ + if (errnum > 0 && errnum < sys_nerr) + return sys_errlist[errnum]; + else + return NULL; +}