Let's have a look at build/config.h:

The comments at the top are misleading: the file is not automatically
generated by configure, and config.h.in doesn't exist.

The following constants are used to prevent conditional declaration of
some standard libc functions: HAVE_{MMAP,BSEARCH,GETHOSTNAME,GETOPT,
MEMCHR,MEMCPY,MEMMOVE,MEMSET,MKSTEMP,SETENV,SNPRINTF,STRDUP,STRERROR,
STRPBRK,STRSEP,STRTOL,STRTOUL,UNSETENV,VSNPRINTF}. OpenBSD does have
this functions in libc and thus doesn't need replacement functions, so
this cruft can be removed. (The corresponding prototypes in com_extern.h
can also be removed.)

Replacing 'const', 'mode_t', 'off_t', 'pid_t', 'size_t', 'ssize_t' and
'vfork' with a macro doesn't make sense for OpenBSD.

Following defines are unused in the code: STDC_HEADERS, TM_IN_SYS_TIME,
WORDS_BIGENDIAN, SPRINTF_RET_CHARPNT, HAVE_{FTRUNCATE_*,GETPAGESIZE,
REVOKE,SELECT,ST_BLKSIZE,VALLOC,VFORK_H,SYS_SELECT_H,BROKEN_*} and can
thus be removed.

HAVE_PERL_INTERP and HAVE_PERL_5_0003_01 are passed via the Makefile, so
they don't have to exist in config.h.

The tcl support has been removed, so HAVE_TCL_INTERP is useless and the
code using it can be removed. The 'tcl' command remains as a stub.

HAVE_SYS_MMAN_H doesn't make sense, because OpenBSD requires <sys/mman.h>
for mmap.

See diff below; no binary change.

cheers,
natano


Index: build/config.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/build/config.h,v
retrieving revision 1.10
diff -u -r1.10 config.h
--- build/config.h      6 Nov 2014 10:48:52 -0000       1.10
+++ build/config.h      10 Nov 2014 07:52:25 -0000
@@ -1,151 +1,10 @@
 /*     $OpenBSD: config.h,v 1.10 2014/11/06 10:48:52 bentley Exp $     */
-/* config.h.  Generated automatically by configure.  */
-/* config.h.in.  Generated automatically from configure.in by autoheader.  */
-
-/* Define to empty if the keyword does not work.  */
-/* #undef const */
-
-/* Define if you have a working `mmap' system call.  */
-#define HAVE_MMAP 1
-
-/* Define if your struct stat has st_blksize.  */
-#define HAVE_ST_BLKSIZE 1
-
-/* Define if you have <vfork.h>.  */
-/* #undef HAVE_VFORK_H */
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-/* #undef mode_t */
-
-/* Define to `long' if <sys/types.h> doesn't define.  */
-/* #undef off_t */
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-/* #undef pid_t */
-
-/* Define to `unsigned' if <sys/types.h> doesn't define.  */
-/* #undef size_t */
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
-
-/* Define if your <sys/time.h> declares struct tm.  */
-/* #undef TM_IN_SYS_TIME */
-
-/* Define vfork as fork if vfork does not work.  */
-/* #undef vfork */
-
-/* Define if your processor stores words with the most significant
-   byte first (like Motorola and SPARC, unlike Intel and VAX).  */
-/* #undef WORDS_BIGENDIAN */
-
-/* Define to `int' if <sys/types.h> doesn't define.  */
-/* #undef ssize_t */
 
 /* Define if you want a debugging version. */
 /* #undef DEBUG */
 
-/* Define if you have a System V-style (broken) gettimeofday. */
-/* #undef HAVE_BROKEN_GETTIMEOFDAY */
-
-/* Define if you have a Ultrix-style (broken) vdisable. */
-/* #undef HAVE_BROKEN_VDISABLE */
-
-/* Define if you have the chsize(2) system call. */
-/* #undef HAVE_FTRUNCATE_CHSIZE */
-
-/* Define if you have the ftruncate(2) system call. */
-#define HAVE_FTRUNCATE_FTRUNCATE 1
-
 /* Define if you have fcntl(2) style locking. */
 /* #undef HAVE_LOCK_FCNTL */
 
 /* Define if you have flock(2) style locking. */
 #define HAVE_LOCK_FLOCK 1
