lynx-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LYNX-DEV lynx2-7-1ac0.94 patches


From: Philippe De Muyter
Subject: LYNX-DEV lynx2-7-1ac0.94 patches
Date: Mon, 17 Nov 1997 19:55:22 +0100 (MET)

Here are the changes I needed to make to lynx2-7-1ac-0.94 to be able to
compile and run it on sysV68 (m68k-motorola-sysv).  Please consider them
for inclusion in the main source tree of lynx.

Thanks in advance

Philippe De Muyter (address@hidden)

* Check for existence of sys/wait.h. - PHDM
* Do not include sys/stat.h twice. - PHDM
* New autoconf-macros to check if a function is declared after including a
specific set of files. - PHDM
* Declare strstr if it is not declared by string.h. - PHDM
* Declare getgrgid and getgrnam if not declared by grp.h. - PHDM
* Provide strstr and mktime implementations, and use them if needed. - PHDM
* Always include sys/types.h in HTUtils.h. - PHDM
* define NO_GROUPS if we do not have getgroups. - PHDM
* define NEED_REMOVE also if test yields unknown. - PHDM
* define mode_t if not done by system include files. - PHDM (address@hidden)

--- /tmp/dm33466        Mon Nov 17 19:23:05 1997
+++ ./src/LYLocal.c     Fri Nov 14 14:36:47 1997
@@ -47,7 +47,9 @@
 
 #ifndef VMS
 #ifndef _WINDOWS
+#ifdef HAVE_SYS_WAIT_H
 #include <sys/wait.h>
+#endif
 #include <errno.h>
 #include <grp.h>
 #endif /*_WINDOWS */
--- /tmp/dm33466        Mon Nov 17 19:23:06 1997
+++ ./src/LYLocal.h     Mon Nov 17 19:15:42 1997
@@ -7,8 +7,10 @@
 #include <types.h>
 #include <stat.h>
 #else
+#if 0 /* already included in tcp.h */
 #include <sys/types.h>
 #include <sys/stat.h>
+#endif
 #endif /* VMS */
 
 #ifndef S_IRWXU 
--- /tmp/dm33466        Mon Nov 17 19:23:06 1997
+++ ./src/LYStrings.h   Fri Nov 14 11:00:43 1997
@@ -2,9 +2,6 @@
 #define LYSTRINGS_H
 
 #include <string.h>
