summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/texinfo/lib
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2000-02-09 02:18:44 +0000
committerMarc Espie <espie@cvs.openbsd.org>2000-02-09 02:18:44 +0000
commit2daf2f782cfcd3aedc541b85f8623f97359545f0 (patch)
tree4612e42a561ef7634424adaa909d6a9f92866034 /gnu/usr.bin/texinfo/lib
parent328f35a635ee7b14c4d6f2dbddacba138e62219b (diff)
Merge conflicts, and a few details:
- Makefile.bsd-wrapper: man pages, disable NLS for now. - doc/Makefile.in: install man pages manually, remove buggy targets that would break `make clean'. - makeinfo/Makefile.in: shell failure ??? rework problematic line. - util/texindex.c: let maketempname create the file, remove race condition.
Diffstat (limited to 'gnu/usr.bin/texinfo/lib')
-rw-r--r--gnu/usr.bin/texinfo/lib/Makefile.am5
-rw-r--r--gnu/usr.bin/texinfo/lib/system.h131
2 files changed, 119 insertions, 17 deletions
diff --git a/gnu/usr.bin/texinfo/lib/Makefile.am b/gnu/usr.bin/texinfo/lib/Makefile.am
index 9e9f8776cbe..3aef660bf40 100644
--- a/gnu/usr.bin/texinfo/lib/Makefile.am
+++ b/gnu/usr.bin/texinfo/lib/Makefile.am
@@ -1,12 +1,13 @@
## Makefile.am for texinfo/lib.
-## $Id: Makefile.am,v 1.2 1999/01/11 16:38:11 espie Exp $
+## $Id: Makefile.am,v 1.3 2000/02/09 02:18:41 espie Exp $
## Run automake in .. to produce Makefile.in from this.
noinst_LIBRARIES = libtxi.a
INCLUDES = -I../intl
# Don't need to list alloca.c, etc., Automake includes them.
-libtxi_a_SOURCES = getopt.c getopt.h getopt1.c system.h xmalloc.c xstrdup.c
+libtxi_a_SOURCES = getopt.c getopt.h getopt1.c substring.c system.h \
+ xexit.c xmalloc.c xstrdup.c
libtxi_a_LIBADD = @LIBOBJS@ @ALLOCA@
libtxi_a_DEPENDENCIES = $(libtxi_a_LIBADD)
diff --git a/gnu/usr.bin/texinfo/lib/system.h b/gnu/usr.bin/texinfo/lib/system.h
index fd2e858a381..6cc359b655a 100644
--- a/gnu/usr.bin/texinfo/lib/system.h
+++ b/gnu/usr.bin/texinfo/lib/system.h
@@ -1,7 +1,7 @@
-/* system.h: System-dependent declarations. Include this first.
- $Id: system.h,v 1.2 1999/01/11 16:38:11 espie Exp $
+/* system.h: system-dependent declarations; include this first.
+ $Id: system.h,v 1.3 2000/02/09 02:18:41 espie Exp $
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 98, 99 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
@@ -37,7 +37,22 @@
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
+#ifndef HAVE_SETLOCALE
+#define setlocale(category,locale) /* empty */
+#endif
+
+/* For gettext (NLS). */
#include <libintl.h>
+#define _(String) gettext (String)
+#define N_(String) (String)
+
+#ifdef STDC_HEADERS
+#define getopt system_getopt
+#include <stdlib.h>
+#undef getopt
+#else
+extern char *getenv ();
+#endif
/* Don't use bcopy! Use memmove if source and destination may overlap,
memcpy otherwise. */
@@ -51,18 +66,6 @@
char *memchr ();
#endif
-#ifdef STDC_HEADERS
-#define getopt system_getopt
-#include <stdlib.h>
-#undef getopt
-#else
-extern char *getenv ();
-#endif
-
-#ifndef HAVE_STRERROR
-extern char *strerror ();
-#endif
-
#include <errno.h>
#ifndef errno
extern int errno;
@@ -71,7 +74,29 @@ extern int errno;
#include <perror.h>
#endif
+#ifndef HAVE_DECL_STRERROR
+extern char *strerror ();
+#endif
+
+#ifndef HAVE_DECL_STRCASECMP
+extern int strcasecmp ();
+#endif
+
+#ifndef HAVE_DECL_STRNCASECMP
+extern int strncasecmp ();
+#endif
+
+#ifndef HAVE_DECL_STRCOLL
+extern int strcoll ();
+#endif
+
#include <sys/stat.h>
+#if STAT_MACROS_BROKEN
+# undef S_ISDIR
+#endif
+#if !defined(S_ISDIR) && defined(S_IFDIR)
+# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
+#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
@@ -89,6 +114,77 @@ extern int errno;
#endif /* not HAVE_FCNTL_H */
#endif /* not O_RDONLY */
+/* MS-DOS and similar non-Posix systems have some peculiarities:
+ - they distinguish between binary and text files;
+ - they use both `/' and `\\' as directory separator in file names;
+ - they can have a drive letter X: prepended to a file name;
+ - they have a separate root directory on each drive;
+ - their filesystems are case-insensitive;
+ - directories in environment variables (like INFOPATH) are separated
+ by `;' rather than `:';
+ - text files can have their lines ended either with \n or with \r\n pairs;
+
+ These are all parameterized here except the last, which is
+ handled by the source code as appropriate (mostly, in info/). */
+#ifndef O_BINARY
+# ifdef _O_BINARY
+# define O_BINARY _O_BINARY
+# else
+# define O_BINARY 0
+# endif
+#endif /* O_BINARY */
+
+#if O_BINARY
+# include <io.h>
+# ifdef __MSDOS__
+# include <limits.h>
+# ifdef __DJGPP__
+# define HAVE_LONG_FILENAMES(dir) (pathconf (dir, _PC_NAME_MAX) > 12)
+# define NULL_DEVICE "/dev/null"
+# else /* !__DJGPP__ */
+# define HAVE_LONG_FILENAMES(dir) (0)
+# define NULL_DEVICE "NUL"
+# endif /* !__DJGPP__ */
+# define SET_SCREEN_SIZE_HELPER terminal_prep_terminal()
+# define DEFAULT_INFO_PRINT_COMMAND ">PRN"
+# else /* !__MSDOS__ */
+# define setmode(f,m) _setmode(f,m)
+# define HAVE_LONG_FILENAMES(dir) (1)
+# define NULL_DEVICE "NUL"
+# endif /* !__MSDOS__ */
+# define SET_BINARY(f) do {if (!isatty(f)) setmode(f,O_BINARY);} while(0)
+# define FOPEN_RBIN "rb"
+# define FOPEN_WBIN "wb"
+# define IS_SLASH(c) ((c) == '/' || (c) == '\\')
+# define HAVE_DRIVE(n) ((n)[0] && (n)[1] == ':')
+# define IS_ABSOLUTE(n) (IS_SLASH((n)[0]) || ((n)[0] && (n)[1] == ':'))
+# define FILENAME_CMP strcasecmp
+# define FILENAME_CMPN strncasecmp
+# define PATH_SEP ";"
+# define STRIP_DOT_EXE 1
+# define DEFAULT_TMPDIR "c:/"
+# define PIPE_USE_FORK 0
+#else /* not O_BINARY */
+# define SET_BINARY(f) (void)0
+# define FOPEN_RBIN "r"
+# define FOPEN_WBIN "w"
+# define IS_SLASH(c) ((c) == '/')
+# define HAVE_DRIVE(n) (0)
+# define IS_ABSOLUTE(n) ((n)[0] == '/')
+# define FILENAME_CMP strcmp
+# define FILENAME_CMPN strncmp
+# define HAVE_LONG_FILENAMES(dir) (1)
+# define PATH_SEP ":"
+# define STRIP_DOT_EXE 0
+# ifdef VMS
+# define DEFAULT_TMPDIR "sys$scratch:"
+# else
+# define DEFAULT_TMPDIR "/tmp/"
+# endif
+# define NULL_DEVICE "/dev/null"
+# define PIPE_USE_FORK 1
+#endif /* not O_BINARY */
+
#ifdef HAVE_PWD_H
#include <pwd.h>
#endif
@@ -98,5 +194,10 @@ struct passwd *getpwnam ();
/* Our library routines not included in any system library. */
extern void *xmalloc (), *xrealloc ();
extern char *xstrdup ();
+extern void xexit ();
+extern char *substring ();
+
+/* For convenience. */
+#define STREQ(s1,s2) (strcmp (s1, s2) == 0)
#endif /* TEXINFO_SYSTEM_H */