-
-/* Define if you want to compile in the Perl interpreter. */
-/* #undef HAVE_PERL_INTERP */
-
-/* Define if your Perl is at least 5.003_01. */
-/* #undef HAVE_PERL_5_003_01 */
-
-/* Define if you have the Berkeley style revoke(2) system call. */
-#define HAVE_REVOKE 1
-
-/* Define if you have <sys/mman.h> */
-#define HAVE_SYS_MMAN_H 1
-
-/* Define if you have <sys/select.h> */
-/* #undef HAVE_SYS_SELECT_H */
-
-/* Define if you want to compile in the Tcl interpreter. */
-/* #undef HAVE_TCL_INTERP */
-
-/* Define if your sprintf returns a pointer, not a length. */
-/* #undef SPRINTF_RET_CHARPNT */
-
-/* Define if you have the bsearch function.  */
-#define HAVE_BSEARCH 1
-
-/* Define if you have the gethostname function.  */
-#define HAVE_GETHOSTNAME 1
-
-/* Define if you have the getopt function.  */
-#define HAVE_GETOPT 1
-
-/* Define if you have the getpagesize function.  */
-#define HAVE_GETPAGESIZE 1
-
-/* Define if you have the memchr function.  */
-#define HAVE_MEMCHR 1
-
-/* Define if you have the memcpy function.  */
-#define HAVE_MEMCPY 1
-
-/* Define if you have the memmove function.  */
-#define HAVE_MEMMOVE 1
-
-/* Define if you have the memset function.  */
-#define HAVE_MEMSET 1
-
-/* Define if you have the mkstemp function.  */
-#define HAVE_MKSTEMP 1
-
-/* Define if you have the mmap function.  */
-#define HAVE_MMAP 1
-
-/* Define if you have the select function.  */
-#define HAVE_SELECT 1
-
-/* Define if you have the setenv function.  */
-#define HAVE_SETENV 1
-
-/* Define if you have the snprintf function.  */
-#define HAVE_SNPRINTF 1
-
-/* Define if you have the strdup function.  */
-#define HAVE_STRDUP 1
-
-/* Define if you have the strerror function.  */
-#define HAVE_STRERROR 1
-
-/* Define if you have the strpbrk function.  */
-#define HAVE_STRPBRK 1
-
-/* Define if you have the strsep function.  */
-#define HAVE_STRSEP 1
-
-/* Define if you have the strtol function.  */
-#define HAVE_STRTOL 1
-
-/* Define if you have the strtoul function.  */
-#define HAVE_STRTOUL 1
-
-/* Define if you have the unsetenv function.  */
-#define HAVE_UNSETENV 1
-
-/* Define if you have the valloc function.  */
-#define HAVE_VALLOC 1
-
-/* Define if you have the vsnprintf function.  */
-#define HAVE_VSNPRINTF 1
Index: ex/ex_tag.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_tag.c,v
retrieving revision 1.17
diff -u -r1.17 ex_tag.c
--- ex/ex_tag.c 1 Dec 2013 19:26:37 -0000       1.17
+++ ex/ex_tag.c 10 Nov 2014 07:51:43 -0000
@@ -16,11 +16,7 @@
 
 #include <sys/param.h>
 #include <sys/types.h>         /* XXX: param.h may not have included types.h */
-
-#ifdef HAVE_SYS_MMAN_H
 #include <sys/mman.h>
-#endif
-
 #include <sys/queue.h>
 #include <sys/stat.h>
 #include <sys/time.h>
Index: ex/ex_tcl.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_tcl.c,v
retrieving revision 1.5
diff -u -r1.5 ex_tcl.c
--- ex/ex_tcl.c 27 Oct 2009 23:59:47 -0000      1.5
+++ ex/ex_tcl.c 10 Nov 2014 07:57:59 -0000
@@ -11,24 +11,14 @@
  * See the LICENSE file for redistribution information.
  */
 
-#include "config.h"
-
 #include <sys/types.h>
 #include <sys/queue.h>
 
 #include <bitstring.h>
-#include <limits.h>
 #include <stdio.h>
-#include <string.h>
-#include <termios.h>
-#include <unistd.h>
 
 #include "../common/common.h"
 