-#ifdef __STRICT_BSD__
-extern char *strstr();
-#endif /* __STRICT_BSD__ */
 
 extern int get_mouse_link NOPARAMS;
 extern char * LYstrncpy PARAMS((
--- /tmp/dm33466        Mon Nov 17 19:23:08 1997
+++ ./src/strstr.c      Mon Nov 17 19:15:00 1997
@@ -0,0 +1,70 @@
+/*
+ * strstr.c -- return the offset of one string within another.
+ *
+ * Copyright (C) 1997 Free Software Foundation, Inc. 
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2, or (at your option) any later
+ * version. 
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details. 
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ */
+
+/* Written by Philippe De Muyter <address@hidden>.  */
+
+/*
+ * NAME 
+ *
+ * strstr -- locate first occurence of a substring 
+ *
+ * SYNOPSIS 
+ *
+ * char *strstr (char *s1, char *s2) 
+ *
+ * DESCRIPTION 
+ *
+ * Locates the first occurence in the string pointed to by S1 of the string
+ * pointed to by S2.  Returns a pointer to the substring found, or a NULL
+ * pointer if not found.  If S2 points to a string with zero length, the
+ * function returns S1. 
+ *
+ * BUGS 
+ *
+ */
+
+char *
+strstr (buf, sub)
+     register char *buf;
+     register char *sub;
+{
+  register char *bp;
+
+  if (!*sub)
+    return buf;
+  for (;;)
+    {
+      if (!*buf)
+       break;
+      bp = buf;
+      for (;;)
+       {
+         if (!*sub)
+           return buf;
+         if (*bp++ != *sub++)
+           break;
+       }
+      sub -= (unsigned long) bp;
+      sub += (unsigned long) buf;
+      buf += 1;
+    }
+  return 0;
+}
+
--- /tmp/dm33466        Mon Nov 17 19:23:08 1997
+++ ./src/makefile.in   Fri Nov 14 15:23:43 1997
@@ -49,7 +49,7 @@
 HTML.o HTFWriter.o HTInit.o DefaultStyle.o LYLocal.o LYUpload.o \
 LYLeaks.o LYexit.o LYJump.o LYList.o LYCgi.o LYTraversal.o \
 LYEditmap.o LYCharSets.o LYCharUtils.o LYMap.o LYCookie.o LYExtern.o \
-LYStyle.o LYHash.o @EXTRA_OBJS@
+LYStyle.o LYHash.o @EXTRA_OBJS@ @LIBOBJS@
 
 C_SRC  = $(OBJS:.o=.c)
 
--- /tmp/dm33466        Mon Nov 17 19:23:08 1997
+++ ./src/mktime.c      Mon Nov 17 19:14:54 1997
@@ -0,0 +1,77 @@
+/*
+ * mktime.c -- converts a struct tm into a time_t
+ *
+ * Copyright (C) 1997 Free Software Foundation, Inc. 
+ *
+ * This program is free software; you can redistribute it and/or modify it 
under
+ * the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2, or (at your option) any later
+ * version. 
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details. 
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59
+ * Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
+ */
+
+/* Written by Philippe De Muyter <address@hidden>.  */
+
+#include       <time.h>
+
+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/dm33466        Mon Nov 17 19:23:09 1997
+++ ./WWW/Library/Implementation/HTUtils.h      Fri Nov 14 12:25:43 1997
@@ -16,6 +16,7 @@
 
 #ifdef HAVE_CONFIG_H
 #include <lynx_cfg.h>  /* generated by autoconf 'configure' script */
+#include <sys/types.h>
 #else
 
 /* Explicit system-configure */
--- /tmp/dm33466        Mon Nov 17 19:23:10 1997
+++ ./WWW/Library/Implementation/HTFile.c       Fri Nov 14 22:43:31 1997
@@ -1134,6 +1134,9 @@ PRIVATE int HTCreatePath ARGS1(CONST cha
 **     1.      No code for non-unix systems.
 **     2.      Isn't there a quicker way?
 */
+#ifndef HAVE_GETGROUPS
+#define NO_GROUPS
+#endif
 #ifdef VMS
 #define NO_GROUPS
 #endif /* VMS */
--- /tmp/dm33466        Mon Nov 17 19:23:10 1997
+++ ./aclocal.m4        Fri Nov 14 15:52:13 1997
@@ -923,7 +923,7 @@ AC_MSG_CHECKING(if NGROUPS is defined)
        ])
 ])
 AC_MSG_RESULT($cf_cv_baddef_remove)
-test "$cf_cv_baddef_remove" = yes && AC_DEFINE(NEED_REMOVE)
+test "$cf_cv_baddef_remove" != no && AC_DEFINE(NEED_REMOVE)
 ])dnl
 dnl ---------------------------------------------------------------------------
 dnl Check for definitions & structures needed for window size-changing
@@ -1251,3 +1251,38 @@ AC_MSG_CHECKING(if struct utmp is declar
 fi
 fi
 ])dnl
+dnl ---------------------------------------------------------------------------
+dnl check if a function is declared by including a set of include files.
+dnl and define HAVE_XXX_DECLARATION accordingly
+dnl CF_CHECK_FUNCDECL(INCLUDES, FUNCTION, [ACTION-IF-FOUND [, 
ACTION-IF-NOT-FOUND]])
+AC_DEFUN(CF_CHECK_FUNCDECL,
+[AC_MSG_CHECKING([for $2 declaration])
+AC_CACHE_VAL(ac_cv_func_decl_$2,
+[AC_TRY_COMPILE([$1],
+[#ifndef ${ac_func}
+int    (*p)() = ${ac_func};
+#endif],
+eval "ac_cv_func_decl_$2=yes", eval "ac_cv_func_decl_$2=no")])dnl
+if eval "test \"`echo '$ac_cv_func_'decl_$2`\" = yes"; then
+  AC_MSG_RESULT(yes)
+  ifelse([$3], , :, [$3])
+else
+  AC_MSG_RESULT(no)
+ifelse([$4], , , [$4
+])dnl
+fi
+])
+dnl ---------------------------------------------------------------------------
+dnl check if functions are declared by including a set of include files.
+dnl and define HAVE_XXX_DECLARATION accordingly
+dnl CF_CHECK_FUNCDECLS(INCLUDES, FUNCTION... [, ACTION-IF-FOUND [, 
ACTION-IF-NOT-FOUND]])
+AC_DEFUN(CF_CHECK_FUNCDECLS,
+[for ac_func in $2
+do
+CF_CHECK_FUNCDECL([$1], $ac_func,
+[changequote(, )dnl
+  ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 
'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`_DECLARATION
+changequote([, ])dnl
+  AC_DEFINE_UNQUOTED($ac_tr_func) $3], $4)dnl
+done
+])
--- /tmp/dm33466        Mon Nov 17 19:23:11 1997
+++ ./configure.in      Fri Nov 14 22:32:31 1997
@@ -297,12 +297,14 @@ slang)
        sys/ioctl.h \
        sys/param.h \
        sys/time.h \
