From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Philippe De Muyter" To: law@cygnus.com Cc: egcs@cygnus.com Subject: Re: New dejagnu snapshot Date: Thu, 09 Oct 1997 15:14:00 -0000 Message-id: <199710092041.WAA00557@mail.macqel.be> References: <4928.876241048@hurl.cygnus.com> X-SW-Source: 1997-10/msg00375.html Here are some changes I needed to make to dejagnu-971006 to compile it and make it almost pass (except 5 non-blocking I/O/pipe/socket related) tcl check. For tcl/unix : Thu Oct 9 21:17:19 1997 Philippe De Muyter * tclUnixChan.c (CreateSocketAddress): Use h_addr, not h_addr_list[0]. * tclUnixFcmd.c (utime.h): Include that file only if HAVE_UTIME_H. (TclpCopyFile): Use mknod, not mkfifo, if !HAVE_MKFIFO. * configure.in (AC_CHECK_FUNCS): Check for mkfifo. (AC_REPLACE_FUNCS): Check for strftime and mktime. * Makefile.in (LIBS): Do not include -lc. (mktime.o, strftime.o): New targets. * tclUnixTime.c (TclpGetTZName): New function. For tcl/tests : Thu Oct 9 21:14:59 1997 Philippe De Muyter * binary.test (binary-37.9): New name for second binary-37.8 test. For tcl/compat : Thu Oct 9 21:07:33 1997 Philippe De Muyter * strftime.c (string.h, locale.h): Do not include those files. (strftime): New function name, instead of TclStrftime. * mktime.c: New file. For expect : Thu Oct 9 21:04:25 1997 Philippe De Muyter * exp_tty_in.h (HAVE_TERMIO): If HAVE_TERMIO, undef HAVE_SGTTYB. * exp_tty.c (sys/stat.h): Include sys/types.h before sys/stat.h. --- /tmp/dm31134 Thu Oct 9 22:27:47 1997 +++ ./expect/exp_tty_in.h Thu Oct 9 13:03:21 1997 @@ -43,6 +43,7 @@ #endif #if defined(HAVE_TERMIO) && !defined(HAVE_TERMIOS) +# undef HAVE_SGTTYB # include # undef POSIX # define TERMINAL termio --- /tmp/dm31134 Thu Oct 9 22:27:47 1997 +++ ./expect/exp_tty.c Thu Oct 9 13:07:45 1997 @@ -11,9 +11,8 @@ # include #endif -#include - #include +#include #ifdef HAVE_UNISTD_H # include --- /tmp/dm31134 Thu Oct 9 22:27:48 1997 +++ ./tcl/compat/strftime.c Thu Oct 9 22:27:40 1997 @@ -50,8 +50,6 @@ #endif /* LIBC_SCCS and not lint */ #include -#include -#include #include "tclInt.h" #include "tclPort.h" @@ -106,7 +104,7 @@ const struct tm *t)); size_t -TclStrftime(s, maxsize, format, t) +strftime(s, maxsize, format, t) char *s; size_t maxsize; const char *format; --- /tmp/dm31134 Thu Oct 9 22:27:48 1997 +++ ./tcl/compat/mktime.c Thu Oct 9 12:54:13 1997 @@ -0,0 +1,90 @@ +/* + * Copyright (c) 1997 + * The Regents of the University of California. All rights reserved. + * + * This code is contributed by Philippe De Muyter (phdm@macqel.be). + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include + +static time_t +mkgmtime(t) +register struct tm *t; + { + register short month, year; + register long time; + static int m_to_d[12] = + {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; + + month = t->tm_mon; + year = t->tm_year + month / 12 + 1900; + month %= 12; + if (month < 0) + { + year -= 1; + month += 12; + } + time = (year - 1970) * 365 + (year - 1969) / 4 + m_to_d[month]; + time = (year - 1970) * 365 + m_to_d[month]; + if (month <= 1) + year -= 1; + time += (year - 1968) / 4; + time -= (year - 1900) / 100; + time += (year - 1600) / 400; + time += t->tm_mday; + time -= 1; + time *= 24; + time += t->tm_hour; + time *= 60; + time += t->tm_min; + time *= 60; + time += t->tm_sec; + return(time); + } + +/* +** mktime -- convert tm struct to time_t +** if tm_isdst >= 0 use it, else compute it +*/ + +time_t +mktime(t) +struct tm *t; + { + time_t clock; + + tzset(); + clock = mkgmtime(t) + timezone; + if (t->tm_isdst > 0 + || (t->tm_isdst < 0 && localtime(&clock)->tm_isdst)) + clock -= 3600; + return(clock); + } --- /tmp/dm31134 Thu Oct 9 22:27:49 1997 +++ ./tcl/tests/binary.test Thu Oct 9 14:02:11 1997 @@ -1312,7 +1312,7 @@ set arg1 foo list [binary scan abcdef "a0x3" arg1] $arg1 } {1 {}} -test binary-37.8 {GetFormatSpec: numbers} { +test binary-37.9 {GetFormatSpec: numbers} { # test format of neg numbers # bug report/fix provided by Harald Kirsch set x [binary format f* {1 -1 2 -2 0}] --- /tmp/dm31134 Thu Oct 9 22:27:49 1997 +++ ./tcl/unix/tclUnixChan.c Wed Oct 8 20:07:42 1997 @@ -2009,7 +2009,7 @@ CreateSocketAddress(sockaddrPtr, host, p hostent = gethostbyname(host); if (hostent != NULL) { memcpy((VOID *) &addr, - (VOID *) hostent->h_addr_list[0], + (VOID *) hostent->h_addr, (size_t) hostent->h_length); } else { #ifdef EHOSTUNREACH --- /tmp/dm31134 Thu Oct 9 22:27:49 1997 +++ ./tcl/unix/tclUnixFCmd.c Wed Oct 8 20:44:35 1997 @@ -49,7 +49,15 @@ #include "tclInt.h" #include "tclPort.h" +#if HAVE_UTIME_H #include +#else +struct utimbuf + { + time_t actime; + time_t modtime; + }; +#endif #include /* @@ -312,6 +320,9 @@ TclpCopyFile(src, dst) return CopyFileAtts(src, dst, &srcStatBuf); case S_IFIFO: +#ifndef HAVE_MKFIFO +#define mkfifo(n, m) mknod(n, S_IFIFO|(m), 0) +#endif if (mkfifo(dst, srcStatBuf.st_mode) < 0) { return TCL_ERROR; } --- /tmp/dm31134 Thu Oct 9 22:27:50 1997 +++ ./tcl/unix/configure.in Thu Oct 9 11:22:24 1997 @@ -87,9 +87,9 @@ AC_CHECK_FUNCS(getcwd, , AC_DEFINE(USEGE # Nb: if getcwd uses popen and pwd(1) (like Solaris) we should really # define USEGETWD even if the posix getcwd exists. Add a test ? -AC_REPLACE_FUNCS(opendir strstr) +AC_CHECK_FUNCS(mkfifo) -AC_REPLACE_FUNCS(strtol tmpnam waitpid) +AC_REPLACE_FUNCS(opendir strtol tmpnam waitpid strftime mktime) AC_CHECK_FUNC(strerror, , AC_DEFINE(NO_STRERROR)) AC_CHECK_FUNC(getwd, , AC_DEFINE(NO_GETWD)) AC_CHECK_FUNC(wait3, , AC_DEFINE(NO_WAIT3)) --- /tmp/dm31134 Thu Oct 9 22:27:50 1997 +++ ./tcl/unix/Makefile.in Thu Oct 9 20:21:18 1997 @@ -211,7 +211,7 @@ ${AC_FLAGS} ${MATH_FLAGS} ${GENERIC_FLAGS} ${PROTO_FLAGS} ${MEM_DEBUG_FLAGS} \ ${COMPILE_DEBUG_FLAGS} ${ENV_FLAGS} -DTCL_SHLIB_EXT=\"${SHLIB_SUFFIX}\" -LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS) -lc +LIBS = @DL_LIBS@ @LIBS@ $(MATH_LIBS) DEPEND_SWITCHES = ${CFLAGS} -I${GENERIC_DIR} -I${SRC_DIR} \ ${AC_FLAGS} ${MATH_FLAGS} \ @@ -789,8 +789,14 @@ getcwd.o: $(COMPAT_DIR)/getcwd.c $(CC) -c $(CC_SWITCHES) $(COMPAT_DIR)/getcwd.c +mktime.o: $(COMPAT_DIR)/mktime.c + $(CC) -c $(CC_SWITCHES) $(COMPAT_DIR)/mktime.c + opendir.o: $(COMPAT_DIR)/opendir.c $(CC) -c $(CC_SWITCHES) $(COMPAT_DIR)/opendir.c + +strftime.o: $(COMPAT_DIR)/strftime.c + $(CC) -c $(CC_SWITCHES) $(COMPAT_DIR)/strftime.c strncasecmp.o: $(COMPAT_DIR)/strncasecmp.c $(CC) -c $(CC_SWITCHES) $(COMPAT_DIR)/strncasecmp.c --- /tmp/dm31134 Thu Oct 9 22:27:51 1997 +++ ./tcl/unix/tclUnixTime.c Thu Oct 9 11:25:02 1997 @@ -237,3 +237,33 @@ TclpGetTime(timePtr) timePtr->sec = tv.tv_sec; timePtr->usec = tv.tv_usec; } + +/* + *---------------------------------------------------------------------- + * + * TclpGetTZName -- + * + * Gets the current timezone string. + * + * Results: + * Returns a pointer to a static string, or NULL on failure. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +char * +TclpGetTZName() +{ + extern int daylight; + extern char *tzname[]; + + tzset(); + if (daylight && tzname[1] != NULL) { + return tzname[1]; + } else { + return tzname[0]; + } +}