-#ifdef HAVE_TCL_INTERP
-#include <tcl.h>
-#endif
-
 /* 
  * ex_tcl -- :[line [,line]] tcl [command]
  *     Run a command through the tcl interpreter.
@@ -40,39 +30,6 @@
        SCR *sp;
        EXCMD *cmdp;
 {
-#ifdef HAVE_TCL_INTERP
-       CHAR_T *p;
-       GS *gp;
-       size_t len;
-       char buf[128];
-
-       /* Initialize the interpreter. */
-       gp = sp->gp;
-       if (gp->tcl_interp == NULL && tcl_init(gp))
-               return (1);
-
-       /* Skip leading white space. */
-       if (cmdp->argc != 0)
-               for (p = cmdp->argv[0]->bp,
-                   len = cmdp->argv[0]->len; len > 0; --len, ++p)
-                       if (!isblank(*p))
-                               break;
-       if (cmdp->argc == 0 || len == 0) {
-               ex_emsg(sp, cmdp->cmd->usage, EXM_USAGE);
-               return (1);
-       }
-
-       (void)snprintf(buf, sizeof(buf),
-           "set viScreenId %d\nset viStartLine %lu\nset viStopLine %lu",
-           sp->id, cmdp->addr1.lno, cmdp->addr2.lno);
-       if (Tcl_Eval(gp->tcl_interp, buf) == TCL_OK &&
-           Tcl_Eval(gp->tcl_interp, cmdp->argv[0]->bp) == TCL_OK)
-               return (0);
-
-       msgq(sp, M_ERR, "Tcl: %s", ((Tcl_Interp *)gp->tcl_interp)->result);
-       return (1);
-#else
        msgq(sp, M_ERR, "302|Vi was not loaded with a Tcl interpreter");
        return (1);
-#endif /* HAVE_TCL_INTERP */
 }
Index: include/com_extern.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/include/com_extern.h,v
retrieving revision 1.5
diff -u -r1.5 com_extern.h
--- include/com_extern.h        17 Feb 2002 19:42:34 -0000      1.5
+++ include/com_extern.h        10 Nov 2014 07:51:43 -0000
@@ -1,66 +1,5 @@
 /*     $OpenBSD: com_extern.h,v 1.5 2002/02/17 19:42:34 millert Exp $  */
 
-#ifndef HAVE_BSEARCH
-void   *bsearch(const void *, const void *, size_t,
-   size_t, int (*)(const void *, const void *));
-#endif
-#ifndef HAVE_SETENV
-int setenv(const char *, const char *, int);
-#endif
-#ifndef HAVE_UNSETENV
-void unsetenv(const char *);
-#endif
-#ifndef HAVE_GETHOSTNAME
-int gethostname(char *, int);
-#endif
-#ifndef HAVE_GETOPT
-int getopt(int, char * const *, const char *); 
-#endif
-#ifndef HAVE_MEMCHR
-void *memchr(const void *, int, size_t);
-#endif
-#ifndef HAVE_MEMCPY
-void *memcpy(void *, const void *, size_t);
-#endif
-#ifndef HAVE_MEMMOVE
-void *memmove(void *, const void *, size_t);
-#endif
-#ifndef HAVE_MEMSET
-void *memset(void *, int, size_t);
-#endif
-#ifndef HAVE_MKSTEMP
-int mkstemp(char *);
-#endif
-#ifndef HAVE_MMAP
-char *mmap(char *, size_t, int, int, int, off_t);
-#endif
-#ifndef HAVE_MMAP
-int munmap(char *, size_t);
-#endif
-#ifndef HAVE_SNPRINTF
-int snprintf(char *, size_t, const char *, ...);
-#endif
-#ifndef HAVE_STRDUP
-char *strdup(const char *);
-#endif
-#ifndef HAVE_STRERROR
-char *strerror(int);
-#endif
-#ifndef HAVE_STRPBRK
-char *strpbrk(const char *, const char *);
-#endif
-#ifndef HAVE_STRSEP
-char *strsep(char **, const char *);
-#endif
-#ifndef HAVE_STRTOL
-long strtol(const char *, char **, int);
-#endif
-#ifndef HAVE_STRTOUL
-unsigned long strtoul(const char *, char **, int);
-#endif
-#ifndef HAVE_VSNPRINTF
-int vsnprintf(char *, size_t, const char *, ...);
-#endif
 SCR *api_fscreen(int, char *);
 int api_aline(SCR *, recno_t, char *, size_t);
 int api_dline(SCR *, recno_t);

Reply via email to