+       sys/wait.h \
        termio.h \
        termios.h \
        unistd.h \
 )
 CF_TERMIO_AND_TERMIOS
 CF_FUNC_WAIT
+AC_TYPE_MODE_T
 
 dnl --------------------------------------------------------------------------
 dnl Checks for library units
@@ -313,10 +315,15 @@ slang)
 AC_CHECK_FUNCS( \
        cuserid \
        getcwd \
+       getgroups \
        putenv \
        readdir \
        waitpid \
 )
+AC_REPLACE_FUNCS( \
+       mktime \
+       strstr \
+)
 
 dnl --------------------------------------------------------------------------
 dnl Checks for external-data
@@ -487,6 +494,9 @@ AC_MSG_CHECKING(if you want to use zlib 
                           disable \"Up-to\" links in directory listings],
        [AC_DEFINE(NO_PARENT_DIR_REFERENCE)])
 AC_MSG_RESULT($enableval)
+
+CF_CHECK_FUNCDECLS([#include <string.h>], strstr)
+CF_CHECK_FUNCDECLS([#include <grp.h>], getgrgid getgrnam)
 
 ### Finally, build config.h and the makefiles
 CFLAGS="$CFLAGS $EXTRA_CFLAGS"
--- /tmp/dm33466        Mon Nov 17 19:23:13 1997
+++ ./config.hin        Fri Nov 14 22:45:40 1997
@@ -21,6 +21,9 @@
 #undef HAVE_FCNTL_H            /* have <fcntl.h> */
 #undef HAVE_GETBKGD            /* defined by CF_COLOR_CURSES */
 #undef HAVE_GETCWD
+#undef HAVE_GETGROUPS
+#undef HAVE_GETGRGID_DECLARATION
+#undef HAVE_GETGRNAM_DECLARATION
 #undef HAVE_KEYPAD
 #undef HAVE_LIMITS_H
 #undef HAVE_NCURSES_H          /* defined if we include <ncurses.h> */
@@ -28,11 +31,13 @@
 #undef HAVE_READDIR
 #undef HAVE_SIZECHANGE         /* defined by CF_SIZECHANGE */
 #undef HAVE_STRING_H
+#undef HAVE_STRSTR_DECLARATION
 #undef HAVE_SYS_DIR_H          /* defined by AC_HEADER_DIRENT */
 #undef HAVE_SYS_FCNTL_H                /* have <sys/fcntl.h> */
 #undef HAVE_SYS_FILIO_H                /* have <sys/filio.h> */
 #undef HAVE_SYS_IOCTL_H                /* have <sys/ioctl.h> */
 #undef HAVE_SYS_NDIR_H         /* defined by AC_HEADER_DIRENT */
+#undef HAVE_SYS_WAIT_H         /* have <sys/wait.h> */
 #undef HAVE_TERMIOS_H          /* have <termios.h> */
 #undef HAVE_TTYTYPE
 #undef HAVE_TYPE_UNIONWAIT     /* CF_UNION_WAIT */
@@ -85,6 +90,7 @@
 #undef ZCAT_PATH               /* CF_PATH_PROG(zcat) */
 #undef ZIP_PATH                        /* CF_PATH_PROG(zip) */
 #undef const                   /* defined by AC_C_CONST */
+#undef mode_t                  /* defined by AC_TYPE_MODE_T */
 #undef vfork                   /* defined by AC_FUNC_FORK */
 /* FIXME:ALLOW_USERS_TO_CHANGE_EXEC_WITHIN_OPTIONS */
 /* FIXME:BSDI */
@@ -103,5 +109,17 @@
 /* FIXME:SOCKS */
 /* FIXME:SVR4_BSDSELECT */
 /* FIXME:SYSLOG_REQUESTED_URLS */
+
+#ifndef HAVE_GETGRGID_DECLARATION
+extern struct group * getgrgid ();
+#endif
+
+#ifndef HAVE_GETGRNAM_DECLARATION
+extern struct group * getgrnam ();
+#endif
+
+#ifndef HAVE_STRSTR_DECLARATION
+extern char * strstr ();
+#endif
 
 #endif /* LYNX_CFG_H */
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

[Prev in Thread] Current Thread [Next in Thread]