summaryrefslogtreecommitdiff
path: root/info
diff options
context:
space:
mode:
Diffstat (limited to 'info')
-rw-r--r--info/Makefile.am15
-rw-r--r--info/Makefile.in877
-rw-r--r--info/README16
-rw-r--r--info/dir.c43
-rw-r--r--info/display.c59
-rw-r--r--info/display.h12
-rw-r--r--info/doc.h8
-rw-r--r--info/dribble.c7
-rw-r--r--info/dribble.h10
-rw-r--r--info/echo-area.c79
-rw-r--r--info/echo-area.h10
-rw-r--r--info/filesys.c179
-rw-r--r--info/filesys.h40
-rw-r--r--info/footnotes.c17
-rw-r--r--info/footnotes.h6
-rw-r--r--info/gc.c23
-rw-r--r--info/gc.h10
-rw-r--r--info/indices.c389
-rw-r--r--info/indices.h12
-rw-r--r--info/info-utils.c291
-rw-r--r--info/info-utils.h59
-rw-r--r--info/info.c767
-rw-r--r--info/info.h58
-rw-r--r--info/infodoc.c99
-rw-r--r--info/infokey.c111
-rw-r--r--info/infokey.h6
-rw-r--r--info/infomap.c1724
-rw-r--r--info/infomap.h6
-rw-r--r--info/infopath.c336
-rw-r--r--info/key.h10
-rw-r--r--info/m-x.c18
-rw-r--r--info/makedoc.c29
-rw-r--r--info/man.c70
-rw-r--r--info/man.h9
-rw-r--r--info/nodemenu.c25
-rw-r--r--info/nodes.c300
-rw-r--r--info/nodes.h26
-rw-r--r--info/pcterm.c604
-rw-r--r--info/search.c160
-rw-r--r--info/search.h32
-rw-r--r--info/session.c828
-rw-r--r--info/session.h28
-rw-r--r--info/signals.c10
-rw-r--r--info/signals.h6
-rw-r--r--info/tag.c273
-rw-r--r--info/tag.h25
-rw-r--r--info/termdep.h12
-rw-r--r--info/terminal.c45
-rw-r--r--info/terminal.h6
-rw-r--r--info/tilde.c37
-rw-r--r--info/tilde.h13
-rw-r--r--info/variables.c88
-rw-r--r--info/variables.h12
-rw-r--r--info/window.c400
-rw-r--r--info/window.h78
55 files changed, 5631 insertions, 2782 deletions
diff --git a/info/Makefile.am b/info/Makefile.am
index 5a3d35a..e831a00 100644
--- a/info/Makefile.am
+++ b/info/Makefile.am
@@ -1,6 +1,8 @@
-# $Id: Makefile.am,v 1.15 2008/03/28 23:39:20 karl Exp $
+# $Id: Makefile.am 5255 2013-04-15 21:39:09Z gray $
# Makefile.am for texinfo/info.
-# Run automake in .. to produce Makefile.in from this.
+#
+# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
+# Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -27,9 +29,8 @@ AM_CPPFLAGS = \
-DINFODIR=\"$(infodir)\" \
-DINFODIR2=\"$(infodir2)\"
-LDADD = ../lib/libtxi.a $(top_builddir)/gnulib/lib/libgnu.a \
- $(TERMLIBS) $(LIBINTL)
-infokey_LDADD = ../lib/libtxi.a $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
+LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL)
+infokey_LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
EXTRA_DIST = README pcterm.c
@@ -37,9 +38,9 @@ ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \
echo-area.c echo-area.h \
filesys.c filesys.h footnotes.c footnotes.h gc.c gc.h \
indices.c indices.h info-utils.c info-utils.h info.c info.h infodoc.c \
- infomap.c infomap.h m-x.c man.c man.h nodemenu.c nodes.c nodes.h \
+ infomap.c infomap.h infopath.c m-x.c man.c man.h nodemenu.c nodes.c nodes.h \
search.c search.h session.c session.h signals.c signals.h \
- termdep.h terminal.c terminal.h tilde.c tilde.h \
+ tag.c tag.h termdep.h terminal.c terminal.h tilde.c tilde.h \
variables.c variables.h window.c window.h
nodist_ginfo_SOURCES = doc.c funs.h
infokey_SOURCES = infokey.c infokey.h key.h
diff --git a/info/Makefile.in b/info/Makefile.in
index d4fea81..af6913d 100644
--- a/info/Makefile.in
+++ b/info/Makefile.in
@@ -1,8 +1,8 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.14 from Makefile.am.
# @configure_input@
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# Copyright (C) 1994-2013 Free Software Foundation, Inc.
+
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -14,9 +14,11 @@
@SET_MAKE@
-# $Id: Makefile.am,v 1.15 2008/03/28 23:39:20 karl Exp $
+# $Id: Makefile.am 5255 2013-04-15 21:39:09Z gray $
# Makefile.am for texinfo/info.
-# Run automake in .. to produce Makefile.in from this.
+#
+# Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012
+# Free Software Foundation, Inc.
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -27,9 +29,54 @@
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
VPATH = @srcdir@
+am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
+am__make_running_with_option = \
+ case $${target_option-} in \
+ ?) ;; \
+ *) echo "am__make_running_with_option: internal error: invalid" \
+ "target option '$${target_option-}' specified" >&2; \
+ exit 1;; \
+ esac; \
+ has_opt=no; \
+ sane_makeflags=$$MAKEFLAGS; \
+ if $(am__is_gnu_make); then \
+ sane_makeflags=$$MFLAGS; \
+ else \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ bs=\\; \
+ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \
+ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \
+ esac; \
+ fi; \
+ skip_next=no; \
+ strip_trailopt () \
+ { \
+ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \
+ }; \
+ for flg in $$sane_makeflags; do \
+ test $$skip_next = yes && { skip_next=no; continue; }; \
+ case $$flg in \
+ *=*|--*) continue;; \
+ -*I) strip_trailopt 'I'; skip_next=yes;; \
+ -*I?*) strip_trailopt 'I';; \
+ -*O) strip_trailopt 'O'; skip_next=yes;; \
+ -*O?*) strip_trailopt 'O';; \
+ -*l) strip_trailopt 'l'; skip_next=yes;; \
+ -*l?*) strip_trailopt 'l';; \
+ -[dEDm]) skip_next=yes;; \
+ -[JT]) skip_next=yes;; \
+ esac; \
+ case $$flg in \
+ *$$target_option*) has_opt=yes; break;; \
+ esac; \
+ done; \
+ test $$has_opt = yes
+am__make_dryrun = (target_option=n; $(am__make_running_with_option))
+am__make_keepgoing = (target_option=k; $(am__make_running_with_option))
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -46,16 +93,22 @@ host_triplet = @host@
bin_PROGRAMS = ginfo$(EXEEXT) infokey$(EXEEXT)
noinst_PROGRAMS = makedoc$(EXEEXT)
subdir = info
-DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
+ $(top_srcdir)/build-aux/depcomp README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/00gnulib.m4 \
+ $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/argz.m4 \
+ $(top_srcdir)/gnulib/m4/btowc.m4 \
$(top_srcdir)/gnulib/m4/codeset.m4 \
+ $(top_srcdir)/gnulib/m4/configmake.m4 \
$(top_srcdir)/gnulib/m4/eealloc.m4 \
- $(top_srcdir)/gnulib/m4/environ.m4 \
+ $(top_srcdir)/gnulib/m4/errno_h.m4 \
$(top_srcdir)/gnulib/m4/error.m4 \
- $(top_srcdir)/gnulib/m4/exitfail.m4 \
$(top_srcdir)/gnulib/m4/extensions.m4 \
+ $(top_srcdir)/gnulib/m4/extern-inline.m4 \
+ $(top_srcdir)/gnulib/m4/fcntl-o.m4 \
+ $(top_srcdir)/gnulib/m4/fcntl_h.m4 \
$(top_srcdir)/gnulib/m4/getopt.m4 \
$(top_srcdir)/gnulib/m4/gettext.m4 \
$(top_srcdir)/gnulib/m4/gettimeofday.m4 \
@@ -64,38 +117,55 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/gnulib-comp.m4 \
$(top_srcdir)/gnulib/m4/iconv.m4 \
$(top_srcdir)/gnulib/m4/include_next.m4 \
- $(top_srcdir)/gnulib/m4/inline.m4 \
$(top_srcdir)/gnulib/m4/intlmacosx.m4 \
+ $(top_srcdir)/gnulib/m4/iswblank.m4 \
+ $(top_srcdir)/gnulib/m4/langinfo_h.m4 \
+ $(top_srcdir)/gnulib/m4/largefile.m4 \
$(top_srcdir)/gnulib/m4/lib-ld.m4 \
$(top_srcdir)/gnulib/m4/lib-link.m4 \
$(top_srcdir)/gnulib/m4/lib-prefix.m4 \
+ $(top_srcdir)/gnulib/m4/libunistring-base.m4 \
$(top_srcdir)/gnulib/m4/localcharset.m4 \
+ $(top_srcdir)/gnulib/m4/locale-fr.m4 \
+ $(top_srcdir)/gnulib/m4/locale-ja.m4 \
+ $(top_srcdir)/gnulib/m4/locale-zh.m4 \
+ $(top_srcdir)/gnulib/m4/locale_h.m4 \
+ $(top_srcdir)/gnulib/m4/localeconv.m4 \
+ $(top_srcdir)/gnulib/m4/lock.m4 \
$(top_srcdir)/gnulib/m4/longlong.m4 \
+ $(top_srcdir)/gnulib/m4/lstat.m4 \
$(top_srcdir)/gnulib/m4/malloc.m4 \
$(top_srcdir)/gnulib/m4/malloca.m4 \
$(top_srcdir)/gnulib/m4/mbchar.m4 \
$(top_srcdir)/gnulib/m4/mbiter.m4 \
$(top_srcdir)/gnulib/m4/mbrtowc.m4 \
- $(top_srcdir)/gnulib/m4/mbscasecmp.m4 \
- $(top_srcdir)/gnulib/m4/mbschr.m4 \
+ $(top_srcdir)/gnulib/m4/mbsinit.m4 \
$(top_srcdir)/gnulib/m4/mbslen.m4 \
- $(top_srcdir)/gnulib/m4/mbsncasecmp.m4 \
- $(top_srcdir)/gnulib/m4/mbsstr.m4 \
$(top_srcdir)/gnulib/m4/mbstate_t.m4 \
$(top_srcdir)/gnulib/m4/mbswidth.m4 \
+ $(top_srcdir)/gnulib/m4/mbtowc.m4 \
$(top_srcdir)/gnulib/m4/memchr.m4 \
- $(top_srcdir)/gnulib/m4/memcmp.m4 \
- $(top_srcdir)/gnulib/m4/memcpy.m4 \
$(top_srcdir)/gnulib/m4/memmem.m4 \
- $(top_srcdir)/gnulib/m4/memmove.m4 \
$(top_srcdir)/gnulib/m4/mempcpy.m4 \
$(top_srcdir)/gnulib/m4/mkstemp.m4 \
+ $(top_srcdir)/gnulib/m4/mmap-anon.m4 \
+ $(top_srcdir)/gnulib/m4/msvc-inval.m4 \
+ $(top_srcdir)/gnulib/m4/msvc-nothrow.m4 \
+ $(top_srcdir)/gnulib/m4/multiarch.m4 \
+ $(top_srcdir)/gnulib/m4/nl_langinfo.m4 \
$(top_srcdir)/gnulib/m4/nls.m4 \
+ $(top_srcdir)/gnulib/m4/nocrash.m4 \
+ $(top_srcdir)/gnulib/m4/off_t.m4 \
$(top_srcdir)/gnulib/m4/onceonly.m4 \
+ $(top_srcdir)/gnulib/m4/pathmax.m4 \
$(top_srcdir)/gnulib/m4/po.m4 \
$(top_srcdir)/gnulib/m4/progtest.m4 \
- $(top_srcdir)/gnulib/m4/setenv.m4 \
+ $(top_srcdir)/gnulib/m4/regex.m4 \
+ $(top_srcdir)/gnulib/m4/secure_getenv.m4 \
+ $(top_srcdir)/gnulib/m4/ssize_t.m4 \
+ $(top_srcdir)/gnulib/m4/stat.m4 \
$(top_srcdir)/gnulib/m4/stdbool.m4 \
+ $(top_srcdir)/gnulib/m4/stddef_h.m4 \
$(top_srcdir)/gnulib/m4/stdint.m4 \
$(top_srcdir)/gnulib/m4/stdlib_h.m4 \
$(top_srcdir)/gnulib/m4/stpcpy.m4 \
@@ -104,13 +174,20 @@ am__aclocal_m4_deps = $(top_srcdir)/gnulib/m4/alloca.m4 \
$(top_srcdir)/gnulib/m4/string_h.m4 \
$(top_srcdir)/gnulib/m4/strndup.m4 \
$(top_srcdir)/gnulib/m4/strnlen.m4 \
+ $(top_srcdir)/gnulib/m4/strstr.m4 \
+ $(top_srcdir)/gnulib/m4/sys_socket_h.m4 \
$(top_srcdir)/gnulib/m4/sys_stat_h.m4 \
$(top_srcdir)/gnulib/m4/sys_time_h.m4 \
+ $(top_srcdir)/gnulib/m4/sys_types_h.m4 \
$(top_srcdir)/gnulib/m4/tempname.m4 \
+ $(top_srcdir)/gnulib/m4/threadlib.m4 \
+ $(top_srcdir)/gnulib/m4/time_h.m4 \
$(top_srcdir)/gnulib/m4/unistd_h.m4 \
- $(top_srcdir)/gnulib/m4/wchar.m4 \
+ $(top_srcdir)/gnulib/m4/warn-on-use.m4 \
+ $(top_srcdir)/gnulib/m4/wchar_h.m4 \
$(top_srcdir)/gnulib/m4/wchar_t.m4 \
- $(top_srcdir)/gnulib/m4/wctype.m4 \
+ $(top_srcdir)/gnulib/m4/wcrtomb.m4 \
+ $(top_srcdir)/gnulib/m4/wctype_h.m4 \
$(top_srcdir)/gnulib/m4/wcwidth.m4 \
$(top_srcdir)/gnulib/m4/wint_t.m4 \
$(top_srcdir)/gnulib/m4/xalloc.m4 $(top_srcdir)/configure.ac
@@ -119,53 +196,100 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
am_ginfo_OBJECTS = dir.$(OBJEXT) display.$(OBJEXT) dribble.$(OBJEXT) \
echo-area.$(OBJEXT) filesys.$(OBJEXT) footnotes.$(OBJEXT) \
gc.$(OBJEXT) indices.$(OBJEXT) info-utils.$(OBJEXT) \
info.$(OBJEXT) infodoc.$(OBJEXT) infomap.$(OBJEXT) \
- m-x.$(OBJEXT) man.$(OBJEXT) nodemenu.$(OBJEXT) nodes.$(OBJEXT) \
- search.$(OBJEXT) session.$(OBJEXT) signals.$(OBJEXT) \
+ infopath.$(OBJEXT) m-x.$(OBJEXT) man.$(OBJEXT) \
+ nodemenu.$(OBJEXT) nodes.$(OBJEXT) search.$(OBJEXT) \
+ session.$(OBJEXT) signals.$(OBJEXT) tag.$(OBJEXT) \
terminal.$(OBJEXT) tilde.$(OBJEXT) variables.$(OBJEXT) \
window.$(OBJEXT)
nodist_ginfo_OBJECTS = doc.$(OBJEXT)
ginfo_OBJECTS = $(am_ginfo_OBJECTS) $(nodist_ginfo_OBJECTS)
ginfo_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
-ginfo_DEPENDENCIES = ../lib/libtxi.a \
- $(top_builddir)/gnulib/lib/libgnu.a $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+ginfo_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
am_infokey_OBJECTS = infokey.$(OBJEXT)
nodist_infokey_OBJECTS = key.$(OBJEXT)
infokey_OBJECTS = $(am_infokey_OBJECTS) $(nodist_infokey_OBJECTS)
-infokey_DEPENDENCIES = ../lib/libtxi.a \
- $(top_builddir)/gnulib/lib/libgnu.a $(am__DEPENDENCIES_1)
+infokey_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
+ $(am__DEPENDENCIES_1)
am_makedoc_OBJECTS = makedoc.$(OBJEXT)
makedoc_OBJECTS = $(am_makedoc_OBJECTS)
makedoc_LDADD = $(LDADD)
-makedoc_DEPENDENCIES = ../lib/libtxi.a \
- $(top_builddir)/gnulib/lib/libgnu.a $(am__DEPENDENCIES_1) \
- $(am__DEPENDENCIES_1)
+makedoc_DEPENDENCIES = $(top_builddir)/gnulib/lib/libgnu.a \
+ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
+AM_V_P = $(am__v_P_@AM_V@)
+am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
+am__v_P_0 = false
+am__v_P_1 = :
+AM_V_GEN = $(am__v_GEN_@AM_V@)
+am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
+am__v_GEN_0 = @echo " GEN " $@;
+am__v_GEN_1 =
+AM_V_at = $(am__v_at_@AM_V@)
+am__v_at_ = $(am__v_at_@AM_DEFAULT_V@)
+am__v_at_0 = @
+am__v_at_1 =
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+AM_V_CC = $(am__v_CC_@AM_V@)
+am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@)
+am__v_CC_0 = @echo " CC " $@;
+am__v_CC_1 =
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+AM_V_CCLD = $(am__v_CCLD_@AM_V@)
+am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
+am__v_CCLD_0 = @echo " CCLD " $@;
+am__v_CCLD_1 =
SOURCES = $(ginfo_SOURCES) $(nodist_ginfo_SOURCES) $(infokey_SOURCES) \
$(nodist_infokey_SOURCES) $(makedoc_SOURCES)
DIST_SOURCES = $(ginfo_SOURCES) $(infokey_SOURCES) $(makedoc_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
+# Read a list of newline-separated strings from the standard input,
+# and print each of them once, without duplicates. Input order is
+# *not* preserved.
+am__uniquify_input = $(AWK) '\
+ BEGIN { nonempty = 0; } \
+ { items[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in items) print i; }; } \
+'
+# Make sure the list of sources is unique. This is necessary because,
+# e.g., the same source file might be shared among _SOURCES variables
+# for different programs/libraries.
+am__define_uniq_tagged_files = \
+ list='$(am__tagged_files)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | $(am__uniquify_input)`
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+pkglibexecdir = @pkglibexecdir@
transform = s/ginfo/info/; $(program_transform_name)
ACLOCAL = @ACLOCAL@
ALLOCA = @ALLOCA@
ALLOCA_H = @ALLOCA_H@
AMTAR = @AMTAR@
+AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
+APPLE_UNIVERSAL_BUILD = @APPLE_UNIVERSAL_BUILD@
+AR = @AR@
+ARFLAGS = @ARFLAGS@
ARGZ_H = @ARGZ_H@
AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
@@ -184,101 +308,324 @@ CPPFLAGS = @CPPFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
+DIFF_A_OPTION = @DIFF_A_OPTION@
+DIFF_U_OPTION = @DIFF_U_OPTION@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+EMULTIHOP_HIDDEN = @EMULTIHOP_HIDDEN@
+EMULTIHOP_VALUE = @EMULTIHOP_VALUE@
+ENOLINK_HIDDEN = @ENOLINK_HIDDEN@
+ENOLINK_VALUE = @ENOLINK_VALUE@
+EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
+EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
+ERRNO_H = @ERRNO_H@
EXEEXT = @EXEEXT@
GETOPT_H = @GETOPT_H@
GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIBC21 = @GLIBC21@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
+GNULIB_ATOLL = @GNULIB_ATOLL@
+GNULIB_BTOWC = @GNULIB_BTOWC@
GNULIB_CALLOC_POSIX = @GNULIB_CALLOC_POSIX@
+GNULIB_CANONICALIZE_FILE_NAME = @GNULIB_CANONICALIZE_FILE_NAME@
+GNULIB_CHDIR = @GNULIB_CHDIR@
GNULIB_CHOWN = @GNULIB_CHOWN@
+GNULIB_CLOSE = @GNULIB_CLOSE@
+GNULIB_DUP = @GNULIB_DUP@
GNULIB_DUP2 = @GNULIB_DUP2@
+GNULIB_DUP3 = @GNULIB_DUP3@
+GNULIB_DUPLOCALE = @GNULIB_DUPLOCALE@
GNULIB_ENVIRON = @GNULIB_ENVIRON@
+GNULIB_EUIDACCESS = @GNULIB_EUIDACCESS@
+GNULIB_FACCESSAT = @GNULIB_FACCESSAT@
GNULIB_FCHDIR = @GNULIB_FCHDIR@
+GNULIB_FCHMODAT = @GNULIB_FCHMODAT@
+GNULIB_FCHOWNAT = @GNULIB_FCHOWNAT@
+GNULIB_FCNTL = @GNULIB_FCNTL@
+GNULIB_FDATASYNC = @GNULIB_FDATASYNC@
+GNULIB_FFSL = @GNULIB_FFSL@
+GNULIB_FFSLL = @GNULIB_FFSLL@
+GNULIB_FSTAT = @GNULIB_FSTAT@
+GNULIB_FSTATAT = @GNULIB_FSTATAT@
+GNULIB_FSYNC = @GNULIB_FSYNC@
GNULIB_FTRUNCATE = @GNULIB_FTRUNCATE@
+GNULIB_FUTIMENS = @GNULIB_FUTIMENS@
GNULIB_GETCWD = @GNULIB_GETCWD@
+GNULIB_GETDOMAINNAME = @GNULIB_GETDOMAINNAME@
+GNULIB_GETDTABLESIZE = @GNULIB_GETDTABLESIZE@
+GNULIB_GETGROUPS = @GNULIB_GETGROUPS@
+GNULIB_GETHOSTNAME = @GNULIB_GETHOSTNAME@
+GNULIB_GETLOADAVG = @GNULIB_GETLOADAVG@
+GNULIB_GETLOGIN = @GNULIB_GETLOGIN@
GNULIB_GETLOGIN_R = @GNULIB_GETLOGIN_R@
GNULIB_GETPAGESIZE = @GNULIB_GETPAGESIZE@
GNULIB_GETSUBOPT = @GNULIB_GETSUBOPT@
+GNULIB_GETTIMEOFDAY = @GNULIB_GETTIMEOFDAY@
+GNULIB_GETUSERSHELL = @GNULIB_GETUSERSHELL@
+GNULIB_GL_UNISTD_H_GETOPT = @GNULIB_GL_UNISTD_H_GETOPT@
+GNULIB_GRANTPT = @GNULIB_GRANTPT@
+GNULIB_GROUP_MEMBER = @GNULIB_GROUP_MEMBER@
+GNULIB_ISATTY = @GNULIB_ISATTY@
+GNULIB_ISWBLANK = @GNULIB_ISWBLANK@
+GNULIB_ISWCTYPE = @GNULIB_ISWCTYPE@
+GNULIB_LCHMOD = @GNULIB_LCHMOD@
GNULIB_LCHOWN = @GNULIB_LCHOWN@
+GNULIB_LINK = @GNULIB_LINK@
+GNULIB_LINKAT = @GNULIB_LINKAT@
+GNULIB_LOCALECONV = @GNULIB_LOCALECONV@
GNULIB_LSEEK = @GNULIB_LSEEK@
+GNULIB_LSTAT = @GNULIB_LSTAT@
GNULIB_MALLOC_POSIX = @GNULIB_MALLOC_POSIX@
+GNULIB_MBRLEN = @GNULIB_MBRLEN@
+GNULIB_MBRTOWC = @GNULIB_MBRTOWC@
GNULIB_MBSCASECMP = @GNULIB_MBSCASECMP@
GNULIB_MBSCASESTR = @GNULIB_MBSCASESTR@
GNULIB_MBSCHR = @GNULIB_MBSCHR@
GNULIB_MBSCSPN = @GNULIB_MBSCSPN@
+GNULIB_MBSINIT = @GNULIB_MBSINIT@
GNULIB_MBSLEN = @GNULIB_MBSLEN@
GNULIB_MBSNCASECMP = @GNULIB_MBSNCASECMP@
GNULIB_MBSNLEN = @GNULIB_MBSNLEN@
+GNULIB_MBSNRTOWCS = @GNULIB_MBSNRTOWCS@
GNULIB_MBSPBRK = @GNULIB_MBSPBRK@
GNULIB_MBSPCASECMP = @GNULIB_MBSPCASECMP@
GNULIB_MBSRCHR = @GNULIB_MBSRCHR@
+GNULIB_MBSRTOWCS = @GNULIB_MBSRTOWCS@
GNULIB_MBSSEP = @GNULIB_MBSSEP@
GNULIB_MBSSPN = @GNULIB_MBSSPN@
GNULIB_MBSSTR = @GNULIB_MBSSTR@
GNULIB_MBSTOK_R = @GNULIB_MBSTOK_R@
+GNULIB_MBTOWC = @GNULIB_MBTOWC@
+GNULIB_MEMCHR = @GNULIB_MEMCHR@
GNULIB_MEMMEM = @GNULIB_MEMMEM@
GNULIB_MEMPCPY = @GNULIB_MEMPCPY@
GNULIB_MEMRCHR = @GNULIB_MEMRCHR@
+GNULIB_MKDIRAT = @GNULIB_MKDIRAT@
GNULIB_MKDTEMP = @GNULIB_MKDTEMP@
+GNULIB_MKFIFO = @GNULIB_MKFIFO@
+GNULIB_MKFIFOAT = @GNULIB_MKFIFOAT@
+GNULIB_MKNOD = @GNULIB_MKNOD@
+GNULIB_MKNODAT = @GNULIB_MKNODAT@
+GNULIB_MKOSTEMP = @GNULIB_MKOSTEMP@
+GNULIB_MKOSTEMPS = @GNULIB_MKOSTEMPS@
GNULIB_MKSTEMP = @GNULIB_MKSTEMP@
+GNULIB_MKSTEMPS = @GNULIB_MKSTEMPS@
+GNULIB_MKTIME = @GNULIB_MKTIME@
+GNULIB_NANOSLEEP = @GNULIB_NANOSLEEP@
+GNULIB_NL_LANGINFO = @GNULIB_NL_LANGINFO@
+GNULIB_NONBLOCKING = @GNULIB_NONBLOCKING@
+GNULIB_OPEN = @GNULIB_OPEN@
+GNULIB_OPENAT = @GNULIB_OPENAT@
+GNULIB_PIPE = @GNULIB_PIPE@
+GNULIB_PIPE2 = @GNULIB_PIPE2@
+GNULIB_POSIX_OPENPT = @GNULIB_POSIX_OPENPT@
+GNULIB_PREAD = @GNULIB_PREAD@
+GNULIB_PTSNAME = @GNULIB_PTSNAME@
+GNULIB_PTSNAME_R = @GNULIB_PTSNAME_R@
GNULIB_PUTENV = @GNULIB_PUTENV@
+GNULIB_PWRITE = @GNULIB_PWRITE@
+GNULIB_RANDOM = @GNULIB_RANDOM@
+GNULIB_RANDOM_R = @GNULIB_RANDOM_R@
GNULIB_RAWMEMCHR = @GNULIB_RAWMEMCHR@
+GNULIB_READ = @GNULIB_READ@
GNULIB_READLINK = @GNULIB_READLINK@
+GNULIB_READLINKAT = @GNULIB_READLINKAT@
GNULIB_REALLOC_POSIX = @GNULIB_REALLOC_POSIX@
+GNULIB_REALPATH = @GNULIB_REALPATH@
+GNULIB_RMDIR = @GNULIB_RMDIR@
GNULIB_RPMATCH = @GNULIB_RPMATCH@
+GNULIB_SECURE_GETENV = @GNULIB_SECURE_GETENV@
GNULIB_SETENV = @GNULIB_SETENV@
+GNULIB_SETHOSTNAME = @GNULIB_SETHOSTNAME@
+GNULIB_SETLOCALE = @GNULIB_SETLOCALE@
GNULIB_SLEEP = @GNULIB_SLEEP@
+GNULIB_STAT = @GNULIB_STAT@
GNULIB_STPCPY = @GNULIB_STPCPY@
GNULIB_STPNCPY = @GNULIB_STPNCPY@
GNULIB_STRCASESTR = @GNULIB_STRCASESTR@
GNULIB_STRCHRNUL = @GNULIB_STRCHRNUL@
GNULIB_STRDUP = @GNULIB_STRDUP@
GNULIB_STRERROR = @GNULIB_STRERROR@
+GNULIB_STRERROR_R = @GNULIB_STRERROR_R@
+GNULIB_STRNCAT = @GNULIB_STRNCAT@
GNULIB_STRNDUP = @GNULIB_STRNDUP@
GNULIB_STRNLEN = @GNULIB_STRNLEN@
GNULIB_STRPBRK = @GNULIB_STRPBRK@
+GNULIB_STRPTIME = @GNULIB_STRPTIME@
GNULIB_STRSEP = @GNULIB_STRSEP@
GNULIB_STRSIGNAL = @GNULIB_STRSIGNAL@
GNULIB_STRSTR = @GNULIB_STRSTR@
GNULIB_STRTOD = @GNULIB_STRTOD@
GNULIB_STRTOK_R = @GNULIB_STRTOK_R@
+GNULIB_STRTOLL = @GNULIB_STRTOLL@
+GNULIB_STRTOULL = @GNULIB_STRTOULL@
+GNULIB_STRVERSCMP = @GNULIB_STRVERSCMP@
+GNULIB_SYMLINK = @GNULIB_SYMLINK@
+GNULIB_SYMLINKAT = @GNULIB_SYMLINKAT@
+GNULIB_SYSTEM_POSIX = @GNULIB_SYSTEM_POSIX@
+GNULIB_TIMEGM = @GNULIB_TIMEGM@
+GNULIB_TIME_R = @GNULIB_TIME_R@
+GNULIB_TOWCTRANS = @GNULIB_TOWCTRANS@
+GNULIB_TTYNAME_R = @GNULIB_TTYNAME_R@
+GNULIB_UNISTD_H_NONBLOCKING = @GNULIB_UNISTD_H_NONBLOCKING@
+GNULIB_UNISTD_H_SIGPIPE = @GNULIB_UNISTD_H_SIGPIPE@
+GNULIB_UNLINK = @GNULIB_UNLINK@
+GNULIB_UNLINKAT = @GNULIB_UNLINKAT@
+GNULIB_UNLOCKPT = @GNULIB_UNLOCKPT@
GNULIB_UNSETENV = @GNULIB_UNSETENV@
+GNULIB_USLEEP = @GNULIB_USLEEP@
+GNULIB_UTIMENSAT = @GNULIB_UTIMENSAT@
+GNULIB_WCPCPY = @GNULIB_WCPCPY@
+GNULIB_WCPNCPY = @GNULIB_WCPNCPY@
+GNULIB_WCRTOMB = @GNULIB_WCRTOMB@
+GNULIB_WCSCASECMP = @GNULIB_WCSCASECMP@
+GNULIB_WCSCAT = @GNULIB_WCSCAT@
+GNULIB_WCSCHR = @GNULIB_WCSCHR@
+GNULIB_WCSCMP = @GNULIB_WCSCMP@
+GNULIB_WCSCOLL = @GNULIB_WCSCOLL@
+GNULIB_WCSCPY = @GNULIB_WCSCPY@
+GNULIB_WCSCSPN = @GNULIB_WCSCSPN@
+GNULIB_WCSDUP = @GNULIB_WCSDUP@
+GNULIB_WCSLEN = @GNULIB_WCSLEN@
+GNULIB_WCSNCASECMP = @GNULIB_WCSNCASECMP@
+GNULIB_WCSNCAT = @GNULIB_WCSNCAT@
+GNULIB_WCSNCMP = @GNULIB_WCSNCMP@
+GNULIB_WCSNCPY = @GNULIB_WCSNCPY@
+GNULIB_WCSNLEN = @GNULIB_WCSNLEN@
+GNULIB_WCSNRTOMBS = @GNULIB_WCSNRTOMBS@
+GNULIB_WCSPBRK = @GNULIB_WCSPBRK@
+GNULIB_WCSRCHR = @GNULIB_WCSRCHR@
+GNULIB_WCSRTOMBS = @GNULIB_WCSRTOMBS@
+GNULIB_WCSSPN = @GNULIB_WCSSPN@
+GNULIB_WCSSTR = @GNULIB_WCSSTR@
+GNULIB_WCSTOK = @GNULIB_WCSTOK@
+GNULIB_WCSWIDTH = @GNULIB_WCSWIDTH@
+GNULIB_WCSXFRM = @GNULIB_WCSXFRM@
+GNULIB_WCTOB = @GNULIB_WCTOB@
+GNULIB_WCTOMB = @GNULIB_WCTOMB@
+GNULIB_WCTRANS = @GNULIB_WCTRANS@
+GNULIB_WCTYPE = @GNULIB_WCTYPE@
GNULIB_WCWIDTH = @GNULIB_WCWIDTH@
+GNULIB_WMEMCHR = @GNULIB_WMEMCHR@
+GNULIB_WMEMCMP = @GNULIB_WMEMCMP@
+GNULIB_WMEMCPY = @GNULIB_WMEMCPY@
+GNULIB_WMEMMOVE = @GNULIB_WMEMMOVE@
+GNULIB_WMEMSET = @GNULIB_WMEMSET@
+GNULIB_WRITE = @GNULIB_WRITE@
+GNULIB__EXIT = @GNULIB__EXIT@
GREP = @GREP@
-HAVE_CALLOC_POSIX = @HAVE_CALLOC_POSIX@
+HAVE_ATOLL = @HAVE_ATOLL@
+HAVE_BTOWC = @HAVE_BTOWC@
+HAVE_CANONICALIZE_FILE_NAME = @HAVE_CANONICALIZE_FILE_NAME@
+HAVE_CHOWN = @HAVE_CHOWN@
HAVE_DECL_ENVIRON = @HAVE_DECL_ENVIRON@
+HAVE_DECL_FCHDIR = @HAVE_DECL_FCHDIR@
+HAVE_DECL_FDATASYNC = @HAVE_DECL_FDATASYNC@
+HAVE_DECL_GETDOMAINNAME = @HAVE_DECL_GETDOMAINNAME@
+HAVE_DECL_GETLOADAVG = @HAVE_DECL_GETLOADAVG@
HAVE_DECL_GETLOGIN_R = @HAVE_DECL_GETLOGIN_R@
+HAVE_DECL_GETPAGESIZE = @HAVE_DECL_GETPAGESIZE@
+HAVE_DECL_GETUSERSHELL = @HAVE_DECL_GETUSERSHELL@
+HAVE_DECL_LOCALTIME_R = @HAVE_DECL_LOCALTIME_R@
HAVE_DECL_MEMMEM = @HAVE_DECL_MEMMEM@
HAVE_DECL_MEMRCHR = @HAVE_DECL_MEMRCHR@
+HAVE_DECL_SETENV = @HAVE_DECL_SETENV@
+HAVE_DECL_SETHOSTNAME = @HAVE_DECL_SETHOSTNAME@
HAVE_DECL_STRDUP = @HAVE_DECL_STRDUP@
-HAVE_DECL_STRERROR = @HAVE_DECL_STRERROR@
+HAVE_DECL_STRERROR_R = @HAVE_DECL_STRERROR_R@
HAVE_DECL_STRNDUP = @HAVE_DECL_STRNDUP@
HAVE_DECL_STRNLEN = @HAVE_DECL_STRNLEN@
HAVE_DECL_STRSIGNAL = @HAVE_DECL_STRSIGNAL@
HAVE_DECL_STRTOK_R = @HAVE_DECL_STRTOK_R@
+HAVE_DECL_TTYNAME_R = @HAVE_DECL_TTYNAME_R@
+HAVE_DECL_UNSETENV = @HAVE_DECL_UNSETENV@
+HAVE_DECL_WCTOB = @HAVE_DECL_WCTOB@
HAVE_DECL_WCWIDTH = @HAVE_DECL_WCWIDTH@
HAVE_DUP2 = @HAVE_DUP2@
+HAVE_DUP3 = @HAVE_DUP3@
+HAVE_DUPLOCALE = @HAVE_DUPLOCALE@
+HAVE_EUIDACCESS = @HAVE_EUIDACCESS@
+HAVE_FACCESSAT = @HAVE_FACCESSAT@
+HAVE_FCHDIR = @HAVE_FCHDIR@
+HAVE_FCHMODAT = @HAVE_FCHMODAT@
+HAVE_FCHOWNAT = @HAVE_FCHOWNAT@
+HAVE_FCNTL = @HAVE_FCNTL@
+HAVE_FDATASYNC = @HAVE_FDATASYNC@
+HAVE_FEATURES_H = @HAVE_FEATURES_H@
+HAVE_FFSL = @HAVE_FFSL@
+HAVE_FFSLL = @HAVE_FFSLL@
+HAVE_FSTATAT = @HAVE_FSTATAT@
+HAVE_FSYNC = @HAVE_FSYNC@
HAVE_FTRUNCATE = @HAVE_FTRUNCATE@
+HAVE_FUTIMENS = @HAVE_FUTIMENS@
+HAVE_GETDTABLESIZE = @HAVE_GETDTABLESIZE@
+HAVE_GETGROUPS = @HAVE_GETGROUPS@
+HAVE_GETHOSTNAME = @HAVE_GETHOSTNAME@
+HAVE_GETLOGIN = @HAVE_GETLOGIN@
+HAVE_GETOPT_H = @HAVE_GETOPT_H@
HAVE_GETPAGESIZE = @HAVE_GETPAGESIZE@
HAVE_GETSUBOPT = @HAVE_GETSUBOPT@
+HAVE_GETTIMEOFDAY = @HAVE_GETTIMEOFDAY@
+HAVE_GRANTPT = @HAVE_GRANTPT@
+HAVE_GROUP_MEMBER = @HAVE_GROUP_MEMBER@
HAVE_INTTYPES_H = @HAVE_INTTYPES_H@
+HAVE_ISWBLANK = @HAVE_ISWBLANK@
HAVE_ISWCNTRL = @HAVE_ISWCNTRL@
+HAVE_LANGINFO_CODESET = @HAVE_LANGINFO_CODESET@
+HAVE_LANGINFO_ERA = @HAVE_LANGINFO_ERA@
+HAVE_LANGINFO_H = @HAVE_LANGINFO_H@
+HAVE_LANGINFO_T_FMT_AMPM = @HAVE_LANGINFO_T_FMT_AMPM@
+HAVE_LANGINFO_YESEXPR = @HAVE_LANGINFO_YESEXPR@
+HAVE_LCHMOD = @HAVE_LCHMOD@
+HAVE_LCHOWN = @HAVE_LCHOWN@
+HAVE_LINK = @HAVE_LINK@
+HAVE_LINKAT = @HAVE_LINKAT@
HAVE_LONG_LONG_INT = @HAVE_LONG_LONG_INT@
HAVE_LSTAT = @HAVE_LSTAT@
-HAVE_MALLOC_POSIX = @HAVE_MALLOC_POSIX@
+HAVE_MBRLEN = @HAVE_MBRLEN@
+HAVE_MBRTOWC = @HAVE_MBRTOWC@
+HAVE_MBSINIT = @HAVE_MBSINIT@
+HAVE_MBSLEN = @HAVE_MBSLEN@
+HAVE_MBSNRTOWCS = @HAVE_MBSNRTOWCS@
+HAVE_MBSRTOWCS = @HAVE_MBSRTOWCS@
+HAVE_MEMCHR = @HAVE_MEMCHR@
HAVE_MEMPCPY = @HAVE_MEMPCPY@
+HAVE_MKDIRAT = @HAVE_MKDIRAT@
HAVE_MKDTEMP = @HAVE_MKDTEMP@
+HAVE_MKFIFO = @HAVE_MKFIFO@
+HAVE_MKFIFOAT = @HAVE_MKFIFOAT@
+HAVE_MKNOD = @HAVE_MKNOD@
+HAVE_MKNODAT = @HAVE_MKNODAT@
+HAVE_MKOSTEMP = @HAVE_MKOSTEMP@
+HAVE_MKOSTEMPS = @HAVE_MKOSTEMPS@
+HAVE_MKSTEMP = @HAVE_MKSTEMP@
+HAVE_MKSTEMPS = @HAVE_MKSTEMPS@
+HAVE_MSVC_INVALID_PARAMETER_HANDLER = @HAVE_MSVC_INVALID_PARAMETER_HANDLER@
+HAVE_NANOSLEEP = @HAVE_NANOSLEEP@
+HAVE_NL_LANGINFO = @HAVE_NL_LANGINFO@
+HAVE_OPENAT = @HAVE_OPENAT@
HAVE_OS_H = @HAVE_OS_H@
+HAVE_PIPE = @HAVE_PIPE@
+HAVE_PIPE2 = @HAVE_PIPE2@
+HAVE_POSIX_OPENPT = @HAVE_POSIX_OPENPT@
+HAVE_PREAD = @HAVE_PREAD@
+HAVE_PTSNAME = @HAVE_PTSNAME@
+HAVE_PTSNAME_R = @HAVE_PTSNAME_R@
+HAVE_PWRITE = @HAVE_PWRITE@
+HAVE_RANDOM = @HAVE_RANDOM@
+HAVE_RANDOM_H = @HAVE_RANDOM_H@
+HAVE_RANDOM_R = @HAVE_RANDOM_R@
HAVE_RAWMEMCHR = @HAVE_RAWMEMCHR@
HAVE_READLINK = @HAVE_READLINK@
-HAVE_REALLOC_POSIX = @HAVE_REALLOC_POSIX@
+HAVE_READLINKAT = @HAVE_READLINKAT@
+HAVE_REALPATH = @HAVE_REALPATH@
HAVE_RPMATCH = @HAVE_RPMATCH@
+HAVE_SECURE_GETENV = @HAVE_SECURE_GETENV@
HAVE_SETENV = @HAVE_SETENV@
+HAVE_SETHOSTNAME = @HAVE_SETHOSTNAME@
HAVE_SIGNED_SIG_ATOMIC_T = @HAVE_SIGNED_SIG_ATOMIC_T@
HAVE_SIGNED_WCHAR_T = @HAVE_SIGNED_WCHAR_T@
HAVE_SIGNED_WINT_T = @HAVE_SIGNED_WINT_T@
@@ -288,26 +635,74 @@ HAVE_STPCPY = @HAVE_STPCPY@
HAVE_STPNCPY = @HAVE_STPNCPY@
HAVE_STRCASESTR = @HAVE_STRCASESTR@
HAVE_STRCHRNUL = @HAVE_STRCHRNUL@
-HAVE_STRNDUP = @HAVE_STRNDUP@
HAVE_STRPBRK = @HAVE_STRPBRK@
+HAVE_STRPTIME = @HAVE_STRPTIME@
HAVE_STRSEP = @HAVE_STRSEP@
HAVE_STRTOD = @HAVE_STRTOD@
+HAVE_STRTOLL = @HAVE_STRTOLL@
+HAVE_STRTOULL = @HAVE_STRTOULL@
+HAVE_STRUCT_RANDOM_DATA = @HAVE_STRUCT_RANDOM_DATA@
HAVE_STRUCT_TIMEVAL = @HAVE_STRUCT_TIMEVAL@
+HAVE_STRVERSCMP = @HAVE_STRVERSCMP@
+HAVE_SYMLINK = @HAVE_SYMLINK@
+HAVE_SYMLINKAT = @HAVE_SYMLINKAT@
HAVE_SYS_BITYPES_H = @HAVE_SYS_BITYPES_H@
HAVE_SYS_INTTYPES_H = @HAVE_SYS_INTTYPES_H@
+HAVE_SYS_LOADAVG_H = @HAVE_SYS_LOADAVG_H@
HAVE_SYS_PARAM_H = @HAVE_SYS_PARAM_H@
HAVE_SYS_TIME_H = @HAVE_SYS_TIME_H@
HAVE_SYS_TYPES_H = @HAVE_SYS_TYPES_H@
+HAVE_TIMEGM = @HAVE_TIMEGM@
HAVE_UNISTD_H = @HAVE_UNISTD_H@
-HAVE_UNSETENV = @HAVE_UNSETENV@
+HAVE_UNLINKAT = @HAVE_UNLINKAT@
+HAVE_UNLOCKPT = @HAVE_UNLOCKPT@
HAVE_UNSIGNED_LONG_LONG_INT = @HAVE_UNSIGNED_LONG_LONG_INT@
+HAVE_USLEEP = @HAVE_USLEEP@
+HAVE_UTIMENSAT = @HAVE_UTIMENSAT@
HAVE_WCHAR_H = @HAVE_WCHAR_H@
+HAVE_WCHAR_T = @HAVE_WCHAR_T@
+HAVE_WCPCPY = @HAVE_WCPCPY@
+HAVE_WCPNCPY = @HAVE_WCPNCPY@
+HAVE_WCRTOMB = @HAVE_WCRTOMB@
+HAVE_WCSCASECMP = @HAVE_WCSCASECMP@
+HAVE_WCSCAT = @HAVE_WCSCAT@
+HAVE_WCSCHR = @HAVE_WCSCHR@
+HAVE_WCSCMP = @HAVE_WCSCMP@
+HAVE_WCSCOLL = @HAVE_WCSCOLL@
+HAVE_WCSCPY = @HAVE_WCSCPY@
+HAVE_WCSCSPN = @HAVE_WCSCSPN@
+HAVE_WCSDUP = @HAVE_WCSDUP@
+HAVE_WCSLEN = @HAVE_WCSLEN@
+HAVE_WCSNCASECMP = @HAVE_WCSNCASECMP@
+HAVE_WCSNCAT = @HAVE_WCSNCAT@
+HAVE_WCSNCMP = @HAVE_WCSNCMP@
+HAVE_WCSNCPY = @HAVE_WCSNCPY@
+HAVE_WCSNLEN = @HAVE_WCSNLEN@
+HAVE_WCSNRTOMBS = @HAVE_WCSNRTOMBS@
+HAVE_WCSPBRK = @HAVE_WCSPBRK@
+HAVE_WCSRCHR = @HAVE_WCSRCHR@
+HAVE_WCSRTOMBS = @HAVE_WCSRTOMBS@
+HAVE_WCSSPN = @HAVE_WCSSPN@
+HAVE_WCSSTR = @HAVE_WCSSTR@
+HAVE_WCSTOK = @HAVE_WCSTOK@
+HAVE_WCSWIDTH = @HAVE_WCSWIDTH@
+HAVE_WCSXFRM = @HAVE_WCSXFRM@
+HAVE_WCTRANS_T = @HAVE_WCTRANS_T@
HAVE_WCTYPE_H = @HAVE_WCTYPE_H@
+HAVE_WCTYPE_T = @HAVE_WCTYPE_T@
+HAVE_WINSOCK2_H = @HAVE_WINSOCK2_H@
HAVE_WINT_T = @HAVE_WINT_T@
+HAVE_WMEMCHR = @HAVE_WMEMCHR@
+HAVE_WMEMCMP = @HAVE_WMEMCMP@
+HAVE_WMEMCPY = @HAVE_WMEMCPY@
+HAVE_WMEMMOVE = @HAVE_WMEMMOVE@
+HAVE_WMEMSET = @HAVE_WMEMSET@
+HAVE_XLOCALE_H = @HAVE_XLOCALE_H@
HAVE__BOOL = @HAVE__BOOL@
+HAVE__EXIT = @HAVE__EXIT@
HELP2MAN = @HELP2MAN@
-HEVEA = @HEVEA@
INCLUDE_NEXT = @INCLUDE_NEXT@
+INCLUDE_NEXT_AS_FIRST_DIRECTIVE = @INCLUDE_NEXT_AS_FIRST_DIRECTIVE@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
@@ -320,72 +715,204 @@ LIBGNU_LIBDEPS = @LIBGNU_LIBDEPS@
LIBGNU_LTLIBDEPS = @LIBGNU_LTLIBDEPS@
LIBICONV = @LIBICONV@
LIBINTL = @LIBINTL@
+LIBMULTITHREAD = @LIBMULTITHREAD@
LIBOBJS = @LIBOBJS@
+LIBPTH = @LIBPTH@
+LIBPTH_PREFIX = @LIBPTH_PREFIX@
LIBS = @LIBS@
+LIBTHREAD = @LIBTHREAD@
+LIBUNISTRING_UNITYPES_H = @LIBUNISTRING_UNITYPES_H@
+LIBUNISTRING_UNIWIDTH_H = @LIBUNISTRING_UNIWIDTH_H@
+LN_S = @LN_S@
LOCALCHARSET_TESTS_ENVIRONMENT = @LOCALCHARSET_TESTS_ENVIRONMENT@
+LOCALE_FR = @LOCALE_FR@
+LOCALE_FR_UTF8 = @LOCALE_FR_UTF8@
+LOCALE_JA = @LOCALE_JA@
+LOCALE_ZH_CN = @LOCALE_ZH_CN@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
+LTLIBMULTITHREAD = @LTLIBMULTITHREAD@
LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
+LTLIBPTH = @LTLIBPTH@
+LTLIBTHREAD = @LTLIBTHREAD@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
MSGFMT = @MSGFMT@
MSGFMT_015 = @MSGFMT_015@
MSGMERGE = @MSGMERGE@
+NEXT_AS_FIRST_DIRECTIVE_ERRNO_H = @NEXT_AS_FIRST_DIRECTIVE_ERRNO_H@
+NEXT_AS_FIRST_DIRECTIVE_FCNTL_H = @NEXT_AS_FIRST_DIRECTIVE_FCNTL_H@
+NEXT_AS_FIRST_DIRECTIVE_GETOPT_H = @NEXT_AS_FIRST_DIRECTIVE_GETOPT_H@
+NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H = @NEXT_AS_FIRST_DIRECTIVE_LANGINFO_H@
+NEXT_AS_FIRST_DIRECTIVE_LOCALE_H = @NEXT_AS_FIRST_DIRECTIVE_LOCALE_H@
+NEXT_AS_FIRST_DIRECTIVE_STDDEF_H = @NEXT_AS_FIRST_DIRECTIVE_STDDEF_H@
+NEXT_AS_FIRST_DIRECTIVE_STDINT_H = @NEXT_AS_FIRST_DIRECTIVE_STDINT_H@
+NEXT_AS_FIRST_DIRECTIVE_STDLIB_H = @NEXT_AS_FIRST_DIRECTIVE_STDLIB_H@
+NEXT_AS_FIRST_DIRECTIVE_STRING_H = @NEXT_AS_FIRST_DIRECTIVE_STRING_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H = @NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H@
+NEXT_AS_FIRST_DIRECTIVE_TIME_H = @NEXT_AS_FIRST_DIRECTIVE_TIME_H@
+NEXT_AS_FIRST_DIRECTIVE_UNISTD_H = @NEXT_AS_FIRST_DIRECTIVE_UNISTD_H@
+NEXT_AS_FIRST_DIRECTIVE_WCHAR_H = @NEXT_AS_FIRST_DIRECTIVE_WCHAR_H@
+NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H = @NEXT_AS_FIRST_DIRECTIVE_WCTYPE_H@
+NEXT_ERRNO_H = @NEXT_ERRNO_H@
+NEXT_FCNTL_H = @NEXT_FCNTL_H@
+NEXT_GETOPT_H = @NEXT_GETOPT_H@
+NEXT_LANGINFO_H = @NEXT_LANGINFO_H@
+NEXT_LOCALE_H = @NEXT_LOCALE_H@
+NEXT_STDDEF_H = @NEXT_STDDEF_H@
NEXT_STDINT_H = @NEXT_STDINT_H@
NEXT_STDLIB_H = @NEXT_STDLIB_H@
NEXT_STRING_H = @NEXT_STRING_H@
NEXT_SYS_STAT_H = @NEXT_SYS_STAT_H@
NEXT_SYS_TIME_H = @NEXT_SYS_TIME_H@
+NEXT_SYS_TYPES_H = @NEXT_SYS_TYPES_H@
+NEXT_TIME_H = @NEXT_TIME_H@
NEXT_UNISTD_H = @NEXT_UNISTD_H@
NEXT_WCHAR_H = @NEXT_WCHAR_H@
NEXT_WCTYPE_H = @NEXT_WCTYPE_H@
OBJEXT = @OBJEXT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_DATE = @PACKAGE_DATE@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PERL = @PERL@
POSUB = @POSUB@
+PRAGMA_COLUMNS = @PRAGMA_COLUMNS@
+PRAGMA_SYSTEM_HEADER = @PRAGMA_SYSTEM_HEADER@
+PROVE = @PROVE@
+PTHREAD_H_DEFINES_STRUCT_TIMESPEC = @PTHREAD_H_DEFINES_STRUCT_TIMESPEC@
PTRDIFF_T_SUFFIX = @PTRDIFF_T_SUFFIX@
RANLIB = @RANLIB@
+REPLACE_BTOWC = @REPLACE_BTOWC@
+REPLACE_CALLOC = @REPLACE_CALLOC@
+REPLACE_CANONICALIZE_FILE_NAME = @REPLACE_CANONICALIZE_FILE_NAME@
REPLACE_CHOWN = @REPLACE_CHOWN@
-REPLACE_FCHDIR = @REPLACE_FCHDIR@
+REPLACE_CLOSE = @REPLACE_CLOSE@
+REPLACE_DUP = @REPLACE_DUP@
+REPLACE_DUP2 = @REPLACE_DUP2@
+REPLACE_DUPLOCALE = @REPLACE_DUPLOCALE@
+REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
+REPLACE_FCNTL = @REPLACE_FCNTL@
+REPLACE_FSTAT = @REPLACE_FSTAT@
+REPLACE_FSTATAT = @REPLACE_FSTATAT@
+REPLACE_FTRUNCATE = @REPLACE_FTRUNCATE@
+REPLACE_FUTIMENS = @REPLACE_FUTIMENS@
REPLACE_GETCWD = @REPLACE_GETCWD@
+REPLACE_GETDOMAINNAME = @REPLACE_GETDOMAINNAME@
+REPLACE_GETGROUPS = @REPLACE_GETGROUPS@
+REPLACE_GETLOGIN_R = @REPLACE_GETLOGIN_R@
REPLACE_GETPAGESIZE = @REPLACE_GETPAGESIZE@
REPLACE_GETTIMEOFDAY = @REPLACE_GETTIMEOFDAY@
+REPLACE_ISATTY = @REPLACE_ISATTY@
+REPLACE_ISWBLANK = @REPLACE_ISWBLANK@
REPLACE_ISWCNTRL = @REPLACE_ISWCNTRL@
REPLACE_LCHOWN = @REPLACE_LCHOWN@
+REPLACE_LINK = @REPLACE_LINK@
+REPLACE_LINKAT = @REPLACE_LINKAT@
+REPLACE_LOCALECONV = @REPLACE_LOCALECONV@
+REPLACE_LOCALTIME_R = @REPLACE_LOCALTIME_R@
REPLACE_LSEEK = @REPLACE_LSEEK@
+REPLACE_LSTAT = @REPLACE_LSTAT@
+REPLACE_MALLOC = @REPLACE_MALLOC@
+REPLACE_MBRLEN = @REPLACE_MBRLEN@
+REPLACE_MBRTOWC = @REPLACE_MBRTOWC@
+REPLACE_MBSINIT = @REPLACE_MBSINIT@
+REPLACE_MBSNRTOWCS = @REPLACE_MBSNRTOWCS@
+REPLACE_MBSRTOWCS = @REPLACE_MBSRTOWCS@
+REPLACE_MBSTATE_T = @REPLACE_MBSTATE_T@
+REPLACE_MBTOWC = @REPLACE_MBTOWC@
+REPLACE_MEMCHR = @REPLACE_MEMCHR@
REPLACE_MEMMEM = @REPLACE_MEMMEM@
REPLACE_MKDIR = @REPLACE_MKDIR@
+REPLACE_MKFIFO = @REPLACE_MKFIFO@
+REPLACE_MKNOD = @REPLACE_MKNOD@
REPLACE_MKSTEMP = @REPLACE_MKSTEMP@
+REPLACE_MKTIME = @REPLACE_MKTIME@
+REPLACE_NANOSLEEP = @REPLACE_NANOSLEEP@
+REPLACE_NL_LANGINFO = @REPLACE_NL_LANGINFO@
+REPLACE_NULL = @REPLACE_NULL@
+REPLACE_OPEN = @REPLACE_OPEN@
+REPLACE_OPENAT = @REPLACE_OPENAT@
+REPLACE_PREAD = @REPLACE_PREAD@
+REPLACE_PTSNAME = @REPLACE_PTSNAME@
+REPLACE_PTSNAME_R = @REPLACE_PTSNAME_R@
REPLACE_PUTENV = @REPLACE_PUTENV@
+REPLACE_PWRITE = @REPLACE_PWRITE@
+REPLACE_RANDOM_R = @REPLACE_RANDOM_R@
+REPLACE_READ = @REPLACE_READ@
+REPLACE_READLINK = @REPLACE_READLINK@
+REPLACE_REALLOC = @REPLACE_REALLOC@
+REPLACE_REALPATH = @REPLACE_REALPATH@
+REPLACE_RMDIR = @REPLACE_RMDIR@
+REPLACE_SETENV = @REPLACE_SETENV@
+REPLACE_SETLOCALE = @REPLACE_SETLOCALE@
+REPLACE_SLEEP = @REPLACE_SLEEP@
+REPLACE_STAT = @REPLACE_STAT@
+REPLACE_STPNCPY = @REPLACE_STPNCPY@
REPLACE_STRCASESTR = @REPLACE_STRCASESTR@
+REPLACE_STRCHRNUL = @REPLACE_STRCHRNUL@
+REPLACE_STRDUP = @REPLACE_STRDUP@
REPLACE_STRERROR = @REPLACE_STRERROR@
+REPLACE_STRERROR_R = @REPLACE_STRERROR_R@
+REPLACE_STRNCAT = @REPLACE_STRNCAT@
+REPLACE_STRNDUP = @REPLACE_STRNDUP@
+REPLACE_STRNLEN = @REPLACE_STRNLEN@
REPLACE_STRSIGNAL = @REPLACE_STRSIGNAL@
REPLACE_STRSTR = @REPLACE_STRSTR@
REPLACE_STRTOD = @REPLACE_STRTOD@
+REPLACE_STRTOK_R = @REPLACE_STRTOK_R@
+REPLACE_STRUCT_LCONV = @REPLACE_STRUCT_LCONV@
+REPLACE_STRUCT_TIMEVAL = @REPLACE_STRUCT_TIMEVAL@
+REPLACE_SYMLINK = @REPLACE_SYMLINK@
+REPLACE_TIMEGM = @REPLACE_TIMEGM@
+REPLACE_TOWLOWER = @REPLACE_TOWLOWER@
+REPLACE_TTYNAME_R = @REPLACE_TTYNAME_R@
+REPLACE_UNLINK = @REPLACE_UNLINK@
+REPLACE_UNLINKAT = @REPLACE_UNLINKAT@
+REPLACE_UNSETENV = @REPLACE_UNSETENV@
+REPLACE_USLEEP = @REPLACE_USLEEP@
+REPLACE_UTIMENSAT = @REPLACE_UTIMENSAT@
+REPLACE_WCRTOMB = @REPLACE_WCRTOMB@
+REPLACE_WCSNRTOMBS = @REPLACE_WCSNRTOMBS@
+REPLACE_WCSRTOMBS = @REPLACE_WCSRTOMBS@
+REPLACE_WCSWIDTH = @REPLACE_WCSWIDTH@
+REPLACE_WCTOB = @REPLACE_WCTOB@
+REPLACE_WCTOMB = @REPLACE_WCTOMB@
REPLACE_WCWIDTH = @REPLACE_WCWIDTH@
+REPLACE_WRITE = @REPLACE_WRITE@
+SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
SIG_ATOMIC_T_SUFFIX = @SIG_ATOMIC_T_SUFFIX@
SIZE_T_SUFFIX = @SIZE_T_SUFFIX@
STDBOOL_H = @STDBOOL_H@
+STDDEF_H = @STDDEF_H@
STDINT_H = @STDINT_H@
STRIP = @STRIP@
-SYS_STAT_H = @SYS_STAT_H@
-SYS_TIME_H = @SYS_TIME_H@
+SYS_TIME_H_DEFINES_STRUCT_TIMESPEC = @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
TERMLIBS = @TERMLIBS@
-TEX = @TEX@
+TEXINFO_DTD_VERSION = @TEXINFO_DTD_VERSION@
+TIME_H_DEFINES_STRUCT_TIMESPEC = @TIME_H_DEFINES_STRUCT_TIMESPEC@
+UNDEFINE_STRTOK_R = @UNDEFINE_STRTOK_R@
+UNISTD_H_HAVE_WINSOCK2_H = @UNISTD_H_HAVE_WINSOCK2_H@
+UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS = @UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS@
+USE_EXTERNAL_EASTASIANWIDTH = @USE_EXTERNAL_EASTASIANWIDTH@
+USE_EXTERNAL_LIBINTL = @USE_EXTERNAL_LIBINTL@
+USE_EXTERNAL_UNIDECODE = @USE_EXTERNAL_UNIDECODE@
USE_NLS = @USE_NLS@
+USE_UNICODE = @USE_UNICODE@
VERSION = @VERSION@
-VOID_UNSETENV = @VOID_UNSETENV@
-WCHAR_H = @WCHAR_H@
WCHAR_T_SUFFIX = @WCHAR_T_SUFFIX@
-WCTYPE_H = @WCTYPE_H@
+WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@
+WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@
WINT_T_SUFFIX = @WINT_T_SUFFIX@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
@@ -416,6 +943,7 @@ gl_LIBOBJS = @gl_LIBOBJS@
gl_LTLIBOBJS = @gl_LTLIBOBJS@
gltests_LIBOBJS = @gltests_LIBOBJS@
gltests_LTLIBOBJS = @gltests_LTLIBOBJS@
+gltests_WITNESS = @gltests_WITNESS@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -427,6 +955,7 @@ infodir = @infodir@
install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
+lispdir = @lispdir@
localedir = $(datadir)/locale
localstatedir = @localstatedir@
mandir = @mandir@
@@ -454,18 +983,16 @@ AM_CPPFLAGS = \
-DINFODIR=\"$(infodir)\" \
-DINFODIR2=\"$(infodir2)\"
-LDADD = ../lib/libtxi.a $(top_builddir)/gnulib/lib/libgnu.a \
- $(TERMLIBS) $(LIBINTL)
-
-infokey_LDADD = ../lib/libtxi.a $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
+LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(TERMLIBS) $(LIBINTL)
+infokey_LDADD = $(top_builddir)/gnulib/lib/libgnu.a $(LIBINTL)
EXTRA_DIST = README pcterm.c
ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \
echo-area.c echo-area.h \
filesys.c filesys.h footnotes.c footnotes.h gc.c gc.h \
indices.c indices.h info-utils.c info-utils.h info.c info.h infodoc.c \
- infomap.c infomap.h m-x.c man.c man.h nodemenu.c nodes.c nodes.h \
+ infomap.c infomap.h infopath.c m-x.c man.c man.h nodemenu.c nodes.c nodes.h \
search.c search.h session.c session.h signals.c signals.h \
- termdep.h terminal.c terminal.h tilde.c tilde.h \
+ tag.c tag.h termdep.h terminal.c terminal.h tilde.c tilde.h \
variables.c variables.h window.c window.h
nodist_ginfo_SOURCES = doc.c funs.h
@@ -497,18 +1024,18 @@ all: $(BUILT_SOURCES)
.SUFFIXES:
.SUFFIXES: .c .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu info/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu info/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu info/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu info/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -522,45 +1049,68 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
- test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
- else :; fi; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p \
+ ; then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' \
+ -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
- rm -f "$(DESTDIR)$(bindir)/$$f"; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' \
+ `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-ginfo$(EXEEXT): $(ginfo_OBJECTS) $(ginfo_DEPENDENCIES)
+
+ginfo$(EXEEXT): $(ginfo_OBJECTS) $(ginfo_DEPENDENCIES) $(EXTRA_ginfo_DEPENDENCIES)
@rm -f ginfo$(EXEEXT)
- $(LINK) $(ginfo_OBJECTS) $(ginfo_LDADD) $(LIBS)
-infokey$(EXEEXT): $(infokey_OBJECTS) $(infokey_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(ginfo_OBJECTS) $(ginfo_LDADD) $(LIBS)
+
+infokey$(EXEEXT): $(infokey_OBJECTS) $(infokey_DEPENDENCIES) $(EXTRA_infokey_DEPENDENCIES)
@rm -f infokey$(EXEEXT)
- $(LINK) $(infokey_OBJECTS) $(infokey_LDADD) $(LIBS)
-makedoc$(EXEEXT): $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES)
+ $(AM_V_CCLD)$(LINK) $(infokey_OBJECTS) $(infokey_LDADD) $(LIBS)
+
+makedoc$(EXEEXT): $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES) $(EXTRA_makedoc_DEPENDENCIES)
@rm -f makedoc$(EXEEXT)
- $(LINK) $(makedoc_OBJECTS) $(makedoc_LDADD) $(LIBS)
+ $(AM_V_CCLD)$(LINK) $(makedoc_OBJECTS) $(makedoc_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -582,6 +1132,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infodoc.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infokey.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infomap.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infopath.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/key.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/m-x.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/makedoc.Po@am__quote@
@@ -591,68 +1142,74 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/session.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signals.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tag.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/terminal.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tilde.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variables.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Po@am__quote@
.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $<
.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
+@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(am__tagged_files)
+ $(am__define_uniq_tagged_files); mkid -fID $$unique
+tags: tags-am
+TAGS: tags
+
+tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ $(am__define_uniq_tagged_files); \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ctags: ctags-am
+
+CTAGS: ctags
+ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files)
+ $(am__define_uniq_tagged_files); \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+cscopelist: cscopelist-am
+
+cscopelist-am: $(am__tagged_files)
+ list='$(am__tagged_files)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -673,13 +1230,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -702,16 +1263,22 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
mostlyclean-generic:
clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@@ -735,6 +1302,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -743,18 +1312,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am: install-binPROGRAMS
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -776,20 +1355,21 @@ ps-am:
uninstall-am: uninstall-binPROGRAMS
-.MAKE: install-am install-strip
+.MAKE: all check install install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-noinstPROGRAMS ctags distclean \
- distclean-compile distclean-generic distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-binPROGRAMS install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
- tags uninstall uninstall-am uninstall-binPROGRAMS
+.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
+ clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
+ cscopelist-am ctags ctags-am distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags tags-am uninstall \
+ uninstall-am uninstall-binPROGRAMS
# We need a linear ordering to prevent race condition in parallel make.
@@ -805,6 +1385,7 @@ key.c: funs.h
funs.h: makedoc$(EXEEXT) $(cmd_sources)
rm -f $(generated_sources)
$(top_builddir)/$(native_tools)/info/makedoc $(cmd_sources)
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/info/README b/info/README
index 4178a01..15d3ff3 100644
--- a/info/README
+++ b/info/README
@@ -1,17 +1,17 @@
-$Id: README,v 1.3 2004/04/11 17:56:45 karl Exp $
+$Id: README 5191 2013-02-23 00:11:18Z karl $
texinfo/info/README
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright 2002, 2011 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.
-Info 2.0 is a complete rewrite of the original standalone Info I wrote in
-1987, the first program I wrote for rms. That program was something like
-my second Unix program ever, and my die-hard machine language coding habits
-tended to show through. I found the original Info hard to read and
-maintain, and thus decided to write this one.
+Info 2.0 is a complete rewrite of the original standalone Info that I
+(Brian Fox) wrote in 1987, the first program I wrote for rms. That
+program was something like my second Unix program ever, and my die-hard
+machine language coding habits tended to show through. I found the
+original Info hard to read and maintain, and thus decided to write this one.
The rewrite consists of about 12,000 lines of code written in about 12
days. I believe this version of Info to be in much better shape than the
@@ -27,4 +27,4 @@ A full listing of the commands available in Info can be gotten by typing
`?' while within an Info window. This produces a node in a window which
can be viewed just like any Info node.
---Brian Fox <bfox@gnu.org>
+--Brian Fox
diff --git a/info/dir.c b/info/dir.c
index 8dbc239..337b931 100644
--- a/info/dir.c
+++ b/info/dir.c
@@ -1,8 +1,8 @@
/* dir.c -- how to build a special "dir" node from "localdir" files.
- $Id: dir.c,v 1.8 2008/06/11 09:55:41 gray Exp $
+ $Id: dir.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2004, 2007,
- 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2004, 2007, 2008, 2009, 2012,
+ 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "info-utils.h"
@@ -28,8 +28,8 @@
with the addition of the menus of every file named in the array
dirs_to_add which are found in INFOPATH. */
-static void add_menu_to_file_buffer (char *contents, long int size,
- FILE_BUFFER *fb);
+static void add_menu_to_file_buffer (char *contents, size_t size,
+ FILE_BUFFER *fb);
static void insert_text_into_fb_at_binding (FILE_BUFFER *fb,
SEARCH_BINDING *binding, char *text, int textlen);
void maybe_build_dir_node (char *dirname);
@@ -40,7 +40,7 @@ static char *dirs_to_add[] = {
/* Return zero if the file represented in the stat structure TEST has
- already been seen, nonzero else. */
+ already been seen, nonzero otherwise. */
typedef struct
{
@@ -59,7 +59,10 @@ new_dir_file_p (struct stat *test)
{
dir_file_list_entry_type entry;
entry = dir_file_list[i];
- if (entry.device == test->st_dev && entry.inode == test->st_ino)
+ if (entry.device == test->st_dev && entry.inode == test->st_ino
+ /* On MS-Windows, `stat' returns zero as the inode, so we
+ effectively disable this optimization for that OS. */
+ && entry.inode != 0)
return 0;
}
@@ -92,14 +95,15 @@ maybe_build_dir_node (char *dirname)
with the dir file just found. */
new_dir_file_p (&dir_buffer->finfo);
- path_index = update_tags = 0;
+ update_tags = 0;
/* Using each element of the path, check for one of the files in
DIRS_TO_ADD. Do not check for "localdir.info.Z" or anything else.
Only files explictly named are eligible. This is a design decision.
There can be an info file name "localdir.info" which contains
information on the setting up of "localdir" files. */
- while ((this_dir = extract_colon_unit (infopath, &path_index)))
+ for (this_dir = infopath_first (&path_index); this_dir;
+ this_dir = infopath_next (&path_index))
{
register int da_index;
char *from_file;
@@ -136,7 +140,7 @@ maybe_build_dir_node (char *dirname)
/* Only add this file if we have not seen it before. */
if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo))
{
- long filesize;
+ size_t filesize;
int compressed;
char *contents = filesys_read_info_file (fullpath, &filesize,
&finfo, &compressed);
@@ -164,7 +168,7 @@ maybe_build_dir_node (char *dirname)
to the menu found in FB->contents. Second argument SIZE is the total
size of CONTENTS. */
static void
-add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
+add_menu_to_file_buffer (char *contents, size_t size, FILE_BUFFER *fb)
{
SEARCH_BINDING contents_binding, fb_binding;
long contents_offset, fb_offset;
@@ -180,11 +184,9 @@ add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
fb_binding.flags = S_FoldCase | S_SkipDest;
/* Move to the start of the menus in CONTENTS and FB. */
- contents_offset = search_forward (INFO_MENU_LABEL, &contents_binding);
- fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
-
- /* If there is no menu in CONTENTS, quit now. */
- if (contents_offset == -1)
+ if (search_forward (INFO_MENU_LABEL, &contents_binding, &contents_offset)
+ != search_success)
+ /* If there is no menu in CONTENTS, quit now. */
return;
/* There is a menu in CONTENTS, and contents_offset points to the first
@@ -193,7 +195,8 @@ add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
contents_offset += skip_whitespace_and_newlines (contents + contents_offset);
/* If there is no menu in FB, make one. */
- if (fb_offset == -1)
+ if (search_forward (INFO_MENU_LABEL, &fb_binding, &fb_offset)
+ != search_success)
{
/* Find the start of the second node in this file buffer. If there
is only one node, we will be adding the contents to the end of
@@ -224,8 +227,8 @@ add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb)
fb_binding.buffer = fb->contents;
fb_binding.start = 0;
fb_binding.end = fb->filesize;
- fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
- if (fb_offset == -1)
+ if (search_forward (INFO_MENU_LABEL, &fb_binding, &fb_offset)
+ != search_success)
abort ();
}
diff --git a/info/display.c b/info/display.c
index 28ed5cb..968420c 100644
--- a/info/display.c
+++ b/info/display.c
@@ -1,7 +1,7 @@
/* display.c -- How to display Info windows.
- $Id: display.c,v 1.16 2008/06/11 09:55:41 gray Exp $
+ $Id: display.c 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1993, 1997, 2003, 2004, 2006, 2007, 2008
+ Copyright 1993, 1997, 2003, 2004, 2006, 2007, 2008, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,20 +17,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "display.h"
+#include "tag.h"
extern int info_any_buffered_input_p (void); /* Found in session.c. */
static void free_display (DISPLAY_LINE **display);
static DISPLAY_LINE **make_display (int width, int height);
-void handle_tag (char *tag);
-void handle_tag_start (char *tag);
-void handle_tag_end (char *tag);
-
/* An array of display lines which tell us what is currently visible on
the display. */
DISPLAY_LINE **the_display = NULL;
@@ -90,33 +87,6 @@ display_update_display (WINDOW *window)
/* Always update the echo area. */
display_update_one_window (the_echo_area);
}
-
-void
-handle_tag_start (char *tag)
-{
- /* TODO really handle this tag. */
- return;
-}
-
-void
-handle_tag_end (char *tag)
-{
- /* TODO really handle this tag. */
- return;
-}
-
-void
-handle_tag (char *tag)
-{
- if (tag[0] == '/')
- {
- tag++;
- handle_tag_end (tag);
- }
- else
- handle_tag_start (tag);
-}
-
struct display_node_closure {
WINDOW *win;
@@ -143,14 +113,14 @@ find_diff (const char *a, size_t alen, const char *b, size_t blen, int *ppos)
}
int
-display_node_text(void *closure, size_t line_index,
+display_node_text(void *closure, size_t pline_index, size_t lline_index,
const char *src_line,
char *printed_line, size_t pl_index, size_t pl_count)
{
struct display_node_closure *dn = closure;
WINDOW *win = dn->win;
DISPLAY_LINE **display = dn->display;
- DISPLAY_LINE *entry = display[win->first_row + line_index];
+ DISPLAY_LINE *entry = display[win->first_row + pline_index];
/* We have the exact line as it should appear on the screen.
Check to see if this line matches the one already appearing
@@ -169,7 +139,7 @@ display_node_text(void *closure, size_t line_index,
/* Need to erase the line if it has escape sequences. */
|| (raw_escapes_p && mbschr (entry->text, '\033') != 0))
{
- terminal_goto_xy (0, win->first_row + line_index);
+ terminal_goto_xy (0, win->first_row + pline_index);
terminal_clear_to_eol ();
entry->inverse = 0;
entry->text[0] = '\0';
@@ -184,7 +154,7 @@ display_node_text(void *closure, size_t line_index,
if (i != pl_count || pl_count != entry->textlen)
{
/* Move to the proper point on the terminal. */
- terminal_goto_xy (i, win->first_row + line_index);
+ terminal_goto_xy (i, win->first_row + pline_index);
/* If there is any text to print, print it. */
if (i != pl_count)
terminal_put_text (printed_line + i);
@@ -226,7 +196,7 @@ display_node_text(void *closure, size_t line_index,
return 1;
}
- if (line_index + 1 == win->height)
+ if (pline_index + 1 == win->height)
return 1;
return 0;
@@ -265,14 +235,15 @@ display_update_one_window (WINDOW *win)
dnc.win = win;
dnc.display = the_display;
- line_index = process_node_text (win, win->line_starts[win->pagetop],
+ line_index = process_node_text (win,
+ win->line_starts[win->pagetop],
1,
display_node_text,
&dnc);
if (display_was_interrupted_p)
return;
}
-
+
/* We have reached the end of the node or the end of the window. If it
is the end of the node, then clear the lines of the window from here
to the end of the window. */
@@ -311,7 +282,6 @@ display_update_one_window (WINDOW *win)
strcpy (display[line_index]->text, win->modeline);
display[line_index]->inverse = 1;
display[line_index]->textlen = strlen (win->modeline);
- fflush (stdout);
}
}
@@ -354,7 +324,7 @@ display_scroll_display (int start, int end, int amount)
last = end + amount;
/* Shift the lines to scroll right into place. */
- for (i = 0; i < (end - start); i++)
+ for (i = 1; i <= (end - start); i++)
{
temp = the_display[last - i];
the_display[last - i] = the_display[end - i];
@@ -370,8 +340,7 @@ display_scroll_display (int start, int end, int amount)
the_display[i]->inverse = 0;
}
}
-
- if (amount < 0)
+ else
{
last = start + amount;
for (i = 0; i < (end - start); i++)
diff --git a/info/display.h b/info/display.h
index e92a572..3abdab8 100644
--- a/info/display.h
+++ b/info/display.h
@@ -1,10 +1,8 @@
/* display.h -- How the display in Info is done.
- $Id: display.h,v 1.8 2008/06/09 22:51:20 gray Exp $
+ $Id: display.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2008, 2011, 2012, 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_DISPLAY_H
#define INFO_DISPLAY_H
@@ -74,6 +72,4 @@ extern void display_scroll_display (int start, int end, int amount);
extern void display_scroll_line_starts (WINDOW *window, int old_pagetop,
char **old_starts, int old_count);
-void handle_tag (char *tag);
-
#endif /* not INFO_DISPLAY_H */
diff --git a/info/doc.h b/info/doc.h
index 98d1ec6..2833c54 100644
--- a/info/doc.h
+++ b/info/doc.h
@@ -1,7 +1,8 @@
/* doc.h -- Structures associating function pointers with documentation.
- $Id: doc.h,v 1.7 2008/02/26 16:51:05 karl Exp $
+ $Id: doc.h 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1993, 2001, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 2001, 2004, 2007, 2011, 2013
+ 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
@@ -16,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#if !defined (DOC_H)
#define DOC_H
@@ -92,7 +93,6 @@ extern InfoCommand *named_function (char *name);
#endif /* NAMED_FUNCTIONS */
extern char *function_documentation (InfoCommand *cmd);
-extern char *key_documentation (char key, Keymap map);
extern char *pretty_keyname (unsigned char key);
extern char *pretty_keyseq (char *keyseq);
extern char *where_is (Keymap map, InfoCommand *cmd);
diff --git a/info/dribble.c b/info/dribble.c
index e77370b..a993d69 100644
--- a/info/dribble.c
+++ b/info/dribble.c
@@ -1,7 +1,8 @@
/* dribble.c -- dribble files for Info.
- $Id: dribble.c,v 1.7 2008/06/11 09:55:41 gray Exp $
+ $Id: dribble.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1998, 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1998, 2004, 2007, 2008, 2013
+ 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
@@ -16,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "dribble.h"
diff --git a/info/dribble.h b/info/dribble.h
index 5f8fbfa..d8d9cbd 100644
--- a/info/dribble.h
+++ b/info/dribble.h
@@ -1,9 +1,7 @@
-/* dribble.h -- Functions and vars declared in dribble.c. */
+/* dribble.h -- Functions and vars declared in dribble.c.
+ $Id: dribble.h 5337 2013-08-22 17:54:06Z karl $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 2004, 2007, 2013 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
@@ -18,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#if !defined (_DRIBBLE_H_)
#define _DRIBBLE_H_
diff --git a/info/echo-area.c b/info/echo-area.c
index c16ef35..2ce170b 100644
--- a/info/echo-area.c
+++ b/info/echo-area.c
@@ -1,7 +1,7 @@
/* echo-area.c -- how to read a line in the echo area.
- $Id: echo-area.c,v 1.14 2008/06/11 09:55:41 gray Exp $
+ $Id: echo-area.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2004, 2007, 2008
+ Copyright 1993, 1997, 1998, 1999, 2001, 2004, 2007, 2008, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
@@ -771,8 +771,8 @@ static REFERENCE **echo_area_completion_items = NULL;
the variable echo_area_completion_items. If there is only one element,
it is the only possible completion. */
static REFERENCE **completions_found = NULL;
-static int completions_found_index = 0;
-static int completions_found_slots = 0;
+static size_t completions_found_index = 0;
+static size_t completions_found_slots = 0;
/* The lowest common denominator found while completing. */
static REFERENCE *LCD_completion;
@@ -814,7 +814,7 @@ info_read_completing_internal (WINDOW *window, const char *prompt,
/* Initialize our local variables. */
initialize_input_line (prompt);
-
+
/* Initialize the echo area for the first (but maybe not the last) time. */
echo_area_initialize_node ();
@@ -828,6 +828,7 @@ info_read_completing_internal (WINDOW *window, const char *prompt,
active_window = the_echo_area;
echo_area_is_active++;
+ window_line_map_init (active_window);
/* Read characters in the echo area. */
while (1)
@@ -840,8 +841,8 @@ info_read_completing_internal (WINDOW *window, const char *prompt,
a default or aborted, and if FORCE is active. */
if (force && line && *line && completions)
{
- register int i;
-
+ size_t i;
+
build_completions ();
/* If there is only one completion, then make the line be that
@@ -912,7 +913,9 @@ info_read_maybe_completing (WINDOW *window,
DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
{
- if (!echo_area_completion_items)
+ if (!echo_area_completion_items
+ || (isprint (key)
+ && ea_last_executed_command == (VFunction *) ea_possible_completions))
{
ea_insert (window, count, key);
return;
@@ -931,15 +934,14 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
}
else
{
- register int i, l;
- int limit, iterations, max_label = 0;
+ size_t i, l;
+ size_t limit, iterations, max_label = 0;
initialize_message_buffer ();
- printf_to_message_buffer (completions_found_index == 1
- ? _("One completion:\n")
- : _("%d completions:\n"),
- (void *) (long) completions_found_index,
- NULL, NULL);
+ printf_to_message_buffer (ngettext ("%d completion:\n",
+ "%d completions:\n",
+ completions_found_index),
+ completions_found_index);
/* Find the maximum length of a label. */
for (i = 0; i < completions_found_index; i++)
@@ -985,17 +987,17 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
label = completions_found[l]->label;
printed_length = strlen (label);
- printf_to_message_buffer ("%s", label, NULL, NULL);
+ printf_to_message_buffer ("%s", label);
if (j + 1 < limit)
{
for (k = 0; k < max_label - printed_length; k++)
- printf_to_message_buffer (" ", NULL, NULL, NULL);
+ printf_to_message_buffer (" ");
}
}
l += iterations;
}
- printf_to_message_buffer ("\n", NULL, NULL, NULL);
+ printf_to_message_buffer ("\n");
}
/* Make a new node to hold onto possible completions. Don't destroy
@@ -1026,15 +1028,17 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
if (calling_window->height > (iterations * 2)
&& calling_window->height / 2 >= WINDOW_MIN_SIZE)
{
- int start, pagetop;
+ int pagetop;
#ifdef SPLIT_BEFORE_ACTIVE
- int end;
+ int start, end;
#endif
active_window = calling_window;
/* Perhaps we can scroll this window on redisplay. */
+#ifdef SPLIT_BEFORE_ACTIVE
start = calling_window->first_row;
+#endif
pagetop = calling_window->pagetop;
compwin =
@@ -1108,7 +1112,8 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion"))
If there are some, insert the space character and continue. */
if (key == SPC && completions_found_index > 1)
{
- register int i, offset;
+ size_t i;
+ int offset;
offset = input_line_end - input_line_beg;
@@ -1163,7 +1168,7 @@ static REFERENCE **last_completion_items = NULL;
static void
completions_must_be_rebuilt (void)
{
- maybe_free (last_completion_request);
+ free (last_completion_request);
last_completion_request = NULL;
last_completion_items = NULL;
}
@@ -1173,7 +1178,8 @@ completions_must_be_rebuilt (void)
static void
build_completions (void)
{
- register int i, len;
+ size_t i;
+ int len;
register REFERENCE *entry;
char *request;
int informed_of_lengthy_job = 0;
@@ -1201,7 +1207,7 @@ build_completions (void)
return;
}
- maybe_free (last_completion_request);
+ free (last_completion_request);
last_completion_request = request;
last_completion_items = echo_area_completion_items;
@@ -1214,13 +1220,12 @@ build_completions (void)
if (mbsncasecmp (request, entry->label, len) == 0)
add_pointer_to_array (entry, completions_found_index,
completions_found, completions_found_slots,
- 20, REFERENCE *);
+ 20);
if (!informed_of_lengthy_job && completions_found_index > 100)
{
informed_of_lengthy_job = 1;
- window_message_in_echo_area (_("Building completions..."),
- NULL, NULL);
+ window_message_in_echo_area (_("Building completions..."));
}
}
@@ -1257,7 +1262,7 @@ build_completions (void)
shortest = j;
}
- maybe_free (LCD_reference.label);
+ free (LCD_reference.label);
LCD_reference.label = xmalloc (1 + shortest);
/* Since both the sorting done inside remove_completion_duplicates
and all the comparisons above are case-insensitive, it's
@@ -1301,7 +1306,7 @@ compare_references (const void *entry1, const void *entry2)
static void
remove_completion_duplicates (void)
{
- register int i, j;
+ size_t i, j;
REFERENCE **temp;
int newlen;
@@ -1342,15 +1347,12 @@ remove_completion_duplicates (void)
DECLARE_INFO_COMMAND (ea_scroll_completions_window, _("Scroll the completions window"))
{
WINDOW *compwin;
- int old_pagetop;
compwin = get_internal_info_window (compwin_name);
if (!compwin)
compwin = calling_window;
- old_pagetop = compwin->pagetop;
-
/* Let info_scroll_forward () do the work, and print any messages that
need to be displayed. */
info_scroll_forward (compwin, count, key);
@@ -1394,8 +1396,8 @@ typedef struct {
} PUSHED_EA;
static PUSHED_EA **pushed_echo_areas = NULL;
-static int pushed_echo_areas_index = 0;
-static int pushed_echo_areas_slots = 0;
+static size_t pushed_echo_areas_index = 0;
+static size_t pushed_echo_areas_slots = 0;
/* Pushing the echo_area has a side effect of zeroing the completion_items. */
static void
@@ -1415,7 +1417,7 @@ push_echo_area (void)
pushed->compwin = echo_area_completions_window;
add_pointer_to_array (pushed, pushed_echo_areas_index, pushed_echo_areas,
- pushed_echo_areas_slots, 4, PUSHED_EA *);
+ pushed_echo_areas_slots, 4);
echo_area_completion_items = NULL;
}
@@ -1461,7 +1463,7 @@ pop_echo_area (void)
static int
echo_area_stack_contains_completions_p (void)
{
- register int i;
+ size_t i;
for (i = 0; i < pushed_echo_areas_index; i++)
if (pushed_echo_areas[i]->compwin)
@@ -1487,13 +1489,12 @@ pause_or_input (void)
#ifdef FD_SET
struct timeval timer;
fd_set readfds;
- int ready;
FD_ZERO (&readfds);
FD_SET (fileno (stdin), &readfds);
timer.tv_sec = 2;
timer.tv_usec = 0;
- ready = select (fileno (stdin) + 1, &readfds, NULL, NULL, &timer);
+ select (fileno (stdin) + 1, &readfds, NULL, NULL, &timer);
#endif /* FD_SET */
}
diff --git a/info/echo-area.h b/info/echo-area.h
index da397b6..132e1b2 100644
--- a/info/echo-area.h
+++ b/info/echo-area.h
@@ -1,10 +1,8 @@
/* echo-area.h -- Functions used in reading information from the echo area.
- $Id: echo-area.h,v 1.8 2008/02/26 16:51:05 karl Exp $
+ $Id: echo-area.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2008, 2011, 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_ECHO_AREA_H
#define INFO_ECHO_AREA_H
diff --git a/info/filesys.c b/info/filesys.c
index dcf5c67..fe8c1b1 100644
--- a/info/filesys.c
+++ b/info/filesys.c
@@ -1,8 +1,8 @@
/* filesys.c -- filesystem specific functions.
- $Id: filesys.c,v 1.12 2008/06/11 09:55:42 gray Exp $
+ $Id: filesys.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2000, 2002, 2003, 2004, 2007, 2008, 2009, 2011,
+ 2012, 2013 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
@@ -17,12 +17,13 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "tilde.h"
#include "filesys.h"
+#include "tag.h"
/* Local to this file. */
static char *info_file_in_path (char *filename, char *path);
@@ -30,7 +31,6 @@ static char *lookup_info_filename (char *filename);
static char *info_absolute_file (char *fname);
static void remember_info_filename (char *filename, char *expansion);
-static void maybe_initialize_infopath (void);
typedef struct
{
@@ -53,10 +53,17 @@ static char *info_suffixes[] = {
};
static COMPRESSION_ALIST compress_suffixes[] = {
+#if STRIP_DOT_EXE
{ ".gz", "gunzip" },
+ { ".lz", "lunzip" },
+#else
+ { ".gz", "gzip -d" },
+ { ".lz", "lzip -d" },
+#endif
+ { ".xz", "unxz" },
{ ".bz2", "bunzip2" },
- { ".lzma", "unlzma" },
{ ".z", "gunzip" },
+ { ".lzma", "unlzma" },
{ ".Z", "uncompress" },
{ ".Y", "unyabba" },
#ifdef __MSDOS__
@@ -66,13 +73,6 @@ static COMPRESSION_ALIST compress_suffixes[] = {
{ NULL, NULL }
};
-/* The path on which we look for info files. You can initialize this
- from the environment variable INFOPATH if there is one, or you can
- call info_add_path () to add paths to the beginning or end of it.
- You can call zap_infopath () to make the path go away. */
-char *infopath = NULL;
-static int infopath_size = 0;
-
/* Expand the filename in PARTIAL to make a real name for this operating
system. This looks in INFO_PATHS in order to find the correct file.
If it can't find the file, it returns NULL. */
@@ -85,9 +85,9 @@ info_find_fullpath (char *partial)
int initial_character;
char *temp;
- filesys_error_number = 0;
+ debug(1, (_("looking for file \"%s\""), partial));
- maybe_initialize_infopath ();
+ filesys_error_number = 0;
if (partial && (initial_character = *partial))
{
@@ -138,7 +138,7 @@ info_find_fullpath (char *partial)
partial = local_temp_filename;
}
else
- temp = info_file_in_path (partial, infopath);
+ temp = info_file_in_path (partial, infopath ());
if (temp)
{
@@ -158,31 +158,28 @@ info_find_fullpath (char *partial)
/* Scan the list of directories in PATH looking for FILENAME. If we find
one that is a regular file, return it as a new string. Otherwise, return
a NULL pointer. */
-static char *
-info_file_in_path (char *filename, char *path)
+char *
+info_file_find_next_in_path (char *filename, char *path, int *diridx)
{
struct stat finfo;
char *temp_dirname;
- int statable, dirname_index;
+ int statable;
/* Reject ridiculous cases up front, to prevent infinite recursion
later on. E.g., someone might say "info '(.)foo'"... */
if (!*filename || STREQ (filename, ".") || STREQ (filename, ".."))
return NULL;
- dirname_index = 0;
-
- while ((temp_dirname = extract_colon_unit (path, &dirname_index)))
+ while ((temp_dirname = extract_colon_unit (path, diridx)))
{
register int i, pre_suffix_length;
char *temp;
+ debug(1, (_("looking for file %s in %s"), filename, temp_dirname));
/* Expand a leading tilde if one is present. */
if (*temp_dirname == '~')
{
- char *expanded_dirname;
-
- expanded_dirname = tilde_expand_word (temp_dirname);
+ char *expanded_dirname = tilde_expand_word (temp_dirname);
free (temp_dirname);
temp_dirname = expanded_dirname;
}
@@ -209,6 +206,7 @@ info_file_in_path (char *filename, char *path)
{
if (S_ISREG (finfo.st_mode))
{
+ debug(1, (_("found file %s"), temp));
return temp;
}
else if (S_ISDIR (finfo.st_mode))
@@ -223,6 +221,7 @@ info_file_in_path (char *filename, char *path)
if (newtemp)
{
free (temp);
+ debug(1, (_("found file %s"), newtemp));
return newtemp;
}
}
@@ -242,7 +241,10 @@ info_file_in_path (char *filename, char *path)
statable = (stat (temp, &finfo) == 0);
if (statable && (S_ISREG (finfo.st_mode)))
- return temp;
+ {
+ debug(1, (_("found file %s"), temp));
+ return temp;
+ }
}
}
}
@@ -251,6 +253,13 @@ info_file_in_path (char *filename, char *path)
return NULL;
}
+static char *
+info_file_in_path (char *filename, char *path)
+{
+ int i = 0;
+ return info_file_find_next_in_path (filename, path, &i);
+}
+
/* Assume FNAME is an absolute file name, and check whether it is
a regular file. If it is, return it as a new string; otherwise
return a NULL pointer. We do it by taking the file name apart
@@ -352,64 +361,21 @@ remember_info_filename (char *filename, char *expansion)
names_and_files[names_and_files_index] = NULL;
}
-static void
-maybe_initialize_infopath (void)
-{
- if (!infopath_size)
- {
- infopath = (char *)
- xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH)));
-
- strcpy (infopath, DEFAULT_INFOPATH);
- }
-}
-
-/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
- whether to put PATH at the front or end of INFOPATH. */
void
-info_add_path (char *path, int where)
+forget_file_names (void)
{
- int len;
-
- if (!infopath)
- {
- infopath = xmalloc (infopath_size = 200 + strlen (path));
- infopath[0] = '\0';
- }
-
- len = strlen (path) + strlen (infopath);
-
- if (len + 2 >= infopath_size)
- infopath = xrealloc (infopath, (infopath_size += (2 * len) + 2));
+ int i;
- if (!*infopath)
- strcpy (infopath, path);
- else if (where == INFOPATH_APPEND)
+ for (i = 0; i < names_and_files_index; i++)
{
- strcat (infopath, PATH_SEP);
- strcat (infopath, path);
+ free (names_and_files[i]->filename);
+ free (names_and_files[i]->expansion);
+ free (names_and_files[i]);
+ names_and_files[i] = NULL;
}
- else if (where == INFOPATH_PREPEND)
- {
- char *temp = xstrdup (infopath);
- strcpy (infopath, path);
- strcat (infopath, PATH_SEP);
- strcat (infopath, temp);
- free (temp);
- }
-}
-
-/* Make INFOPATH have absolutely nothing in it. */
-void
-zap_infopath (void)
-{
- if (infopath)
- free (infopath);
-
- infopath = NULL;
- infopath_size = 0;
+ names_and_files_index = 0;
}
-
+
/* Given a chunk of text and its length, convert all CRLF pairs at every
end-of-line into a single Newline character. Return the length of
produced text.
@@ -450,22 +416,22 @@ convert_eols (char *text, long int textlen)
If the file turns out to be compressed, set IS_COMPRESSED to non-zero.
If the file cannot be read, return a NULL pointer. */
char *
-filesys_read_info_file (char *pathname, long int *filesize,
- struct stat *finfo, int *is_compressed)
+filesys_read_info_file (char *pathname, size_t *filesize,
+ struct stat *finfo, int *is_compressed)
{
- long st_size;
+ size_t fsize;
+ char *contents;
- *filesize = filesys_error_number = 0;
+ fsize = filesys_error_number = 0;
if (compressed_filename_p (pathname))
{
*is_compressed = 1;
- return filesys_read_compressed (pathname, filesize);
+ contents = filesys_read_compressed (pathname, &fsize);
}
else
{
int descriptor;
- char *contents;
*is_compressed = 0;
descriptor = open (pathname, O_RDONLY | O_BINARY, 0666);
@@ -478,31 +444,30 @@ filesys_read_info_file (char *pathname, long int *filesize,
}
/* Try to read the contents of this file. */
- st_size = (long) finfo->st_size;
- contents = xmalloc (1 + st_size);
- if ((read (descriptor, contents, st_size)) != st_size)
+ fsize = (long) finfo->st_size;
+ contents = xmalloc (1 + fsize);
+ if ((read (descriptor, contents, fsize)) != fsize)
{
filesys_error_number = errno;
close (descriptor);
free (contents);
return NULL;
}
-
+ contents[fsize] = 0;
close (descriptor);
+ }
- /* Convert any DOS-style CRLF EOLs into Unix-style NL.
- Seems like a good idea to have even on Unix, in case the Info
- files are coming from some Windows system across a network. */
- *filesize = convert_eols (contents, st_size);
-
- /* EOL conversion can shrink the text quite a bit. We don't
- want to waste storage. */
- if (*filesize < st_size)
- contents = xrealloc (contents, 1 + *filesize);
- contents[*filesize] = '\0';
+ /* Convert any DOS-style CRLF EOLs into Unix-style NL.
+ Seems like a good idea to have even on Unix, in case the Info
+ files are coming from some Windows system across a network. */
+ fsize = convert_eols (contents, fsize);
- return contents;
- }
+ /* EOL conversion can shrink the text quite a bit. We don't
+ want to waste storage. */
+ contents = xrealloc (contents, 1 + fsize);
+ contents[fsize] = '\0';
+ *filesize = fsize;
+ return contents;
}
/* Typically, pipe buffers are 4k. */
@@ -512,7 +477,7 @@ filesys_read_info_file (char *pathname, long int *filesize,
#define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER)
char *
-filesys_read_compressed (char *pathname, long int *filesize)
+filesys_read_compressed (char *pathname, size_t *filesize)
{
FILE *stream;
char *command, *decompressor;
@@ -538,7 +503,7 @@ filesys_read_compressed (char *pathname, long int *filesize)
temp = xmalloc (5 + strlen (command));
sprintf (temp, "%s...", command);
- message_in_echo_area ("%s", temp, NULL);
+ message_in_echo_area ("%s", temp);
free (temp);
}
#endif /* !BUILDING_LIBRARY */
@@ -549,7 +514,7 @@ filesys_read_compressed (char *pathname, long int *filesize)
/* Read chunks from this file until there are none left to read. */
if (stream)
{
- long offset, size;
+ size_t offset, size;
char *chunk;
offset = size = 0;
@@ -557,7 +522,7 @@ filesys_read_compressed (char *pathname, long int *filesize)
while (1)
{
- int bytes_read;
+ size_t bytes_read;
bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream);
@@ -581,9 +546,9 @@ filesys_read_compressed (char *pathname, long int *filesize)
}
else
{
- *filesize = convert_eols (contents, offset);
- contents = xrealloc (contents, 1 + *filesize);
- contents[*filesize] = '\0';
+ contents = xrealloc (contents, 1 + offset);
+ contents[offset] = '\0';
+ *filesize = offset;
}
}
else
diff --git a/info/filesys.h b/info/filesys.h
index 611a709..fc1ac67 100644
--- a/info/filesys.h
+++ b/info/filesys.h
@@ -1,8 +1,8 @@
/* filesys.h -- external declarations for filesys.c.
- $Id: filesys.h,v 1.7 2007/07/01 21:20:29 karl Exp $
+ $Id: filesys.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2004, 2005, 2007 Free Software
- Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2002, 2004, 2005, 2007, 2009, 2012, 2013
+ 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_FILESYS_H
#define INFO_FILESYS_H
@@ -25,24 +25,36 @@
/* The path on which we look for info files. You can initialize this
from the environment variable INFOPATH if there is one, or you can
call info_add_path () to add paths to the beginning or end of it. */
-extern char *infopath;
+
+extern char *infopath ();
+
+/* Initialize INFOPATH */
+void infopath_init (void);
/* Make INFOPATH have absolutely nothing in it. */
-extern void zap_infopath (void);
+extern void infopath_clear (void);
/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
whether to put PATH at the front or end of INFOPATH. */
-extern void info_add_path (char *path, int where);
+extern void infopath_add (char *path, int where);
+
+/* Iterate over INFOPATH */
+char *infopath_first (int *idx);
+char *infopath_next (int *idx);
-/* Defines that are passed along with the pathname to info_add_path (). */
+/* Defines that are passed along with the pathname to infopath_add (). */
#define INFOPATH_PREPEND 0
#define INFOPATH_APPEND 1
+#define INFOPATH_INIT 2
/* Expand the filename in PARTIAL to make a real name for this operating
system. This looks in INFO_PATHS in order to find the correct file.
If it can't find the file, it returns NULL. */
extern char *info_find_fullpath (char *partial);
+/* Forget all cached file names */
+extern void forget_file_names (void);
+
/* Given a chunk of text and its length, convert all CRLF pairs at the
EOLs into a single Newline character. Return the length of produced
text. */
@@ -52,10 +64,10 @@ long convert_eols (char *text, long textlen);
that file in it, and returning the size of that buffer in FILESIZE.
FINFO is a stat struct which has already been filled in by the caller.
If the file cannot be read, return a NULL pointer. */
-extern char *filesys_read_info_file (char *pathname, long int *filesize,
+extern char *filesys_read_info_file (char *pathname, size_t *filesize,
struct stat *finfo, int *is_compressed);
-extern char *filesys_read_compressed (char *pathname, long int *filesize);
+extern char *filesys_read_compressed (char *pathname, size_t *filesize);
/* Return the command string that would be used to decompress FILENAME. */
extern char *filesys_decompressor_for_file (char *filename);
@@ -76,9 +88,15 @@ extern char *extract_colon_unit (char *string, int *idx);
/* Return true if FILENAME is `dir', with a possible compression suffix. */
extern int is_dir_name (char *filename);
+/* Scan the list of directories in PATH looking for FILENAME. If we find
+ one that is a regular file, return it as a new string. Otherwise, return
+ a NULL pointer. */
+extern char *info_file_find_next_in_path (char *filename, char *path,
+ int *diridx);
+
/* The default value of INFOPATH. */
#if !defined (DEFAULT_INFOPATH)
-# define DEFAULT_INFOPATH ".:/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info"
+# define DEFAULT_INFOPATH ".:PATH:/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info"
#endif /* !DEFAULT_INFOPATH */
#if !defined (S_ISREG) && defined (S_IFREG)
diff --git a/info/footnotes.c b/info/footnotes.c
index 552ae2a..451177b 100644
--- a/info/footnotes.c
+++ b/info/footnotes.c
@@ -1,8 +1,8 @@
/* footnotes.c -- Some functions for manipulating footnotes.
- $Id: footnotes.c,v 1.9 2008/06/11 09:55:42 gray Exp $
+ $Id: footnotes.c 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2002, 2004, 2007,
- 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 1999, 2002, 2004, 2007, 2008, 2011, 2013
+ 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
@@ -60,8 +60,7 @@ make_footnotes_node (NODE *node)
fn_node = node;
/* See if this node contains the magic footnote label. */
- fn_start =
- info_search_in_node (FOOTNOTE_LABEL, node, 0, NULL, 1, 0);
+ fn_start = info_search_in_node (FOOTNOTE_LABEL, node, 0, NULL, 1, 0, 0);
/* If it doesn't, check to see if it has an associated footnotes node. */
if (fn_start == -1)
@@ -96,7 +95,7 @@ make_footnotes_node (NODE *node)
if (!filename)
filename = node->filename;
- fn_node = info_get_node (filename, refname);
+ fn_node = info_get_node (filename, refname, PARSE_NODE_DFLT);
if (fn_node)
fn_start = 0;
@@ -256,11 +255,11 @@ DECLARE_INFO_COMMAND (info_show_footnotes,
switch (result)
{
case FN_UNFOUND:
- info_error (msg_no_foot_node, NULL, NULL);
+ info_error ("%s", msg_no_foot_node);
break;
case FN_UNABLE:
- info_error (msg_win_too_small, NULL, NULL);
+ info_error ("%s", msg_win_too_small);
break;
}
}
diff --git a/info/footnotes.h b/info/footnotes.h
index 6a82828..0a5b3e4 100644
--- a/info/footnotes.h
+++ b/info/footnotes.h
@@ -1,7 +1,7 @@
/* footnotes.h -- Some functions for manipulating footnotes.
- $Id: footnotes.h,v 1.6 2007/07/01 21:20:29 karl Exp $
+ $Id: footnotes.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007
+ Copyright 1993, 1997, 1998, 2002, 2004, 2007, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_FOOTNOTES_H
#define INFO_FOOTNOTES_H
diff --git a/info/gc.c b/info/gc.c
index e883e4b..4a00703 100644
--- a/info/gc.c
+++ b/info/gc.c
@@ -1,7 +1,8 @@
/* gc.c -- Functions to remember and garbage collect unused node contents.
- $Id: gc.c,v 1.7 2008/06/11 09:55:42 gray Exp $
+ $Id: gc.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1993, 2004, 2007, 2008, 2013
+ 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
@@ -16,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
@@ -24,8 +25,8 @@
list can be garbage collected when no info window contains a node whose
contents member match the pointer. */
static char **gcable_pointers = NULL;
-static int gcable_pointers_index = 0;
-static int gcable_pointers_slots = 0;
+static size_t gcable_pointers_index = 0;
+static size_t gcable_pointers_slots = 0;
/* Add POINTER to the list of garbage collectible pointers. A pointer
is not actually garbage collected until no info window contains a node
@@ -35,7 +36,7 @@ add_gcable_pointer (char *pointer)
{
gc_pointers ();
add_pointer_to_array (pointer, gcable_pointers_index, gcable_pointers,
- gcable_pointers_slots, 10, char *);
+ gcable_pointers_slots, 10);
}
/* Grovel the list of info windows and gc-able pointers finding those
@@ -43,11 +44,11 @@ add_gcable_pointer (char *pointer)
void
gc_pointers (void)
{
- register int i, j, k;
+ size_t i, j, k;
INFO_WINDOW *iw;
char **new = NULL;
- int new_index = 0;
- int new_slots = 0;
+ size_t new_index = 0;
+ size_t new_slots = 0;
if (!info_windows || !gcable_pointers_index)
return;
@@ -63,8 +64,8 @@ gc_pointers (void)
for (k = 0; k < gcable_pointers_index; k++)
if (gcable_pointers[k] == node->contents)
{
- add_pointer_to_array
- (node->contents, new_index, new, new_slots, 10, char *);
+ add_pointer_to_array (node->contents, new_index, new,
+ new_slots, 10);
break;
}
}
diff --git a/info/gc.h b/info/gc.h
index a35fcac..03553e3 100644
--- a/info/gc.h
+++ b/info/gc.h
@@ -1,10 +1,8 @@
/* gc.h -- Functions for garbage collecting unused node contents.
- $Id: gc.h,v 1.6 2007/07/01 21:20:30 karl Exp $
+ $Id: gc.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_GC_H
#define INFO_GC_H
diff --git a/info/indices.c b/info/indices.c
index af04cdc..ae4afeb 100644
--- a/info/indices.c
+++ b/info/indices.c
@@ -1,7 +1,7 @@
/* indices.c -- deal with an Info file index.
- $Id: indices.c,v 1.11 2008/06/11 09:55:42 gray Exp $
+ $Id: indices.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004, 2007, 2008
+ Copyright 1993, 1997, 1998, 1999, 2002, 2003, 2004, 2007, 2008, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,10 +17,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "indices.h"
+#include "variables.h"
/* User-visible variable controls the output of info-index-next. */
int show_index_match = 1;
@@ -31,6 +32,8 @@ static REFERENCE **index_index = NULL;
/* The offset of the most recently selected index element. */
static int index_offset = 0;
+/* Whether we are doing partial index search */
+static int index_partial = 0;
/* Variable which holds the last string searched for. */
static char *index_search = NULL;
@@ -48,8 +51,8 @@ typedef struct {
/* An array associating index nodenames with index offset ranges. */
static INDEX_NAME_ASSOC **index_nodenames = NULL;
-static int index_nodenames_index = 0;
-static int index_nodenames_slots = 0;
+static size_t index_nodenames_index = 0;
+static size_t index_nodenames_slots = 0;
/* Add the name of NODE, and the range of the associated index elements
(passed in ARRAY) to index_nodenames. */
@@ -74,9 +77,8 @@ add_index_to_index_nodenames (REFERENCE **array, NODE *node)
assoc->first = 1 + index_nodenames[i]->last;
assoc->last = assoc->first + last;
}
- add_pointer_to_array
- (assoc, index_nodenames_index, index_nodenames, index_nodenames_slots,
- 10, INDEX_NAME_ASSOC *);
+ add_pointer_to_array (assoc, index_nodenames_index, index_nodenames,
+ index_nodenames_slots, 10);
}
/* Find and return the indices of WINDOW's file. The indices are defined
@@ -105,8 +107,8 @@ info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
return NULL;
/* Reset globals describing where the index was found. */
- maybe_free (initial_index_filename);
- maybe_free (initial_index_nodename);
+ free (initial_index_filename);
+ free (initial_index_nodename);
initial_index_filename = NULL;
initial_index_nodename = NULL;
@@ -135,7 +137,8 @@ info_indices_of_file_buffer (FILE_BUFFER *file_buffer)
REFERENCE **menu;
/* Found one. Get its menu. */
- node = info_get_node (tag->filename, tag->nodename);
+ node = info_get_node (tag->filename, tag->nodename,
+ PARSE_NODE_VERBATIM);
if (!node)
continue;
@@ -185,25 +188,25 @@ do_info_index_search (WINDOW *window, int count, char *search_string)
index_offset = 0;
/* The user is selecting a new search string, so flush the old one. */
- maybe_free (index_search);
+ free (index_search);
index_search = NULL;
/* If this window's file is not the same as the one that we last built an
index for, build and remember an index now. */
fb = file_buffer_of_window (window);
if (!initial_index_filename ||
+ !fb ||
(FILENAME_CMP (initial_index_filename, fb->filename) != 0))
{
info_free_references (index_index);
- window_message_in_echo_area (_("Finding index entries..."),
- NULL, NULL);
+ window_message_in_echo_area (_("Finding index entries..."));
index_index = info_indices_of_file_buffer (fb);
}
/* If there is no index, quit now. */
if (!index_index)
{
- info_error (_("No indices found."), NULL, NULL);
+ info_error (_("No indices found."));
return;
}
@@ -234,7 +237,8 @@ do_info_index_search (WINDOW *window, int count, char *search_string)
NODE *node;
node = info_get_node (initial_index_filename,
- initial_index_nodename);
+ initial_index_nodename,
+ PARSE_NODE_DFLT);
set_remembered_pagetop_and_point (window);
window_set_node_of_window (window, node);
remember_window_and_node (window, node);
@@ -244,6 +248,14 @@ do_info_index_search (WINDOW *window, int count, char *search_string)
}
}
+ if (mbslen (line) < min_search_length)
+ {
+ info_error (_("Search string too short"));
+ free (line);
+ return;
+ }
+
+
/* The user typed either a completed index label, or a partial string.
Find an exact match, or, failing that, the first index entry containing
the partial string. So, we just call info_next_index_match () with minor
@@ -259,8 +271,11 @@ do_info_index_search (WINDOW *window, int count, char *search_string)
index_offset = i;
}
else
- index_offset = -1;
-
+ {
+ index_offset = -1;
+ index_partial = 0;
+ }
+
old_offset = index_offset;
/* The "last" string searched for is this one. */
@@ -287,8 +302,9 @@ index_entry_exists (WINDOW *window, char *string)
return 0;
fb = file_buffer_of_window (window);
- if (!initial_index_filename
- || (FILENAME_CMP (initial_index_filename, fb->filename) != 0))
+ if (!initial_index_filename ||
+ !fb ||
+ (FILENAME_CMP (initial_index_filename, fb->filename) != 0))
{
info_free_references (index_index);
index_index = info_indices_of_file_buffer (fb);
@@ -320,25 +336,51 @@ index_entry_exists (WINDOW *window, char *string)
return 1;
}
+/* Return true if ENT->label matches "S( <[0-9]+>)?", where S stands
+ for the first LEN characters from STR. */
+static int
+index_entry_matches (REFERENCE *ent, const char *str, size_t len)
+{
+ char *p;
+
+ if (strncmp (ent->label, str, len))
+ return 0;
+ p = ent->label + len;
+ if (!*p)
+ return 1;
+ if (p[0] == ' ' && p[1] == '<')
+ {
+ for (p += 2; *p; p++)
+ {
+ if (p[0] == '>' && p[1] == 0)
+ return 1;
+ else if (!isdigit (*p))
+ return 0;
+ }
+ }
+ return 0;
+}
+
DECLARE_INFO_COMMAND (info_next_index_match,
_("Go to the next matching index item from the last `\\[index-search]' command"))
{
register int i;
int partial, dir;
NODE *node;
-
+ size_t search_len;
+
/* If there is no previous search string, the user hasn't built an index
yet. */
if (!index_search)
{
- info_error (_("No previous index search string."), NULL, NULL);
+ info_error (_("No previous index search string."));
return;
}
/* If there is no index, that is an error. */
if (!index_index)
{
- info_error (_("No index entries."), NULL, NULL);
+ info_error (_("No index entries."));
return;
}
@@ -349,30 +391,47 @@ DECLARE_INFO_COMMAND (info_next_index_match,
else
dir = 1;
- /* Search for the next occurence of index_search. First try to find
- an exact match. */
+ /* Search for the next occurence of index_search. */
partial = 0;
+ search_len = strlen (index_search);
- for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
- if (strcmp (index_search, index_index[i]->label) == 0)
- break;
-
- /* If that failed, look for the next substring match. */
- if ((i < 0) || (!index_index[i]))
+ if (!index_partial)
{
+ /* First try to find an exact match. */
for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
- if (string_in_line (index_search, index_index[i]->label) != -1)
- break;
+ if (index_entry_matches (index_index[i], index_search, search_len))
+ break;
- if ((i > -1) && (index_index[i]))
- partial = string_in_line (index_search, index_index[i]->label);
+ /* If that failed, look for the next substring match. */
+ if ((i < 0) || (!index_index[i]))
+ {
+ index_offset = 0;
+ index_partial = 1;
+ }
}
+ if (index_partial)
+ {
+ /* When looking for substrings, take care not to return previous exact
+ matches. */
+ for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
+ if (!index_entry_matches (index_index[i], index_search, search_len))
+ {
+ partial = string_in_line (index_search, index_index[i]->label);
+ if (partial != -1)
+ break;
+ }
+ index_partial = partial > 0;
+ }
+
/* If that failed, print an error. */
if ((i < 0) || (!index_index[i]))
{
- info_error (_("No %sindex entries containing `%s'."),
- index_offset > 0 ? (char *) _("more ") : "", index_search);
+ info_error (index_offset > 0 ?
+ _("No more index entries containing `%s'.") :
+ _("No index entries containing `%s'."),
+ index_search);
+ index_offset = 0;
return;
}
@@ -399,7 +458,7 @@ DECLARE_INFO_COMMAND (info_next_index_match,
string matched. */
match = xstrdup (index_index[i]->label);
- if (partial && show_index_match)
+ if (partial > 0 && show_index_match)
{
int k, ls, start, upper;
@@ -428,7 +487,8 @@ DECLARE_INFO_COMMAND (info_next_index_match,
}
/* Select the node corresponding to this index entry. */
- node = info_get_node (index_index[i]->filename, index_index[i]->nodename);
+ node = info_get_node (index_index[i]->filename, index_index[i]->nodename,
+ PARSE_NODE_DFLT);
if (!node)
{
@@ -441,7 +501,8 @@ DECLARE_INFO_COMMAND (info_next_index_match,
{
long loc;
- long line = index_index[i]->line_number - 1;
+ long line = window_log_to_phys_line (window,
+ index_index[i]->line_number - 1);
if (line >= 0 && line < window->line_count)
{
@@ -452,7 +513,7 @@ DECLARE_INFO_COMMAND (info_next_index_match,
{
/* Try to find an occurence of LABEL in this node. */
long start = window->line_starts[1] - window->node->contents;
- loc = info_target_search_node (node, index_index[i]->label, start);
+ loc = info_target_search_node (node, index_index[i]->label, start, 1);
}
if (loc != -1)
@@ -474,12 +535,12 @@ DECLARE_INFO_COMMAND (info_next_index_match,
REFERENCE **
apropos_in_all_indices (char *search_string, int inform)
{
- register int i, dir_index;
+ size_t i, dir_index;
REFERENCE **all_indices = NULL;
REFERENCE **dir_menu = NULL;
NODE *dir_node;
- dir_node = info_get_node ("dir", "Top");
+ dir_node = info_get_node ("dir", "Top", PARSE_NODE_DFLT);
if (dir_node)
dir_menu = info_menu_of_node (dir_node);
@@ -509,11 +570,12 @@ apropos_in_all_indices (char *search_string, int inform)
/* Find this node. If we cannot find it, try using the label of the
entry as a file (i.e., "(LABEL)Top"). */
- this_node = info_get_node (this_item->filename, this_item->nodename);
+ this_node = info_get_node (this_item->filename, this_item->nodename,
+ PARSE_NODE_VERBATIM);
if (!this_node && this_item->nodename &&
(strcmp (this_item->label, this_item->nodename) == 0))
- this_node = info_get_node (this_item->label, "Top");
+ this_node = info_get_node (this_item->label, "Top", PARSE_NODE_DFLT);
if (!this_node)
{
@@ -546,8 +608,7 @@ apropos_in_all_indices (char *search_string, int inform)
}
if (this_fb && inform)
- message_in_echo_area (_("Scanning indices of `%s'..."),
- files_name, NULL);
+ message_in_echo_area (_("Scanning indices of `%s'..."), files_name);
this_index = info_indices_of_file_buffer (this_fb);
free (this_node);
@@ -574,24 +635,18 @@ apropos_in_all_indices (char *search_string, int inform)
if (all_indices)
{
REFERENCE *entry, **apropos_list = NULL;
- int apropos_list_index = 0;
- int apropos_list_slots = 0;
+ size_t apropos_list_index = 0;
+ size_t apropos_list_slots = 0;
for (i = 0; (entry = all_indices[i]); i++)
{
if (string_in_line (search_string, entry->label) != -1)
{
- add_pointer_to_array
- (entry, apropos_list_index, apropos_list, apropos_list_slots,
- 100, REFERENCE *);
+ add_pointer_to_array (entry, apropos_list_index, apropos_list,
+ apropos_list_slots, 100);
}
else
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
- free (entry);
- }
+ info_reference_free (entry);
}
free (all_indices);
@@ -611,7 +666,7 @@ info_apropos (char *string)
apropos_list = apropos_in_all_indices (string, 0);
if (!apropos_list)
- info_error (_(APROPOS_NONE), string, NULL);
+ info_error (_(APROPOS_NONE), string);
else
{
register int i;
@@ -651,7 +706,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
apropos_list = apropos_in_all_indices (line, 1);
if (!apropos_list)
- info_error (_(APROPOS_NONE), line, NULL);
+ info_error (_(APROPOS_NONE), line);
else
{
register int i;
@@ -660,7 +715,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
initialize_message_buffer ();
printf_to_message_buffer
(_("\n* Menu: Nodes whose indices contain `%s':\n"),
- line, NULL, NULL);
+ line);
line_buffer = xmalloc (500);
for (i = 0; apropos_list[i]; i++)
@@ -674,7 +729,7 @@ DECLARE_INFO_COMMAND (info_index_apropos,
len = pad_to (40, line_buffer);
sprintf (line_buffer + len, "(%s)%s.",
apropos_list[i]->filename, apropos_list[i]->nodename);
- printf_to_message_buffer ("%s\n", line_buffer, NULL, NULL);
+ printf_to_message_buffer ("%s\n", line_buffer);
}
free (line_buffer);
}
@@ -741,3 +796,213 @@ DECLARE_INFO_COMMAND (info_index_apropos,
if (!info_error_was_printed)
window_clear_echo_area ();
}
+
+static FILE_BUFFER *
+create_virtindex_file_buffer (const char *filename, char *contents, size_t size)
+{
+ FILE_BUFFER *file_buffer;
+
+ file_buffer = make_file_buffer ();
+ file_buffer->filename = filename ? xstrdup (filename) : NULL;
+ file_buffer->fullpath = filename ? xstrdup (filename) : NULL;
+ file_buffer->finfo.st_size = 0;
+ file_buffer->flags = (N_IsInternal | N_CannotGC);
+
+ file_buffer->contents = contents;
+ file_buffer->filesize = size;
+ build_tags_and_nodes (file_buffer);
+ return file_buffer;
+}
+
+static NODE *
+create_virtindex_node (FILE_BUFFER *file_buffer)
+{
+ NODE *node;
+ TAG *tag = file_buffer->tags[0];
+ char *text = file_buffer->contents + tag->nodestart;
+
+ text += skip_node_separator (text);
+
+ node = xmalloc (sizeof (NODE));
+ node->filename = file_buffer->filename;
+ node->nodename = xstrdup (tag->nodename);
+ node->contents = text;
+ node->nodelen = strlen (text);
+ node->body_start = strcspn(node->contents, "\n");
+
+ node->flags = 0;
+ node->display_pos = 0;
+ node->parent = NULL;
+ node->flags = 0;
+
+ return node;
+}
+
+#define NODECOL 41
+#define LINECOL 62
+
+static void
+format_reference (REFERENCE *ref, const char *filename, struct text_buffer *buf)
+{
+ size_t n;
+
+ n = text_buffer_printf (buf, "* %s: ", ref->label);
+ if (n < NODECOL)
+ n += text_buffer_fill (buf, ' ', NODECOL - n);
+
+ if (ref->filename && strcmp (ref->filename, filename))
+ n += text_buffer_printf (buf, "(%s)", ref->filename);
+ n += text_buffer_printf (buf, "%s. ", ref->nodename);
+
+ if (n < LINECOL)
+ n += text_buffer_fill (buf, ' ', LINECOL - n);
+ else
+ {
+ text_buffer_add_char (buf, '\n');
+ text_buffer_fill (buf, ' ', LINECOL);
+ }
+
+ text_buffer_printf (buf, "(line %4d)\n", ref->line_number);
+}
+
+DECLARE_INFO_COMMAND (info_virtual_index,
+ _("List all matches of a string in the index"))
+{
+ char *line;
+ FILE_BUFFER *fb, *tfb;
+ NODE *node;
+ struct text_buffer text;
+ size_t i;
+ size_t cnt, off;
+
+ fb = file_buffer_of_window (window);
+
+ if (!initial_index_filename ||
+ !fb ||
+ (FILENAME_CMP (initial_index_filename, fb->filename) != 0))
+ {
+ info_free_references (index_index);
+ window_message_in_echo_area (_("Finding index entries..."));
+ index_index = info_indices_of_file_buffer (fb);
+ }
+
+ if (!index_index)
+ {
+ info_error (_("No index"));
+ return;
+ }
+
+ line = info_read_maybe_completing (window, _("Index topic: "),
+ index_index);
+
+ /* User aborted? */
+ if (!line)
+ {
+ info_abort_key (window, 1, 1);
+ return;
+ }
+
+ if (mbslen (line) < min_search_length)
+ {
+ info_error (_("Search string too short"));
+ free (line);
+ return;
+ }
+
+ text_buffer_init (&text);
+ text_buffer_printf (&text, _("Index for `%s'"), line);
+ text_buffer_add_char (&text, 0);
+ off = text.off;
+ text_buffer_printf (&text,
+ "\n\n%c\n%s %s, %s %s, %s Top\n\n"
+ "Info Virtual Index\n"
+ "******************\n\n"
+ "Index entries that match `%s':\n\n"
+ "* Menu:\n\n",
+ INFO_COOKIE,
+ INFO_FILE_LABEL, fb->filename,
+ INFO_NODE_LABEL, text.base,
+ INFO_UP_LABEL, line);
+ memmove (text.base, text.base + off, text.off - off);
+ text.off -= off;
+
+ cnt = 0;
+ for (i = 0; index_index[i]; i++)
+ {
+ if (string_in_line (line, index_index[i]->label) != -1)
+ {
+ format_reference (index_index[i], fb->filename, &text);
+ cnt++;
+ }
+ }
+
+ if (cnt == 0)
+ {
+ text_buffer_free (&text);
+ info_error (_("No index entries containing `%s'."), line);
+ return;
+ }
+
+ tfb = create_virtindex_file_buffer (fb->filename, text.base, text.off);
+ node = create_virtindex_node (tfb);
+
+ info_set_node_of_window (1, window, node);
+
+ if (!info_error_was_printed)
+ window_clear_echo_area ();
+}
+
+static NODE *allfiles_node;
+
+NODE *
+allfiles_create_node (char *term, REFERENCE **fref)
+{
+ int i;
+ struct text_buffer text;
+ size_t off;
+ FILE_BUFFER *fb;
+
+ text_buffer_init (&text);
+ text_buffer_printf (&text, _("File names matching `%s'"), term);
+ text_buffer_add_char (&text, 0);
+ off = text.off;
+
+ text_buffer_printf (&text,
+ "\n\n%c\n%s %s\n\n"
+ "Info File Index\n"
+ "***************\n\n"
+ "File names that match `%s':\n\n"
+ "* Menu:\n\n",
+ INFO_COOKIE,
+ INFO_NODE_LABEL, text.base, term);
+
+ memmove (text.base, text.base + off, text.off - off);
+ text.off -= off;
+
+ for (i = 0; fref[i]; i++)
+ {
+ text_buffer_printf (&text, "* %4i: (%s)", i+1, fref[i]->filename);
+ if (fref[i]->nodename)
+ text_buffer_printf (&text, "%s", fref[i]->nodename);
+ text_buffer_printf (&text, ".\n");
+ }
+
+ fb = create_virtindex_file_buffer (NULL, text.base, text.off);
+ allfiles_node = create_virtindex_node (fb);
+
+ return allfiles_node;
+}
+
+DECLARE_INFO_COMMAND (info_all_files, _("Show all matching files"))
+{
+ if (!allfiles_node)
+ {
+ info_error (_("No file index"));
+ return;
+ }
+
+ info_set_node_of_window (1, window, allfiles_node);
+
+ if (!info_error_was_printed)
+ window_clear_echo_area ();
+}
diff --git a/info/indices.h b/info/indices.h
index 712fa88..fa0be6e 100644
--- a/info/indices.h
+++ b/info/indices.h
@@ -1,10 +1,8 @@
/* indices.h -- Functions defined in indices.c.
- $Id: indices.h,v 1.6 2007/07/01 21:20:30 karl Exp $
+ $Id: indices.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_INDICES_H
#define INFO_INDICES_H
@@ -41,4 +39,6 @@ extern void info_index_apropos (WINDOW *window, int count, unsigned char key);
extern void do_info_index_search (WINDOW *window, int count, char *search_string);
extern int index_entry_exists (WINDOW *window, char *string);
+NODE *allfiles_create_node (char *term, REFERENCE **fref);
+
#endif /* not INFO_INDICES_H */
diff --git a/info/info-utils.c b/info/info-utils.c
index 7236452..37659d0 100644
--- a/info/info-utils.c
+++ b/info/info-utils.c
@@ -1,8 +1,8 @@
/* info-utils.c -- miscellanous.
- $Id: info-utils.c,v 1.12 2008/06/11 09:55:42 gray Exp $
+ $Id: info-utils.c 5379 2013-09-19 09:00:48Z eliz $
- Copyright (C) 1993, 1998, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1998, 2003, 2004, 2007, 2008, 2009, 2011, 2012,
+ 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "info-utils.h"
@@ -25,6 +25,10 @@
# include "man.h"
#endif /* HANDLE_MAN_PAGES */
+#ifdef __hpux
+#define va_copy(ap1,ap2) memcpy((&ap1),(&ap2),sizeof(va_list))
+#endif
+
/* When non-zero, various display and input functions handle ISO Latin
character sets correctly. */
int ISO_Latin_p = 1;
@@ -41,6 +45,9 @@ char *info_parsed_nodename = NULL;
calling info_parse_xxx (). */
int info_parsed_line_number = 0;
+static void save_string (char *string, char **string_p, int *string_size_p);
+static void saven_string (char *string, int len, char **string_p,
+ int *string_size_p);
/* Functions to remember a filename or nodename for later return. */
static void save_filename (char *filename);
static void saven_filename (char *filename, int len);
@@ -53,11 +60,16 @@ static REFERENCE **info_references_internal (char *label,
/* Parse the filename and nodename out of STRING. If STRING doesn't
contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
- INFO_PARSED_FILENAME to NULL. If second argument NEWLINES_OKAY is
- non-zero, it says to allow the nodename specification to cross a
- newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
+ INFO_PARSED_FILENAME to NULL. The second argument is one of
+ the PARSE_NODE_* constants. It specifies how to parse the node name:
+
+ PARSE_NODE_DFLT Node name stops at LF, `,', `.', or `TAB'
+ PARSE_NODE_SKIP_NEWLINES Node name stops at `,', `.', or `TAB'
+ PARSE_NODE_VERBATIM Don't parse nodename
+*/
+
void
-info_parse_node (char *string, int newlines_okay)
+info_parse_node (char *string, int flag)
{
register int i = 0;
@@ -74,14 +86,34 @@ info_parse_node (char *string, int newlines_okay)
/* Check for (FILENAME)NODENAME. */
if (*string == '(')
{
+ int bcnt;
+ int bfirst;
+
i = 0;
/* Advance past the opening paren. */
string++;
- /* Find the closing paren. */
- while (string[i] && string[i] != ')')
- i++;
+ /* Find the closing paren. Handle nested parens correctly. */
+ for (bcnt = 0, bfirst = -1; string[i]; i++)
+ {
+ if (string[i] == ')')
+ {
+ if (bcnt == 0)
+ {
+ bfirst = -1;
+ break;
+ }
+ else if (!bfirst)
+ bfirst = i;
+ bcnt--;
+ }
+ else if (string[i] == '(')
+ bcnt++;
+ }
+ if (bfirst >= 0)
+ i = bfirst;
+
/* Remember parsed filename. */
saven_filename (string, i);
@@ -93,7 +125,7 @@ info_parse_node (char *string, int newlines_okay)
}
/* Parse out nodename. */
- i = skip_node_characters (string, newlines_okay);
+ i = skip_node_characters (string, flag);
saven_nodename (string, i);
canonicalize_whitespace (info_parsed_nodename);
if (info_parsed_nodename && !*info_parsed_nodename)
@@ -157,7 +189,7 @@ info_parse_label (char *label, NODE *node)
nodeline += i;
nodeline += skip_whitespace (nodeline);
- info_parse_node (nodeline, DONT_SKIP_NEWLINES);
+ info_parse_node (nodeline, PARSE_NODE_DFLT);
}
/* **************************************************************** */
@@ -181,9 +213,8 @@ info_menu_of_node (NODE *node)
tmp_search.flags = S_FoldCase;
/* Find the start of the menu. */
- position = search_forward (INFO_MENU_LABEL, &tmp_search);
-
- if (position == -1)
+ if (search_forward (INFO_MENU_LABEL, &tmp_search, &position)
+ != search_success)
return NULL;
/* We have the start of the menu now. Glean menu items from the rest
@@ -241,7 +272,7 @@ info_references_internal (char *label, SEARCH_BINDING *binding)
{
SEARCH_BINDING tmp_search;
REFERENCE **refs = NULL;
- int refs_index = 0, refs_slots = 0;
+ size_t refs_index = 0, refs_slots = 0;
int searching_for_menu_items = 0;
long position;
@@ -252,7 +283,7 @@ info_references_internal (char *label, SEARCH_BINDING *binding)
searching_for_menu_items = (mbscasecmp (label, INFO_MENU_ENTRY_LABEL) == 0);
- while ((position = search_forward (label, &tmp_search)) != -1)
+ while (search_forward (label, &tmp_search, &position) == search_success)
{
int offset, start;
char *refdef;
@@ -310,9 +341,9 @@ info_references_internal (char *label, SEARCH_BINDING *binding)
refdef += skip_whitespace_and_newlines (refdef);
if (searching_for_menu_items)
- info_parse_node (refdef, DONT_SKIP_NEWLINES);
+ info_parse_node (refdef, PARSE_NODE_DFLT);
else
- info_parse_node (refdef, SKIP_NEWLINES);
+ info_parse_node (refdef, PARSE_NODE_SKIP_NEWLINES);
if (info_parsed_filename)
entry->filename = xstrdup (info_parsed_filename);
@@ -323,8 +354,7 @@ info_references_internal (char *label, SEARCH_BINDING *binding)
entry->line_number = info_parsed_line_number;
}
- add_pointer_to_array
- (entry, refs_index, refs, refs_slots, 50, REFERENCE *);
+ add_pointer_to_array (entry, refs_index, refs, refs_slots, 50);
}
return refs;
}
@@ -404,6 +434,18 @@ info_copy_reference (REFERENCE *src)
+void
+info_reference_free (REFERENCE *ref)
+{
+ if (ref)
+ {
+ free (ref->label);
+ free (ref->filename);
+ free (ref->nodename);
+ free (ref);
+ }
+}
+
/* Free the data associated with REFERENCES. */
void
info_free_references (REFERENCE **references)
@@ -414,13 +456,7 @@ info_free_references (REFERENCE **references)
if (references)
{
for (i = 0; references && (entry = references[i]); i++)
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
-
- free (entry);
- }
+ info_reference_free (entry);
free (references);
}
@@ -485,10 +521,11 @@ static size_t the_rep_size;
/* Return a pointer to a string which is the printed representation
of CHARACTER if it were printed at HPOS. */
char *
-printed_representation (const unsigned char *cp, size_t len, size_t hpos,
+printed_representation (const char *character, size_t len, size_t hpos,
/* Return: */
size_t *plen)
{
+ const unsigned char *cp = (const unsigned char *) character;
register int i = 0;
int printable_limit = ISO_Latin_p ? 255 : 127;
#define REPSPACE(s) \
@@ -574,10 +611,6 @@ static int parsed_filename_size = 0;
/* Amount of space allocated to INFO_PARSED_NODENAME via xmalloc (). */
static int parsed_nodename_size = 0;
-static void save_string (char *string, char **string_p, int *string_size_p);
-static void saven_string (char *string, int len, char **string_p,
- int *string_size_p);
-
/* Remember FILENAME in PARSED_FILENAME. An empty FILENAME is translated
to a NULL pointer in PARSED_FILENAME. */
static void
@@ -624,14 +657,19 @@ save_string (char *string, char **string_p, int *string_size_p)
*string_p = NULL;
*string_size_p = 0;
}
- else
+ else if (string_size_p)
{
if (strlen (string) >= (unsigned int) *string_size_p)
- *string_p = xrealloc
- (*string_p, (*string_size_p = 1 + strlen (string)));
+ *string_p = xrealloc (*string_p,
+ (*string_size_p = 1 + strlen (string)));
strcpy (*string_p, string);
}
+ else
+ {
+ free (*string_p);
+ *string_p = xstrdup (string);
+ }
}
/* Just like save_string (), but you also pass the length of STRING. */
@@ -646,11 +684,18 @@ saven_string (char *string, int len, char **string_p, int *string_size_p)
*string_p = NULL;
*string_size_p = 0;
}
- else
+ else
{
- if (len >= *string_size_p)
- *string_p = xrealloc (*string_p, (*string_size_p = 1 + len));
-
+ if (string_size_p)
+ {
+ if (len >= *string_size_p)
+ *string_p = xrealloc (*string_p, (*string_size_p = 1 + len));
+ }
+ else
+ {
+ free (*string_p);
+ *string_p = xmalloc (1 + len);
+ }
strncpy (*string_p, string, len);
(*string_p)[len] = '\0';
}
@@ -727,3 +772,167 @@ get_window_of_node (NODE *node)
return win;
}
+
+/* Flexible Text Buffer */
+
+void
+text_buffer_init (struct text_buffer *buf)
+{
+ memset (buf, 0, sizeof *buf);
+}
+
+void
+text_buffer_free (struct text_buffer *buf)
+{
+ free (buf->base);
+}
+
+size_t
+text_buffer_vprintf (struct text_buffer *buf, const char *format, va_list ap)
+{
+ ssize_t n;
+ va_list ap_copy;
+
+ if (!buf->base)
+ {
+ if (buf->size == 0)
+ buf->size = MIN_TEXT_BUF_ALLOC; /* Initial allocation */
+
+ buf->base = xmalloc (buf->size);
+ }
+
+ for (;;)
+ {
+ va_copy (ap_copy, ap);
+ n = vsnprintf (buf->base + buf->off, buf->size - buf->off,
+ format, ap_copy);
+ va_end (ap_copy);
+ if (n < 0 || buf->off + n >= buf->size ||
+ !memchr (buf->base + buf->off, '\0', buf->size - buf->off + 1))
+ {
+ size_t newlen = buf->size * 2;
+ if (newlen < buf->size)
+ xalloc_die ();
+ buf->size = newlen;
+ buf->base = xrealloc (buf->base, buf->size);
+ }
+ else
+ {
+ buf->off += n;
+ break;
+ }
+ }
+ return n;
+}
+
+void
+text_buffer_alloc (struct text_buffer *buf, size_t len)
+{
+ if (buf->off + len > buf->size)
+ {
+ buf->size = buf->off + len;
+ if (buf->size < MIN_TEXT_BUF_ALLOC)
+ buf->size = MIN_TEXT_BUF_ALLOC;
+ buf->base = xrealloc (buf->base, buf->size);
+ }
+}
+
+size_t
+text_buffer_add_string (struct text_buffer *buf, const char *str, size_t len)
+{
+ text_buffer_alloc (buf, len);
+ memcpy (buf->base + buf->off, str, len);
+ buf->off += len;
+ return len;
+}
+
+size_t
+text_buffer_fill (struct text_buffer *buf, int c, size_t len)
+{
+ char *p;
+ int i;
+
+ text_buffer_alloc (buf, len);
+
+ for (i = 0, p = buf->base + buf->off; i < len; i++)
+ *p++ = c;
+ buf->off += len;
+
+ return len;
+}
+
+void
+text_buffer_add_char (struct text_buffer *buf, int c)
+{
+ char ch = c;
+ text_buffer_add_string (buf, &ch, 1);
+}
+
+size_t
+text_buffer_printf (struct text_buffer *buf, const char *format, ...)
+{
+ va_list ap;
+ size_t n;
+
+ va_start (ap, format);
+ n = text_buffer_vprintf (buf, format, ap);
+ va_end (ap);
+ return n;
+}
+
+#if defined(__MSDOS__) || defined(__MINGW32__)
+/* Cannot use FILENAME_CMP here, since that does not consider forward-
+ and back-slash characters equal. */
+static int
+fncmp (const char *fn1, const char *fn2)
+{
+ const char *s1 = fn1, *s2 = fn2;
+
+ while (tolower (*s1) == tolower (*s2)
+ || (IS_SLASH (*s1) && IS_SLASH (*s2)))
+ {
+ if (*s1 == 0)
+ return 0;
+ s1++;
+ s2++;
+ }
+
+ return tolower (*s1) - tolower (*s2);
+}
+#else
+# define fncmp(s,t) strcmp(s,t)
+#endif
+
+struct info_namelist_entry
+{
+ struct info_namelist_entry *next;
+ char name[1];
+};
+
+int
+info_namelist_add (struct info_namelist_entry **ptop, const char *name)
+{
+ struct info_namelist_entry *p;
+
+ for (p = *ptop; p; p = p->next)
+ if (fncmp (p->name, name) == 0)
+ return 1;
+
+ p = xmalloc (sizeof (*p) + strlen (name));
+ strcpy (p->name, name);
+ p->next = *ptop;
+ *ptop = p;
+ return 0;
+}
+
+void
+info_namelist_free (struct info_namelist_entry *top)
+{
+ while (top)
+ {
+ struct info_namelist_entry *next = top->next;
+ free (top);
+ top = next;
+ }
+}
+
diff --git a/info/info-utils.h b/info/info-utils.h
index 6d8d7ac..79e690f 100644
--- a/info/info-utils.h
+++ b/info/info-utils.h
@@ -1,8 +1,8 @@
/* info-utils.h -- Exported functions and variables from info-utils.c.
- $Id: info-utils.h,v 1.8 2008/05/10 14:39:04 gray Exp $
+ $Id: info-utils.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1996, 1998, 2002, 2003, 2004, 2007 Free Software
- Foundation, Inc.
+ Copyright 1993, 1996, 1998, 2002, 2003, 2004, 2007, 2011, 2012, 2013
+ 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_UTILS_H
#define INFO_UTILS_H
@@ -49,12 +49,23 @@ extern char *info_parsed_filename;
calling info_parse_xxx (). */
extern char *info_parsed_nodename;
+#define PARSE_NODE_DFLT 0
+#define PARSE_NODE_SKIP_NEWLINES 1
+#define PARSE_NODE_VERBATIM 2
+#define PARSE_NODE_START 3
+
/* Parse the filename and nodename out of STRING. If STRING doesn't
contain a filename (i.e., it is NOT (FILENAME)NODENAME) then set
- INFO_PARSED_FILENAME to NULL. If second argument NEWLINES_OKAY is
- non-zero, it says to allow the nodename specification to cross a
- newline boundary (i.e., only `,', `.', or `TAB' can end the spec). */
-void info_parse_node (char *string, int newlines_okay);
+ INFO_PARSED_FILENAME to NULL. The second argument is one of
+ the PARSE_NODE_* constants. It specifies how to parse the node name:
+
+ PARSE_NODE_DFLT Node name stops at LF, `,', `.', or `TAB'
+ PARSE_NODE_SKIP_NEWLINES Node name stops at `,', `.', or `TAB'
+ PARSE_NODE_VERBATIM Don't parse nodename
+ PARSE_NODE_START The STRING argument is retrieved from a node
+ start line, and therefore ends in `,' only.
+*/
+void info_parse_node (char *string, int flag);
/* Return a NULL terminated array of REFERENCE * which represents the menu
found in NODE. If there is no menu in NODE, just return a NULL pointer. */
@@ -88,6 +99,9 @@ REFERENCE **info_concatenate_references (REFERENCE **ref1, REFERENCE **ref2);
/* Copy an existing reference into new memory. */
extern REFERENCE *info_copy_reference (REFERENCE *src);
+/* Free the data associated with a single REF */
+void info_reference_free (REFERENCE *ref);
+
/* Free the data associated with REFERENCES. */
extern void info_free_references (REFERENCE **references);
@@ -98,7 +112,7 @@ void canonicalize_whitespace (char *string);
/* Return a pointer to a string which is the printed representation
of CHARACTER if it were printed at HPOS. */
-extern char *printed_representation (const unsigned char *cp, size_t len,
+extern char *printed_representation (const char *str, size_t len,
size_t hpos, size_t *plen);
/* Return a pointer to the part of PATHNAME that simply defines the file. */
@@ -133,4 +147,31 @@ extern void info_parse_label (char *label, NODE *node);
info_parse_label (INFO_ALTPREV_LABEL, n); \
} while (0)
+struct text_buffer
+{
+ char *base;
+ size_t size;
+ size_t off;
+};
+
+#define MIN_TEXT_BUF_ALLOC 512
+
+void text_buffer_init (struct text_buffer *buf);
+void text_buffer_free (struct text_buffer *buf);
+void text_buffer_alloc (struct text_buffer *buf, size_t len);
+size_t text_buffer_vprintf (struct text_buffer *buf, const char *format,
+ va_list ap);
+size_t text_buffer_add_string (struct text_buffer *buf, const char *str,
+ size_t len);
+size_t text_buffer_fill (struct text_buffer *buf, int c, size_t len);
+void text_buffer_add_char (struct text_buffer *buf, int c);
+size_t text_buffer_printf (struct text_buffer *buf, const char *format, ...);
+#define text_buffer_reset(buf) ((buf)->off = 0)
+#define text_buffer_base(buf) ((buf)->base)
+#define text_buffer_off(buf) ((buf)->off)
+
+struct info_namelist_entry;
+int info_namelist_add (struct info_namelist_entry **ptop, const char *name);
+void info_namelist_free (struct info_namelist_entry *top);
+
#endif /* not INFO_UTILS_H */
diff --git a/info/info.c b/info/info.c
index 4e204c1..e348528 100644
--- a/info/info.c
+++ b/info/info.c
@@ -1,8 +1,9 @@
/* info.c -- Display nodes of Info files in multiple windows.
- $Id: info.c,v 1.33 2008/08/14 17:36:13 karl Exp $
+ $Id: info.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2005, 2007, 2008, 2009, 2010, 2011, 2012, 2013
+ 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
@@ -17,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "indices.h"
@@ -57,8 +58,8 @@ static int print_help_p = 0;
/* Array of the names of nodes that the user specified with "--node" on the
command line. */
static char **user_nodenames = NULL;
-static int user_nodenames_index = 0;
-static int user_nodenames_slots = 0;
+static size_t user_nodenames_index = 0;
+static size_t user_nodenames_slots = 0;
/* String specifying the first file to load. This string can only be set
by the user specifying "--file" on the command line. */
@@ -79,10 +80,19 @@ int vi_keys_p = 0;
/* Non-zero means don't remove ANSI escape sequences. */
int raw_escapes_p = 1;
+/* Print/visit all matching documents. */
+static int all_matches_p = 0;
+
/* Non-zero means print the absolute location of the file to be loaded. */
static int print_where_p = 0;
-#ifdef __MSDOS__
+/* Debugging level */
+unsigned debug_level;
+
+/* Non-zero means don't try to be smart when searching for nodes. */
+int strict_node_location_p = 0;
+
+#if defined(__MSDOS__) || defined(__MINGW32__)
/* Non-zero indicates that screen output should be made 'speech-friendly'.
Since on MSDOS the usual behavior is to write directly to the video
memory, speech synthesizer software cannot grab the output. Therefore,
@@ -98,7 +108,9 @@ int speech_friendly = 0;
#define RESTORE_OPTION 3
#define IDXSRCH_OPTION 4
static struct option long_options[] = {
+ { "all", 0, 0, 'a' },
{ "apropos", 1, 0, 'k' },
+ { "debug", 1, 0, 'x' },
{ "directory", 1, 0, 'd' },
{ "dribble", 1, 0, DRIBBLE_OPTION },
{ "file", 1, 0, 'f' },
@@ -113,22 +125,24 @@ static struct option long_options[] = {
{ "no-show-malformed-multibytes", 0, &show_malformed_multibyte_p, 0 },
{ "restore", 1, 0, RESTORE_OPTION },
{ "show-options", 0, 0, 'O' },
+ { "strict-node-location", 0, &strict_node_location_p, 1 },
{ "subnodes", 0, &dump_subnodes, 1 },
{ "usage", 0, 0, 'O' },
+ { "variable", 0, 0, 'v' },
{ "version", 0, &print_version_p, 1 },
{ "vi-keys", 0, &vi_keys_p, 1 },
{ "where", 0, &print_where_p, 1 },
-#ifdef __MSDOS__
+#if defined(__MSDOS__) || defined(__MINGW32__)
{ "speech-friendly", 0, &speech_friendly, 1 },
#endif
{NULL, 0, NULL, 0}
};
/* String describing the shorthand versions of the long options found above. */
-#ifdef __MSDOS__
-static char *short_options = "k:d:n:f:ho:ORswb";
+#if defined(__MSDOS__) || defined(__MINGW32__)
+static char *short_options = "ak:d:n:f:ho:ORsv:wbx:";
#else
-static char *short_options = "k:d:n:f:ho:ORws";
+static char *short_options = "ak:d:n:f:ho:ORv:wsx:";
#endif
/* When non-zero, the Info window system has been initialized. */
@@ -139,6 +153,350 @@ static void info_short_help (void);
static void init_messages (void);
+static const char *
+node_file_name (NODE *node, int dirok)
+{
+ if (node->parent)
+ return node->parent;
+ else if (node->filename
+ && (dirok ||
+ !is_dir_name (filename_non_directory (node->filename))))
+ return node->filename;
+ return 0;
+}
+
+static int
+single_file (char *filename, int argc, char **argv)
+{
+ NODE *initial_node; /* First node loaded by Info. */
+ NODE *new_initial_node, *error_node;
+
+ /* Get the initial Info node. It is either "(dir)Top", or what the user
+ specifed with values in filename and user_nodenames. */
+ initial_node = info_get_node (filename,
+ user_nodenames ? user_nodenames[0] : 0,
+ PARSE_NODE_DFLT);
+
+ /* If we couldn't get the initial node, this user is in trouble. */
+ if (!initial_node)
+ {
+ if (info_recent_file_error)
+ info_error ("%s", info_recent_file_error);
+ else
+ info_error (msg_cant_find_node,
+ user_nodenames ? user_nodenames[0] : "Top");
+ return EXIT_FAILURE;
+ }
+
+ /* Special cases for when the user specifies multiple nodes. If we
+ are dumping to an output file, dump all of the nodes specified.
+ Otherwise, attempt to create enough windows to handle the nodes
+ that this user wants displayed. */
+ if (user_nodenames_index > 1)
+ {
+ free (initial_node);
+
+ if (print_where_p)
+ printf ("%s\n", filename ? filename : "unknown?!");
+ else if (user_output_filename)
+ dump_nodes_to_file (filename, user_nodenames,
+ user_output_filename, dump_subnodes);
+ else
+ begin_multiple_window_info_session (filename, user_nodenames);
+
+ return EXIT_SUCCESS;
+ }
+
+ /* If there are arguments remaining, they are the names of menu items
+ in sequential info files starting from the first one loaded. That
+ file name is either "dir", or the contents of filename if one
+ was specified. */
+ /* If they say info -O info, we want to show them the invocation node
+ for standalone info; there's nothing useful in info.texi. */
+ if (goto_invocation_p && *argv
+ && mbscasecmp (*argv, "info") == 0)
+ *argv = "info-stnd";
+
+ new_initial_node = info_follow_menus (initial_node, argv, &error_node, 0);
+
+ if (new_initial_node && new_initial_node != initial_node)
+ initial_node = new_initial_node;
+
+ if (print_where_p)
+ {
+ const char *name = node_file_name (initial_node, 0);
+ if (!name)
+ return EXIT_FAILURE;
+ printf ("%s\n", name);
+ return EXIT_SUCCESS;
+ }
+
+ /* If the user specified that this node should be output, then do that
+ now. Otherwise, start the Info session with this node. Or act
+ accordingly if the initial node was not found. */
+ if (user_output_filename && !goto_invocation_p)
+ {
+ if (error_node)
+ show_error_node (error_node);
+ else
+ dump_node_to_file (initial_node, user_output_filename,
+ dump_subnodes);
+ }
+ else
+ {
+ if (error_node)
+ {
+ initialize_info_session (initial_node, 1);
+ show_error_node (error_node);
+ info_session ();
+ }
+
+ /* If the user specified `--index-search=STRING' or
+ --show-options, start the info session in the node
+ corresponding to what they want. */
+ else if (index_search_p || goto_invocation_p)
+ {
+ int status = EXIT_SUCCESS;
+
+ initialize_info_session (initial_node, 0);
+
+ if (goto_invocation_p ||
+ index_entry_exists (windows, index_search_string))
+ {
+ terminal_prep_terminal ();
+ terminal_clear_screen ();
+ info_last_executed_command = NULL;
+
+ if (index_search_p)
+ do_info_index_search (windows, 0, index_search_string);
+ else
+ {
+ /* If they said "info --show-options foo bar baz",
+ the last of the arguments is the program whose
+ options they want to see. */
+ char **p = argv;
+ char *program;
+
+ if (*p)
+ {
+ while (p[1])
+ p++;
+ program = xstrdup (*p);
+ }
+ else if (filename)
+ /* If there's no command-line arguments to
+ supply the program name, use the Info file
+ name (sans extension and leading directories)
+ instead. */
+ program = program_name_from_file_name (filename);
+ else
+ program = xstrdup ("");
+
+ info_intuit_options_node (windows, initial_node, program);
+ free (program);
+ }
+
+ if (user_output_filename)
+ {
+ dump_node_to_file (windows->node, user_output_filename,
+ dump_subnodes);
+ }
+ else
+ info_read_and_dispatch ();
+
+ /* On program exit, leave the cursor at the bottom of the
+ window, and restore the terminal IO. */
+ terminal_goto_xy (0, screenheight - 1);
+ terminal_clear_to_eol ();
+ fflush (stdout);
+ terminal_unprep_terminal ();
+ }
+ else
+ {
+ fprintf (stderr, _("no index entries found for `%s'\n"),
+ index_search_string);
+ status = EXIT_FAILURE;
+ }
+
+ close_dribble_file ();
+ return status;
+ }
+ else
+ begin_info_session (initial_node);
+ }
+
+ return EXIT_SUCCESS;
+}
+
+static char *
+dirname (const char *file)
+{
+ char *p;
+ size_t len;
+
+ p = strrchr (file, '/');
+ if (!p)
+ return NULL;
+ len = p - file;
+ p = xmalloc (len + 1);
+ memcpy (p, file, len);
+ p[len] = 0;
+ return p;
+}
+
+REFERENCE **
+info_find_matching_files (char *filename)
+{
+ size_t argc = 0;
+ size_t argn = 0;
+ REFERENCE **argv = NULL;
+ int i = 0;
+ char *p;
+
+ while (1)
+ {
+ p = info_file_find_next_in_path (filename, infopath (), &i);
+ if (argc == argn)
+ {
+ if (argn == 0)
+ argn = 2;
+ argv = x2nrealloc (argv, &argn, sizeof (argv[0]));
+ }
+ if (!p)
+ {
+ argv[argc] = NULL;
+ break;
+ }
+
+ argv[argc] = xzalloc (sizeof (*argv[0]));
+ argv[argc]->filename = p;
+ ++argc;
+ }
+
+ return argv;
+}
+
+static int
+all_files (char *filename, int argc, char **argv)
+{
+ REFERENCE **fref;
+ char *fname;
+ int i, j;
+ int dirok;
+ struct info_namelist_entry *nlist = NULL;
+ int dump_flags = dump_subnodes;
+
+ if (user_filename)
+ {
+ fname = user_filename;
+ dirok = 0;
+ }
+ else
+ {
+ fname = "dir";
+ dirok = 1;
+ }
+
+ fref = info_find_matching_files (fname);
+
+ for (i = 0; fref[i]; )
+ {
+ NODE *node;
+
+ forget_file_names ();
+ if (!user_filename)
+ {
+ char *p = dirname (fref[i]->filename);
+ infopath_add (p, INFOPATH_INIT);
+ free (p);
+ }
+ node = info_get_node (fref[i]->filename,
+ user_nodenames ? user_nodenames[0] : 0,
+ PARSE_NODE_DFLT);
+
+ if (node)
+ {
+ NODE *subnode = info_follow_menus (node, argv, NULL, 1);
+ if (!subnode)
+ {
+ forget_info_file (fref[i]->filename);
+ node = NULL;
+ }
+ else
+ node = subnode;
+ }
+
+ if (node)
+ {
+ const char *name = node_file_name (node, dirok);
+ if (!name)
+ node = NULL;
+ else
+ {
+ free (fref[i]->filename);
+ fref[i]->filename = xstrdup (name);
+ }
+ }
+
+ if (!node)
+ {
+ info_reference_free (fref[i]);
+ for (j = i; (fref[j] = fref[j + 1]); j++);
+ }
+ else
+ {
+ if (info_namelist_add (&nlist, fref[i]->filename) == 0)
+ {
+ if (print_where_p)
+ printf ("%s\n", fref[i]->filename);
+ else if (user_output_filename)
+ {
+ dump_node_to_file (node, user_output_filename, dump_flags);
+ dump_flags |= DUMP_APPEND;
+ }
+ else
+ fref[i]->nodename = xstrdup (node->nodename);
+ forget_info_file (fref[i]->filename);
+ ++i;
+ }
+ else
+ {
+ forget_info_file (fref[i]->filename);
+ info_reference_free (fref[i]);
+ for (j = i; (fref[j] = fref[j + 1]); j++);
+ }
+ }
+ }
+
+ info_namelist_free (nlist);
+
+ if (print_where_p || user_output_filename)
+ return EXIT_SUCCESS;
+
+ if (i <= 1)
+ return single_file (user_filename, argc, argv);
+
+ begin_info_session (allfiles_create_node (argc ? argv[0] : fname, fref));
+ return EXIT_SUCCESS;
+}
+
+static void
+set_debug_level (const char *arg)
+{
+ char *p;
+ long n = strtol (arg, &p, 10);
+ if (*p)
+ {
+ fprintf (stderr, _("invalid number: %s\n"), arg);
+ exit (EXIT_FAILURE);
+ }
+ if (n < 0 || n > UINT_MAX)
+ debug_level = UINT_MAX;
+ else
+ debug_level = n;
+}
+
+
/* **************************************************************** */
/* */
/* Main Entry Point to the Info Program */
@@ -149,7 +507,6 @@ int
main (int argc, char *argv[])
{
int getopt_long_index; /* Index returned by getopt_long (). */
- NODE *initial_node; /* First node loaded by Info. */
#ifdef HAVE_SETLOCALE
/* Set locale via LC_ALL. */
@@ -163,13 +520,13 @@ main (int argc, char *argv[])
#endif
init_messages ();
-
+ infopath_init ();
while (1)
{
int option_character;
- option_character = getopt_long
- (argc, argv, short_options, long_options, &getopt_long_index);
+ option_character = getopt_long (argc, argv, short_options, long_options,
+ &getopt_long_index);
/* getopt_long returns EOF when there are no more long options. */
if (option_character == EOF)
@@ -185,15 +542,19 @@ main (int argc, char *argv[])
case 0:
break;
+ case 'a':
+ all_matches_p = 1;
+ break;
+
/* User wants to add a directory. */
case 'd':
- info_add_path (optarg, INFOPATH_PREPEND);
+ infopath_add (optarg, INFOPATH_PREPEND);
break;
/* User is specifying a particular node. */
case 'n':
add_pointer_to_array (optarg, user_nodenames_index, user_nodenames,
- user_nodenames_slots, 10, char *);
+ user_nodenames_slots, 10);
break;
/* User is specifying a particular Info file. */
@@ -239,17 +600,17 @@ main (int argc, char *argv[])
print_where_p = 1;
break;
-#ifdef __MSDOS__
+#if defined(__MSDOS__) || defined(__MINGW32__)
/* User wants speech-friendly output. */
case 'b':
speech_friendly = 1;
break;
-#endif /* __MSDOS__ */
+#endif /* __MSDOS__ || __MINGW32__ */
/* User has specified a string to search all indices for. */
case 'k':
apropos_p = 1;
- maybe_free (apropos_search_string);
+ free (apropos_search_string);
apropos_search_string = xstrdup (optarg);
break;
@@ -267,13 +628,48 @@ main (int argc, char *argv[])
/* User has specified a string to search all indices for. */
case IDXSRCH_OPTION:
index_search_p = 1;
- maybe_free (index_search_string);
+ free (index_search_string);
index_search_string = xstrdup (optarg);
break;
+ case 'v':
+ {
+ char *p;
+ p = strchr (optarg, '=');
+ if (!p)
+ {
+ info_error (_("malformed variable assignment: %s"), optarg);
+ exit (EXIT_FAILURE);
+ }
+ *p++ = 0;
+ if (set_variable_to_value (optarg, p))
+ {
+ switch (errno)
+ {
+ case ENOENT:
+ info_error (_("%s: no such variable"), optarg);
+ break;
+
+ case EINVAL:
+ info_error (_("value %s is not valid for variable %s"),
+ p, optarg);
+ break;
+
+ default:
+ abort ();
+ }
+ exit (EXIT_FAILURE);
+ }
+ }
+ break;
+
+ case 'x':
+ set_debug_level (optarg);
+ break;
+
default:
fprintf (stderr, _("Try --help for more information.\n"));
- xexit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -286,6 +682,9 @@ main (int argc, char *argv[])
dump_subnodes = 1;
}
+ if (dump_subnodes)
+ dump_subnodes = DUMP_SUBNODES;
+
/* If the user specified --version, then show the version and exit. */
if (print_version_p)
{
@@ -295,52 +694,15 @@ main (int argc, char *argv[])
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n"),
- "2008");
- xexit (0);
+ "2013");
+ exit (EXIT_SUCCESS);
}
/* If the `--help' option was present, show the help and exit. */
if (print_help_p)
{
info_short_help ();
- xexit (0);
- }
-
- /* If the user hasn't specified a path for Info files, default it.
- Lowest priority is our messy hardwired list in filesys.h.
- Then comes the user's INFODIR from the Makefile.
- Highest priority is the environment variable, if set. */
- if (!infopath)
- {
- char *path_from_env = getenv ("INFOPATH");
-
- if (path_from_env)
- {
- unsigned len = strlen (path_from_env);
- /* Trailing : on INFOPATH means insert the default path. */
- if (len && path_from_env[len - 1] == PATH_SEP[0])
- {
- path_from_env[len - 1] = 0;
- info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
- }
-#ifdef INFODIR /* from the Makefile */
- info_add_path (INFODIR, INFOPATH_PREPEND);
-#endif
- info_add_path (path_from_env, INFOPATH_PREPEND);
- }
- else
- {
- info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
-#ifdef INFODIR /* from the Makefile */
- info_add_path (INFODIR, INFOPATH_PREPEND);
-#endif
-#ifdef INFODIR2 /* from the Makefile, too */
-# ifdef INFODIR
- if (!STREQ (INFODIR, INFODIR2))
-# endif
- info_add_path (INFODIR2, INFOPATH_PREPEND);
-#endif
- }
+ exit (EXIT_SUCCESS);
}
/* If the user specified a particular filename, add the path of that
@@ -353,172 +715,16 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
if (apropos_p)
{
info_apropos (apropos_search_string);
- xexit (0);
+ exit (EXIT_SUCCESS);
}
- /* Get the initial Info node. It is either "(dir)Top", or what the user
- specifed with values in user_filename and user_nodenames. */
- initial_node = info_get_node (user_filename,
- user_nodenames ? user_nodenames[0] : 0);
+ argc -= optind;
+ argv += optind;
+
+ if (all_matches_p)
+ return all_files (user_filename, argc, argv);
- /* If we couldn't get the initial node, this user is in trouble. */
- if (!initial_node)
- {
- if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
- else
- info_error (msg_cant_find_node,
- user_nodenames ? user_nodenames[0] : "Top", NULL);
- xexit (1);
- }
-
- /* Special cases for when the user specifies multiple nodes. If we
- are dumping to an output file, dump all of the nodes specified.
- Otherwise, attempt to create enough windows to handle the nodes
- that this user wants displayed. */
- if (user_nodenames_index > 1)
- {
- free (initial_node);
-
- if (print_where_p)
- printf ("%s\n", user_filename ? user_filename : "unknown?!");
- else if (user_output_filename)
- dump_nodes_to_file
- (user_filename, user_nodenames, user_output_filename, dump_subnodes);
- else
- begin_multiple_window_info_session (user_filename, user_nodenames);
-
- xexit (0);
- }
-
- /* If there are arguments remaining, they are the names of menu items
- in sequential info files starting from the first one loaded. That
- file name is either "dir", or the contents of user_filename if one
- was specified. */
- {
- const char *errstr;
- char *errarg1, *errarg2;
- NODE *new_initial_node;
-
- /* If they say info -O info, we want to show them the invocation node
- for standalone info; there's nothing useful in info.texi. */
- if (goto_invocation_p && argv[optind]
- && mbscasecmp (argv[optind], "info") == 0)
- argv[optind] = "info-stnd";
-
- new_initial_node = info_follow_menus (initial_node, argv + optind,
- &errstr, &errarg1, &errarg2);
-
- if (new_initial_node && new_initial_node != initial_node)
- initial_node = new_initial_node;
-
- if (print_where_p)
- {
- if (initial_node->parent)
- printf ("%s\n", initial_node->parent);
- else if (initial_node->filename
- && !is_dir_name (filename_non_directory (initial_node->filename)))
- printf ("%s\n", initial_node->filename);
- else
- xexit (1);
- xexit (0);
- }
-
- /* If the user specified that this node should be output, then do that
- now. Otherwise, start the Info session with this node. Or act
- accordingly if the initial node was not found. */
- if (user_output_filename && !goto_invocation_p)
- {
- if (!errstr)
- dump_node_to_file (initial_node, user_output_filename,
- dump_subnodes);
- else
- info_error (errstr, errarg1, errarg2);
- }
- else
- {
-
- if (errstr)
- begin_info_session_with_error (initial_node, errstr,
- errarg1, errarg2);
- /* If the user specified `--index-search=STRING' or
- --show-options, start the info session in the node
- corresponding to what they want. */
- else if (index_search_p || goto_invocation_p)
- {
- int status = 0;
-
- initialize_info_session (initial_node, 0);
-
- if (goto_invocation_p
- || index_entry_exists (windows, index_search_string))
- {
- terminal_prep_terminal ();
- terminal_clear_screen ();
- info_last_executed_command = NULL;
-
- if (index_search_p)
- do_info_index_search (windows, 0, index_search_string);
- else
- {
- /* If they said "info --show-options foo bar baz",
- the last of the arguments is the program whose
- options they want to see. */
- char **p = argv + optind;
- char *program;
-
- if (*p)
- {
- while (p[1])
- p++;
- program = xstrdup (*p);
- }
- else if (user_filename)
- /* If there's no command-line arguments to
- supply the program name, use the Info file
- name (sans extension and leading directories)
- instead. */
- program = program_name_from_file_name (user_filename);
- else
- program = xstrdup ("");
-
- info_intuit_options_node (windows, initial_node, program);
- free (program);
- }
-
- if (user_output_filename)
- {
- dump_node_to_file (windows->node, user_output_filename,
- dump_subnodes);
- }
- else
- info_read_and_dispatch ();
-
- /* On program exit, leave the cursor at the bottom of the
- window, and restore the terminal IO. */
- terminal_goto_xy (0, screenheight - 1);
- terminal_clear_to_eol ();
- fflush (stdout);
- terminal_unprep_terminal ();
- }
- else
- {
- fprintf (stderr, _("no index entries found for `%s'\n"),
- index_search_string);
- status = 2;
- }
-
- close_dribble_file ();
- xexit (status);
- }
- else
- begin_info_session (initial_node);
- }
-
- xexit (0);
- }
-
- return 0; /* Avoid bogus warnings. */
+ return single_file (user_filename, argc, argv);
}
void
@@ -537,7 +743,7 @@ add_file_directory_to_path (char *filename)
temp += 2;
}
temp[-1] = 0;
- info_add_path (directory_name, INFOPATH_PREPEND);
+ infopath_add (directory_name, INFOPATH_PREPEND);
}
free (directory_name);
@@ -552,23 +758,70 @@ int info_error_was_printed = 0;
/* Non-zero means ring terminal bell on errors. */
int info_error_rings_bell_p = 1;
-/* Print FORMAT with ARG1 and ARG2. If the window system was initialized,
+static FILE *debug_file;
+
+static void
+close_debugfile (void)
+{
+ fclose (debug_file);
+}
+
+#define INFODEBUG_FILE "infodebug"
+
+void
+vinfo_debug (const char *format, va_list ap)
+{
+ FILE *fp;
+
+ if (!debug_file)
+ {
+ if (!info_windows_initialized_p || display_inhibited)
+ fp = stderr;
+ else
+ {
+ debug_file = fopen (INFODEBUG_FILE, "w");
+ if (!debug_file)
+ {
+ info_error (_("can't open %s: %s"), INFODEBUG_FILE,
+ strerror (errno));
+ exit (EXIT_FAILURE);
+ }
+ atexit (close_debugfile);
+ fp = debug_file;
+ info_error (_("debugging output diverted to \"%s\""),
+ INFODEBUG_FILE);
+ }
+ }
+ else
+ fp = debug_file;
+
+ fprintf (fp, "%s: ", program_name);
+ vfprintf (fp, format, ap);
+ fprintf (fp, "\n");
+ fflush (stderr);
+}
+
+void
+info_debug (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vinfo_debug (format, ap);
+ va_end (ap);
+}
+
+/* Print AP according to FORMAT. If the window system was initialized,
then the message is printed in the echo area. Otherwise, a message is
output to stderr. */
void
-info_error (const char *format, void *arg1, void *arg2)
+vinfo_error (const char *format, va_list ap)
{
info_error_was_printed = 1;
if (!info_windows_initialized_p || display_inhibited)
{
fprintf (stderr, "%s: ", program_name);
- if (arg1)
- fprintf (stderr, format, arg1, arg2);
- else
- /* If we're passed a string, just print it. Otherwise a % in a
- filename gets treated as a format specifier. */
- fputs (format, stderr);
+ vfprintf (stderr, format, ap);
fprintf (stderr, "\n");
fflush (stderr);
}
@@ -578,11 +831,11 @@ info_error (const char *format, void *arg1, void *arg2)
{
if (info_error_rings_bell_p)
terminal_ring_bell ();
- window_message_in_echo_area (format, arg1, arg2);
+ vwindow_message_in_echo_area (format, ap);
}
else
{
- NODE *temp = build_message_node (format, arg1, arg2);
+ NODE *temp = build_message_node (format, ap);
if (info_error_rings_bell_p)
terminal_ring_bell ();
inform_in_echo_area (temp->contents);
@@ -592,6 +845,30 @@ info_error (const char *format, void *arg1, void *arg2)
}
}
+void
+info_error (const char *format, ...)
+{
+ va_list ap;
+ va_start (ap, format);
+ vinfo_error (format, ap);
+ va_end (ap);
+}
+
+void
+show_error_node (NODE *node)
+{
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ if (!echo_area_is_active)
+ {
+ free_echo_area ();
+ window_set_node_of_window (the_echo_area, node);
+ display_update_one_window (the_echo_area);
+ }
+ else
+ inform_in_echo_area (node->contents);
+}
+
/* Produce a scaled down description of the available options to Info. */
static void
@@ -605,33 +882,37 @@ Read documentation in Info format.\n"), program_name);
puts (_("\
Options:\n\
+ -a, --all use all matching manuals.\n\
-k, --apropos=STRING look up STRING in all indices of all manuals.\n\
-d, --directory=DIR add DIR to INFOPATH.\n\
- --dribble=FILENAME remember user keystrokes in FILENAME.\n\
- -f, --file=FILENAME specify Info file to visit."));
+ --dribble=FILE remember user keystrokes in FILENAME.\n\
+ -f, --file=MANUAL specify Info manual to visit."));
puts (_("\
-h, --help display this help and exit.\n\
--index-search=STRING go to node pointed by index entry STRING.\n\
-n, --node=NODENAME specify nodes in first visited Info file.\n\
- -o, --output=FILENAME output selected nodes to FILENAME."));
+ -o, --output=FILE output selected nodes to FILE."));
puts (_("\
-R, --raw-escapes output \"raw\" ANSI escapes (default).\n\
--no-raw-escapes output escapes as literal text.\n\
- --restore=FILENAME read initial keystrokes from FILENAME.\n\
+ --restore=FILE read initial keystrokes from FILE.\n\
-O, --show-options, --usage go to command-line options node."));
-#ifdef __MSDOS__
+#if defined(__MSDOS__) || defined(__MINGW32__)
puts (_("\
-b, --speech-friendly be friendly to speech synthesizers."));
#endif
puts (_("\
+ --strict-node-location (for debugging) use Info file pointers as-is.\n\
--subnodes recursively output menu items.\n\
+ -v, --variable VAR=VALUE assign VALUE to Info variable VAR.\n\
--vi-keys use vi-like and less-like key bindings.\n\
--version display version information and exit.\n\
- -w, --where, --location print physical location of Info file."));
+ -w, --where, --location print physical location of Info file.\n\
+ -x, --debug=NUMBER set debugging level (-1 for all).\n"));
puts (_("\n\
The first non-option argument, if present, is the menu entry to start from;\n\
@@ -659,7 +940,7 @@ Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
Texinfo home page: http://www.gnu.org/software/texinfo/"));
- xexit (0);
+ exit (EXIT_SUCCESS);
}
diff --git a/info/info.h b/info/info.h
index 8a3d0c0..e3fbcfd 100644
--- a/info/info.h
+++ b/info/info.h
@@ -1,8 +1,8 @@
/* info.h -- Header file which includes all of the other headers.
- $Id: info.h,v 1.9 2008/05/10 14:39:05 gray Exp $
+ $Id: info.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007, 2011,
+ 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_H
#define INFO_H
@@ -63,15 +63,19 @@ typedef char *CFunction ();
array where POINTER should be added. GROW is the number of slots to grow
ARRAY by, in the case that it needs growing. TYPE is a cast of the type
of object stored in ARRAY (e.g., NODE_ENTRY *. */
-#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
- do { \
- if (idx + 2 >= slots) \
- array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
- array[idx++] = (type)pointer; \
- array[idx] = (type)NULL; \
- } while (0)
-
-#define maybe_free(x) do { if (x) free (x); } while (0)
+#define add_pointer_to_array(pointer, idx, array, slots, minslots) \
+ do \
+ { \
+ if (idx + 2 >= slots) \
+ { \
+ if (slots == 0) \
+ slots = minslots; \
+ array = x2nrealloc (array, &slots, sizeof(array[0])); \
+ } \
+ array[idx++] = pointer; \
+ array[idx] = NULL; \
+ } \
+ while (0)
#if !defined (zero_mem) && defined (HAVE_MEMSET)
# define zero_mem(mem, length) memset (mem, 0, length)
@@ -126,10 +130,28 @@ extern int vi_keys_p;
/* Non-zero means don't remove ANSI escape sequences from man pages. */
extern int raw_escapes_p;
-/* Print FORMAT with ARG1 and ARG2. If the window system was initialized,
+/* Non-zero means don't try to be smart when searching for nodes. */
+extern int strict_node_location_p;
+
+extern unsigned debug_level;
+
+#define debug(n,c) \
+ do \
+ { \
+ if (debug_level >= (n)) \
+ info_debug c; \
+ } \
+ while (0)
+
+extern void vinfo_debug (const char *format, va_list ap);
+extern void info_debug (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
+
+/* Print args as per FORMAT. If the window system was initialized,
then the message is printed in the echo area. Otherwise, a message is
output to stderr. */
-extern void info_error (const char *format, void *arg1, void *arg2);
+extern void info_error (const char *format, ...) TEXINFO_PRINTFLIKE(1,2);
+
+extern void vinfo_error (const char *format, va_list ap);
extern void add_file_directory_to_path (char *filename);
@@ -152,12 +174,12 @@ extern const char *msg_win_too_small;
extern const char *msg_cant_make_help;
-#if defined(INFOKEY)
/* Found in variables.c. */
-extern void set_variable_to_value (char *name, char *value);
-#endif /* INFOKEY */
+extern int set_variable_to_value (char *name, char *value);
/* Found in m-x.c. */
extern char *read_function_name (const char *prompt, WINDOW *window);
+extern void show_error_node (NODE *node);
+
#endif /* !INFO_H */
diff --git a/info/infodoc.c b/info/infodoc.c
index 706d53f..3214961 100644
--- a/info/infodoc.c
+++ b/info/infodoc.c
@@ -1,8 +1,8 @@
/* infodoc.c -- functions which build documentation nodes.
- $Id: infodoc.c,v 1.26 2008/06/11 09:55:42 gray Exp $
+ $Id: infodoc.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
- 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
+ 2007, 2008, 2011, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "funs.h"
@@ -78,6 +78,8 @@ static char *info_internal_help_text[] = {
N_("\\%-10[search-next] Search for next occurrence.\n"),
N_("\\%-10[index-search] Search for a specified string in the index, and\n\
select the node referenced by the first entry found.\n"),
+ N_("\\%-10[virtual-index] Synthesize menu of matching index entries.\n"),
+ "\n",
N_("\\%-10[abort-key] Cancel the current operation.\n"),
"\n",
NULL
@@ -220,16 +222,13 @@ dump_map_to_message_buffer (char *prefix, Keymap map)
if (last - 1 != i)
{
- printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix),
- NULL, NULL);
+ printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix));
new_prefix[prefix_len] = last - 1;
- printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix),
- NULL, NULL);
+ printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
i = last - 1;
}
else
- printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix),
- NULL, NULL);
+ printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix));
#if defined (NAMED_FUNCTIONS)
/* Print the name of the function, and some padding before the
@@ -238,23 +237,23 @@ dump_map_to_message_buffer (char *prefix, Keymap map)
int length_so_far;
int desired_doc_start = 40; /* Must be multiple of 8. */
- printf_to_message_buffer ("(%s)", name, NULL, NULL);
+ printf_to_message_buffer ("(%s)", name);
length_so_far = message_buffer_length_this_line ();
if ((desired_doc_start + strlen (doc))
>= (unsigned int) the_screen->width)
- printf_to_message_buffer ("\n ", NULL, NULL, NULL);
+ printf_to_message_buffer ("\n ");
else
{
while (length_so_far < desired_doc_start)
{
- printf_to_message_buffer ("\t", NULL, NULL, NULL);
+ printf_to_message_buffer ("\t");
length_so_far += character_width ('\t', length_so_far);
}
}
}
#endif /* NAMED_FUNCTIONS */
- printf_to_message_buffer ("%s\n", doc, NULL, NULL);
+ printf_to_message_buffer ("%s\n", doc);
}
}
free (new_prefix);
@@ -308,17 +307,14 @@ create_internal_info_help_node (int help_is_only_window_p)
#endif /* !INFOKEY */
}
- printf_to_message_buffer ("---------------------\n", NULL, NULL, NULL);
- printf_to_message_buffer (_("The current search path is:\n"),
- NULL, NULL, NULL);
- printf_to_message_buffer ("%s\n", infopath, NULL, NULL);
- printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL);
- printf_to_message_buffer (_("Commands available in Info windows:\n\n"),
- NULL, NULL, NULL);
+ printf_to_message_buffer ("---------------------\n");
+ printf_to_message_buffer (_("The current search path is:\n"));
+ printf_to_message_buffer ("%s\n", infopath ());
+ printf_to_message_buffer ("---------------------\n\n");
+ printf_to_message_buffer (_("Commands available in Info windows:\n\n"));
dump_map_to_message_buffer ("", info_keymap);
- printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL);
- printf_to_message_buffer (_("Commands available in the echo area:\n\n"),
- NULL, NULL, NULL);
+ printf_to_message_buffer ("---------------------\n\n");
+ printf_to_message_buffer (_("Commands available in the echo area:\n\n"));
dump_map_to_message_buffer ("", echo_area_keymap);
#if defined (NAMED_FUNCTIONS)
@@ -336,16 +332,14 @@ create_internal_info_help_node (int help_is_only_window_p)
{
if (!printed_one_mx)
{
- printf_to_message_buffer ("---------------------\n\n",
- NULL, NULL, NULL);
+ printf_to_message_buffer ("---------------------\n\n");
if (exec_keys && exec_keys[0])
printf_to_message_buffer
(_("The following commands can only be invoked via %s:\n\n"),
- exec_keys, NULL, NULL);
+ exec_keys);
else
printf_to_message_buffer
- (_("The following commands cannot be invoked at all:\n\n"),
- NULL, NULL, NULL);
+ (_("The following commands cannot be invoked at all:\n\n"));
printed_one_mx = 1;
}
@@ -361,9 +355,9 @@ create_internal_info_help_node (int help_is_only_window_p)
}
if (printed_one_mx)
- printf_to_message_buffer ("\n", NULL, NULL, NULL);
+ printf_to_message_buffer ("\n");
- maybe_free (exec_keys);
+ free (exec_keys);
#endif /* NAMED_FUNCTIONS */
node = message_buffer_to_node ();
@@ -372,10 +366,7 @@ create_internal_info_help_node (int help_is_only_window_p)
else
{
/* We already had the right contents, so simply use them. */
- node = build_message_node ("", 0, 0);
- free (node->contents);
- node->contents = contents;
- node->nodelen = 1 + strlen (contents);
+ node = string_to_node (contents);
}
internal_info_help_node = node;
@@ -486,7 +477,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message"))
}
else
{
- info_error (msg_cant_make_help, NULL, NULL);
+ info_error ("%s", msg_cant_make_help);
}
}
@@ -523,12 +514,12 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'")
nodename = "Help";
/* Try to get the info file for Info. */
- node = info_get_node ("Info", nodename);
+ node = info_get_node ("Info", nodename, PARSE_NODE_DFLT);
if (!node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
+ info_error ("%s", info_recent_file_error);
else
info_error (msg_cant_file_node, "Info", nodename);
}
@@ -618,18 +609,6 @@ named_function (char *name)
}
#endif /* NAMED_FUNCTIONS */
-/* Return the documentation associated with KEY in MAP. */
-char *
-key_documentation (char key, Keymap map)
-{
- InfoCommand *function = map[key].function;
-
- if (function)
- return function_documentation (function);
- else
- return NULL;
-}
-
DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
{
char keys[50];
@@ -642,8 +621,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
for (;;)
{
- message_in_echo_area (_("Describe key: %s"),
- pretty_keyseq (keys), NULL);
+ message_in_echo_area (_("Describe key: %s"), pretty_keyseq (keys));
keystroke = info_get_input_char ();
unmessage_in_echo_area ();
@@ -669,8 +647,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
if (map[keystroke].function == NULL)
{
- message_in_echo_area (_("%s is undefined."),
- pretty_keyseq (keys), NULL);
+ message_in_echo_area (_("%s is undefined."), pretty_keyseq (keys));
return;
}
else if (map[keystroke].type == ISKMAP)
@@ -699,7 +676,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
if (map[lowerkey].function == NULL)
{
message_in_echo_area (_("%s is undefined."),
- pretty_keyseq (keys), NULL);
+ pretty_keyseq (keys));
return;
}
}
@@ -722,7 +699,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
sprintf (message, _("%s is defined to %s."), keyname, fundoc);
#endif /* !NAMED_FUNCTIONS */
- window_message_in_echo_area ("%s", message, NULL);
+ window_message_in_echo_area ("%s", message);
free (message);
break;
}
@@ -885,7 +862,7 @@ replace_in_documentation (const char *string, int help_is_only_window_p)
register int i, start, next;
static char *result = NULL;
- maybe_free (result);
+ free (result);
result = xmalloc (1 + reslen);
i = next = start = 0;
@@ -1036,7 +1013,7 @@ replace_in_documentation (const char *string, int help_is_only_window_p)
start++;
}
- maybe_free (fmt);
+ free (fmt);
}
}
strcpy (result + next, string + start);
@@ -1169,8 +1146,7 @@ DECLARE_INFO_COMMAND (info_where_is,
if (!location || !location[0])
{
- info_error (_("`%s' is not on any keys"),
- command_name, NULL);
+ info_error (_("`%s' is not on any keys"), command_name);
}
else
{
@@ -1185,8 +1161,7 @@ DECLARE_INFO_COMMAND (info_where_is,
}
}
else
- info_error (_("There is no function named `%s'"),
- command_name, NULL);
+ info_error (_("There is no function named `%s'"), command_name);
}
free (command_name);
diff --git a/info/infokey.c b/info/infokey.c
index 5c30a26..bb18dde 100644
--- a/info/infokey.c
+++ b/info/infokey.c
@@ -1,8 +1,8 @@
/* infokey.c -- compile ~/.infokey to ~/.info.
- $Id: infokey.c,v 1.18 2008/06/11 09:55:42 gray Exp $
+ $Id: infokey.c 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1999, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009,
+ 2010, 2011, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Andrew Bettison <andrewb@zip.com.au>. */
+ Originally written by Andrew Bettison. */
#include "info.h"
#include "infomap.h"
@@ -72,11 +72,10 @@ struct sect
static char *mkpath (const char *dir, const char *file);
static int compile (FILE *fp, const char *filename, struct sect *sections);
static int write_infokey_file (FILE *fp, struct sect *sections);
-static void syntax_error (const char *filename,
- unsigned int linenum, const char *fmt,
- const void *a1, const void *a2, const void *a3, const void *a4);
-static void error_message (int error_code, const char *fmt,
- const void *a1, const void *a2, const void *a3, const void *a4);
+static void syntax_error (const char *filename, unsigned int linenum,
+ const char *fmt, ...) TEXINFO_PRINTFLIKE(3,4);
+static void error_message (int error_code, const char *fmt, ...)
+ TEXINFO_PRINTFLIKE(2,3);
static void suggest_help (void);
static void short_help (void);
@@ -133,7 +132,7 @@ main (int argc, char **argv)
default:
suggest_help ();
- xexit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -146,15 +145,15 @@ main (int argc, char **argv)
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
This is free software: you are free to change and redistribute it.\n\
There is NO WARRANTY, to the extent permitted by law.\n"),
- "2008");
- xexit (0);
+ "2013");
+ exit (EXIT_SUCCESS);
}
/* If the `--help' option was present, show the help and exit. */
if (print_help_p)
{
short_help ();
- xexit (0);
+ exit (EXIT_SUCCESS);
}
/* If there is one argument remaining, it is the name of the input
@@ -167,10 +166,9 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
}
else if (optind != argc)
{
- error_message (0, _("incorrect number of arguments"),
- NULL, NULL, NULL, NULL);
+ error_message (0, _("incorrect number of arguments"));
suggest_help ();
- xexit (1);
+ exit (EXIT_FAILURE);
}
/* Use default filenames where none given. */
@@ -178,7 +176,7 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
char *homedir;
homedir = getenv ("HOME");
-#ifdef __MSDOS__
+#if defined(__MSDOS__) || defined(__MINGW32__)
if (!homedir)
homedir = ".";
#endif
@@ -199,8 +197,8 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
if (!inf)
{
error_message (errno, _("cannot open input file `%s'"),
- input_filename, NULL, NULL, NULL);
- xexit (1);
+ input_filename);
+ exit (EXIT_FAILURE);
}
/* Compile the input file to its verious sections, then write the
@@ -213,8 +211,8 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
if (!outf)
{
error_message (errno, _("cannot create output file `%s'"),
- output_filename, NULL, NULL, NULL);
- xexit (1);
+ output_filename);
+ exit (EXIT_FAILURE);
}
/* Write the contents of the output file and close it. If there is
@@ -224,19 +222,19 @@ There is NO WARRANTY, to the extent permitted by law.\n"),
if (!write_infokey_file (outf, sections))
{
error_message (errno, _("error writing to `%s'"),
- output_filename, NULL, NULL, NULL);
+ output_filename);
write_error = 1;
}
if (fclose (outf) == EOF)
{
error_message (errno, _("error closing output file `%s'"),
- output_filename, NULL, NULL, NULL);
+ output_filename);
write_error = 1;
}
if (write_error)
{
unlink (output_filename);
- xexit (1);
+ exit (EXIT_FAILURE);
}
}
@@ -419,7 +417,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
octal,
special_key
}
- seqstate; /* used if state == get_keyseq */
+ seqstate = normal; /* used if state == get_keyseq */
char meta = 0;
char ocnt = 0; /* used if state == get_keyseq && seqstate == octal */
@@ -447,8 +445,8 @@ compile (FILE *fp, const char *filename, struct sect *sections)
seq[slen++] = meta ? Meta(c) : (c); \
else \
{ \
- syntax_error(filename, lnum, _("key sequence too long"), \
- NULL, NULL, NULL, NULL); \
+ syntax_error(filename, lnum, \
+ _("key sequence too long")); \
error = 1; \
} \
meta = 0; \
@@ -526,8 +524,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
rescan = 1;
if (slen == 0)
{
- syntax_error (filename, lnum, _("missing key sequence"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("missing key sequence"));
error = 1;
}
}
@@ -607,8 +604,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
else
{
syntax_error (filename, lnum,
- _("NUL character (\\000) not permitted"),
- NULL, NULL, NULL, NULL);
+ _("NUL character (\\000) not permitted"));
error = 1;
}
}
@@ -638,8 +634,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
else
{
syntax_error (filename, lnum,
- _("NUL character (^%c) not permitted"),
- (void *) (long) c, NULL, NULL, NULL);
+ _("NUL character (^%c) not permitted"), c);
error = 1;
}
seqstate = normal;
@@ -662,8 +657,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
rescan = 1;
if (alen == 0)
{
- syntax_error (filename, lnum, _("missing action name"),
- (void *) (long) c, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("missing action name"));
error = 1;
}
else
@@ -678,15 +672,14 @@ compile (FILE *fp, const char *filename, struct sect *sections)
&& add_to_section (&sections[section], "", 1)
&& add_to_section (&sections[section], &av, 1)))
{
- syntax_error (filename, lnum, _("section too long"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("section too long"));
error = 1;
}
}
else
{
syntax_error (filename, lnum, _("unknown action `%s'"),
- act, NULL, NULL, NULL);
+ act);
error = 1;
}
}
@@ -695,8 +688,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
act[alen++] = c;
else
{
- syntax_error (filename, lnum, _("action name too long"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("action name too long"));
error = 1;
}
break;
@@ -709,8 +701,8 @@ compile (FILE *fp, const char *filename, struct sect *sections)
else if (!isspace (c))
{
syntax_error (filename, lnum,
- _("extra characters following action `%s'"),
- act, NULL, NULL, NULL);
+ _("extra characters following action `%s'"),
+ act);
error = 1;
}
break;
@@ -720,8 +712,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
{
if (varlen == 0)
{
- syntax_error (filename, lnum, _("missing variable name"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("missing variable name"));
error = 1;
}
state = get_value;
@@ -730,16 +721,14 @@ compile (FILE *fp, const char *filename, struct sect *sections)
else if (c == '\n' || isspace (c))
{
syntax_error (filename, lnum,
- _("missing `=' immediately after variable name"),
- NULL, NULL, NULL, NULL);
+ _("missing `=' immediately after variable name"));
error = 1;
}
else if (varlen < sizeof varn)
varn[varlen++] = c;
else
{
- syntax_error (filename, lnum, _("variable name too long"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("variable name too long"));
error = 1;
}
break;
@@ -753,8 +742,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
&& add_to_section (&sections[section], val, vallen)
&& add_to_section (&sections[section], "", 1)))
{
- syntax_error (filename, lnum, _("section too long"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("section too long"));
error = 1;
}
}
@@ -762,8 +750,7 @@ compile (FILE *fp, const char *filename, struct sect *sections)
val[vallen++] = c;
else
{
- syntax_error (filename, lnum, _("value too long"),
- NULL, NULL, NULL, NULL);
+ syntax_error (filename, lnum, _("value too long"));
error = 1;
}
break;
@@ -868,11 +855,14 @@ write_infokey_file (FILE *fp, struct sect *sections)
progname: "filename", line N: message
*/
static void
-error_message (int error_code, const char *fmt,
- const void *a1, const void *a2, const void *a3, const void *a4)
+error_message (int error_code, const char *fmt, ...)
{
+ va_list ap;
+
fprintf (stderr, "%s: ", program_name);
- fprintf (stderr, fmt, a1, a2, a3, a4);
+ va_start(ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end(ap);
if (error_code)
fprintf (stderr, " - %s", strerror (error_code));
fprintf (stderr, "\n");
@@ -883,12 +873,15 @@ error_message (int error_code, const char *fmt,
*/
static void
syntax_error (const char *filename,
- unsigned int linenum, const char *fmt,
- const void *a1, const void *a2, const void *a3, const void *a4)
+ unsigned int linenum, const char *fmt, ...)
{
+ va_list ap;
+
fprintf (stderr, "%s: ", program_name);
fprintf (stderr, _("\"%s\", line %u: "), filename, linenum);
- fprintf (stderr, fmt, a1, a2, a3, a4);
+ va_start(ap, fmt);
+ vfprintf (stderr, fmt, ap);
+ va_end(ap);
fprintf (stderr, "\n");
}
@@ -920,5 +913,5 @@ Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
Texinfo home page: http://www.gnu.org/software/texinfo/"));
- xexit (0);
+ exit (EXIT_SUCCESS);
}
diff --git a/info/infokey.h b/info/infokey.h
index 783d921..13bd68a 100644
--- a/info/infokey.h
+++ b/info/infokey.h
@@ -1,7 +1,7 @@
/* infokey.h -- Custom keystroke definition support.
- $Id: infokey.h,v 1.5 2007/07/01 21:20:30 karl Exp $
+ $Id: infokey.h 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1999, 2002, 2007 Free Software Foundation, Inc.
+ Copyright 1999, 2002, 2007, 2013 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
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Andrew Bettison <andrewb@zip.com.au>.
+ Originally written by Andrew Bettison.
This design was derived from the "lesskey" system in less 3.4.0. by
Mark Nudelman.
diff --git a/info/infomap.c b/info/infomap.c
index b964d01..b1be694 100644
--- a/info/infomap.c
+++ b/info/infomap.c
@@ -1,8 +1,8 @@
/* infomap.c -- keymaps for Info.
- $Id: infomap.c,v 1.21 2008/06/11 09:55:42 gray Exp $
+ $Id: infomap.c 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007,
+ 2008, 2011, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "infomap.h"
@@ -55,7 +55,7 @@ keymap_make_keymap (void)
keymap[Meta(i)].type = ISFUNC;
keymap[Meta(i)].function =
#endif /* INFOKEY */
- keymap[i].function = InfoCmd(info_do_lowercase_version);
+ keymap[i].function = InfoCmd (info_do_lowercase_version);
}
return keymap;
@@ -68,7 +68,7 @@ find_function_keyseq (Keymap map, int c, Keymap rootmap)
FUNCTION_KEYSEQ *k;
if (map[c].type != ISFUNC)
- abort();
+ abort ();
if (map[c].function == NULL)
return NULL;
for (k = map[c].function->keys; k; k = k->next)
@@ -95,13 +95,13 @@ add_function_keyseq (InfoCommand *function,
FUNCTION_KEYSEQ *ks;
if (function == NULL ||
- function == InfoCmd(info_do_lowercase_version) ||
- function == InfoCmd(ea_insert))
+ function == InfoCmd (info_do_lowercase_version) ||
+ function == InfoCmd (ea_insert))
return;
- ks = xmalloc (sizeof(FUNCTION_KEYSEQ));
+ ks = xmalloc (sizeof (FUNCTION_KEYSEQ));
ks->next = function->keys;
ks->map = rootmap;
- ks->keyseq = xstrdup(keyseq);
+ ks->keyseq = xstrdup (keyseq);
function->keys = ks;
}
@@ -113,11 +113,11 @@ remove_function_keyseq (InfoCommand *function,
FUNCTION_KEYSEQ *k, *kp;
if (function == NULL ||
- function == InfoCmd(info_do_lowercase_version) ||
- function == InfoCmd(ea_insert))
+ function == InfoCmd (info_do_lowercase_version) ||
+ function == InfoCmd (ea_insert))
return;
for (kp = NULL, k = function->keys; k; kp = k, k = k->next)
- if (k->map == rootmap && strcmp(k->keyseq, keyseq) == 0)
+ if (k->map == rootmap && strcmp (k->keyseq, keyseq) == 0)
break;
if (!k)
abort ();
@@ -152,12 +152,13 @@ keymap_copy_keymap (Keymap map, Keymap rootmap, Keymap newroot)
#if defined(INFOKEY)
ks = find_function_keyseq (map, i, rootmap);
if (ks)
- add_function_keyseq(map[i].function, ks->keyseq, newroot);
+ add_function_keyseq (map[i].function, ks->keyseq, newroot);
#endif /* INFOKEY */
break;
case ISKMAP:
- keymap[i].function = (InfoCommand *)keymap_copy_keymap
- ((Keymap)map[i].function, rootmap, NULL);
+ keymap[i].function =
+ (InfoCommand *)keymap_copy_keymap ((Keymap)map[i].function,
+ rootmap, NULL);
break;
}
}
@@ -184,7 +185,7 @@ keymap_discard_keymap (Keymap map, Keymap rootmap)
{
case ISFUNC:
#if defined(INFOKEY)
- ks = find_function_keyseq(map, i, rootmap);
+ ks = find_function_keyseq (map, i, rootmap);
if (ks)
remove_function_keyseq (map[i].function, ks->keyseq, rootmap);
#endif /* INFOKEY */
@@ -196,13 +197,13 @@ keymap_discard_keymap (Keymap map, Keymap rootmap)
}
}
- free(map);
+ free (map);
}
/* Conditionally bind key sequence. */
static int
keymap_bind_keyseq (Keymap map,
- const char *keyseq, KEYMAP_ENTRY *keyentry)
+ const char *keyseq, KEYMAP_ENTRY *keyentry)
{
Keymap m = map;
const unsigned char *s = (unsigned char *) keyseq;
@@ -219,14 +220,13 @@ keymap_bind_keyseq (Keymap map,
{
case ISFUNC:
#if defined(INFOKEY)
- ks = find_function_keyseq(m, c, map);
+ ks = find_function_keyseq (m, c, map);
if (ks)
remove_function_keyseq (m[c].function, ks->keyseq, map);
#else /* !INFOKEY */
- if (!(m[c].function == NULL || (
- m != map &&
- m[c].function == InfoCmd(info_do_lowercase_version))
- ))
+ if (!(m[c].function == NULL ||
+ (m != map &&
+ m[c].function == InfoCmd (info_do_lowercase_version))))
return 0;
#endif /* !INFOKEY */
@@ -287,581 +287,586 @@ Keymap echo_area_keymap = NULL;
static unsigned char default_emacs_like_info_keys[] =
{
- 0, /* suppress-default-keybindings flag */
- TAB, NUL, A_info_move_to_next_xref,
- LFD, NUL, A_info_select_reference_this_line,
- RET, NUL, A_info_select_reference_this_line,
- CONTROL('a'), NUL, A_info_beginning_of_line,
- CONTROL('b'), NUL, A_info_backward_char,
- CONTROL('e'), NUL, A_info_end_of_line,
- CONTROL('f'), NUL, A_info_forward_char,
- CONTROL('h'), NUL, A_info_get_help_window,
- CONTROL('l'), NUL, A_info_redraw_display,
- CONTROL('n'), NUL, A_info_next_line,
- CONTROL('p'), NUL, A_info_prev_line,
- CONTROL('r'), NUL, A_isearch_backward,
- CONTROL('s'), NUL, A_isearch_forward,
- CONTROL('u'), NUL, A_info_universal_argument,
- CONTROL('v'), NUL, A_info_scroll_forward_page_only,
- ',', NUL, A_info_next_index_match,
- '/', NUL, A_info_search,
- '0', NUL, A_info_last_menu_item,
- '1', NUL, A_info_menu_digit,
- '2', NUL, A_info_menu_digit,
- '3', NUL, A_info_menu_digit,
- '4', NUL, A_info_menu_digit,
- '5', NUL, A_info_menu_digit,
- '6', NUL, A_info_menu_digit,
- '7', NUL, A_info_menu_digit,
- '8', NUL, A_info_menu_digit,
- '9', NUL, A_info_menu_digit,
- '<', NUL, A_info_first_node,
- '>', NUL, A_info_last_node,
- '?', NUL, A_info_get_help_window,
- '[', NUL, A_info_global_prev_node,
- ']', NUL, A_info_global_next_node,
- 'b', NUL, A_info_beginning_of_node,
- 'd', NUL, A_info_dir_node,
- 'e', NUL, A_info_end_of_node,
- 'f', NUL, A_info_xref_item,
- 'g', NUL, A_info_goto_node,
- 'G', NUL, A_info_menu_sequence,
- 'h', NUL, A_info_get_help_window,
- 'H', NUL, A_info_get_info_help_node,
- 'i', NUL, A_info_index_search,
- 'l', NUL, A_info_history_node,
- 'm', NUL, A_info_menu_item,
- 'n', NUL, A_info_next_node,
- 'O', NUL, A_info_goto_invocation_node,
- 'p', NUL, A_info_prev_node,
- 'r', NUL, A_info_xref_item,
- 'R', NUL, A_info_toggle_regexp,
- 's', NUL, A_info_search,
- 'S', NUL, A_info_search_case_sensitively,
- 't', NUL, A_info_top_node,
- 'u', NUL, A_info_up_node,
- ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
- ESC, CONTROL('f'), NUL, A_info_show_footnotes,
- ESC, CONTROL('g'), NUL, A_info_abort_key,
- ESC, TAB, NUL, A_info_move_to_prev_xref,
- ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
- ESC, '<', NUL, A_info_beginning_of_node,
- ESC, '>', NUL, A_info_end_of_node,
- ESC, 'b', NUL, A_info_backward_word,
- ESC, 'f', NUL, A_info_forward_word,
- ESC, 'r', NUL, A_info_move_to_window_line,
- ESC, 'v', NUL, A_info_scroll_backward_page_only,
- Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
- Meta(CONTROL('f')), NUL, A_info_show_footnotes,
- Meta(CONTROL('g')), NUL, A_info_abort_key,
- Meta(TAB), NUL, A_info_move_to_prev_xref,
- Meta(CONTROL('v')), NUL, A_info_scroll_other_window,
- Meta('<'), NUL, A_info_beginning_of_node,
- Meta('>'), NUL, A_info_end_of_node,
- Meta('b'), NUL, A_info_backward_word,
- Meta('f'), NUL, A_info_forward_word,
- Meta('r'), NUL, A_info_move_to_window_line,
- Meta('v'), NUL, A_info_scroll_backward_page_only,
+ 0, /* suppress-default-keybindings flag */
+ TAB, NUL, A_info_move_to_next_xref,
+ LFD, NUL, A_info_select_reference_this_line,
+ RET, NUL, A_info_select_reference_this_line,
+ CONTROL('a'), NUL, A_info_beginning_of_line,
+ CONTROL('b'), NUL, A_info_backward_char,
+ CONTROL('e'), NUL, A_info_end_of_line,
+ CONTROL('f'), NUL, A_info_forward_char,
+ CONTROL('h'), NUL, A_info_get_help_window,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('p'), NUL, A_info_prev_line,
+ CONTROL('r'), NUL, A_isearch_backward,
+ CONTROL('s'), NUL, A_isearch_forward,
+ CONTROL('u'), NUL, A_info_universal_argument,
+ CONTROL('v'), NUL, A_info_scroll_forward_page_only,
+ ',', NUL, A_info_next_index_match,
+ '/', NUL, A_info_search,
+ '0', NUL, A_info_last_menu_item,
+ '1', NUL, A_info_menu_digit,
+ '2', NUL, A_info_menu_digit,
+ '3', NUL, A_info_menu_digit,
+ '4', NUL, A_info_menu_digit,
+ '5', NUL, A_info_menu_digit,
+ '6', NUL, A_info_menu_digit,
+ '7', NUL, A_info_menu_digit,
+ '8', NUL, A_info_menu_digit,
+ '9', NUL, A_info_menu_digit,
+ '<', NUL, A_info_first_node,
+ '=', NUL, A_info_display_file_info,
+ '>', NUL, A_info_last_node,
+ '?', NUL, A_info_get_help_window,
+ '[', NUL, A_info_global_prev_node,
+ ']', NUL, A_info_global_next_node,
+ 'b', NUL, A_info_beginning_of_node,
+ 'd', NUL, A_info_dir_node,
+ 'e', NUL, A_info_end_of_node,
+ 'f', NUL, A_info_xref_item,
+ 'g', NUL, A_info_goto_node,
+ 'G', NUL, A_info_menu_sequence,
+ 'h', NUL, A_info_get_help_window,
+ 'H', NUL, A_info_get_info_help_node,
+ 'i', NUL, A_info_index_search,
+ 'I', NUL, A_info_virtual_index,
+ 'l', NUL, A_info_history_node,
+ 'm', NUL, A_info_menu_item,
+ 'n', NUL, A_info_next_node,
+ 'O', NUL, A_info_goto_invocation_node,
+ 'p', NUL, A_info_prev_node,
+ 'r', NUL, A_info_xref_item,
+ 'R', NUL, A_info_toggle_regexp,
+ 's', NUL, A_info_search,
+ 'S', NUL, A_info_search_case_sensitively,
+ 't', NUL, A_info_top_node,
+ 'u', NUL, A_info_up_node,
+ ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('f'), NUL, A_info_show_footnotes,
+ ESC, CONTROL('g'), NUL, A_info_abort_key,
+ ESC, TAB, NUL, A_info_move_to_prev_xref,
+ ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
+ ESC, '<', NUL, A_info_beginning_of_node,
+ ESC, '>', NUL, A_info_end_of_node,
+ ESC, 'b', NUL, A_info_backward_word,
+ ESC, 'f', NUL, A_info_forward_word,
+ ESC, 'r', NUL, A_info_move_to_window_line,
+ ESC, 'v', NUL, A_info_scroll_backward_page_only,
+ Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta(CONTROL('f')), NUL, A_info_show_footnotes,
+ Meta(CONTROL('g')), NUL, A_info_abort_key,
+ Meta(TAB), NUL, A_info_move_to_prev_xref,
+ Meta(CONTROL('v')), NUL, A_info_scroll_other_window,
+ Meta('<'), NUL, A_info_beginning_of_node,
+ Meta('>'), NUL, A_info_end_of_node,
+ Meta('b'), NUL, A_info_backward_word,
+ Meta('f'), NUL, A_info_forward_word,
+ Meta('r'), NUL, A_info_move_to_window_line,
+ Meta('v'), NUL, A_info_scroll_backward_page_only,
#if defined (NAMED_FUNCTIONS)
- ESC, 'x', NUL, A_info_execute_command,
- Meta('x'), NUL, A_info_execute_command,
+ ESC, 'x', NUL, A_info_execute_command,
+ Meta('x'), NUL, A_info_execute_command,
#endif /* NAMED_FUNCTIONS */
- CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
- CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
- CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
- CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
- CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
- CONTROL('x'), '0', NUL, A_info_delete_window,
- CONTROL('x'), '1', NUL, A_info_keep_one_window,
- CONTROL('x'), '2', NUL, A_info_split_window,
- CONTROL('x'), '^', NUL, A_info_grow_window,
- CONTROL('x'), 'b', NUL, A_select_visited_node,
- CONTROL('x'), 'k', NUL, A_info_kill_node,
- CONTROL('x'), 'n', NUL, A_info_search_next,
- CONTROL('x'), 'N', NUL, A_info_search_previous,
- CONTROL('x'), 'o', NUL, A_info_next_window,
- CONTROL('x'), 't', NUL, A_info_tile_windows,
- CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
-
+ CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
+ CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
+ CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
+ CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
+ CONTROL('x'), '0', NUL, A_info_delete_window,
+ CONTROL('x'), '1', NUL, A_info_keep_one_window,
+ CONTROL('x'), '2', NUL, A_info_split_window,
+ CONTROL('x'), '^', NUL, A_info_grow_window,
+ CONTROL('x'), 'b', NUL, A_select_visited_node,
+ CONTROL('x'), 'f', NUL, A_info_all_files,
+ CONTROL('x'), 'k', NUL, A_info_kill_node,
+ CONTROL('x'), 'n', NUL, A_info_search_next,
+ CONTROL('x'), 'N', NUL, A_info_search_previous,
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), 't', NUL, A_info_tile_windows,
+ CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
+
/* Arrow key bindings for info keymaps. It seems that some
terminals do not match their termcap entries, so it's best to just
define everything with both of the usual prefixes. */
- SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward,
- SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward,
- '\033', 'O', 'A', NUL, A_info_prev_line,
- '\033', '[', 'A', NUL, A_info_prev_line,
- '\033', 'O', 'B', NUL, A_info_next_line,
- '\033', '[', 'B', NUL, A_info_next_line,
- SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_char,
- '\033', 'O', 'C', NUL, A_info_forward_char,
- '\033', '[', 'C', NUL, A_info_forward_char,
- SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_char,
- '\033', 'O', 'D', NUL, A_info_backward_char,
- '\033', '[', 'D', NUL, A_info_backward_char,
- SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
- SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
- SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_backward,
-
- ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
- ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
- ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
- ESC, '\033', 'O', 'A', NUL, A_info_prev_line,
- ESC, '\033', '[', 'A', NUL, A_info_prev_line,
- ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
- ESC, '\033', 'O', 'B', NUL, A_info_next_line,
- ESC, '\033', '[', 'B', NUL, A_info_next_line,
- ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_word,
- ESC, '\033', 'O', 'C', NUL, A_info_forward_word,
- ESC, '\033', '[', 'C', NUL, A_info_forward_word,
- ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_word,
- ESC, '\033', 'O', 'D', NUL, A_info_backward_word,
- ESC, '\033', '[', 'D', NUL, A_info_backward_word,
-
- /* We want help to report q, not C-x C-c, etc. */
- 'q', NUL, A_info_quit,
- 'x', NUL, A_info_delete_window,
- SPC, NUL, A_info_scroll_forward,
- DEL, NUL, A_info_scroll_backward,
- '{', NUL, A_info_search_previous,
- '}', NUL, A_info_search_next,
- CONTROL('g'), NUL, A_info_abort_key,
- SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
- SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
+ SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward,
+ SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward,
+ '\033', 'O', 'A', NUL, A_info_prev_line,
+ '\033', '[', 'A', NUL, A_info_prev_line,
+ '\033', 'O', 'B', NUL, A_info_next_line,
+ '\033', '[', 'B', NUL, A_info_next_line,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_char,
+ '\033', 'O', 'C', NUL, A_info_forward_char,
+ '\033', '[', 'C', NUL, A_info_forward_char,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_char,
+ '\033', 'O', 'D', NUL, A_info_backward_char,
+ '\033', '[', 'D', NUL, A_info_backward_char,
+ SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
+ SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
+ SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_backward,
+
+ ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
+ ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
+ ESC, '\033', 'O', 'A', NUL, A_info_prev_line,
+ ESC, '\033', '[', 'A', NUL, A_info_prev_line,
+ ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
+ ESC, '\033', 'O', 'B', NUL, A_info_next_line,
+ ESC, '\033', '[', 'B', NUL, A_info_next_line,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_info_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_info_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_info_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_info_backward_word,
+
+ /* We want help to report q, not C-x C-c, etc. */
+ 'q', NUL, A_info_quit,
+ 'x', NUL, A_info_delete_window,
+ SPC, NUL, A_info_scroll_forward,
+ DEL, NUL, A_info_scroll_backward,
+ '{', NUL, A_info_search_previous,
+ '}', NUL, A_info_search_next,
+ CONTROL('g'), NUL, A_info_abort_key,
+ SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_line,
+ SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_line,
};
static unsigned char default_emacs_like_ea_keys[] =
{
- 0, /* suppress-default-keybindings flag */
- ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
- Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
- ESC, CONTROL('g'), NUL, A_ea_abort,
- ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
- ESC, 'b', NUL, A_ea_backward_word,
- ESC, 'd', NUL, A_ea_kill_word,
- ESC, 'f', NUL, A_ea_forward_word,
- ESC, 'y', NUL, A_ea_yank_pop,
- ESC, '?', NUL, A_ea_possible_completions,
- ESC, TAB, NUL, A_ea_tab_insert,
- ESC, DEL, NUL, A_ea_backward_kill_word,
- Meta(CONTROL('g')), NUL, A_ea_abort,
- Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
- Meta('b'), NUL, A_ea_backward_word,
- Meta('d'), NUL, A_ea_kill_word,
- Meta('f'), NUL, A_ea_forward_word,
- Meta('y'), NUL, A_ea_yank_pop,
- Meta('?'), NUL, A_ea_possible_completions,
- Meta(TAB), NUL, A_ea_tab_insert,
- Meta(DEL), NUL, A_ea_backward_kill_word,
- CONTROL('a'), NUL, A_ea_beg_of_line,
- CONTROL('b'), NUL, A_ea_backward,
- CONTROL('d'), NUL, A_ea_delete,
- CONTROL('e'), NUL, A_ea_end_of_line,
- CONTROL('f'), NUL, A_ea_forward,
- CONTROL('g'), NUL, A_ea_abort,
- CONTROL('h'), NUL, A_ea_rubout,
+ 0, /* suppress-default-keybindings flag */
+ ESC, '0', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ Meta('0'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('g'), NUL, A_ea_abort,
+ ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
+ ESC, 'b', NUL, A_ea_backward_word,
+ ESC, 'd', NUL, A_ea_kill_word,
+ ESC, 'f', NUL, A_ea_forward_word,
+ ESC, 'y', NUL, A_ea_yank_pop,
+ ESC, '?', NUL, A_ea_possible_completions,
+ ESC, TAB, NUL, A_ea_tab_insert,
+ ESC, DEL, NUL, A_ea_backward_kill_word,
+ Meta(CONTROL('g')), NUL, A_ea_abort,
+ Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
+ Meta('b'), NUL, A_ea_backward_word,
+ Meta('d'), NUL, A_ea_kill_word,
+ Meta('f'), NUL, A_ea_forward_word,
+ Meta('y'), NUL, A_ea_yank_pop,
+ Meta('?'), NUL, A_ea_possible_completions,
+ Meta(TAB), NUL, A_ea_tab_insert,
+ Meta(DEL), NUL, A_ea_backward_kill_word,
+ CONTROL('a'), NUL, A_ea_beg_of_line,
+ CONTROL('b'), NUL, A_ea_backward,
+ CONTROL('d'), NUL, A_ea_delete,
+ CONTROL('e'), NUL, A_ea_end_of_line,
+ CONTROL('f'), NUL, A_ea_forward,
+ CONTROL('g'), NUL, A_ea_abort,
+ CONTROL('h'), NUL, A_ea_rubout,
/* CONTROL('k') */
- SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
- CONTROL('l'), NUL, A_info_redraw_display,
- CONTROL('q'), NUL, A_ea_quoted_insert,
- CONTROL('t'), NUL, A_ea_transpose_chars,
- CONTROL('u'), NUL, A_info_universal_argument,
- CONTROL('y'), NUL, A_ea_yank,
- LFD, NUL, A_ea_newline,
- RET, NUL, A_ea_newline,
- SPC, NUL, A_ea_complete,
- TAB, NUL, A_ea_complete,
- '?', NUL, A_ea_possible_completions,
+ SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('q'), NUL, A_ea_quoted_insert,
+ CONTROL('t'), NUL, A_ea_transpose_chars,
+ CONTROL('u'), NUL, A_info_universal_argument,
+ CONTROL('y'), NUL, A_ea_yank,
+ LFD, NUL, A_ea_newline,
+ RET, NUL, A_ea_newline,
+ SPC, NUL, A_ea_complete,
+ TAB, NUL, A_ea_complete,
+ '?', NUL, A_ea_possible_completions,
#ifdef __MSDOS__
- /* PC users will lynch me if I don't give them their usual DEL
- effect... */
- DEL, NUL, A_ea_delete,
+ /* PC users will lynch me if I don't give them their usual DEL
+ effect... */
+ DEL, NUL, A_ea_delete,
#else
- DEL, NUL, A_ea_rubout,
+ DEL, NUL, A_ea_rubout,
#endif
#if defined (NAMED_FUNCTIONS)
/* ESC, 'x', NUL, A_info_execute_command, */
/* Meta('x'), NUL, A_info_execute_command, */
#endif /* NAMED_FUNCTIONS */
- CONTROL('x'), 'o', NUL, A_info_next_window,
- CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
/* Arrow key bindings for echo area keymaps. It seems that some
terminals do not match their termcap entries, so it's best to just
define everything with both of the usual prefixes. */
- SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
- '\033', 'O', 'C', NUL, A_ea_forward,
- '\033', '[', 'C', NUL, A_ea_forward,
- SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
- '\033', 'O', 'D', NUL, A_ea_backward,
- '\033', '[', 'D', NUL, A_ea_backward,
- ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
- ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
- ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
- ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
- ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
- ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
+ '\033', 'O', 'C', NUL, A_ea_forward,
+ '\033', '[', 'C', NUL, A_ea_forward,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
+ '\033', 'O', 'D', NUL, A_ea_backward,
+ '\033', '[', 'D', NUL, A_ea_backward,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
#ifdef __MSDOS__
- SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
#else
- SK_ESCAPE, SK_DELETE, NUL, A_ea_rubout,
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_rubout,
#endif
- SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
- SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
- ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_backward_kill_word,
- CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+ SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
+ SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_backward_kill_word,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
};
static unsigned char default_vi_like_info_keys[] =
{
- 0, /* suppress-default-keybindings flag */
- '0', NUL, A_info_add_digit_to_numeric_arg,
- '1', NUL, A_info_add_digit_to_numeric_arg,
- '2', NUL, A_info_add_digit_to_numeric_arg,
- '3', NUL, A_info_add_digit_to_numeric_arg,
- '4', NUL, A_info_add_digit_to_numeric_arg,
- '5', NUL, A_info_add_digit_to_numeric_arg,
- '6', NUL, A_info_add_digit_to_numeric_arg,
- '7', NUL, A_info_add_digit_to_numeric_arg,
- '8', NUL, A_info_add_digit_to_numeric_arg,
- '9', NUL, A_info_add_digit_to_numeric_arg,
- '-', NUL, A_info_add_digit_to_numeric_arg,
- TAB, NUL, A_info_move_to_next_xref,
- LFD, NUL, A_info_down_line,
- RET, NUL, A_info_down_line,
- CONTROL('a'), NUL, A_info_beginning_of_line,
- CONTROL('b'), NUL, A_info_scroll_backward_page_only,
- CONTROL('d'), NUL, A_info_scroll_half_screen_down,
- CONTROL('e'), NUL, A_info_down_line,
- CONTROL('f'), NUL, A_info_scroll_forward_page_only,
- CONTROL('k'), NUL, A_info_up_line,
- CONTROL('l'), NUL, A_info_redraw_display,
- CONTROL('n'), NUL, A_info_down_line,
- CONTROL('p'), NUL, A_info_up_line,
- CONTROL('r'), NUL, A_info_redraw_display,
- CONTROL('s'), NUL, A_isearch_forward,
- CONTROL('u'), NUL, A_info_scroll_half_screen_up,
- CONTROL('v'), NUL, A_info_scroll_forward_page_only,
- CONTROL('y'), NUL, A_info_up_line,
- ',', NUL, A_info_next_index_match,
- '/', NUL, A_info_search,
- ESC, '0', NUL, A_info_last_menu_item,
- ESC, '1', NUL, A_info_menu_digit,
- ESC, '2', NUL, A_info_menu_digit,
- ESC, '3', NUL, A_info_menu_digit,
- ESC, '4', NUL, A_info_menu_digit,
- ESC, '5', NUL, A_info_menu_digit,
- ESC, '6', NUL, A_info_menu_digit,
- ESC, '7', NUL, A_info_menu_digit,
- ESC, '8', NUL, A_info_menu_digit,
- ESC, '9', NUL, A_info_menu_digit,
- Meta('0'), NUL, A_info_last_menu_item,
- Meta('1'), NUL, A_info_menu_digit,
- Meta('2'), NUL, A_info_menu_digit,
- Meta('3'), NUL, A_info_menu_digit,
- Meta('4'), NUL, A_info_menu_digit,
- Meta('5'), NUL, A_info_menu_digit,
- Meta('6'), NUL, A_info_menu_digit,
- Meta('7'), NUL, A_info_menu_digit,
- Meta('8'), NUL, A_info_menu_digit,
- Meta('9'), NUL, A_info_menu_digit,
- '<', NUL, A_info_first_node,
- '>', NUL, A_info_last_node,
- '?', NUL, A_info_search_backward,
- '[', NUL, A_info_global_prev_node,
- ']', NUL, A_info_global_next_node,
- '\'', NUL, A_info_history_node,
- 'b', NUL, A_info_scroll_backward,
- 'd', NUL, A_info_scroll_half_screen_down,
- 'e', NUL, A_info_down_line,
- 'E', NUL, A_info_view_file,
- ':', 'e', NUL, A_info_view_file,
- 'f', NUL, A_info_scroll_forward_page_only,
- 'F', NUL, A_info_scroll_forward_page_only,
- 'g', NUL, A_info_first_node,
- 'G', NUL, A_info_last_node,
- 'h', NUL, A_info_get_help_window,
- 'H', NUL, A_info_get_help_window,
- 'i', NUL, A_info_index_search,
- 'I', NUL, A_info_goto_invocation_node,
- 'j', NUL, A_info_next_line,
- 'k', NUL, A_info_prev_line,
- 'l', NUL, A_info_history_node,
- 'm', NUL, A_info_menu_item,
- 'n', NUL, A_info_search_next,
- 'N', NUL, A_info_search_previous,
- 'O', NUL, A_info_goto_invocation_node,
- 'p', NUL, A_info_prev_node,
- 'Q', NUL, A_info_quit,
- ':', 'q', NUL, A_info_quit,
- ':', 'Q', NUL, A_info_quit,
- 'Z', 'Z', NUL, A_info_quit,
- 'r', NUL, A_info_redraw_display,
- 'R', NUL, A_info_toggle_regexp,
- 's', NUL, A_info_search,
- 'S', NUL, A_info_search_case_sensitively,
- 't', NUL, A_info_top_node,
- 'u', NUL, A_info_scroll_half_screen_up,
- 'w', NUL, A_info_scroll_backward_page_only_set_window,
- 'y', NUL, A_info_up_line,
- 'z', NUL, A_info_scroll_forward_page_only_set_window,
- ESC, CONTROL('f'), NUL, A_info_show_footnotes,
- ESC, CONTROL('g'), NUL, A_info_abort_key,
- ESC, TAB, NUL, A_info_move_to_prev_xref,
- ESC, SPC, NUL, A_info_scroll_forward_page_only,
- ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
- ESC, '<', NUL, A_info_beginning_of_node,
- ESC, '>', NUL, A_info_end_of_node,
- ESC, '/', NUL, A_info_search,
- ESC, '?', NUL, A_info_search_backward,
- ESC, 'b', NUL, A_info_beginning_of_node,
- ESC, 'd', NUL, A_info_dir_node,
- ESC, 'e', NUL, A_info_end_of_node,
- ESC, 'f', NUL, A_info_xref_item,
- ESC, 'g', NUL, A_info_select_reference_this_line,
- ESC, 'h', NUL, A_info_get_info_help_node,
- ESC, 'm', NUL, A_info_menu_item,
- ESC, 'n', NUL, A_info_search,
- ESC, 'N', NUL, A_info_search_backward,
- ESC, 'r', NUL, A_isearch_backward,
- ESC, 's', NUL, A_isearch_forward,
- ESC, 't', NUL, A_info_top_node,
- ESC, 'v', NUL, A_info_scroll_backward_page_only,
+ 0, /* suppress-default-keybindings flag */
+ '0', NUL, A_info_add_digit_to_numeric_arg,
+ '1', NUL, A_info_add_digit_to_numeric_arg,
+ '2', NUL, A_info_add_digit_to_numeric_arg,
+ '3', NUL, A_info_add_digit_to_numeric_arg,
+ '4', NUL, A_info_add_digit_to_numeric_arg,
+ '5', NUL, A_info_add_digit_to_numeric_arg,
+ '6', NUL, A_info_add_digit_to_numeric_arg,
+ '7', NUL, A_info_add_digit_to_numeric_arg,
+ '8', NUL, A_info_add_digit_to_numeric_arg,
+ '9', NUL, A_info_add_digit_to_numeric_arg,
+ '-', NUL, A_info_add_digit_to_numeric_arg,
+ TAB, NUL, A_info_move_to_next_xref,
+ LFD, NUL, A_info_down_line,
+ RET, NUL, A_info_down_line,
+ CONTROL('a'), NUL, A_info_beginning_of_line,
+ CONTROL('b'), NUL, A_info_scroll_backward_page_only,
+ CONTROL('c'), NUL, A_info_abort_key,
+ CONTROL('d'), NUL, A_info_scroll_half_screen_down,
+ CONTROL('e'), NUL, A_info_down_line,
+ CONTROL('f'), NUL, A_info_scroll_forward_page_only,
+ CONTROL('g'), NUL, A_info_display_file_info,
+ CONTROL('k'), NUL, A_info_up_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('n'), NUL, A_info_down_line,
+ CONTROL('p'), NUL, A_info_up_line,
+ CONTROL('r'), NUL, A_info_redraw_display,
+ CONTROL('s'), NUL, A_isearch_forward,
+ CONTROL('u'), NUL, A_info_scroll_half_screen_up,
+ CONTROL('v'), NUL, A_info_scroll_forward_page_only,
+ CONTROL('y'), NUL, A_info_up_line,
+ ',', NUL, A_info_next_index_match,
+ '/', NUL, A_info_search,
+ ESC, '0', NUL, A_info_last_menu_item,
+ ESC, '1', NUL, A_info_menu_digit,
+ ESC, '2', NUL, A_info_menu_digit,
+ ESC, '3', NUL, A_info_menu_digit,
+ ESC, '4', NUL, A_info_menu_digit,
+ ESC, '5', NUL, A_info_menu_digit,
+ ESC, '6', NUL, A_info_menu_digit,
+ ESC, '7', NUL, A_info_menu_digit,
+ ESC, '8', NUL, A_info_menu_digit,
+ ESC, '9', NUL, A_info_menu_digit,
+ Meta('0'), NUL, A_info_last_menu_item,
+ Meta('1'), NUL, A_info_menu_digit,
+ Meta('2'), NUL, A_info_menu_digit,
+ Meta('3'), NUL, A_info_menu_digit,
+ Meta('4'), NUL, A_info_menu_digit,
+ Meta('5'), NUL, A_info_menu_digit,
+ Meta('6'), NUL, A_info_menu_digit,
+ Meta('7'), NUL, A_info_menu_digit,
+ Meta('8'), NUL, A_info_menu_digit,
+ Meta('9'), NUL, A_info_menu_digit,
+ '<', NUL, A_info_first_node,
+ '>', NUL, A_info_last_node,
+ '?', NUL, A_info_search_backward,
+ '[', NUL, A_info_global_prev_node,
+ ']', NUL, A_info_global_next_node,
+ '\'', NUL, A_info_history_node,
+ 'b', NUL, A_info_scroll_backward,
+ 'd', NUL, A_info_scroll_half_screen_down,
+ 'e', NUL, A_info_down_line,
+ 'E', NUL, A_info_view_file,
+ ':', 'e', NUL, A_info_view_file,
+ 'f', NUL, A_info_scroll_forward_page_only,
+ 'F', NUL, A_info_scroll_forward_page_only,
+ 'g', NUL, A_info_first_node,
+ 'G', NUL, A_info_last_node,
+ 'h', NUL, A_info_get_help_window,
+ 'H', NUL, A_info_get_help_window,
+ 'i', NUL, A_info_index_search,
+ 'I', NUL, A_info_goto_invocation_node,
+ 'j', NUL, A_info_next_line,
+ 'k', NUL, A_info_prev_line,
+ 'l', NUL, A_info_history_node,
+ 'm', NUL, A_info_menu_item,
+ 'n', NUL, A_info_search_next,
+ ':', 'a', NUL, A_info_all_files,
+ 'N', NUL, A_info_search_previous,
+ 'O', NUL, A_info_goto_invocation_node,
+ 'p', NUL, A_info_prev_node,
+ 'Q', NUL, A_info_quit,
+ ':', 'q', NUL, A_info_quit,
+ ':', 'Q', NUL, A_info_quit,
+ 'Z', 'Z', NUL, A_info_quit,
+ 'r', NUL, A_info_redraw_display,
+ 'R', NUL, A_info_toggle_regexp,
+ 's', NUL, A_info_search,
+ 'S', NUL, A_info_search_case_sensitively,
+ 't', NUL, A_info_top_node,
+ 'u', NUL, A_info_scroll_half_screen_up,
+ 'w', NUL, A_info_scroll_backward_page_only_set_window,
+ 'y', NUL, A_info_up_line,
+ 'z', NUL, A_info_scroll_forward_page_only_set_window,
+ ESC, CONTROL('f'), NUL, A_info_show_footnotes,
+ ESC, CONTROL('g'), NUL, A_info_abort_key,
+ ESC, TAB, NUL, A_info_move_to_prev_xref,
+ ESC, SPC, NUL, A_info_scroll_forward_page_only,
+ ESC, CONTROL('v'), NUL, A_info_scroll_other_window,
+ ESC, '<', NUL, A_info_beginning_of_node,
+ ESC, '>', NUL, A_info_end_of_node,
+ ESC, '/', NUL, A_info_search,
+ ESC, '?', NUL, A_info_search_backward,
+ ESC, 'b', NUL, A_info_beginning_of_node,
+ ESC, 'd', NUL, A_info_dir_node,
+ ESC, 'e', NUL, A_info_end_of_node,
+ ESC, 'f', NUL, A_info_xref_item,
+ ESC, 'g', NUL, A_info_select_reference_this_line,
+ ESC, 'h', NUL, A_info_get_info_help_node,
+ ESC, 'I', NUL, A_info_virtual_index,
+ ESC, 'm', NUL, A_info_menu_item,
+ ESC, 'n', NUL, A_info_search,
+ ESC, 'N', NUL, A_info_search_backward,
+ ESC, 'r', NUL, A_isearch_backward,
+ ESC, 's', NUL, A_isearch_forward,
+ ESC, 't', NUL, A_info_top_node,
+ ESC, 'v', NUL, A_info_scroll_backward_page_only,
#if defined (NAMED_FUNCTIONS)
- ESC, 'x', NUL, A_info_execute_command,
- Meta('x'), NUL, A_info_execute_command,
+ ESC, 'x', NUL, A_info_execute_command,
+ Meta('x'), NUL, A_info_execute_command,
#endif /* NAMED_FUNCTIONS */
- ESC, DEL, NUL, A_info_scroll_other_window_backward,
- CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
- CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
- CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
- CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
- CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
- CONTROL('x'), LFD, NUL, A_info_select_reference_this_line,
- CONTROL('x'), RET, NUL, A_info_select_reference_this_line,
- CONTROL('x'), '0', NUL, A_info_delete_window,
- CONTROL('x'), '1', NUL, A_info_keep_one_window,
- CONTROL('x'), '2', NUL, A_info_split_window,
- CONTROL('x'), '^', NUL, A_info_grow_window,
- CONTROL('x'), 'b', NUL, A_select_visited_node,
- CONTROL('x'), 'g', NUL, A_info_goto_node,
- CONTROL('x'), 'i', NUL, A_info_index_search,
- CONTROL('x'), 'I', NUL, A_info_goto_invocation_node,
- CONTROL('x'), 'k', NUL, A_info_kill_node,
- CONTROL('x'), 'n', NUL, A_info_next_node,
- CONTROL('x'), 'o', NUL, A_info_next_window,
- CONTROL('x'), 'O', NUL, A_info_goto_invocation_node,
- CONTROL('x'), 'p', NUL, A_info_prev_node,
- CONTROL('x'), 'r', NUL, A_info_xref_item,
- CONTROL('x'), 't', NUL, A_info_tile_windows,
- CONTROL('x'), 'u', NUL, A_info_up_node,
- CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
- CONTROL('x'), ',', NUL, A_info_next_index_match,
+ ESC, DEL, NUL, A_info_scroll_other_window_backward,
+ CONTROL('x'), CONTROL('b'), NUL, A_list_visited_nodes,
+ CONTROL('x'), CONTROL('c'), NUL, A_info_quit,
+ CONTROL('x'), CONTROL('f'), NUL, A_info_view_file,
+ CONTROL('x'), CONTROL('g'), NUL, A_info_abort_key,
+ CONTROL('x'), CONTROL('v'), NUL, A_info_view_file,
+ CONTROL('x'), LFD, NUL, A_info_select_reference_this_line,
+ CONTROL('x'), RET, NUL, A_info_select_reference_this_line,
+ CONTROL('x'), '0', NUL, A_info_delete_window,
+ CONTROL('x'), '1', NUL, A_info_keep_one_window,
+ CONTROL('x'), '2', NUL, A_info_split_window,
+ CONTROL('x'), '^', NUL, A_info_grow_window,
+ CONTROL('x'), 'b', NUL, A_select_visited_node,
+ CONTROL('x'), 'g', NUL, A_info_goto_node,
+ CONTROL('x'), 'i', NUL, A_info_index_search,
+ CONTROL('x'), 'I', NUL, A_info_goto_invocation_node,
+ CONTROL('x'), 'k', NUL, A_info_kill_node,
+ CONTROL('x'), 'n', NUL, A_info_next_node,
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), 'O', NUL, A_info_goto_invocation_node,
+ CONTROL('x'), 'p', NUL, A_info_prev_node,
+ CONTROL('x'), 'r', NUL, A_info_xref_item,
+ CONTROL('x'), 't', NUL, A_info_tile_windows,
+ CONTROL('x'), 'u', NUL, A_info_up_node,
+ CONTROL('x'), 'w', NUL, A_info_toggle_wrap,
+ CONTROL('x'), ',', NUL, A_info_next_index_match,
/* Arrow key bindings for info keymaps. It seems that some
terminals do not match their termcap entries, so it's best to just
define everything with both of the usual prefixes. */
-
- SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward,
- SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward,
- '\033', 'O', 'A', NUL, A_info_up_line,
- '\033', '[', 'A', NUL, A_info_up_line,
- '\033', 'O', 'B', NUL, A_info_down_line,
- '\033', '[', 'B', NUL, A_info_down_line,
- SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_scroll_forward_page_only,
- '\033', 'O', 'C', NUL, A_info_scroll_forward_page_only,
- '\033', '[', 'C', NUL, A_info_scroll_forward_page_only,
- SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_scroll_backward_page_only,
- '\033', 'O', 'D', NUL, A_info_scroll_backward_page_only,
- '\033', '[', 'D', NUL, A_info_scroll_backward_page_only,
- SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
- SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
- ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
- ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
- ESC, SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_other_window_backward,
- ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_node,
- ESC, '\033', 'O', 'A', NUL, A_info_prev_node,
- ESC, '\033', '[', 'A', NUL, A_info_prev_node,
- ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_node,
- ESC, '\033', 'O', 'B', NUL, A_info_next_node,
- ESC, '\033', '[', 'B', NUL, A_info_next_node,
- ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_xref_item,
- ESC, '\033', 'O', 'C', NUL, A_info_xref_item,
- ESC, '\033', '[', 'C', NUL, A_info_xref_item,
- ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_beginning_of_node,
- ESC, '\033', 'O', 'D', NUL, A_info_beginning_of_node,
- ESC, '\033', '[', 'D', NUL, A_info_beginning_of_node,
- CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
-
- /* We want help to report q, not C-x C-c, etc. */
- 'q', NUL, A_info_quit,
- 'x', NUL, A_info_delete_window,
- SPC, NUL, A_info_scroll_forward,
- DEL, NUL, A_info_scroll_backward,
- '{', NUL, A_info_search_previous,
- '}', NUL, A_info_search_next,
- CONTROL('g'), NUL, A_info_abort_key,
- SK_ESCAPE, SK_UP_ARROW, NUL, A_info_up_line,
- SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_down_line,
+
+ SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_backward,
+ SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_forward,
+ '\033', 'O', 'A', NUL, A_info_up_line,
+ '\033', '[', 'A', NUL, A_info_up_line,
+ '\033', 'O', 'B', NUL, A_info_down_line,
+ '\033', '[', 'B', NUL, A_info_down_line,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_scroll_forward_page_only,
+ '\033', 'O', 'C', NUL, A_info_scroll_forward_page_only,
+ '\033', '[', 'C', NUL, A_info_scroll_forward_page_only,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_scroll_backward_page_only,
+ '\033', 'O', 'D', NUL, A_info_scroll_backward_page_only,
+ '\033', '[', 'D', NUL, A_info_scroll_backward_page_only,
+ SK_ESCAPE, SK_HOME, NUL, A_info_beginning_of_node,
+ SK_ESCAPE, SK_END, NUL, A_info_end_of_node,
+ ESC, SK_ESCAPE, SK_PAGE_DOWN, NUL, A_info_scroll_other_window,
+ ESC, SK_ESCAPE, SK_PAGE_UP, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_info_scroll_other_window_backward,
+ ESC, SK_ESCAPE, SK_UP_ARROW, NUL, A_info_prev_node,
+ ESC, '\033', 'O', 'A', NUL, A_info_prev_node,
+ ESC, '\033', '[', 'A', NUL, A_info_prev_node,
+ ESC, SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_next_node,
+ ESC, '\033', 'O', 'B', NUL, A_info_next_node,
+ ESC, '\033', '[', 'B', NUL, A_info_next_node,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_info_xref_item,
+ ESC, '\033', 'O', 'C', NUL, A_info_xref_item,
+ ESC, '\033', '[', 'C', NUL, A_info_xref_item,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_info_beginning_of_node,
+ ESC, '\033', 'O', 'D', NUL, A_info_beginning_of_node,
+ ESC, '\033', '[', 'D', NUL, A_info_beginning_of_node,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+
+ /* We want help to report q, not C-x C-c, etc. */
+ 'q', NUL, A_info_quit,
+ 'x', NUL, A_info_delete_window,
+ SPC, NUL, A_info_scroll_forward,
+ DEL, NUL, A_info_scroll_backward,
+ '{', NUL, A_info_search_previous,
+ '}', NUL, A_info_search_next,
+ SK_ESCAPE, SK_UP_ARROW, NUL, A_info_up_line,
+ SK_ESCAPE, SK_DOWN_ARROW, NUL, A_info_down_line,
};
static unsigned char default_vi_like_ea_keys[] =
{
- 0, /* suppress-default-keybindings flag */
- ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
- ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
- Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
- Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
- ESC, CONTROL('g'), NUL, A_ea_abort,
- ESC, CONTROL('h'), NUL, A_ea_backward_kill_word,
- ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
- ESC, '0', NUL, A_ea_beg_of_line,
- ESC, '$', NUL, A_ea_end_of_line,
- ESC, 'b', NUL, A_ea_backward_word,
- ESC, 'd', NUL, A_ea_kill_word,
- ESC, 'f', NUL, A_ea_forward_word,
- ESC, 'h', NUL, A_ea_forward,
- ESC, 'l', NUL, A_ea_backward,
- ESC, 'w', NUL, A_ea_forward_word,
- ESC, 'x', NUL, A_ea_delete,
- ESC, 'X', NUL, A_ea_kill_word,
- ESC, 'y', NUL, A_ea_yank_pop,
- ESC, '?', NUL, A_ea_possible_completions,
- ESC, TAB, NUL, A_ea_tab_insert,
- ESC, DEL, NUL, A_ea_kill_word,
- Meta(CONTROL('g')), NUL, A_ea_abort,
- Meta(CONTROL('h')), NUL, A_ea_backward_kill_word,
- Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
- Meta('0'), NUL, A_ea_beg_of_line,
- Meta('$'), NUL, A_ea_end_of_line,
- Meta('b'), NUL, A_ea_backward_word,
- Meta('d'), NUL, A_ea_kill_word,
- Meta('f'), NUL, A_ea_forward_word,
- Meta('h'), NUL, A_ea_forward,
- Meta('l'), NUL, A_ea_backward,
- Meta('w'), NUL, A_ea_forward_word,
- Meta('x'), NUL, A_ea_delete,
- Meta('X'), NUL, A_ea_kill_word,
- Meta('y'), NUL, A_ea_yank_pop,
- Meta('?'), NUL, A_ea_possible_completions,
- Meta(TAB), NUL, A_ea_tab_insert,
- Meta(DEL), NUL, A_ea_kill_word,
- CONTROL('a'), NUL, A_ea_beg_of_line,
- CONTROL('b'), NUL, A_ea_backward,
- CONTROL('d'), NUL, A_ea_delete,
- CONTROL('e'), NUL, A_ea_end_of_line,
- CONTROL('f'), NUL, A_ea_forward,
- CONTROL('g'), NUL, A_ea_abort,
- CONTROL('h'), NUL, A_ea_rubout,
-/* CONTROL('k') */
- SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
- CONTROL('l'), NUL, A_info_redraw_display,
- CONTROL('q'), NUL, A_ea_quoted_insert,
- CONTROL('t'), NUL, A_ea_transpose_chars,
- CONTROL('u'), NUL, A_ea_abort,
- CONTROL('v'), NUL, A_ea_quoted_insert,
- CONTROL('y'), NUL, A_ea_yank,
- LFD, NUL, A_ea_newline,
- RET, NUL, A_ea_newline,
- SPC, NUL, A_ea_complete,
- TAB, NUL, A_ea_complete,
- '?', NUL, A_ea_possible_completions,
+ 0, /* suppress-default-keybindings flag */
+ ESC, '1', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '2', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '3', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '4', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '5', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '6', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '7', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '8', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '9', NUL, A_info_add_digit_to_numeric_arg,
+ ESC, '-', NUL, A_info_add_digit_to_numeric_arg,
+ Meta('1'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('2'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('3'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('4'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('5'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('6'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('7'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('8'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('9'), NUL, A_info_add_digit_to_numeric_arg,
+ Meta('-'), NUL, A_info_add_digit_to_numeric_arg,
+ ESC, CONTROL('g'), NUL, A_ea_abort,
+ ESC, CONTROL('h'), NUL, A_ea_backward_kill_word,
+ ESC, CONTROL('v'), NUL, A_ea_scroll_completions_window,
+ ESC, '0', NUL, A_ea_beg_of_line,
+ ESC, '$', NUL, A_ea_end_of_line,
+ ESC, 'b', NUL, A_ea_backward_word,
+ ESC, 'd', NUL, A_ea_kill_word,
+ ESC, 'f', NUL, A_ea_forward_word,
+ ESC, 'h', NUL, A_ea_forward,
+ ESC, 'l', NUL, A_ea_backward,
+ ESC, 'w', NUL, A_ea_forward_word,
+ ESC, 'x', NUL, A_ea_delete,
+ ESC, 'X', NUL, A_ea_kill_word,
+ ESC, 'y', NUL, A_ea_yank_pop,
+ ESC, '?', NUL, A_ea_possible_completions,
+ ESC, TAB, NUL, A_ea_tab_insert,
+ ESC, DEL, NUL, A_ea_kill_word,
+ Meta(CONTROL('g')), NUL, A_ea_abort,
+ Meta(CONTROL('h')), NUL, A_ea_backward_kill_word,
+ Meta(CONTROL('v')), NUL, A_ea_scroll_completions_window,
+ Meta('0'), NUL, A_ea_beg_of_line,
+ Meta('$'), NUL, A_ea_end_of_line,
+ Meta('b'), NUL, A_ea_backward_word,
+ Meta('d'), NUL, A_ea_kill_word,
+ Meta('f'), NUL, A_ea_forward_word,
+ Meta('h'), NUL, A_ea_forward,
+ Meta('l'), NUL, A_ea_backward,
+ Meta('w'), NUL, A_ea_forward_word,
+ Meta('x'), NUL, A_ea_delete,
+ Meta('X'), NUL, A_ea_kill_word,
+ Meta('y'), NUL, A_ea_yank_pop,
+ Meta('?'), NUL, A_ea_possible_completions,
+ Meta(TAB), NUL, A_ea_tab_insert,
+ Meta(DEL), NUL, A_ea_kill_word,
+ CONTROL('a'), NUL, A_ea_beg_of_line,
+ CONTROL('b'), NUL, A_ea_backward,
+ CONTROL('d'), NUL, A_ea_delete,
+ CONTROL('e'), NUL, A_ea_end_of_line,
+ CONTROL('f'), NUL, A_ea_forward,
+ CONTROL('g'), NUL, A_ea_abort,
+ CONTROL('h'), NUL, A_ea_rubout,
+ /* CONTROL('k') */
+ SK_ESCAPE, SK_LITERAL, NUL, A_ea_kill_line,
+ CONTROL('l'), NUL, A_info_redraw_display,
+ CONTROL('q'), NUL, A_ea_quoted_insert,
+ CONTROL('t'), NUL, A_ea_transpose_chars,
+ CONTROL('u'), NUL, A_ea_abort,
+ CONTROL('v'), NUL, A_ea_quoted_insert,
+ CONTROL('y'), NUL, A_ea_yank,
+ LFD, NUL, A_ea_newline,
+ RET, NUL, A_ea_newline,
+ SPC, NUL, A_ea_complete,
+ TAB, NUL, A_ea_complete,
+ '?', NUL, A_ea_possible_completions,
#ifdef __MSDOS__
- /* PC users will lynch me if I don't give them their usual DEL
- effect... */
- DEL, NUL, A_ea_delete,
+ /* PC users will lynch me if I don't give them their usual DEL
+ effect... */
+ DEL, NUL, A_ea_delete,
#else
DEL, NUL, A_ea_rubout,
#endif
- CONTROL('x'), 'o', NUL, A_info_next_window,
- CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
-
+ CONTROL('x'), 'o', NUL, A_info_next_window,
+ CONTROL('x'), DEL, NUL, A_ea_backward_kill_line,
+
/* Arrow key bindings for echo area keymaps. It seems that some
terminals do not match their termcap entries, so it's best to just
define everything with both of the usual prefixes. */
- SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
- '\033', 'O', 'C', NUL, A_ea_forward,
- '\033', '[', 'C', NUL, A_ea_forward,
- SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
- '\033', 'O', 'D', NUL, A_ea_backward,
- '\033', '[', 'D', NUL, A_ea_backward,
- SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
- SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
+ SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward,
+ '\033', 'O', 'C', NUL, A_ea_forward,
+ '\033', '[', 'C', NUL, A_ea_forward,
+ SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward,
+ '\033', 'O', 'D', NUL, A_ea_backward,
+ '\033', '[', 'D', NUL, A_ea_backward,
+ SK_ESCAPE, SK_HOME, NUL, A_ea_beg_of_line,
+ SK_ESCAPE, SK_END, NUL, A_ea_end_of_line,
#ifdef __MSDOS__
- SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
+ SK_ESCAPE, SK_DELETE, NUL, A_ea_delete,
#else
- SK_DELETE, SK_DELETE, NUL, A_ea_rubout,
+ SK_DELETE, SK_DELETE, NUL, A_ea_rubout,
#endif
- ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
- ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
- ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
- ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
- ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
- ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
- ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_kill_word,
- CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
+ ESC, SK_ESCAPE, SK_RIGHT_ARROW, NUL, A_ea_forward_word,
+ ESC, '\033', 'O', 'C', NUL, A_ea_forward_word,
+ ESC, '\033', '[', 'C', NUL, A_ea_forward_word,
+ ESC, SK_ESCAPE, SK_LEFT_ARROW, NUL, A_ea_backward_word,
+ ESC, '\033', 'O', 'D', NUL, A_ea_backward_word,
+ ESC, '\033', '[', 'D', NUL, A_ea_backward_word,
+ ESC, SK_ESCAPE, SK_DELETE, NUL, A_ea_kill_word,
+ CONTROL('x'), SK_ESCAPE, SK_DELETE, NUL,A_ea_backward_kill_line,
};
@@ -878,14 +883,14 @@ static unsigned int user_vars_len;
static unsigned long
filesize (int f)
{
- long pos = lseek(f, 0L, SEEK_CUR);
- long sz = -1L;
- if (pos != -1L)
- {
- sz = lseek(f, 0L, SEEK_END);
- lseek(f, pos, SEEK_SET);
- }
- return sz == -1L ? 0L : sz;
+ long pos = lseek (f, 0L, SEEK_CUR);
+ long sz = -1L;
+ if (pos != -1L)
+ {
+ sz = lseek (f, 0L, SEEK_END);
+ lseek (f, pos, SEEK_SET);
+ }
+ return sz == -1L ? 0L : sz;
}
/* Get an integer from a infokey file.
@@ -894,13 +899,13 @@ filesize (int f)
static int
getint (unsigned char **sp)
{
- int n;
-
- if ( !((*sp)[0] < INFOKEY_RADIX && (*sp)[1] < INFOKEY_RADIX) )
- return -1;
- n = (*sp)[0] + (*sp)[1] * INFOKEY_RADIX;
- *sp += 2;
- return n;
+ int n;
+
+ if ( !((*sp)[0] < INFOKEY_RADIX && (*sp)[1] < INFOKEY_RADIX) )
+ return -1;
+ n = (*sp)[0] + (*sp)[1] * INFOKEY_RADIX;
+ *sp += 2;
+ return n;
}
@@ -909,139 +914,139 @@ getint (unsigned char **sp)
static int
fetch_user_maps (void)
{
- char *filename = NULL;
- char *homedir;
- int f;
- unsigned char *buf;
- unsigned long len;
- long nread;
- unsigned char *p;
- int n;
-
- /* Find and open file. */
- if ((filename = getenv("INFOKEY")) != NULL)
- filename = xstrdup(filename);
- else if ((homedir = getenv("HOME")) != NULL)
- {
- filename = xmalloc(strlen(homedir) + 2 + strlen(INFOKEY_FILE));
- strcpy(filename, homedir);
- strcat(filename, "/");
- strcat(filename, INFOKEY_FILE);
- }
-#ifdef __MSDOS__
- /* Poor baby, she doesn't have a HOME... */
- else
- filename = xstrdup(INFOKEY_FILE); /* try current directory */
+ char *filename = NULL;
+ char *homedir;
+ int f;
+ unsigned char *buf;
+ unsigned long len;
+ long nread;
+ unsigned char *p;
+ int n;
+
+ /* Find and open file. */
+ if ((filename = getenv ("INFOKEY")) != NULL)
+ filename = xstrdup (filename);
+ else if ((homedir = getenv ("HOME")) != NULL)
+ {
+ filename = xmalloc (strlen (homedir) + 2 + strlen (INFOKEY_FILE));
+ strcpy (filename, homedir);
+ strcat (filename, "/");
+ strcat (filename, INFOKEY_FILE);
+ }
+#if defined(__MSDOS__) || defined(__MINGW32__)
+ /* Poor baby, she doesn't have a HOME... */
+ else
+ filename = xstrdup (INFOKEY_FILE); /* try current directory */
#endif
- if (filename == NULL || (f = open(filename, O_RDONLY)) == (-1))
- {
- if (filename && errno != ENOENT)
- {
- info_error(filesys_error_string(filename, errno),
- NULL, NULL);
- free(filename);
- }
- return 0;
- }
- SET_BINARY (f);
-
- /* Ensure that the file is a reasonable size. */
- len = filesize(f);
- if (len < INFOKEY_NMAGIC + 2 || len > 100 * 1024)
- {
- /* Bad file (a valid file must have at least 9 chars, and
- more than 100 KB is a problem). */
- if (len < INFOKEY_NMAGIC + 2)
- info_error(_("Ignoring invalid infokey file `%s' - too small"),
- filename, NULL);
- else
- info_error(_("Ignoring invalid infokey file `%s' - too big"),
- filename, NULL);
- close(f);
- free(filename);
- return 0;
- }
-
- /* Read the file into a buffer. */
- buf = xmalloc((int)len);
- nread = read(f, buf, (unsigned int) len);
- close(f);
- if ((unsigned int) nread != len)
- {
- info_error(_("Error reading infokey file `%s' - short read"),
- filename, NULL);
- free(buf);
- free(filename);
- return 0;
- }
-
- /* Check the header, trailer, and version of the file to increase
- our confidence that the contents are valid. */
- if ( buf[0] != INFOKEY_MAGIC_S0
- || buf[1] != INFOKEY_MAGIC_S1
- || buf[2] != INFOKEY_MAGIC_S2
- || buf[3] != INFOKEY_MAGIC_S3
- || buf[len - 4] != INFOKEY_MAGIC_E0
- || buf[len - 3] != INFOKEY_MAGIC_E1
- || buf[len - 2] != INFOKEY_MAGIC_E2
- || buf[len - 1] != INFOKEY_MAGIC_E3
- )
- {
- info_error(_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"),
- filename, NULL);
- free(filename);
- return 0;
- }
- if (len < INFOKEY_NMAGIC + strlen(VERSION) + 1
- || strcmp(VERSION, (char *) (buf + 4)) != 0)
- {
- info_error
- (_("Your infokey file `%s' is out of date -- run infokey to update it"),
- filename, NULL);
- free(filename);
- return 0;
- }
-
- /* Extract the pieces. */
- for (p = buf + 4 + strlen(VERSION) + 1;
- (unsigned int) (p - buf) < len - 4;
- p += n)
- {
- int s = *p++;
-
- n = getint(&p);
- if (n < 0 || (unsigned int) n > len - 4 - (p - buf))
- {
- info_error(_("Invalid infokey file `%s' (bad section length) -- run infokey to update it"),
- filename, NULL);
- free(filename);
- return 0;
- }
-
- switch (s)
- {
- case INFOKEY_SECTION_INFO:
- user_info_keys = p;
- user_info_keys_len = n;
- break;
- case INFOKEY_SECTION_EA:
- user_ea_keys = p;
- user_ea_keys_len = n;
- break;
- case INFOKEY_SECTION_VAR:
- user_vars = p;
- user_vars_len = n;
- break;
- default:
- info_error(_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"),
- filename, NULL);
- free(filename);
- return 0;
- }
- }
+ if (filename == NULL || (f = open (filename, O_RDONLY)) == -1)
+ {
+ if (filename && errno != ENOENT)
+ {
+ info_error ("%s", filesys_error_string (filename, errno));
+ free (filename);
+ }
+ return 0;
+ }
+ SET_BINARY (f);
- free(filename);
- return 1;
+ /* Ensure that the file is a reasonable size. */
+ len = filesize (f);
+ if (len < INFOKEY_NMAGIC + 2 || len > 100 * 1024)
+ {
+ /* Bad file (a valid file must have at least 9 chars, and
+ more than 100 KB is a problem). */
+ if (len < INFOKEY_NMAGIC + 2)
+ info_error (_("Ignoring invalid infokey file `%s' - too small"),
+ filename);
+ else
+ info_error (_("Ignoring invalid infokey file `%s' - too big"),
+ filename);
+ close (f);
+ free (filename);
+ return 0;
+ }
+
+ /* Read the file into a buffer. */
+ buf = xmalloc ((int)len);
+ nread = read (f, buf, (unsigned int) len);
+ close (f);
+ if ((unsigned int) nread != len)
+ {
+ info_error (_("Error reading infokey file `%s' - short read"),
+ filename);
+ free (buf);
+ free (filename);
+ return 0;
+ }
+
+ /* Check the header, trailer, and version of the file to increase
+ our confidence that the contents are valid. */
+ if (buf[0] != INFOKEY_MAGIC_S0 ||
+ buf[1] != INFOKEY_MAGIC_S1 ||
+ buf[2] != INFOKEY_MAGIC_S2 ||
+ buf[3] != INFOKEY_MAGIC_S3 ||
+ buf[len - 4] != INFOKEY_MAGIC_E0 ||
+ buf[len - 3] != INFOKEY_MAGIC_E1 ||
+ buf[len - 2] != INFOKEY_MAGIC_E2 ||
+ buf[len - 1] != INFOKEY_MAGIC_E3)
+ {
+ info_error (_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"),
+ filename);
+ free (filename);
+ return 0;
+ }
+ if (len < INFOKEY_NMAGIC + strlen (VERSION) + 1 ||
+ strcmp (VERSION, (char *) (buf + 4)) != 0)
+ {
+ info_error (_("Your infokey file `%s' is out of date -- run infokey to update it"),
+ filename);
+ free (filename);
+ return 0;
+ }
+
+ /* Extract the pieces. */
+ for (p = buf + 4 + strlen (VERSION) + 1;
+ (unsigned int) (p - buf) < len - 4;
+ p += n)
+ {
+ int s = *p++;
+
+ n = getint (&p);
+ if (n < 0 || (unsigned int) n > len - 4 - (p - buf))
+ {
+ info_error (_("Invalid infokey file `%s' (bad section length) -- run infokey to update it"),
+ filename);
+ free (filename);
+ return 0;
+ }
+
+ switch (s)
+ {
+ case INFOKEY_SECTION_INFO:
+ user_info_keys = p;
+ user_info_keys_len = n;
+ break;
+
+ case INFOKEY_SECTION_EA:
+ user_ea_keys = p;
+ user_ea_keys_len = n;
+ break;
+
+ case INFOKEY_SECTION_VAR:
+ user_vars = p;
+ user_vars_len = n;
+ break;
+
+ default:
+ info_error (_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"),
+ filename);
+ free (filename);
+ return 0;
+ }
+ }
+
+ free (filename);
+ return 1;
}
/* Decode special key sequences from the infokey file. Return zero
@@ -1049,59 +1054,59 @@ fetch_user_maps (void)
doesn't define.
*/
static int
-decode_keys(unsigned char *src, unsigned int slen,
- unsigned char *dst, unsigned int dlen)
+decode_keys (unsigned char *src, unsigned int slen,
+ unsigned char *dst, unsigned int dlen)
{
- unsigned char *s = src;
- unsigned char *d = dst;
+ unsigned char *s = src;
+ unsigned char *d = dst;
#define To_dst(c) do { \
- if ((unsigned int) (d - dst) < dlen) *d++ = (c); \
+ if ((unsigned int) (d - dst) < dlen) *d++ = (c); \
} while (0)
- while ((unsigned int) (s - src) < slen)
- {
- unsigned char c = ISMETA(*s) ? UNMETA(*s) : *s;
-
- if (c == SK_ESCAPE)
- {
- char *t;
- static char lit[] = { SK_ESCAPE, NUL };
-
- switch ((unsigned int) (s + 1 - src) < slen ? s[1] : '\0')
- {
- case SK_RIGHT_ARROW: t = term_kr; break;
- case SK_LEFT_ARROW: t = term_kl; break;
- case SK_UP_ARROW: t = term_ku; break;
- case SK_DOWN_ARROW: t = term_kd; break;
- case SK_PAGE_UP: t = term_kP; break;
- case SK_PAGE_DOWN: t = term_kN; break;
- case SK_HOME: t = term_kh; break;
- case SK_END: t = term_ke; break;
- case SK_DELETE: t = term_kx; break;
- case SK_INSERT: t = term_ki; break;
- case SK_LITERAL:
- default: t = lit; break;
- }
- if (t == NULL)
- return 0;
- while (*t)
- To_dst(ISMETA(*s) ? Meta(*t++) : *t++);
- s += 2;
- }
- else
- {
- if (ISMETA(*s))
- To_dst(Meta(*s++));
- else
- To_dst(*s++);
- }
- }
-
- To_dst('\0');
-
- return 1;
-
+ while ((unsigned int) (s - src) < slen)
+ {
+ unsigned char c = ISMETA (*s) ? UNMETA (*s) : *s;
+
+ if (c == SK_ESCAPE)
+ {
+ char *t;
+ static char lit[] = { SK_ESCAPE, NUL };
+
+ switch ((unsigned int) (s + 1 - src) < slen ? s[1] : '\0')
+ {
+ case SK_RIGHT_ARROW: t = term_kr; break;
+ case SK_LEFT_ARROW: t = term_kl; break;
+ case SK_UP_ARROW: t = term_ku; break;
+ case SK_DOWN_ARROW: t = term_kd; break;
+ case SK_PAGE_UP: t = term_kP; break;
+ case SK_PAGE_DOWN: t = term_kN; break;
+ case SK_HOME: t = term_kh; break;
+ case SK_END: t = term_ke; break;
+ case SK_DELETE: t = term_kx; break;
+ case SK_INSERT: t = term_ki; break;
+ case SK_LITERAL:
+ default: t = lit; break;
+ }
+ if (t == NULL)
+ return 0;
+ while (*t)
+ To_dst (ISMETA (*s) ? Meta (*t++) : *t++);
+ s += 2;
+ }
+ else
+ {
+ if (ISMETA (*s))
+ To_dst (Meta (*s++));
+ else
+ To_dst (*s++);
+ }
+ }
+
+ To_dst ('\0');
+
+ return 1;
+
#undef To_dst
}
@@ -1109,117 +1114,126 @@ decode_keys(unsigned char *src, unsigned int slen,
/* Convert an infokey file section to keymap bindings. Return false if
the default bindings are to be suppressed. */
static int
-section_to_keymaps(Keymap map, unsigned char *table, unsigned int len)
+section_to_keymaps (Keymap map, unsigned char *table, unsigned int len)
{
- int stop;
- unsigned char *p;
- unsigned char *seq = NULL;
- unsigned int seqlen = 0;
- enum { getseq, gotseq, getaction } state = getseq;
-
- stop = len > 0 ? table[0] : 0;
-
- for (p = table + 1; (unsigned int) (p - table) < len; p++)
- {
- switch (state)
- {
- case getseq:
- if (*p)
- {
- seq = p;
- state = gotseq;
- }
- break;
-
- case gotseq:
- if (!*p)
- {
- seqlen = p - seq;
- state = getaction;
- }
- break;
-
- case getaction:
- {
- unsigned int action = *p;
- unsigned char keyseq[256];
- KEYMAP_ENTRY ke;
-
- state = getseq;
- /* If decode_keys returns zero, it
- means that seq includes keys which
- the terminal doesn't support, like
- PageDown. In that case, don't bind
- the key sequence. */
- if (decode_keys(seq, seqlen, keyseq,
- sizeof keyseq))
- {
- keyseq[sizeof keyseq - 1] = '\0';
- ke.type = ISFUNC;
- ke.function =
- action < A_NCOMMANDS
- ? &function_doc_array[action]
- : NULL;
- keymap_bind_keyseq(map,
- (const char *) keyseq, &ke);
- }
- }
- break;
- }
- }
- if (state != getseq)
- info_error(_("Bad data in infokey file -- some key bindings ignored"),
- NULL, NULL);
- return !stop;
+ int stop;
+ unsigned char *p;
+ unsigned char *seq = NULL;
+ unsigned int seqlen = 0;
+ enum { getseq, gotseq, getaction } state = getseq;
+
+ stop = len > 0 ? table[0] : 0;
+
+ for (p = table + 1; (unsigned int) (p - table) < len; p++)
+ {
+ switch (state)
+ {
+ case getseq:
+ if (*p)
+ {
+ seq = p;
+ state = gotseq;
+ }
+ break;
+
+ case gotseq:
+ if (!*p)
+ {
+ seqlen = p - seq;
+ state = getaction;
+ }
+ break;
+
+ case getaction:
+ {
+ unsigned int action = *p;
+ unsigned char keyseq[256];
+ KEYMAP_ENTRY ke;
+
+ state = getseq;
+ /* If decode_keys returns zero, it means that seq includes keys
+ which the terminal doesn't support, like PageDown. In that
+ case, don't bind the key sequence. */
+ if (decode_keys (seq, seqlen, keyseq, sizeof keyseq))
+ {
+ keyseq[sizeof keyseq - 1] = '\0';
+ ke.type = ISFUNC;
+ ke.function = action < A_NCOMMANDS ?
+ &function_doc_array[action]
+ : NULL;
+ keymap_bind_keyseq (map, (const char *) keyseq, &ke);
+ }
+ }
+ break;
+ }
+ }
+ if (state != getseq)
+ info_error ("%s", _("Bad data in infokey file -- some key bindings ignored"));
+ return !stop;
}
/* Convert an infokey file section to variable settings.
*/
static void
-section_to_vars(unsigned char *table, unsigned int len)
+section_to_vars (unsigned char *table, unsigned int len)
{
- enum { getvar, gotvar, getval, gotval } state = getvar;
- unsigned char *var = NULL;
- unsigned char *val = NULL;
- unsigned char *p;
-
- for (p = table; (unsigned int) (p - table) < len; p++)
- {
- switch (state)
- {
- case getvar:
- if (*p)
- {
- var = p;
- state = gotvar;
- }
- break;
-
- case gotvar:
- if (!*p)
- state = getval;
- break;
-
- case getval:
- if (*p)
- {
- val = p;
- state = gotval;
- }
- break;
-
- case gotval:
- if (!*p)
- {
- set_variable_to_value((char *) var, (char *) val);
- state = getvar;
- }
- break;
- }
- }
- if (state != getvar)
- info_error(_("Bad data in infokey file -- some var settings ignored"),
- NULL, NULL);
+ enum { getvar, gotvar, getval, gotval } state = getvar;
+ unsigned char *var = NULL;
+ unsigned char *val = NULL;
+ unsigned char *p;
+
+ for (p = table; (unsigned int) (p - table) < len; p++)
+ {
+ switch (state)
+ {
+ case getvar:
+ if (*p)
+ {
+ var = p;
+ state = gotvar;
+ }
+ break;
+
+ case gotvar:
+ if (!*p)
+ state = getval;
+ break;
+
+ case getval:
+ if (*p)
+ {
+ val = p;
+ state = gotval;
+ }
+ break;
+
+ case gotval:
+ if (!*p)
+ {
+ if (set_variable_to_value ((char *) var, (char *) val))
+ {
+ switch (errno)
+ {
+ case ENOENT:
+ info_error (_("%s: no such variable"), var);
+ break;
+
+ case EINVAL:
+ info_error (_("value %s is not valid for variable %s"),
+ val, var);
+ break;
+
+ default:
+ abort ();
+ }
+ }
+ state = getvar;
+ }
+ break;
+ }
+ }
+ if (state != getvar)
+ info_error ("%s", _("Bad data in infokey file -- some var settings ignored"));
}
void
@@ -1238,10 +1252,10 @@ initialize_info_keymaps (void)
/* Bind the echo area insert routines. */
for (i = 0; i < 256; i++)
if (isprint (i))
- echo_area_keymap[i].function = InfoCmd(ea_insert);
+ echo_area_keymap[i].function = InfoCmd (ea_insert);
/* Get user-defined keys and variables. */
- if (fetch_user_maps())
+ if (fetch_user_maps ())
{
if (user_info_keys_len && user_info_keys[0])
suppress_info_default_bindings = 1;
@@ -1254,32 +1268,32 @@ initialize_info_keymaps (void)
if (vi_keys_p)
{
if (!suppress_info_default_bindings)
- section_to_keymaps(info_keymap, default_vi_like_info_keys,
- sizeof(default_vi_like_info_keys));
+ section_to_keymaps (info_keymap, default_vi_like_info_keys,
+ sizeof (default_vi_like_info_keys));
if (!suppress_ea_default_bindings)
- section_to_keymaps(echo_area_keymap, default_vi_like_ea_keys,
- sizeof(default_vi_like_ea_keys));
+ section_to_keymaps (echo_area_keymap, default_vi_like_ea_keys,
+ sizeof (default_vi_like_ea_keys));
}
else
{
if (!suppress_info_default_bindings)
- section_to_keymaps(info_keymap, default_emacs_like_info_keys,
- sizeof(default_emacs_like_info_keys));
+ section_to_keymaps (info_keymap, default_emacs_like_info_keys,
+ sizeof (default_emacs_like_info_keys));
if (!suppress_ea_default_bindings)
- section_to_keymaps(echo_area_keymap, default_emacs_like_ea_keys,
- sizeof(default_emacs_like_ea_keys));
+ section_to_keymaps (echo_area_keymap, default_emacs_like_ea_keys,
+ sizeof (default_emacs_like_ea_keys));
}
/* If the user specified custom bindings, apply them on top of the
default ones. */
if (user_info_keys_len)
- section_to_keymaps(info_keymap, user_info_keys, user_info_keys_len);
+ section_to_keymaps (info_keymap, user_info_keys, user_info_keys_len);
if (user_ea_keys_len)
- section_to_keymaps(echo_area_keymap, user_ea_keys, user_ea_keys_len);
+ section_to_keymaps (echo_area_keymap, user_ea_keys, user_ea_keys_len);
if (user_vars_len)
- section_to_vars(user_vars, user_vars_len);
+ section_to_vars (user_vars, user_vars_len);
}
/* vim: set sw=2 cino={1s>2sn-s^-se-s: */
diff --git a/info/infomap.h b/info/infomap.h
index 1e67069..72b49d8 100644
--- a/info/infomap.h
+++ b/info/infomap.h
@@ -1,7 +1,7 @@
/* infomap.h -- description of a keymap in Info and related functions.
- $Id: infomap.h,v 1.6 2007/07/01 21:20:30 karl Exp $
+ $Id: infomap.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 2001, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 2001, 2004, 2007, 2013 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
@@ -16,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originaly written by Brian Fox. */
#ifndef INFOMAP_H
#define INFOMAP_H
diff --git a/info/infopath.c b/info/infopath.c
new file mode 100644
index 0000000..0174945
--- /dev/null
+++ b/info/infopath.c
@@ -0,0 +1,336 @@
+/* infopath.c -- INFOPATH handling.
+ $Id: infopath.c 5339 2013-08-22 18:02:59Z karl $
+
+ Copyright 1993, 1997, 1998, 2000, 2002, 2003, 2004, 2007, 2008, 2009, 2011,
+ 2012, 2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "info.h"
+#include "filesys.h"
+
+/* The path on which we look for info files. */
+static char *infopath_base = NULL;
+/* Allocated size of infopath_base. */
+static int infopath_size = 0;
+/* If 1, infopath_base has been modified and needs compaction */
+static int infopath_dirty = 0;
+
+/* Return a pointer to the next directory in STR (having length LEN).
+ *IDX points to the offset in STR where to start searching. Return
+ NULL if *IDX points at or after the trailing null character. Otherwise,
+ store the length of the returned directory segment into the memory
+ location pointed to by RETLEN. */
+static char *
+nextdir (char *str, int len, int *idx, int *retlen)
+{
+ int i;
+ char *ret;
+
+ if (!str || *idx >= len)
+ return NULL;
+
+ if (*idx > 0)
+ ++*idx;
+ ret = str + *idx;
+
+ for (i = *idx; str[i]; i++)
+ if (str[i] == PATH_SEP[0])
+ break;
+
+ *retlen = i - *idx;
+ *idx = i;
+ return ret;
+}
+
+/* Compact the INFOPATH value by removing repeated directory entries */
+void
+compact_infopath (void)
+{
+ int i, j, k, l;
+ int dl, pl;
+ char *dir, *p;
+ int chg = 0;
+
+ l = strlen (infopath_base);
+ for (i = 0; (dir = nextdir (infopath_base, l, &i, &dl)); )
+ {
+ for (j = k = i; (p = nextdir (infopath_base, l, &j, &pl)); k = j)
+ {
+ if (pl == dl && memcmp (dir, p, dl) == 0)
+ {
+ memmove (infopath_base + k, infopath_base + j, (l - j + 1));
+ l -= pl + 1;
+ chg = 1;
+ }
+ }
+ }
+ if (chg)
+ debug(2, ("INFOPATH compacted: %s", infopath_base));
+ infopath_dirty = 0;
+}
+
+void
+infopath_init ()
+{
+ /* Initialize INFOPATH.
+ The hardwired default settings (filesy.h) are the lowest priority.
+ Then comes the user's INFODIR from the Makefile.
+ Highest priority is the environment variable, if set. */
+ char *path_from_env = getenv ("INFOPATH");
+
+ if (path_from_env)
+ {
+ unsigned len = strlen (path_from_env);
+ /* Trailing : on INFOPATH means insert the default path. */
+ if (len && path_from_env[len - 1] == PATH_SEP[0])
+ {
+ path_from_env[len - 1] = 0;
+ infopath_add (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+ }
+#ifdef INFODIR /* from the Makefile */
+ infopath_add (INFODIR, INFOPATH_PREPEND);
+#endif
+ infopath_add (path_from_env, INFOPATH_PREPEND);
+ }
+ else
+ {
+ infopath_add (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+#ifdef INFODIR /* from the Makefile */
+ infopath_add (INFODIR, INFOPATH_PREPEND);
+#endif
+#ifdef INFODIR2 /* from the Makefile, too */
+# ifdef INFODIR
+ if (!STREQ (INFODIR, INFODIR2))
+# endif
+ infopath_add (INFODIR2, INFOPATH_PREPEND);
+#endif
+ }
+}
+
+char *
+infopath ()
+{
+ if (!infopath_base)
+ infopath_add (DEFAULT_INFOPATH, INFOPATH_INIT);
+ if (infopath_dirty)
+ compact_infopath ();
+ return infopath_base;
+}
+
+/* Make INFOPATH have absolutely nothing in it. */
+void
+infopath_clear (void)
+{
+ if (infopath_base)
+ {
+ infopath_base[0] = 0;
+ infopath_dirty = 0;
+ }
+ debug(2, ("INFOPATH cleared"));
+}
+
+/* For each path element PREFIX/DIR in PATH substitute either
+ PREFIX/share/info or PREFIX/info if that directory exists.
+ Avoid duplicates from, e.g., PREFIX/bin and PREFIX/sbin. */
+static char *
+build_infopath_from_path (void)
+{
+ typedef struct path_el
+ {
+ struct path_el *next;
+ char *path;
+ unsigned int len;
+ } PATH_EL, *PATH_PTR;
+
+ PATH_EL path_head = { NULL, NULL, 1 };
+ PATH_PTR path_prev, path_next;
+ char *res, *path_from_env, *temp_dirname;
+ int dirname_index = 0;
+ struct stat finfo;
+
+ path_from_env = getenv ("PATH");
+
+ while ((temp_dirname = extract_colon_unit (path_from_env, &dirname_index)))
+ {
+ unsigned int i, dir = 0;
+
+ /* Find end of DIRNAME/ (but ignore "/") */
+ for (i = 0; temp_dirname[i]; i++)
+ if (i && IS_SLASH (temp_dirname[i]))
+ dir = i + 1;
+
+ /* Discard path elements ending with "/", "/.", or "/.." */
+ if (!temp_dirname[dir] || STREQ (temp_dirname + dir, ".") || STREQ (temp_dirname + dir, "."))
+ dir = 0;
+
+ path_prev = &path_head;
+ while (dir && (path_next = path_prev->next))
+ {
+ /* Ignore duplicate DIRNAME */
+ if (dir == path_next->len && strncmp (temp_dirname, path_next->path, dir) == 0)
+ dir = 0;
+
+ path_prev = path_next;
+ }
+
+ if (dir)
+ {
+ temp_dirname = xrealloc (temp_dirname, dir + strlen ("share/info") +1);
+
+ /* first try DIRNAME/share/info */
+ strcpy (temp_dirname + dir, "share/info");
+ if (stat (temp_dirname, &finfo) != 0 || !S_ISDIR (finfo.st_mode))
+ {
+ /* then try DIRNAME/info */
+ strcpy (temp_dirname + dir, "info");
+ if (stat (temp_dirname, &finfo) != 0 || !S_ISDIR (finfo.st_mode))
+ dir = 0;
+ }
+ }
+
+ if (dir)
+ {
+ path_next = xmalloc (sizeof (PATH_EL));
+ path_next->next = NULL;
+ path_next->path = temp_dirname;
+ path_next->len = dir;
+ path_prev->next = path_next;
+ path_head.len += strlen (temp_dirname) + 1;
+ }
+ else
+ free (temp_dirname);
+ }
+
+ /* Build the resulting sequence of paths */
+ res = xmalloc (path_head.len);
+ res[0] = '\0';
+
+ for (path_prev = path_head.next; path_prev; path_prev = path_next)
+ {
+ strcat (res, path_prev->path);
+ if ((path_next = path_prev->next))
+ strcat (res, PATH_SEP);
+
+ free (path_prev->path);
+ free (path_prev);
+ }
+
+ return res;
+}
+
+/* Add PATH to the list of paths found in INFOPATH. 2nd argument says
+ whether to put PATH at the front or end of INFOPATH.
+ Replace one path element "PATH" in PATH by a sequence of
+ path elements derived from the environment variable PATH. */
+void
+infopath_add (char *path, int where)
+{
+ int len;
+ int found = 0;
+ unsigned int i, j;
+
+ /* Search for "PATH" in PATH */
+ for (i = 0; path[i]; i++)
+ {
+ j = i + strlen ("PATH");
+ if (strncmp (path + i, "PATH", strlen ("PATH")) == 0 &&
+ (!path[j] || path[j] == PATH_SEP[0]))
+ {
+ found = 1;
+ break;
+ }
+ else
+ {
+ /* Advance to next PATH_SEP. */
+ while (path[i] && path[i] != PATH_SEP[0])
+ i++;
+
+ if (!path[i])
+ break;
+ }
+ }
+
+ if (found)
+ {
+ /* Build infopath from the environment variable PATH */
+ char *temp = build_infopath_from_path ();
+
+ if (i || path[j])
+ {
+ char *old_path = path;
+
+ /* Splice it into OLD_PATH */
+ path = xmalloc (1 + strlen (temp) +
+ strlen (old_path) - strlen ("PATH"));
+ if (i)
+ strncpy (path, old_path, i);
+ strcpy (path + i, temp);
+ if (old_path[j])
+ strcat (path, old_path + j);
+
+ free (temp);
+ }
+ else
+ path = temp;
+ }
+
+ if (where == INFOPATH_INIT)
+ infopath_clear ();
+
+ if (!infopath_base)
+ {
+ infopath_base = xmalloc (infopath_size = 200 + strlen (path));
+ infopath_base[0] = '\0';
+ }
+
+ len = strlen (path) + strlen (infopath_base);
+
+ if (len + 2 >= infopath_size)
+ infopath_base = xrealloc (infopath_base, (infopath_size += (2 * len) + 2));
+
+ if (!*infopath_base || !infopath_base[0])
+ strcpy (infopath_base, path);
+ else if (where == INFOPATH_APPEND)
+ {
+ strcat (infopath_base, PATH_SEP);
+ strcat (infopath_base, path);
+ }
+ else if (where == INFOPATH_PREPEND)
+ {
+ char *temp = xstrdup (infopath_base);
+ strcpy (infopath_base, path);
+ strcat (infopath_base, PATH_SEP);
+ strcat (infopath_base, temp);
+ free (temp);
+ }
+ infopath_dirty = 1;
+ debug(2, ("INFOPATH=%s", infopath_base));
+ if (found)
+ free (path);
+}
+
+char *
+infopath_next (int *idx)
+{
+ return extract_colon_unit (infopath_base, idx);
+}
+
+char *
+infopath_first (int *idx)
+{
+ *idx = 0;
+ return infopath_next (idx);
+}
diff --git a/info/key.h b/info/key.h
index e8409da..f5c408c 100644
--- a/info/key.h
+++ b/info/key.h
@@ -1,9 +1,7 @@
-/* key.h -- Structure associating function names with numeric codes. */
+/* key.h -- Structure associating function names with numeric codes.
+ $Id: key.h 5338 2013-08-22 17:58:30Z karl $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 2007, 2013 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
@@ -18,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Andrew Bettison <andrewb@zip.com.au> */
+ Originally written by Andrew Bettison. */
#if !defined (KEY_H)
#define KEY_H
diff --git a/info/m-x.c b/info/m-x.c
index a66f3ed..7ab0854 100644
--- a/info/m-x.c
+++ b/info/m-x.c
@@ -1,8 +1,8 @@
/* m-x.c -- Meta-x minibuffer reader.
- $Id: m-x.c,v 1.8 2008/06/11 09:55:42 gray Exp $
+ $Id: m-x.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2001, 2002, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2001, 2002, 2004, 2007, 2008, 2011,
+ 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "funs.h"
@@ -37,7 +37,7 @@ read_function_name (const char *prompt, WINDOW *window)
register int i;
char *line;
REFERENCE **array = NULL;
- int array_index = 0, array_slots = 0;
+ size_t array_index = 0, array_slots = 0;
/* Make an array of REFERENCE which actually contains the names of
the functions available in Info. */
@@ -50,8 +50,7 @@ read_function_name (const char *prompt, WINDOW *window)
entry->nodename = NULL;
entry->filename = NULL;
- add_pointer_to_array
- (entry, array_index, array, array_slots, 200, REFERENCE *);
+ add_pointer_to_array (entry, array_index, array, array_slots, 200);
}
line = info_read_completing_in_echo_area (window, prompt, array);
@@ -136,8 +135,7 @@ DECLARE_INFO_COMMAND (info_execute_command,
(strncmp (line, "echo-area-", 10) == 0))
{
free (line);
- info_error (_("Cannot execute an `echo-area' command here."),
- NULL, NULL);
+ info_error (_("Cannot execute an `echo-area' command here."));
return;
}
@@ -150,7 +148,7 @@ DECLARE_INFO_COMMAND (info_execute_command,
if (InfoFunction(command))
(*InfoFunction(command)) (active_window, count, 0);
else
- info_error (_("Undefined command: %s"), line, NULL);
+ info_error (_("Undefined command: %s"), line);
}
}
diff --git a/info/makedoc.c b/info/makedoc.c
index 21fcb3b..59fd42c 100644
--- a/info/makedoc.c
+++ b/info/makedoc.c
@@ -1,8 +1,8 @@
/* makedoc.c -- make doc.c and funs.h from input files.
- $Id: makedoc.c,v 1.10 2008/06/11 09:55:42 gray Exp $
+ $Id: makedoc.c 5338 2013-08-22 17:58:30Z karl $
- Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007,
- 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2007,
+ 2008, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
/* This program grovels the contents of the source files passed as arguments
and writes out a file of function pointers and documentation strings, and
@@ -42,7 +42,8 @@ static char *doc_header[] = {
"/* doc.c -- Generated structure containing function names and doc strings.",
"",
" This file was automatically made from various source files with the",
- " command `%s'. DO NOT EDIT THIS FILE, only `%s.c'.",
+ " command `%s'.",
+ " DO NOT EDIT THIS FILE, only `%s.c'.",
NULL
};
@@ -96,13 +97,13 @@ typedef struct {
char *filename; /* Name of the file containing entries. */
long entrylen; /* Total number of characters in tag block. */
EMACS_TAG **entries; /* Entries found in FILENAME. */
- int entries_index;
- int entries_slots;
+ size_t entries_index;
+ size_t entries_slots;
} EMACS_TAG_BLOCK;
EMACS_TAG_BLOCK **emacs_tags = NULL;
-int emacs_tags_index = 0;
-int emacs_tags_slots = 0;
+size_t emacs_tags_index = 0;
+size_t emacs_tags_slots = 0;
#define DECLARATION_STRING "\nDECLARE_INFO_COMMAND"
@@ -243,7 +244,7 @@ main (int argc, char **argv)
static void
maybe_dump_tags (FILE *stream)
{
- register int i;
+ size_t i;
/* Emacs needs its TAGS file to be in Unix text format (i.e., only
newline at end of every line, no CR), so when we generate a
@@ -254,7 +255,7 @@ maybe_dump_tags (FILE *stream)
/* Print out the information for each block. */
for (i = 0; i < emacs_tags_index; i++)
{
- register int j;
+ size_t j;
register EMACS_TAG_BLOCK *block;
register EMACS_TAG *etag;
long block_len;
@@ -313,7 +314,7 @@ add_tag_to_block (EMACS_TAG_BLOCK *block,
tag->line = line;
tag->char_offset = char_offset;
add_pointer_to_array (tag, block->entries_index, block->entries,
- block->entries_slots, 50, EMACS_TAG *);
+ block->entries_slots, 50);
}
/* Read the file represented by FILENAME into core, and search it for Info
@@ -542,7 +543,7 @@ process_one_file (char *filename, FILE *doc_stream,
free the memory already allocated to it. */
if (block->entries)
add_pointer_to_array (block, emacs_tags_index, emacs_tags,
- emacs_tags_slots, 10, EMACS_TAG_BLOCK *);
+ emacs_tags_slots, 10);
else
{
free (block->filename);
@@ -554,7 +555,7 @@ static void
fatal_file_error (char *filename)
{
fprintf (stderr, _("Couldn't manipulate the file %s.\n"), filename);
- xexit (2);
+ exit (EXIT_FAILURE);
}
static FILE *
diff --git a/info/man.c b/info/man.c
index 27d1c27..054a5f2 100644
--- a/info/man.c
+++ b/info/man.c
@@ -1,8 +1,8 @@
-/* man.c: How to read and format man files.
- $Id: man.c,v 1.14 2008/06/28 08:09:32 gray Exp $
+/* man.c: How to read and format man files.
+ $Id: man.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
- 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005,
+ 2007, 2008, 2009, 2011, 2012, 2013 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
@@ -20,7 +20,9 @@
Originally written by Brian Fox Thu May 4 09:17:52 1995. */
#include "info.h"
+#ifndef __MINGW32__
#include <sys/ioctl.h>
+#endif
#include "signals.h"
#if defined (HAVE_SYS_TIME_H)
#include <sys/time.h>
@@ -60,7 +62,8 @@ static char *get_manpage_contents (char *pagename);
NODE *
make_manpage_node (char *pagename)
{
- return info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename);
+ return info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename,
+ PARSE_NODE_VERBATIM);
}
NODE *
@@ -104,7 +107,8 @@ get_manpage_node (FILE_BUFFER *file_buffer, char *pagename)
the feet of info_windows[] array. Therefore, all the
nodes on that list which are showing man pages have their
contents member pointing into the blue. Undo that harm. */
- if (old_contents && oldsize && old_contents != file_buffer->contents)
+ if (old_contents && oldsize && old_contents != file_buffer->contents
+ && info_windows)
{
int iw;
INFO_WINDOW *info_win;
@@ -292,7 +296,7 @@ get_manpage_contents (char *pagename)
if (manpage_section)
formatter_args[arg_index++] = manpage_section;
else
- formatter_args[arg_index++] = "-a";
+ formatter_args[arg_index++] = "-a";
formatter_args[arg_index++] = manpage_pagename;
formatter_args[arg_index] = NULL;
@@ -331,23 +335,29 @@ get_manpage_contents (char *pagename)
/* If we get here, we couldn't exec, so close out the pipe and
exit. */
close (pipes[1]);
- xexit (0);
+ exit (EXIT_SUCCESS);
}
#else /* !PIPE_USE_FORK */
/* Cannot fork/exec, but can popen/pclose. */
{
FILE *fpipe;
- char *cmdline = xmalloc (strlen (formatter_args[0])
- + strlen (manpage_pagename)
- + (arg_index > 2 ? strlen (manpage_section) : 0)
- + 3);
+ char *cmdline;
+ size_t cmdlen = 0;
int save_stderr = dup (fileno (stderr));
int fd_err = open (NULL_DEVICE, O_WRONLY, 0666);
+ int i;
+
+ for (i = 0; i < arg_index; i++)
+ cmdlen += strlen (formatter_args[i]);
+ /* Add-ons: 2 blanks, 2 quotes for the formatter program, 1
+ terminating null character. */
+ cmdlen += 2 + 2 + 1;
+ cmdline = xmalloc (cmdlen);
if (fd_err > 2)
dup2 (fd_err, fileno (stderr)); /* Don't print errors. */
- sprintf (cmdline, "%s %s %s", formatter_args[0], manpage_pagename,
- arg_index > 2 ? manpage_section : "");
+ sprintf (cmdline, "\"%s\" %s %s",
+ formatter_args[0], formatter_args[1], formatter_args[2]);
fpipe = popen (cmdline, "r");
free (cmdline);
if (fd_err > 2)
@@ -401,6 +411,7 @@ manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename)
node->parent = NULL;
node->flags = (N_HasTagsTable | N_IsManPage);
node->contents += skip_node_separator (node->contents);
+ node->body_start = strcspn(node->contents, "\n");
}
return node;
@@ -499,8 +510,8 @@ find_reference_section (NODE *node)
for (i = 0; reference_section_starters[i] != NULL; i++)
{
- position = search_forward (reference_section_starters[i], &frs_binding);
- if (position != -1)
+ if (search_forward (reference_section_starters[i], &frs_binding,
+ &position) == search_success)
break;
}
@@ -530,8 +541,8 @@ xrefs_of_manpage (NODE *node)
{
SEARCH_BINDING *reference_section;
REFERENCE **refs = NULL;
- int refs_index = 0;
- int refs_slots = 0;
+ size_t refs_index = 0;
+ size_t refs_slots = 0;
long position;
reference_section = find_reference_section (node);
@@ -544,7 +555,7 @@ xrefs_of_manpage (NODE *node)
within parenthesis. */
reference_section->flags = 0;
- while ((position = search_forward ("(", reference_section)) != -1)
+ while (search_forward ("(", reference_section, &position) == search_success)
{
register int start, end;
@@ -583,8 +594,7 @@ xrefs_of_manpage (NODE *node)
entry->start = start;
entry->end = end;
- add_pointer_to_array
- (entry, refs_index, refs, refs_slots, 10, REFERENCE *);
+ add_pointer_to_array (entry, refs_index, refs, refs_slots, 10);
}
reference_section->start = position + 1;
@@ -643,12 +653,12 @@ locate_manpage_xref (NODE *node, long int start, int dir)
REFERENCE **
manpage_xrefs_in_binding (NODE *node, SEARCH_BINDING *binding)
{
- register int i;
+ size_t i;
REFERENCE **all_refs = xrefs_of_manpage (node);
REFERENCE **brefs = NULL;
REFERENCE *entry;
- int brefs_index = 0;
- int brefs_slots = 0;
+ size_t brefs_index = 0;
+ size_t brefs_slots = 0;
int start, end;
if (!all_refs)
@@ -660,17 +670,9 @@ manpage_xrefs_in_binding (NODE *node, SEARCH_BINDING *binding)
for (i = 0; (entry = all_refs[i]); i++)
{
if ((entry->start > start) && (entry->end < end))
- {
- add_pointer_to_array
- (entry, brefs_index, brefs, brefs_slots, 10, REFERENCE *);
- }
+ add_pointer_to_array (entry, brefs_index, brefs, brefs_slots, 10);
else
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
- free (entry);
- }
+ info_reference_free (entry);
}
free (all_refs);
diff --git a/info/man.h b/info/man.h
index 89377cb..c02d0e2 100644
--- a/info/man.h
+++ b/info/man.h
@@ -1,10 +1,7 @@
/* man.h: Defines and external function declarations for man.c.
- $Id: man.h,v 1.6 2007/07/01 21:20:30 karl Exp $
+ $Id: man.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2013 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
@@ -19,7 +16,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */
+ Originally written by Brian Fox. */
#ifndef INFO_MAN_H
#define INFO_MAN_H
diff --git a/info/nodemenu.c b/info/nodemenu.c
index 9b46014..df0fb66 100644
--- a/info/nodemenu.c
+++ b/info/nodemenu.c
@@ -1,8 +1,8 @@
/* nodemenu.c -- produce a menu of all visited nodes.
- $Id: nodemenu.c,v 1.11 2008/06/11 09:55:42 gray Exp $
+ $Id: nodemenu.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2002, 2003, 2004, 2007, 2008, 2011,
+ 2013 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
@@ -17,11 +17,11 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
-NODE * get_visited_nodes (Function *filter_func);
+NODE *get_visited_nodes (Function *filter_func);
/* Return a line describing the format of a node information line. */
static const char *
@@ -132,7 +132,7 @@ get_visited_nodes (Function *filter_func)
INFO_WINDOW *info_win;
NODE *node;
char **lines = NULL;
- int lines_index = 0, lines_slots = 0;
+ size_t lines_index = 0, lines_slots = 0;
if (!info_windows)
return NULL;
@@ -153,8 +153,7 @@ get_visited_nodes (Function *filter_func)
char *line;
line = format_node_info (node);
- add_pointer_to_array
- (line, lines_index, lines, lines_slots, 20, char *);
+ add_pointer_to_array (line, lines_index, lines, lines_slots, 20);
}
}
}
@@ -199,15 +198,13 @@ get_visited_nodes (Function *filter_func)
printf_to_message_buffer
("%s", replace_in_documentation
(_("Here is the menu of nodes you have recently visited.\n\
-Select one from this menu, or use `\\[history-node]' in another window.\n"), 0),
- NULL, NULL);
+Select one from this menu, or use `\\[history-node]' in another window.\n"), 0));
- printf_to_message_buffer ("%s\n", (char *) nodemenu_format_info (),
- NULL, NULL);
+ printf_to_message_buffer ("%s\n", nodemenu_format_info ());
for (i = 0; (lines != NULL) && (i < lines_index); i++)
{
- printf_to_message_buffer ("%s\n", lines[i], NULL, NULL);
+ printf_to_message_buffer ("%s\n", lines[i]);
free (lines[i]);
}
@@ -333,7 +330,7 @@ DECLARE_INFO_COMMAND (select_visited_node,
entry = info_get_labeled_reference (line, menu);
if (!entry)
- info_error (_("The reference disappeared! (%s)."), line, NULL);
+ info_error (_("The reference disappeared! (%s)."), line);
else
info_select_reference (window, entry);
}
diff --git a/info/nodes.c b/info/nodes.c
index 41a748c..a12f3b4 100644
--- a/info/nodes.c
+++ b/info/nodes.c
@@ -1,8 +1,8 @@
/* nodes.c -- how to get an Info file and node.
- $Id: nodes.c,v 1.11 2008/06/11 09:55:42 gray Exp $
+ $Id: nodes.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
- 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1998, 1999, 2000, 2002, 2003, 2004, 2006, 2007,
+ 2008, 2009, 2011, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
@@ -25,12 +25,12 @@
#include "search.h"
#include "filesys.h"
#include "info-utils.h"
+#include "tag.h"
#if defined (HANDLE_MAN_PAGES)
# include "man.h"
#endif /* HANDLE_MAN_PAGES */
-static void forget_info_file (char *filename);
static void remember_info_file (FILE_BUFFER *file_buffer);
static void free_file_buffer_tags (FILE_BUFFER *file_buffer);
static void free_info_tag (TAG *tag);
@@ -66,7 +66,7 @@ char *info_recent_file_error = NULL;
FILE_BUFFER **info_loaded_files = NULL;
/* The number of slots currently allocated to LOADED_FILES. */
-int info_loaded_files_slots = 0;
+size_t info_loaded_files_slots = 0;
/* Public functions for node manipulation. */
@@ -75,16 +75,19 @@ extern void maybe_build_dir_node (char *dirname);
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
If FILENAME is NULL, `dir' is used.
- IF NODENAME is NULL, `Top' is used.
+ If NODENAME is NULL, `Top' is used.
+ The FLAG argument (one of the PARSE_NODE_* constants) instructs how to
+ parse NODENAME.
+
If the node cannot be found, return NULL. */
NODE *
-info_get_node (char *filename, char *nodename)
+info_get_node (char *filename, char *nodename, int flag)
{
NODE *node;
FILE_BUFFER *file_buffer = NULL;
info_recent_file_error = NULL;
- info_parse_node (nodename, DONT_SKIP_NEWLINES);
+ info_parse_node (nodename, flag);
nodename = NULL;
if (info_parsed_filename)
@@ -106,14 +109,18 @@ info_get_node (char *filename, char *nodename)
file_buffer = info_find_file (filename);
if (!file_buffer)
{
- if (filesys_error_number)
- info_recent_file_error =
- filesys_error_string (filename, filesys_error_number);
- return NULL;
+ node = make_manpage_node (filename);
+ if (!node)
+ {
+ if (filesys_error_number)
+ info_recent_file_error =
+ filesys_error_string (filename, filesys_error_number);
+ return NULL;
+ }
}
-
- /* Look for the node. */
- node = info_get_node_of_file_buffer (nodename, file_buffer);
+ else
+ /* Look for the node. */
+ node = info_get_node_of_file_buffer (nodename, file_buffer);
/* If the node not found was "Top", try again with different case,
unless this was a man page. */
@@ -131,6 +138,16 @@ info_get_node (char *filename, char *nodename)
return node;
}
+static void
+node_set_body_start (NODE *node)
+{
+ int n = skip_node_separator (node->contents);
+ node->body_start = strcspn(node->contents + n, "\n");
+ node->body_start += n;
+ if (node->contents[++node->body_start] == '\n')
+ ++node->body_start;
+}
+
/* Return a pointer to a NODE structure for the Info node NODENAME in
FILE_BUFFER. NODENAME can be passed as NULL, in which case the
nodename of "Top" is used. If the node cannot be found, return a
@@ -170,6 +187,7 @@ info_get_node_of_file_buffer (char *nodename, FILE_BUFFER *file_buffer)
node->nodelen = file_buffer->filesize;
node->flags = 0;
node->display_pos = 0;
+ node_set_body_start (node);
}
#if defined (HANDLE_MAN_PAGES)
/* If the file buffer is the magic one associated with manpages, call
@@ -315,11 +333,11 @@ static FILE_BUFFER *
info_load_file_internal (char *filename, int get_tags)
{
char *fullpath, *contents;
- long filesize;
+ size_t filesize;
struct stat finfo;
int retcode, compressed;
FILE_BUFFER *file_buffer = NULL;
-
+
/* Get the full pathname of this file, as known by the info system.
That is to say, search along INFOPATH and expand tildes, etc. */
fullpath = info_find_fullpath (filename);
@@ -378,7 +396,7 @@ info_load_file_internal (char *filename, int get_tags)
file_buffer->contents = contents;
if (compressed)
file_buffer->flags |= N_IsCompressed;
-
+
/* If requested, build the tags and nodes for this file buffer. */
if (get_tags)
build_tags_and_nodes (file_buffer);
@@ -405,11 +423,10 @@ build_tags_and_nodes (FILE_BUFFER *file_buffer)
binding.end = 0;
binding.flags = S_FoldCase;
- position = search_backward (TAGS_TABLE_END_LABEL, &binding);
-
- /* If there is a tag table, find the start of it, and grovel over it
- extracting tag information. */
- if (position != -1)
+ if (search_backward (TAGS_TABLE_END_LABEL, &binding, &position)
+ == search_success)
+ /* If there is a tag table, find the start of it, and grovel over it
+ extracting tag information. */
while (1)
{
long tags_table_begin, tags_table_end;
@@ -432,9 +449,8 @@ build_tags_and_nodes (FILE_BUFFER *file_buffer)
binding.end = 0;
/* Locate the start of the tags table. */
- position = search_backward (TAGS_TABLE_BEG_LABEL, &binding);
-
- if (position == -1)
+ if (search_backward (TAGS_TABLE_BEG_LABEL, &binding, &position)
+ != search_success)
break;
binding.end = position;
@@ -472,9 +488,8 @@ build_tags_and_nodes (FILE_BUFFER *file_buffer)
indirect.buffer = binding.buffer;
indirect.flags = S_FoldCase;
- position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect);
-
- if (position == -1)
+ if (search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect,
+ &position) != search_success)
{
/* This file is malformed. Give up. */
return;
@@ -502,7 +517,7 @@ static void
get_nodes_of_info_file (FILE_BUFFER *file_buffer)
{
long nodestart;
- int tags_index = 0;
+ size_t tags_index = 0;
SEARCH_BINDING binding;
binding.buffer = file_buffer->contents;
@@ -543,11 +558,12 @@ get_nodes_of_info_file (FILE_BUFFER *file_buffer)
/* Find the end of the nodename. */
end = start +
- skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES);
+ skip_node_characters (nodeline + start, PARSE_NODE_DFLT);
/* Okay, we have isolated the node name, and we know where the
node starts. Remember this information. */
entry = xmalloc (sizeof (TAG));
+ entry->content_cache = NULL;
entry->nodename = xmalloc (1 + (end - start));
strncpy (entry->nodename, nodeline + start, end - start);
entry->nodename[end - start] = 0;
@@ -569,7 +585,7 @@ get_nodes_of_info_file (FILE_BUFFER *file_buffer)
/* Add this tag to the array of tag structures in this FILE_BUFFER. */
add_pointer_to_array (entry, tags_index, file_buffer->tags,
- file_buffer->tags_slots, 100, TAG *);
+ file_buffer->tags_slots, 100);
}
}
@@ -598,7 +614,7 @@ get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
int name_offset;
SEARCH_BINDING *tmp_search;
long position;
- int tags_index = 0;
+ size_t tags_index = 0;
tmp_search = copy_binding (buffer_binding);
@@ -618,7 +634,7 @@ get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
/* The tag table consists of lines containing node names and positions.
Do each line until we find one that doesn't contain a node name. */
- while ((position = search_forward ("\n", tmp_search)) != -1)
+ while (search_forward ("\n", tmp_search, &position) == search_success)
{
TAG *entry;
char *nodedef;
@@ -652,6 +668,7 @@ get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
break;
entry = xmalloc (sizeof (TAG));
+ entry->content_cache = NULL;
/* Find the beginning of the node definition. */
tmp_search->start += name_offset;
@@ -681,7 +698,7 @@ get_nodes_of_tags_table (FILE_BUFFER *file_buffer,
/* Add this node structure to the array of node structures in this
FILE_BUFFER. */
add_pointer_to_array (entry, tags_index, file_buffer->tags,
- file_buffer->tags_slots, 100, TAG *);
+ file_buffer->tags_slots, 100);
}
free (tmp_search);
}
@@ -702,7 +719,7 @@ get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer,
{
int i;
SUBFILE **subfiles = NULL;
- int subfiles_index = 0, subfiles_slots = 0;
+ size_t subfiles_index = 0, subfiles_slots = 0;
TAG *entry;
/* First get the list of tags from the tags table. Then lookup the
@@ -734,8 +751,8 @@ get_tags_of_indirect_tags_table (FILE_BUFFER *file_buffer,
subfile->filename[colon - 1] = 0;
subfile->first_byte = (long) atol (line + colon);
- add_pointer_to_array
- (subfile, subfiles_index, subfiles, subfiles_slots, 10, SUBFILE *);
+ add_pointer_to_array (subfile, subfiles_index, subfiles,
+ subfiles_slots, 10);
while (*line++ != '\n');
}
@@ -928,7 +945,6 @@ find_node_of_anchor (FILE_BUFFER *file_buffer, TAG *tag)
return node;
}
-
/* Return the node from FILE_BUFFER which matches NODENAME by searching
the tags table in FILE_BUFFER, or NULL. */
static NODE *
@@ -938,13 +954,13 @@ info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, char *nodename)
int i;
/* If no tags at all (possibly a misformatted info file), quit. */
- if (!file_buffer->tags) {
+ if (!file_buffer->tags)
return NULL;
- }
for (i = 0; (tag = file_buffer->tags[i]); i++)
if (strcmp (nodename, tag->nodename) == 0)
{
+ NODE *node;
FILE_BUFFER *subfile = info_find_file_internal (tag->filename,
INFO_NO_TAGS);
if (!subfile)
@@ -959,92 +975,109 @@ info_node_of_file_buffer_tags (FILE_BUFFER *file_buffer, char *nodename)
/* If we were able to find this file and load it, then return
the node within it. */
- {
- NODE *node = xmalloc (sizeof (NODE));
- node->filename = subfile->fullpath;
- node->parent = NULL;
- node->nodename = tag->nodename;
- node->contents = subfile->contents + tag->nodestart;
- node->display_pos = 0;
- node->flags = 0;
-
- if (file_buffer->flags & N_HasTagsTable)
- {
- node->flags |= N_HasTagsTable;
-
- if (file_buffer->flags & N_TagsIndirect)
- {
- node->flags |= N_TagsIndirect;
- node->parent = file_buffer->fullpath;
- }
- }
-
- if (subfile->flags & N_IsCompressed)
- node->flags |= N_IsCompressed;
-
- /* If TAG->nodelen hasn't been calculated yet, then we aren't
- in a position to trust the entry pointer. Adjust things so
- that ENTRY->nodestart gets the exact address of the start of
- the node separator which starts this node, and NODE->contents
- gets the address of the line defining this node. If we cannot
- do that, the node isn't really here. */
- if (tag->nodelen == -1)
- {
- int min, max;
- char *node_sep;
- SEARCH_BINDING node_body;
- char *buff_end;
-
- min = max = DEFAULT_INFO_FUDGE;
-
- if (tag->nodestart < DEFAULT_INFO_FUDGE)
- min = tag->nodestart;
-
- if (DEFAULT_INFO_FUDGE >
- (subfile->filesize - tag->nodestart))
- max = subfile->filesize - tag->nodestart;
-
- /* NODE_SEP gets the address of the separator which defines
- this node, or NULL if the node wasn't found.
- NODE->contents is side-effected to point to right after
- the separator. */
- node_sep = adjust_nodestart (node, min, max);
- if (node_sep == NULL)
- {
- free (node);
- return NULL;
- }
- /* Readjust tag->nodestart. */
- tag->nodestart = node_sep - subfile->contents;
-
- /* Calculate the length of the current node. */
- buff_end = subfile->contents + subfile->filesize;
-
- node_body.buffer = node->contents;
- node_body.start = 0;
- node_body.end = buff_end - node_body.buffer;
- node_body.flags = 0;
- tag->nodelen = get_node_length (&node_body);
- node->nodelen = tag->nodelen;
- }
-
- else if (tag->nodelen == 0) /* anchor, return containing node */
- {
- free (node);
- node = find_node_of_anchor (file_buffer, tag);
- }
-
- else
- {
- /* Since we know the length of this node, we have already
- adjusted tag->nodestart to point to the exact start of
- it. Simply skip the node separator. */
- node->contents += skip_node_separator (node->contents);
- node->nodelen = tag->nodelen;
- }
-
- return node;
- }
+ if (!(tag->nodestart >= 0 && tag->nodestart < subfile->filesize))
+ return NULL;
+
+ node = xmalloc (sizeof (NODE));
+ node->filename = subfile->fullpath;
+ node->parent = NULL;
+ node->nodename = tag->nodename;
+
+ if (tag->content_cache)
+ node->contents = tag->content_cache;
+ else
+ node->contents = subfile->contents + tag->nodestart;
+
+ node->display_pos = 0;
+ node->flags = 0;
+ node_set_body_start (node);
+
+ if (file_buffer->flags & N_HasTagsTable)
+ {
+ node->flags |= N_HasTagsTable;
+
+ if (file_buffer->flags & N_TagsIndirect)
+ {
+ node->flags |= N_TagsIndirect;
+ node->parent = file_buffer->fullpath;
+ }
+ }
+
+ if (subfile->flags & N_IsCompressed)
+ node->flags |= N_IsCompressed;
+
+ /* If TAG->nodelen hasn't been calculated yet, then we aren't
+ in a position to trust the entry pointer. Adjust things so
+ that ENTRY->nodestart gets the exact address of the start of
+ the node separator which starts this node, and NODE->contents
+ gets the address of the line defining this node. If we cannot
+ do that, the node isn't really here. */
+ if (tag->nodelen == -1)
+ {
+ int min, max;
+ char *node_sep;
+ SEARCH_BINDING node_body;
+ char *buff_end;
+
+ min = max = DEFAULT_INFO_FUDGE;
+
+ if (strict_node_location_p)
+ {
+ min = 0;
+ max = 2;
+ }
+
+ if (tag->nodestart < min)
+ min = tag->nodestart;
+
+ if (max >
+ (subfile->filesize - tag->nodestart))
+ max = subfile->filesize - tag->nodestart;
+
+ /* NODE_SEP gets the address of the separator which defines
+ this node, or NULL if the node wasn't found.
+ NODE->contents is side-effected to point to right after
+ the separator. */
+ node_sep = adjust_nodestart (node, min, max);
+ if (node_sep == NULL)
+ {
+ free (node);
+ return NULL;
+ }
+ /* Readjust tag->nodestart. */
+ tag->nodestart = node_sep - subfile->contents;
+
+ /* Calculate the length of the current node. */
+ buff_end = subfile->contents + subfile->filesize;
+
+ node_body.buffer = node->contents;
+ node_body.start = 0;
+ node_body.end = buff_end - node_body.buffer;
+ node_body.flags = 0;
+ tag->nodelen = get_node_length (&node_body);
+ /* Expand eventual \b[...\b] constructs in the contents.
+ If found, update node->contents to point to the resulting
+ buffer. */
+ if (tags_expand (node->contents, tag->nodelen,
+ &tag->content_cache, &tag->nodelen))
+ node->contents = tag->content_cache;
+ node->nodelen = tag->nodelen;
+ }
+ else if (tag->nodelen == 0) /* anchor, return containing node */
+ {
+ free (node);
+ node = find_node_of_anchor (file_buffer, tag);
+ }
+ else
+ {
+ /* Since we know the length of this node, we have already
+ adjusted tag->nodestart to point to the exact start of
+ it. Simply skip the node separator. */
+ node->contents += skip_node_separator (node->contents);
+ node->nodelen = tag->nodelen;
+ }
+
+ return node;
}
/* There was a tag table for this file, and the node wasn't found.
@@ -1080,11 +1113,11 @@ remember_info_file (FILE_BUFFER *file_buffer)
;
add_pointer_to_array (file_buffer, i, info_loaded_files,
- info_loaded_files_slots, 10, FILE_BUFFER *);
+ info_loaded_files_slots, 10);
}
/* Forget the contents, tags table, nodes list, and names of FILENAME. */
-static void
+void
forget_info_file (char *filename)
{
int i;
@@ -1152,7 +1185,8 @@ static void
free_info_tag (TAG *tag)
{
free (tag->nodename);
-
+ free (tag->content_cache);
+
/* We don't free tag->filename, because that filename is part of the
subfiles list for the containing FILE_BUFFER. free_info_tags ()
will free the subfiles when it is appropriate. */
@@ -1236,11 +1270,12 @@ adjust_nodestart (NODE *node, int min, int max)
{
nodedef += offset;
nodedef += skip_whitespace (nodedef);
- offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES);
+ offset = skip_node_characters (nodedef, PARSE_NODE_START);
if (((unsigned int) offset == strlen (node->nodename)) &&
(strncmp (node->nodename, nodedef, offset) == 0))
{
node->contents = nodestart;
+ node_set_body_start (node);
return node_body.buffer + position;
}
}
@@ -1263,6 +1298,7 @@ adjust_nodestart (NODE *node, int min, int max)
(if we used a tag to get here, that is). Set the flag in NODE->flags. */
node->contents = node_body.buffer + position;
node->contents += skip_node_separator (node->contents);
+ node_set_body_start (node);
if (node->flags & N_HasTagsTable)
node->flags |= N_UpdateTags;
return node_body.buffer + position;
diff --git a/info/nodes.h b/info/nodes.h
index 213dc3c..36fa741 100644
--- a/info/nodes.h
+++ b/info/nodes.h
@@ -1,7 +1,7 @@
/* nodes.h -- How we represent nodes internally.
- $Id: nodes.h,v 1.6 2007/07/01 21:20:31 karl Exp $
+ $Id: nodes.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007
+ Copyright 1993, 1997, 1998, 2002, 2004, 2007, 2011, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef NODES_H
#define NODES_H
@@ -41,6 +41,7 @@ typedef struct {
char *contents; /* Characters appearing in this node. */
long nodelen; /* The length of the CONTENTS member. */
unsigned long display_pos; /* Where to display at, if nonzero. */
+ long body_start; /* Offset of the actual node body */
int flags; /* See immediately below. */
} NODE;
@@ -88,7 +89,10 @@ typedef struct {
char *filename; /* The file where this node can be found. */
char *nodename; /* The node pointed to by this tag. */
long nodestart; /* The offset of the start of this node. */
- long nodelen; /* The length of this node. */
+ size_t nodelen; /* The length of this node. */
+ char *content_cache; /* Cache of the node contents; used if the
+ node contents must be preprocessed before
+ displaying it. */
} TAG;
/* The following structure is used to remember information about the contents
@@ -103,10 +107,10 @@ typedef struct {
char *fullpath; /* The full pathname of this info file. */
struct stat finfo; /* Information about this file. */
char *contents; /* The contents of this particular file. */
- long filesize; /* The number of bytes this file expands to. */
+ size_t filesize; /* The number of bytes this file expands to. */
char **subfiles; /* If non-null, the list of subfiles. */
TAG **tags; /* If non-null, the indirect tags table. */
- int tags_slots; /* Number of slots allocated for TAGS. */
+ size_t tags_slots; /* Number of slots allocated for TAGS. */
int flags; /* Various flags. Mimics of N_* flags. */
} FILE_BUFFER;
@@ -116,7 +120,7 @@ typedef struct {
extern FILE_BUFFER **info_loaded_files;
/* The number of slots currently allocated to INFO_LOADED_FILES. */
-extern int info_loaded_files_slots;
+extern size_t info_loaded_files_slots;
/* Locate the file named by FILENAME, and return the information structure
describing this file. The file may appear in our list of loaded files
@@ -133,8 +137,12 @@ extern FILE_BUFFER *info_load_file (char *filename);
/* Return a pointer to a NODE structure for the Info node (FILENAME)NODENAME.
FILENAME can be passed as NULL, in which case the filename of "dir" is used.
NODENAME can be passed as NULL, in which case the nodename of "Top" is used.
+
+ The FLAG argument (one of the PARSE_NODE_* constants) instructs how to
+ parse NODENAME.
+
If the node cannot be found, return a NULL pointer. */
-extern NODE *info_get_node (char *filename, char *nodename);
+extern NODE *info_get_node (char *filename, char *nodename, int flag);
/* Return a pointer to a NODE structure for the Info node NODENAME in
FILE_BUFFER. NODENAME can be passed as NULL, in which case the
@@ -153,4 +161,6 @@ extern char *info_recent_file_error;
/* Create a new, empty file buffer. */
extern FILE_BUFFER *make_file_buffer (void);
+void forget_info_file (char *filename);
+
#endif /* not NODES_H */
diff --git a/info/pcterm.c b/info/pcterm.c
index 7eeb80f..9cfd111 100644
--- a/info/pcterm.c
+++ b/info/pcterm.c
@@ -1,7 +1,7 @@
/* pcterm.c -- How to handle the PC terminal for Info under MS-DOS/MS-Windows.
- $Id: pcterm.c,v 1.8 2008/06/11 09:55:42 gray Exp $
+ $Id: pcterm.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1998, 1999, 2003, 2004, 2007, 2008
+ Copyright 1998, 1999, 2003, 2004, 2007, 2008, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -18,10 +18,11 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-/* WARNING WARNING WARNING!!!
- This probably won't work as is with anything but DJGPP! However, Borland
- should come close, and other PC compilers will need minor modifications. */
+/* WARNING WARNING WARNING!!! This probably won't work as is with
+ anything but DJGPP and MinGW! However, Borland should come close,
+ and other PC compilers will need minor modifications. */
+#ifdef __MSDOS__
/* intl/libintl.h defines a macro `gettext' which
conflicts with conio.h header. */
#ifdef gettext
@@ -32,6 +33,42 @@
#include <pc.h>
#include <keys.h>
#include <conio.h>
+#endif
+
+#ifdef _WIN32
+#include <io.h>
+#include <conio.h>
+#include <process.h>
+#include <windows.h>
+
+struct text_info {
+ WORD normattr;
+ WORD attribute;
+ SHORT winleft;
+ SHORT wintop;
+ SHORT winright;
+ SHORT winbottom;
+ SHORT screenheight;
+ SHORT screenwidth;
+ SHORT curx;
+ SHORT cury;
+ COORD bufsize;
+ unsigned char currmode; /* unused and unsupported for Windows */
+};
+
+struct termios {
+ int dummy;
+};
+
+enum text_modes { LASTMODE=-1 };
+
+#define cprintf _cprintf
+#define cputs _cputs
+
+#undef read
+#undef _read
+
+#endif
#include "variables.h"
@@ -44,10 +81,514 @@ extern int speech_friendly; /* defined in info.c */
/* **************************************************************** */
static struct text_info outside_info; /* holds screen params outside Info */
+#ifdef _WIN32
+static SHORT norm_attr, inv_attr;
+static SHORT current_attr;
+static HANDLE hstdin = INVALID_HANDLE_VALUE;
+static HANDLE hstdout = INVALID_HANDLE_VALUE;
+static HANDLE hinfo = INVALID_HANDLE_VALUE;
+static HANDLE hscreen = INVALID_HANDLE_VALUE;
+static DWORD old_inpmode;
+#else
static unsigned char norm_attr, inv_attr;
+#endif
static unsigned const char * find_sequence (int);
+#ifdef _WIN32
+
+/* Windows-specific initialization and de-initialization. */
+void
+w32_info_prep (void)
+{
+ SetConsoleActiveScreenBuffer (hinfo);
+ current_attr = norm_attr;
+ hscreen = hinfo;
+ SetConsoleMode (hstdin, ENABLE_WINDOW_INPUT);
+}
+
+void
+w32_info_unprep (void)
+{
+ SetConsoleActiveScreenBuffer (hstdout);
+ current_attr = outside_info.normattr;
+ hscreen = hstdout;
+ SetConsoleMode (hstdin, old_inpmode);
+}
+
+void
+w32_cleanup (void)
+{
+ CloseHandle (hinfo);
+}
+
+static void w32_info_init (void) __attribute__((constructor));
+static void pc_initialize_terminal (char *);
+
+static void
+w32_info_init (void)
+{
+ /* We need to set this single hook here; the rest
+ will be set by pc_initialize_terminal when it is called. */
+ terminal_initialize_terminal_hook = pc_initialize_terminal;
+}
+
+/* Emulate DJGPP conio functions for Windows. */
+static void
+gettextinfo (struct text_info *ti)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ static TCHAR errbuf[500];
+
+ hstdin = GetStdHandle (STD_INPUT_HANDLE);
+ hstdout = GetStdHandle (STD_OUTPUT_HANDLE);
+ hinfo = CreateConsoleScreenBuffer (GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
+
+ if (hstdin != INVALID_HANDLE_VALUE
+ && hstdout != INVALID_HANDLE_VALUE
+ && hinfo != INVALID_HANDLE_VALUE
+ && GetConsoleMode (hstdin, &old_inpmode)
+ && GetConsoleScreenBufferInfo (hstdout, &csbi))
+ {
+ ti->normattr = csbi.wAttributes;
+ ti->winleft = 1;
+ ti->wintop = 1;
+ ti->winright = csbi.srWindow.Right + 1;
+ ti->winbottom = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
+ ti->attribute = csbi.wAttributes;
+ ti->screenheight = csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
+ ti->screenwidth = csbi.srWindow.Right - csbi.srWindow.Left + 1;
+ ti->curx = csbi.dwCursorPosition.X;
+ ti->cury = csbi.dwCursorPosition.Y;
+ ti->bufsize = csbi.dwSize;
+
+ atexit (w32_cleanup);
+ }
+ else
+ {
+ DWORD error_no = GetLastError ();
+
+ if (!FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL,
+ error_no,
+ 0, /* choose most suitable language */
+ errbuf, sizeof (errbuf), NULL))
+ sprintf (errbuf, "w32 error %u", error_no);
+ CloseHandle (hinfo);
+ info_error (_("Terminal cannot be initialized: %s\n"), errbuf, NULL);
+ exit (1);
+ }
+}
+
+void
+textattr (int attr)
+{
+ SetConsoleTextAttribute (hscreen, attr);
+}
+
+void
+textmode (int mode)
+{
+ /* Nothing. */
+}
+
+void
+ScreenGetCursor (int *row, int *col)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ *row = csbi.dwCursorPosition.Y;
+ *col = csbi.dwCursorPosition.X;
+}
+
+void
+ScreenSetCursor (int row, int col)
+{
+ COORD cursor_pos;
+
+ cursor_pos.X = col;
+ cursor_pos.Y = row;
+
+ SetConsoleCursorPosition (hscreen, cursor_pos);
+}
+
+void
+ScreenClear (void)
+{
+ DWORD nchars = screenwidth * screenheight;
+ COORD start_pos;
+ DWORD written;
+
+ start_pos.X = start_pos.Y = 0;
+ FillConsoleOutputAttribute (hscreen, norm_attr, nchars, start_pos, &written);
+ FillConsoleOutputCharacter (hscreen, ' ', nchars, start_pos, &written);
+}
+
+void
+clreol (void)
+{
+ DWORD nchars;
+ COORD start_pos;
+ DWORD written;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ start_pos = csbi.dwCursorPosition;
+ nchars = csbi.dwSize.X - start_pos.X;
+
+ FillConsoleOutputAttribute (hscreen, current_attr, nchars, start_pos,
+ &written);
+ FillConsoleOutputCharacter (hscreen, ' ', nchars, start_pos, &written);
+}
+
+void
+ScreenVisualBell (void)
+{
+ DWORD nchars = screenwidth * screenheight;
+ COORD start_pos;
+ DWORD written;
+
+ start_pos.X = start_pos.Y = 0;
+ FillConsoleOutputAttribute (hscreen, inv_attr, nchars, start_pos, &written);
+ Sleep (20);
+ FillConsoleOutputAttribute (hscreen, norm_attr, nchars, start_pos, &written);
+}
+
+int
+movetext(int left, int top, int right, int bottom, int destleft, int desttop)
+{
+ SMALL_RECT src;
+ COORD dest;
+ CHAR_INFO fill;
+
+ src.Left = left - 1;
+ src.Top = top - 1;
+ src.Right = right - 1;
+ src.Bottom = bottom - 1;
+
+ dest.X = destleft - 1;
+ dest.Y = desttop - 1;
+
+ fill.Attributes = norm_attr;
+ fill.Char.AsciiChar = (CHAR)' ';
+
+ return ScrollConsoleScreenBuffer (hscreen, &src , NULL, dest, &fill) != 0;
+}
+
+int
+ScreenRows (void)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ return csbi.srWindow.Bottom - csbi.srWindow.Top + 1;
+}
+
+int
+ScreenCols (void)
+{
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+ return csbi.srWindow.Right - csbi.srWindow.Left + 1;
+}
+
+void
+_set_screen_lines (int lines)
+{
+ SMALL_RECT window_rectangle;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+ COORD scrbufsize;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+
+ window_rectangle = csbi.srWindow;
+ window_rectangle.Bottom = window_rectangle.Top + lines - 1;
+ SetConsoleWindowInfo (hscreen, TRUE, &window_rectangle);
+
+ /* Set the screen buffer size to the same dimensions as the window,
+ so that the dysfunctional scroll bar disappears. */
+ scrbufsize.X = window_rectangle.Right - window_rectangle.Left + 1;
+ scrbufsize.Y = window_rectangle.Bottom - window_rectangle.Top + 1;
+ SetConsoleScreenBufferSize (hscreen, scrbufsize);
+}
+
+void
+w32_set_screen_dimensions (int cols, int rows)
+{
+ SMALL_RECT window_rectangle;
+ CONSOLE_SCREEN_BUFFER_INFO csbi;
+
+ GetConsoleScreenBufferInfo (hscreen, &csbi);
+
+ window_rectangle = csbi.srWindow;
+ window_rectangle.Bottom = window_rectangle.Top + rows - 1;
+ window_rectangle.Right = window_rectangle.Left + cols - 1;
+ SetConsoleWindowInfo (hscreen, TRUE, &window_rectangle);
+}
+
+/* Emulate `sleep'. */
+unsigned
+sleep (unsigned sec)
+{
+ Sleep (sec*1000);
+ return 0;
+}
+
+/* Keyboard input support. */
+
+static int
+w32_our_tty (int fd)
+{
+ return
+ isatty (fd)
+ /* Windows `isatty' actually tests for character devices, so the
+ null device gets reported as a tty. Fix that by calling
+ `lseek'. */
+ && lseek (fd, SEEK_CUR, 0) == -1
+ /* Is this our tty? */
+ && hstdin != INVALID_HANDLE_VALUE
+ && hstdin == (HANDLE)_get_osfhandle (fd);
+}
+
+/* Translate a Windows key event into the equivalent sequence of bytes
+ to be submitted to Info dispatcher. */
+#define define_seq(p,s1,s2) \
+ do { \
+ if ((ctl & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) != 0) \
+ memcpy (p, s1, sizeof (s1)), p += sizeof (s1) - 1; \
+ else \
+ memcpy (p, s2, sizeof (s2)), p += sizeof (s2) - 1; \
+ } while (0)
+
+static int
+w32keyseq (unsigned char ascii_ch, WORD vkey, DWORD ctl, unsigned char *seq)
+{
+ unsigned char *p = seq;
+
+ switch (ascii_ch)
+ {
+ case '\0':
+ /* Keys with no ASCII code are extended keys, like arrows. */
+ switch (vkey)
+ {
+ case VK_PRIOR:
+ define_seq (p, "\033\061p", "\033v");
+ break;
+ case VK_NEXT:
+ define_seq (p, "\033\061n", "\026");
+ break;
+ case VK_END:
+ define_seq (p, "\033>", "\033>");
+ break;
+ case VK_HOME:
+ define_seq (p, "\033<", "\033<");
+ break;
+ case VK_LEFT:
+ define_seq (p, "\033b", "\033[D");
+ break;
+ case VK_UP:
+ define_seq (p, "\033\061u", "\033[A");
+ break;
+ case VK_RIGHT:
+ define_seq (p, "\033f", "\033[C");
+ break;
+ case VK_DOWN:
+ define_seq (p, "\033\061m", "\033[B");
+ break;
+ case VK_INSERT:
+ define_seq (p, "\033[L", "\033[L");
+ break;
+ case VK_DELETE: /* Delete => Ctrl-d, Alt-Delete => ESC d */
+ if ((ctl & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) != 0)
+ define_seq (p, "\033d", "\033d");
+ else
+ define_seq (p, "\033d", "\004");
+ break;
+ case VK_HELP: /* F1 => Ctrl-h */
+ case VK_F1:
+ *p++ = '\010';
+ break;
+ case 50: /* Ctrl-@ => '\0' */
+ if ((ctl & SHIFT_PRESSED) != 0)
+ *p++ = '\0';
+ break;
+ default:
+ if (0x41 <= vkey && vkey <= 0x5a)
+ {
+ /* Alt-Ctrl-a, Alt-Ctrl-b, etc. */
+ *p++ = '\033';
+ *p++ = '\001' + vkey - 0x41;
+ }
+ }
+ break;
+ case ' ': /* Ctrl-SPC => '\0' */
+ if ((ctl & (LEFT_CTRL_PRESSED | RIGHT_CTRL_PRESSED)) != 0)
+ ascii_ch = '\0';
+ *p++ = ascii_ch;
+ break;
+ case '\t': /* Shift-TAB/Alt-TAB => Esc-TAB */
+ if ((ctl & (SHIFT_PRESSED | LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) != 0)
+ {
+ memcpy (p, "\033\011", sizeof ("\033\011"));
+ p += sizeof ("\033\011") - 1;
+ }
+ else
+ *p++ = '\t';
+ break;
+ case '\b':
+ /* Backspace => DEL. */
+ ascii_ch = '\177';
+ /* FALLTHROUGH */
+ default:
+ if ((ctl & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)) != 0)
+ *p++ = '\033';
+ *p++ = ascii_ch;
+ break;
+ }
+ return p - seq;
+}
+
+static unsigned char buffered_chars[512];
+static size_t buf_head;
+static size_t buf_tail;
+
+static ssize_t
+w32_kbd_read (unsigned char *inbuf, size_t n)
+{
+ DWORD nevents, nread;
+ INPUT_RECORD inrec;
+ ssize_t nret = 0;
+
+ do {
+
+ /* Stuff any unread buffered characters. */
+ while (buf_head < buf_tail && n > 0)
+ {
+ *inbuf++ = buffered_chars[buf_head++];
+ nret++;
+ n--;
+ }
+ if (n <= 0)
+ break;
+
+ /* Wait for input. */
+ while (GetNumberOfConsoleInputEvents (hstdin, &nevents)
+ && nevents < 1)
+ Sleep (20);
+
+ while (nevents-- && n > 0)
+ {
+ if (!ReadConsoleInput (hstdin, &inrec, 1, &nread))
+ return -1;
+
+ if (nread > 0)
+ {
+ switch (inrec.EventType)
+ {
+ case KEY_EVENT:
+ if (inrec.Event.KeyEvent.bKeyDown == TRUE
+ && !(inrec.Event.KeyEvent.wVirtualScanCode == 0
+ || inrec.Event.KeyEvent.wVirtualKeyCode == VK_SHIFT
+ || inrec.Event.KeyEvent.wVirtualKeyCode == VK_CONTROL
+ || inrec.Event.KeyEvent.wVirtualKeyCode == VK_MENU))
+ {
+ unsigned char keyseq[10];
+ int count = inrec.Event.KeyEvent.wRepeatCount;
+ unsigned char ch = inrec.Event.KeyEvent.uChar.AsciiChar;
+ WORD vkey = inrec.Event.KeyEvent.wVirtualKeyCode;
+ DWORD ctl_state = inrec.Event.KeyEvent.dwControlKeyState;
+ int nbytes = w32keyseq (ch, vkey, ctl_state, keyseq);
+
+ /* Supply up to N characters to the caller. */
+ while (count && n >= nbytes)
+ {
+ if (nbytes == 1 && keyseq[0] == '\032')
+ {
+ terminal_goto_xy (0, screenheight - 1);
+ terminal_clear_to_eol ();
+ fflush (stdout);
+ terminal_unprep_terminal ();
+ kill (getpid (), 0);
+ terminal_prep_terminal ();
+ reset_info_window_sizes ();
+ }
+ else
+ {
+ memcpy (&inbuf[nret], keyseq, nbytes);
+ nret += nbytes;
+ n -= nbytes;
+ }
+ count--;
+ }
+ /* Buffer the rest. */
+ if (count > 0)
+ {
+ buf_head = buf_tail = 0;
+ while (count--
+ && buf_tail < sizeof(buffered_chars) - nbytes)
+ {
+ memcpy (&buffered_chars[buf_tail], keyseq, nbytes);
+ buf_tail += nbytes;
+ }
+ }
+ }
+ break;
+ case WINDOW_BUFFER_SIZE_EVENT:
+ {
+ int rows, cols;
+
+ /* Note: this event is only sent when the console
+ window's _screen_buffer_ size is changed via
+ the Properties->Layout dialog. */
+ cols = inrec.Event.WindowBufferSizeEvent.dwSize.X;
+ rows = inrec.Event.WindowBufferSizeEvent.dwSize.Y;
+ screenwidth = cols;
+ screenheight = rows;
+ w32_set_screen_dimensions (cols, rows);
+ display_initialize_display (screenwidth, screenheight);
+ window_new_screen_size (screenwidth, screenheight);
+ redisplay_after_signal ();
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ } while (n > 0);
+ return nret;
+}
+
+long
+w32_chars_avail (int fd)
+{
+ if (w32_our_tty (fd))
+ return buf_tail - buf_head;
+ else
+ {
+ struct stat st;
+
+ if (fstat (fd, &st) < 0)
+ return 1;
+ else
+ return st.st_size;
+ }
+}
+
+ssize_t
+w32_read (int fd, void *buf, size_t n)
+{
+ if (w32_our_tty (fd))
+ return w32_kbd_read (buf, n);
+ else
+ return _read (fd, buf, n);
+}
+
+#endif /* _WIN32 */
+
/* Turn on reverse video. */
static void
pc_begin_inverse (void)
@@ -192,6 +733,10 @@ pc_prep_terminal (void)
{
int tty;
+#ifdef _WIN32
+ w32_info_prep ();
+#endif
+
/* Do not set screen height if we already have it, because
doing so erases the screen. */
if (screenheight != ScreenRows ())
@@ -221,6 +766,10 @@ pc_unprep_terminal (void)
{
int tty;
+#ifdef _WIN32
+ w32_info_unprep ();
+#endif
+
textattr (outside_info.normattr);
/* Do not set screen height if we already have it, because
@@ -230,8 +779,13 @@ pc_unprep_terminal (void)
_set_screen_lines (outside_info.screenheight);
textmode (LASTMODE);
}
+#ifdef __MSDOS__
else
pc_clear_to_eol (); /* for text attributes to really take effect */
+#endif
+#ifdef _WIN32
+ SetConsoleScreenBufferSize (hstdout, outside_info.bufsize);
+#endif
/* Switch back to text mode on stdin. */
tty = fileno (stdin);
@@ -256,7 +810,12 @@ pc_initialize_terminal (term_name)
{
term_name = getenv ("TERM");
if (!term_name)
+#ifdef __MSDOS__
term_name = "pc-dos"; /* ``what's in a name?'' */
+#endif
+#ifdef _WIN32
+ term_name = "w32console";
+#endif
}
/* Get current video information, to be restored later. */
@@ -311,6 +870,7 @@ pc_initialize_terminal (term_name)
pc_get_screen_size ();
+#ifdef __MSDOS__
/* Store the arrow keys. */
term_ku = (char *)find_sequence (K_Up);
term_kd = (char *)find_sequence (K_Down);
@@ -326,6 +886,7 @@ pc_initialize_terminal (term_name)
term_ki = (char *)find_sequence (K_Insert);
term_kx = (char *)find_sequence (K_Delete);
#endif
+#endif /* __MSDOS__ */
/* Set all the hooks to our PC-specific functions. */
terminal_begin_inverse_hook = pc_begin_inverse;
@@ -684,12 +1245,14 @@ kill (pid_t pid, int sig)
getxkey ();
#endif
pc_write_chars (interrupted_msg, sizeof (interrupted_msg) - 1);
- xexit (1);
+ exit (EXIT_FAILURE);
case SIGUSR1:
/* Simulate SIGTSTP by invoking a subsidiary shell. */
+#ifndef _WIN32
pc_goto_xy (0, outside_info.screenheight - 1);
pc_clear_to_eol ();
pc_write_chars (stopped_msg, sizeof (stopped_msg) - 1);
+#endif
/* The child shell can change the working directory, so
we need to save and restore it, since it is global. */
@@ -699,7 +1262,26 @@ kill (pid_t pid, int sig)
/* We don't want to get fatal signals while the subshell runs. */
old_INT = signal (SIGINT, SIG_IGN);
old_QUIT = signal (SIGQUIT, SIG_IGN);
+#ifdef _WIN32
+ {
+ const char *argv[2];
+ const char *shell = NULL;
+
+ argv[0] = NULL;
+ shell = getenv ("SHELL");
+ if (!shell)
+ {
+ shell = getenv ("COMSPEC");
+ if (!shell)
+ return -1;
+ argv[0] = " /k";
+ }
+ argv[1] = NULL;
+ _spawnvp (_P_WAIT, shell, argv);
+ }
+#else
system ("");
+#endif
if (*cwd)
chdir (cwd);
signal (SIGINT, old_INT);
@@ -718,14 +1300,14 @@ kill (pid_t pid, int sig)
/* These should never be called, but they make the linker happy. */
-void tputs (char *a, int b, int (*c)())
+int tputs (const char *a, int b, int (*c)(int))
{
- perror ("tputs");
+ perror ("tputs"); return 0; /* here and below, added dummy retvals */
}
-char* tgoto (char*a, int b, int c)
+char* tgoto (const char *a, int b, int c)
{
- perror ("tgoto"); return 0; /* here and below, added dummy retvals */
+ perror ("tgoto"); return 0;
}
int tgetnum (char*a)
@@ -743,7 +1325,7 @@ char* tgetstr (char *a, char **b)
perror ("tgetstr"); return 0;
}
-int tgetent (char*a, char*b)
+int tgetent (char *a, const char *b)
{
perror ("tgetent"); return 0;
}
diff --git a/info/search.c b/info/search.c
index 44010bf..04e671f 100644
--- a/info/search.c
+++ b/info/search.c
@@ -1,7 +1,7 @@
/* search.c -- searching large bodies of text.
- $Id: search.c,v 1.9 2008/06/11 09:55:42 gray Exp $
+ $Id: search.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007, 2008
+ Copyright 1993, 1997, 1998, 2002, 2004, 2007, 2008, 2009, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include <regex.h>
@@ -70,16 +70,16 @@ copy_binding (SEARCH_BINDING *binding)
/* Search forwards or backwards for the text delimited by BINDING.
The search is forwards if BINDING->start is greater than BINDING->end. */
-long
-search (char *string, SEARCH_BINDING *binding)
+enum search_result
+search (char *string, SEARCH_BINDING *binding, long *poff)
{
- long result;
+ enum search_result result;
/* If the search is backwards, then search backwards, otherwise forwards. */
if (binding->start > binding->end)
- result = search_backward (string, binding);
+ result = search_backward (string, binding, poff);
else
- result = search_forward (string, binding);
+ result = search_forward (string, binding, poff);
return result;
}
@@ -88,13 +88,13 @@ search (char *string, SEARCH_BINDING *binding)
delimited by BINDING. The search is forwards if BINDING->start is greater
than BINDING->end.
- If PRET is specified, it receives a copy of BINDING at the end of a
+ If PEND is specified, it receives a copy of BINDING at the end of a
succeded search. Its START and END fields contain bounds of the found
string instance.
*/
-long
-regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
- SEARCH_BINDING *pret)
+enum search_result
+regexp_search (char *regexp, SEARCH_BINDING *binding,
+ long *poff, SEARCH_BINDING *pend)
{
static char *previous_regexp = NULL;
static char *previous_content = NULL;
@@ -163,8 +163,8 @@ regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
int size = regerror (result, &preg, NULL, 0);
char *buf = xmalloc (size);
regerror (result, &preg, buf, size);
- info_error (_("regexp error: %s"), buf, NULL);
- return -1;
+ info_error (_("regexp error: %s"), buf);
+ return search_failure;
}
previous_regexp = xstrdup(regexp);
@@ -173,14 +173,27 @@ regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
if (previous_content != binding->buffer)
{
/* new buffer to search in, let's scan it */
- regoff_t start = 0;
+ regoff_t start = 0, end;
+ size_t content_length;
char saved_char;
+ if (binding->start < binding->end)
+ {
+ start = binding->start;
+ end = binding->end;
+ }
+ else
+ {
+ start = binding->end;
+ end = binding->start;
+ }
+ content_length = end - start + 1;
+
previous_content = binding->buffer;
- saved_char = previous_content[length-1];
- previous_content[length-1] = '\0';
+ saved_char = previous_content[content_length-1];
+ previous_content[content_length-1] = '\0';
- for (match_count = 0; start < length; )
+ for (match_count = 0; start < content_length; )
{
int result = 0;
if (match_count >= match_alloc)
@@ -213,7 +226,7 @@ regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
break;
}
}
- previous_content[length-1] = saved_char;
+ previous_content[content_length-1] = saved_char;
}
pos = binding->start;
@@ -225,14 +238,15 @@ regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
{
if (matches[i].rm_so <= pos)
{
- if (pret)
+ if (pend)
{
- pret->buffer = binding->buffer;
- pret->flags = binding->flags;
- pret->start = matches[i].rm_so;
- pret->end = matches[i].rm_eo;
+ pend->buffer = binding->buffer;
+ pend->flags = binding->flags;
+ pend->start = matches[i].rm_so;
+ pend->end = matches[i].rm_eo;
}
- return matches[i].rm_so;
+ *poff = matches[i].rm_so;
+ return search_success;
}
}
}
@@ -244,28 +258,29 @@ regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
{
if (matches[i].rm_so >= pos)
{
- if (pret)
+ if (pend)
{
- pret->buffer = binding->buffer;
- pret->flags = binding->flags;
- pret->start = matches[i].rm_so;
- pret->end = matches[i].rm_eo;
+ pend->buffer = binding->buffer;
+ pend->flags = binding->flags;
+ pend->start = matches[i].rm_so;
+ pend->end = matches[i].rm_eo;
}
if (binding->flags & S_SkipDest)
- return matches[i].rm_eo;
+ *poff = matches[i].rm_eo;
else
- return matches[i].rm_so;
+ *poff = matches[i].rm_so;
+ return search_success;
}
}
}
/* not found */
- return -1;
+ return search_not_found;
}
/* Search forwards for STRING through the text delimited in BINDING. */
-long
-search_forward (char *string, SEARCH_BINDING *binding)
+enum search_result
+search_forward (char *string, SEARCH_BINDING *binding, long *poff)
{
register int c, i, len;
register char *buff, *end;
@@ -310,7 +325,8 @@ search_forward (char *string, SEARCH_BINDING *binding)
free (alternate);
if (binding->flags & S_SkipDest)
buff += len;
- return buff - binding->buffer;
+ *poff = buff - binding->buffer;
+ return search_success;
}
buff++;
@@ -319,12 +335,12 @@ search_forward (char *string, SEARCH_BINDING *binding)
if (alternate)
free (alternate);
- return -1;
+ return search_not_found;
}
/* Search for STRING backwards through the text delimited in BINDING. */
-long
-search_backward (char *input_string, SEARCH_BINDING *binding)
+enum search_result
+search_backward (char *input_string, SEARCH_BINDING *binding, long *poff)
{
register int c, i, len;
register char *buff, *end;
@@ -379,7 +395,8 @@ search_backward (char *input_string, SEARCH_BINDING *binding)
if (binding->flags & S_SkipDest)
buff -= len;
- return 1 + buff - binding->buffer;
+ *poff = 1 + buff - binding->buffer;
+ return search_success;
}
buff--;
@@ -389,7 +406,7 @@ search_backward (char *input_string, SEARCH_BINDING *binding)
if (alternate)
free (alternate);
- return -1;
+ return search_not_found;
}
/* Find STRING in LINE, returning the offset of the end of the string.
@@ -400,7 +417,8 @@ string_in_line (char *string, char *line)
{
register int end;
SEARCH_BINDING binding;
-
+ long offset;
+
/* Find the end of the line. */
for (end = 0; line[end] && line[end] != '\n'; end++);
@@ -410,7 +428,9 @@ string_in_line (char *string, char *line)
binding.end = end;
binding.flags = S_FoldCase | S_SkipDest;
- return search_forward (string, &binding);
+ if (search_forward (string, &binding, &offset) == search_success)
+ return offset;
+ return -1;
}
/* Return non-zero if STRING is the first text to appear at BINDING. */
@@ -419,7 +439,8 @@ looking_at (char *string, SEARCH_BINDING *binding)
{
long search_end;
- search_end = search (string, binding);
+ if (search (string, binding, &search_end) != search_success)
+ return 0;
/* If the string was not found, SEARCH_END is -1. If the string was found,
but not right away, SEARCH_END is != binding->start. Otherwise, the
@@ -470,35 +491,51 @@ skip_non_whitespace (char *string)
return i;
}
-/* Return the index of the first non-node character in STRING. Note that
- this function contains quite a bit of hair to ignore periods in some
- special cases. This is because we here at GNU ship some info files which
- contain nodenames that contain periods. No such nodename can start with
- a period, or continue with whitespace, newline, or ')' immediately following
- the period. If second argument NEWLINES_OKAY is non-zero, newlines should
+/* Return the index of the first non-node character in STRING.
+
+ The second argument instructs how to parse the node name:
+
+ PARSE_NODE_DFLT Node name stops at LF, `,', `.', or `TAB'
+ PARSE_NODE_SKIP_NEWLINES Node name stops at `,', `.', or `TAB'
+ PARSE_NODE_VERBATIM Don't parse nodename
+ PARSE_NODE_START The STRING argument is retrieved from a node
+ start line, and therefore ends in `,' only.
+
+ Note that if FLAG is PARSE_NODE_DFLT or PARSE_NODE_SKIP_NEWLINES, this
+ function contains quite a bit of hair to ignore periods in some special
+ cases. This is because we here at GNU ship some info files which contain
+ nodenames that contain periods. No such nodename can start with a period,
+ or continue with whitespace, newline, or ')' immediately following the
+ period. If second argument NEWLINES_OKAY is non-zero, newlines should
be skipped while parsing out the nodename specification. */
int
-skip_node_characters (char *string, int newlines_okay)
+skip_node_characters (char *string, int flag)
{
register int c, i = 0;
int paren_seen = 0;
int paren = 0;
+ if (!string)
+ return 0;
+
+ if (flag == PARSE_NODE_VERBATIM)
+ return strlen (string);
+
/* Handle special case. This is when another function has parsed out the
filename component of the node name, and we just want to parse out the
nodename proper. In that case, a period at the start of the nodename
indicates an empty nodename. */
- if (string && *string == '.')
+ if (*string == '.')
return 0;
- if (string && *string == '(')
+ if (*string == '(')
{
paren++;
paren_seen++;
i++;
}
- for (; string && (c = string[i]); i++)
+ for (; (c = string[i]); i++)
{
if (paren)
{
@@ -509,25 +546,26 @@ skip_node_characters (char *string, int newlines_okay)
continue;
}
-
+
/* If the character following the close paren is a space or period,
then this node name has no more characters associated with it. */
if (c == '\t' ||
c == ',' ||
c == INFO_TAGSEP ||
- ((!newlines_okay) && (c == '\n')) ||
+ (!(flag == PARSE_NODE_SKIP_NEWLINES) && (c == '\n')) ||
((paren_seen && string[i - 1] == ')') &&
(c == ' ' || c == '.')) ||
- (c == '.' &&
- (
+ (flag != PARSE_NODE_START &&
+ (c == '.' &&
+ (
#if 0
/* This test causes a node name ending in a period, like `This.', not to
be found. The trailing . is stripped. This occurs in the jargon
file (`I see no X here.' is a node name). */
(!string[i + 1]) ||
#endif
- (whitespace_or_newline (string[i + 1])) ||
- (string[i + 1] == ')'))))
+ (whitespace_or_newline (string[i + 1])) ||
+ (string[i + 1] == ')')))))
break;
}
return i;
@@ -664,7 +702,7 @@ find_node_in_binding (char *nodename, SEARCH_BINDING *binding)
tmp_search.start += offset;
tmp_search.start += skip_whitespace (tmp_search.buffer + tmp_search.start);
offset = skip_node_characters
- (tmp_search.buffer + tmp_search.start, DONT_SKIP_NEWLINES);
+ (tmp_search.buffer + tmp_search.start, PARSE_NODE_DFLT);
/* Notice that this is an exact match. You cannot grovel through
the buffer with this function looking for random nodes. */
diff --git a/info/search.h b/info/search.h
index ac2ce76..f79db26 100644
--- a/info/search.h
+++ b/info/search.h
@@ -1,7 +1,7 @@
/* search.h -- Structure used to search large bodies of text, with bounds.
- $Id: search.h,v 1.8 2008/06/11 09:02:11 gray Exp $
+ $Id: search.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 1998, 2002, 2004, 2007
+ Copyright 1993, 1997, 1998, 2002, 2004, 2007, 2009, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
/* The search functions take two arguments:
@@ -42,13 +42,26 @@ typedef struct {
#define S_FoldCase 0x01 /* Set means fold case in searches. */
#define S_SkipDest 0x02 /* Set means return pointing after the dest. */
+enum search_result
+ {
+ search_success,
+ search_not_found,
+ search_failure
+ };
+
SEARCH_BINDING *make_binding (char *buffer, long int start, long int end);
SEARCH_BINDING *copy_binding (SEARCH_BINDING *binding);
-extern long search_forward (char *string, SEARCH_BINDING *binding);
-extern long search_backward (char *input_string, SEARCH_BINDING *binding);
-extern long search (char *string, SEARCH_BINDING *binding);
-extern long regexp_search (char *regexp, SEARCH_BINDING *binding, long length,
- SEARCH_BINDING *pret);
+extern enum search_result search_forward (char *string,
+ SEARCH_BINDING *binding, long *poff);
+extern enum search_result search_backward (char *input_string,
+ SEARCH_BINDING *binding,
+ long *poff);
+extern enum search_result search (char *string, SEARCH_BINDING *binding,
+ long *poff);
+extern enum search_result regexp_search (char *regexp,
+ SEARCH_BINDING *binding,
+ long *poff,
+ SEARCH_BINDING *pret);
extern int looking_at (char *string, SEARCH_BINDING *binding);
/* Note that STRING_IN_LINE () always returns the offset of the 1st character
@@ -67,9 +80,6 @@ extern int skip_line (char *string);
extern int skip_node_characters (char *string, int newlines_okay);
extern int skip_node_separator (char *body);
-#define DONT_SKIP_NEWLINES 0
-#define SKIP_NEWLINES 1
-
extern long find_node_separator (SEARCH_BINDING *binding);
extern long find_tags_table (SEARCH_BINDING *binding);
extern long find_node_in_binding (char *nodename, SEARCH_BINDING *binding);
diff --git a/info/session.c b/info/session.c
index 6eaea61..7510bf6 100644
--- a/info/session.c
+++ b/info/session.c
@@ -1,8 +1,8 @@
/* session.c -- user windowing interface to Info.
- $Id: session.c,v 1.43 2008/06/11 17:38:33 gray Exp $
+ $Id: session.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
- 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
+ 2004, 2007, 2008, 2009, 2011, 2012, 2013 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
@@ -17,11 +17,17 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "search.h"
+#ifndef __MINGW32__
#include <sys/ioctl.h>
+#endif
+#ifdef __MINGW32__
+# define read(f,b,s) w32_read(f,b,s)
+# define _read(f,b,s) w32_read(f,b,s)
+#endif
#if defined (HAVE_SYS_TIME_H)
# include <sys/time.h>
@@ -58,14 +64,17 @@ int quit_info_immediately = 0;
INFO_WINDOW **info_windows = NULL;
/* Where to add the next window, if we need to add one. */
-static int info_windows_index = 0;
+static size_t info_windows_index = 0;
/* Number of slots allocated to `info_windows'. */
-static int info_windows_slots = 0;
+static size_t info_windows_slots = 0;
/* Whether to use regexps or not for search. */
static int use_regex = 1;
+/* Minimal length of a search string */
+int min_search_length = 1;
+
void remember_window_and_node (WINDOW *window, NODE *node);
void forget_window_and_nodes (WINDOW *window);
void display_startup_message_and_start (void);
@@ -83,7 +92,7 @@ begin_multiple_window_info_session (char *filename, char **nodenames)
{
NODE *node;
- node = info_get_node (filename, nodenames[i]);
+ node = info_get_node (filename, nodenames[i], PARSE_NODE_DFLT);
if (!node)
break;
@@ -112,9 +121,9 @@ begin_multiple_window_info_session (char *filename, char **nodenames)
if (!largest)
{
display_update_display (windows);
- info_error (msg_cant_find_window, NULL, NULL);
+ info_error ("%s", msg_cant_find_window);
info_session ();
- xexit (0);
+ exit (EXIT_SUCCESS);
}
active_window = largest;
@@ -127,26 +136,15 @@ begin_multiple_window_info_session (char *filename, char **nodenames)
else
{
display_update_display (windows);
- info_error (msg_win_too_small, NULL, NULL);
+ info_error ("%s", msg_win_too_small);
info_session ();
- xexit (0);
+ exit (EXIT_SUCCESS);
}
}
}
display_startup_message_and_start ();
}
-/* Start an info session with INITIAL_NODE, and an error message in the echo
- area made from FORMAT and ARG. */
-void
-begin_info_session_with_error (NODE *initial_node, const char *format,
- void *arg1, void *arg2)
-{
- initialize_info_session (initial_node, 1);
- info_error (format, arg1, arg2);
- info_session ();
-}
-
/* Start an info session with INITIAL_NODE. */
void
begin_info_session (NODE *initial_node)
@@ -190,10 +188,8 @@ void
info_read_and_dispatch (void)
{
unsigned char key;
- int done;
- done = 0;
- while (!done && !quit_info_immediately)
+ for (quit_info_immediately = 0; !quit_info_immediately; )
{
int lk = 0;
@@ -241,14 +237,9 @@ info_read_and_dispatch (void)
info_aborted_echo_area)
{
ea_last_executed_command = NULL;
- done = 1;
+ break;
}
-
- if (info_last_executed_command == (VFunction *) info_quit)
- quit_info_immediately = 1;
}
- else if (info_last_executed_command == (VFunction *) info_quit)
- done = 1;
}
}
@@ -268,8 +259,8 @@ initialize_info_session (NODE *node, int clear_screen)
if (!term_name)
term_name = "dumb";
- info_error (msg_term_too_dumb, term_name, NULL);
- xexit (1);
+ info_error (msg_term_too_dumb, term_name);
+ exit (EXIT_FAILURE);
}
if (clear_screen)
@@ -375,7 +366,7 @@ remember_window_and_node (WINDOW *window, NODE *node)
info_win->nodes_slots = 0;
add_pointer_to_array (info_win, info_windows_index, info_windows,
- info_windows_slots, 10, INFO_WINDOW *);
+ info_windows_slots, 10);
}
/* If this node, the current pagetop, and the current point are the
@@ -418,7 +409,7 @@ remember_window_and_node (WINDOW *window, NODE *node)
static void
consistency_check_info_windows (void)
{
- register int i;
+ size_t i;
for (i = 0; i < info_windows_index; i++)
{
@@ -438,7 +429,7 @@ consistency_check_info_windows (void)
void
forget_window_and_nodes (WINDOW *window)
{
- register int i;
+ size_t i;
INFO_WINDOW *info_win = NULL;
for (i = 0; info_windows && (info_win = info_windows[i]); i++)
@@ -467,8 +458,8 @@ forget_window_and_nodes (WINDOW *window)
free (info_win->nodes[i]);
free (info_win->nodes);
- maybe_free (info_win->pagetops);
- maybe_free (info_win->points);
+ free (info_win->pagetops);
+ free (info_win->points);
}
free (info_win);
@@ -538,14 +529,18 @@ set_window_pagetop (WINDOW *window, int desired_top)
direction. Do this only if there would be a savings in redisplay
time. This is true if the amount to scroll is less than the height
of the window, and if the number of lines scrolled would be greater
- than 10 % of the window's height. */
+ than 10 % of the window's height.
+
+ To prevent status line blinking when keeping up or down key,
+ scrolling is disabled if the amount to scroll is 1. */
if (old_pagetop < desired_top)
{
int start, end, amount;
amount = desired_top - old_pagetop;
- if ((amount >= window->height) ||
+ if (amount == 1 ||
+ (amount >= window->height) ||
(((window->height - amount) * 10) < window->height))
return;
@@ -560,7 +555,8 @@ set_window_pagetop (WINDOW *window, int desired_top)
amount = old_pagetop - desired_top;
- if ((amount >= window->height) ||
+ if (amount == 1 ||
+ (amount >= window->height) ||
(((window->height - amount) * 10) < window->height))
return;
@@ -600,7 +596,7 @@ move_to_new_line (int old, int new, WINDOW *window)
{
if (old == -1)
{
- info_error (msg_cant_find_point, NULL, NULL);
+ info_error ("%s", msg_cant_find_point);
}
else
{
@@ -657,6 +653,22 @@ DECLARE_INFO_COMMAND (info_next_line, _("Move down to the next line"))
}
}
+/* "Safe" version of info_next_line, for use when moving to a
+ reference within the window. It assumes that point is 0 and
+ is safe in the sense that it won't allow to change nodes if
+ COUNT is greater than the number of lines in the current node.
+
+ This is necessary to avoid incorrect placement on malformed
+ info documents (such as gawk.info v. 3.1.5) when
+ cursor_movement_scrolls_p is set to 1. */
+
+static void
+internal_next_line (WINDOW *window, int count, unsigned char key)
+{
+ if (count >= 0 && count < window->line_count)
+ info_next_line (window, count, key);
+}
+
/* Move WINDOW's point up to the previous line if possible. */
DECLARE_INFO_COMMAND (info_prev_line, _("Move up to the previous line"))
{
@@ -1096,6 +1108,8 @@ char *info_scroll_choices[] = {
/* Controls whether scroll-behavior affects line movement commands */
int cursor_movement_scrolls_p = 1;
+int search_skip_screen_p = 0;
+
/* Choices for the scroll-last-node variable */
char *scroll_last_node_choices[] = {
"Stop", "Scroll", "Top", NULL
@@ -1132,14 +1146,14 @@ forward_move_node_structure (WINDOW *window, int behaviour)
switch (behaviour)
{
case IS_PageOnly:
- info_error (msg_at_node_bottom, NULL, NULL);
+ info_error ("%s", msg_at_node_bottom);
return 1;
case IS_NextOnly:
info_next_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
{
- info_error (msg_no_pointer, (char *) _("Next"), NULL);
+ info_error (msg_no_pointer, _("Next"));
return 1;
}
else
@@ -1155,8 +1169,7 @@ forward_move_node_structure (WINDOW *window, int behaviour)
switch (scroll_last_node)
{
case SLN_Stop:
- info_error (_("No more nodes within this document."),
- NULL, NULL);
+ info_error ("%s", _("No more nodes within this document."));
return 1;
case SLN_Scroll:
@@ -1280,8 +1293,7 @@ forward_move_node_structure (WINDOW *window, int behaviour)
window->point = info_win->points[old_current];
recalculate_line_starts (window);
window->flags |= W_UpdateWindow;
- info_error (_("No more nodes within this document."),
- NULL, NULL);
+ info_error ("%s", _("No more nodes within this document."));
return 1;
}
}
@@ -1299,14 +1311,14 @@ backward_move_node_structure (WINDOW *window, int behaviour)
switch (behaviour)
{
case IS_PageOnly:
- info_error (msg_at_node_top, NULL, NULL);
+ info_error ("%s", msg_at_node_top);
return 1;
case IS_NextOnly:
info_prev_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
{
- info_error (_("No `Prev' for this node."), NULL, NULL);
+ info_error ("%s", _("No `Prev' for this node."));
return 1;
}
else
@@ -1325,9 +1337,8 @@ backward_move_node_structure (WINDOW *window, int behaviour)
if (!info_parsed_nodename && (!info_parsed_filename
|| is_dir_name (info_parsed_filename)))
{
- info_error (
- _("No `Prev' or `Up' for this node within this document."),
- NULL, NULL);
+ info_error ("%s",
+ _("No `Prev' or `Up' for this node within this document."));
return 1;
}
else
@@ -1685,7 +1696,7 @@ DECLARE_INFO_COMMAND (info_next_window, _("Select the next window"))
/* If no other window, error now. */
if (!windows->next && !echo_area_is_active)
{
- info_error (msg_one_window, NULL, NULL);
+ info_error ("%s", msg_one_window);
return;
}
@@ -1725,7 +1736,7 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window"))
if (!windows->next && !echo_area_is_active)
{
- info_error (msg_one_window, NULL, NULL);
+ info_error ("%s", msg_one_window);
return;
}
@@ -1767,12 +1778,14 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window"))
DECLARE_INFO_COMMAND (info_split_window, _("Split the current window"))
{
WINDOW *split, *old_active;
+#if defined (SPLIT_BEFORE_ACTIVE)
int pagetop;
/* Remember the current pagetop of the window being split. If it doesn't
change, we can scroll its contents around after the split. */
pagetop = window->pagetop;
-
+#endif
+
/* Make the new window. */
old_active = active_window;
active_window = window;
@@ -1781,7 +1794,7 @@ DECLARE_INFO_COMMAND (info_split_window, _("Split the current window"))
if (!split)
{
- info_error (msg_win_too_small, NULL, NULL);
+ info_error ("%s", msg_win_too_small);
}
else
{
@@ -1820,7 +1833,8 @@ DECLARE_INFO_COMMAND (info_split_window, _("Split the current window"))
else
filename = iw->nodes[j]->filename;
- node = info_get_node (filename, iw->nodes[j]->nodename);
+ node = info_get_node (filename, iw->nodes[j]->nodename,
+ PARSE_NODE_DFLT);
if (node)
{
window_set_node_of_window (split, node);
@@ -1849,11 +1863,11 @@ DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window"))
{
if (!windows->next)
{
- info_error (msg_cant_kill_last, NULL, NULL);
+ info_error ("%s", msg_cant_kill_last);
}
else if (window->flags & W_WindowIsPerm)
{
- info_error (_("Cannot delete a permanent window"), NULL, NULL);
+ info_error ("%s", _("Cannot delete a permanent window"));
}
else
{
@@ -1938,7 +1952,7 @@ DECLARE_INFO_COMMAND (info_scroll_other_window, _("Scroll the other window"))
/* If only one window, give up. */
if (!windows->next)
{
- info_error (msg_one_window, NULL, NULL);
+ info_error ("%s", msg_one_window);
return;
}
@@ -1985,11 +1999,10 @@ DECLARE_INFO_COMMAND (info_toggle_wrap,
DECLARE_INFO_COMMAND (info_toggle_regexp,
_("Toggle the usage of regular expressions in searches"))
{
- use_regex = 1 - use_regex;
+ use_regex = !use_regex;
window_message_in_echo_area (use_regex
? _("Using regular expressions for searches.")
- : _("Using literal strings for searches."),
- NULL, NULL);
+ : _("Using literal strings for searches."));
}
/* **************************************************************** */
@@ -2043,7 +2056,7 @@ info_select_reference (WINDOW *window, REFERENCE *entry)
else
nodename = xstrdup ("Top");
- node = info_get_node (filename, nodename);
+ node = info_get_node (filename, nodename, PARSE_NODE_VERBATIM);
/* Try something a little weird. If the node couldn't be found, and the
reference was of the form "foo::", see if the entry->label can be found
@@ -2055,10 +2068,10 @@ info_select_reference (WINDOW *window, REFERENCE *entry)
if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0))
{
- node = info_get_node (entry->label, "Top");
+ node = info_get_node (entry->label, "Top", PARSE_NODE_DFLT);
if (!node && info_recent_file_error)
{
- maybe_free (file_system_error);
+ free (file_system_error);
file_system_error = xstrdup (info_recent_file_error);
}
}
@@ -2067,14 +2080,14 @@ info_select_reference (WINDOW *window, REFERENCE *entry)
if (!node)
{
if (file_system_error)
- info_error (file_system_error, NULL, NULL);
+ info_error ("%s", file_system_error);
else
- info_error (msg_cant_find_node, nodename, NULL);
+ info_error (msg_cant_find_node, nodename);
}
- maybe_free (file_system_error);
- maybe_free (filename);
- maybe_free (nodename);
+ free (file_system_error);
+ free (filename);
+ free (nodename);
if (node)
info_set_node_of_window (1, window, node);
@@ -2088,7 +2101,7 @@ info_parse_and_select (char *line, WINDOW *window)
{
REFERENCE entry;
- info_parse_node (line, DONT_SKIP_NEWLINES);
+ info_parse_node (line, PARSE_NODE_DFLT);
entry.nodename = info_parsed_nodename;
entry.filename = info_parsed_filename;
@@ -2097,6 +2110,22 @@ info_parse_and_select (char *line, WINDOW *window)
info_select_reference (window, &entry);
}
+static int
+info_win_find_node (INFO_WINDOW *win, NODE *node)
+{
+ int i;
+
+ for (i = win->nodes_index - 1; i >= 0; i--)
+ {
+ NODE *p = win->nodes[i];
+
+ if (strcmp (p->filename, node->filename) == 0 &&
+ strcmp (p->nodename, node->nodename) == 0)
+ break;
+ }
+ return i;
+}
+
/* Given that the values of INFO_PARSED_FILENAME and INFO_PARSED_NODENAME
are previously filled, try to get the node represented by them into
WINDOW. The node should have been pointed to by the LABEL pointer of
@@ -2126,7 +2155,7 @@ info_handle_pointer (char *label, WINDOW *window)
else
nodename = xstrdup ("Top");
- node = info_get_node (filename, nodename);
+ node = info_get_node (filename, nodename, PARSE_NODE_DFLT);
if (node)
{
@@ -2135,7 +2164,13 @@ info_handle_pointer (char *label, WINDOW *window)
info_win = get_info_window_of_window (window);
if (info_win)
{
- info_win->pagetops[info_win->current] = window->pagetop;
+ if (strcmp (label, "Up") == 0)
+ {
+ int i = info_win_find_node (info_win, node);
+ if (i >= 0)
+ node->display_pos = info_win->points[i];
+ }
+ info_win->pagetops[info_win->current] = window->pagetop;
info_win->points[info_win->current] = window->point;
}
info_set_node_of_window (1, window, node);
@@ -2143,7 +2178,7 @@ info_handle_pointer (char *label, WINDOW *window)
else
{
if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
+ info_error ("%s", info_recent_file_error);
else
info_error (msg_cant_file_node, filename, nodename);
}
@@ -2153,7 +2188,7 @@ info_handle_pointer (char *label, WINDOW *window)
}
else
{
- info_error (msg_no_pointer, label, NULL);
+ info_error (msg_no_pointer, label);
}
}
@@ -2205,11 +2240,12 @@ DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file"))
if (count > 0)
i = last_node_tag_idx + 1;
if (i > 0)
- node = info_get_node (fb->filename, fb->tags[i - 1]->nodename);
+ node = info_get_node (fb->filename, fb->tags[i - 1]->nodename,
+ PARSE_NODE_DFLT);
}
if (!node)
- info_error (_("This window has no additional nodes"), NULL, NULL);
+ info_error ("%s", _("This window has no additional nodes"));
else
info_set_node_of_window (1, window, node);
}
@@ -2238,11 +2274,12 @@ DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file"))
if (count > 0)
i = last_node_tag_idx + 1;
if (i > 0)
- node = info_get_node (fb->filename, fb->tags[i - 1]->nodename);
+ node = info_get_node (fb->filename, fb->tags[i - 1]->nodename,
+ PARSE_NODE_DFLT);
}
if (!node)
- info_error (_("This window has no additional nodes"), NULL, NULL);
+ info_error ("%s", _("This window has no additional nodes"));
else
info_set_node_of_window (1, window, node);
}
@@ -2264,7 +2301,7 @@ DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
if (!menu)
{
- info_error (msg_no_menu_node, NULL, NULL);
+ info_error ("%s", msg_no_menu_node);
return;
}
@@ -2285,11 +2322,13 @@ DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
{
info_select_reference (window, menu[i]);
if (menu[i]->line_number > 0)
- info_next_line (window, menu[i]->line_number - 1, key);
+ internal_next_line (window, menu[i]->line_number - 1, key);
}
else
- info_error (_("There aren't %d items in this menu."),
- (void *) (long) item, NULL);
+ info_error (ngettext ("There isn't %d item in this menu.",
+ "There aren't %d items in this menu.",
+ item),
+ item);
info_free_references (menu);
return;
@@ -2377,9 +2416,9 @@ info_menu_or_ref_item (WINDOW *window, int count,
if (!menu)
{
if (builder == info_menu_of_node)
- info_error (msg_no_menu_node, NULL, NULL);
+ info_error ("%s", msg_no_menu_node);
else
- info_error (msg_no_xref_node, NULL, NULL);
+ info_error ("%s", msg_no_xref_node);
return;
}
@@ -2508,7 +2547,7 @@ info_menu_or_ref_item (WINDOW *window, int count,
/* User aborts, just quit. */
if (!line)
{
- maybe_free (defentry);
+ free (defentry);
info_free_references (menu);
info_abort_key (window, 0, 0);
return;
@@ -2575,7 +2614,7 @@ info_menu_or_ref_item (WINDOW *window, int count,
}
if (!entry && defentry)
- info_error (_("The reference disappeared! (%s)."), line, NULL);
+ info_error (_("The reference disappeared! (%s)."), line);
else
{
NODE *orig = window->node;
@@ -2592,30 +2631,22 @@ info_menu_or_ref_item (WINDOW *window, int count,
else
start = 0;
- offset =
- info_target_search_node (window->node, entry->label, start);
+ offset = info_target_search_node (window->node, entry->label,
+ start, 0);
- if (offset != -1)
- {
- window->point = offset;
- window_adjust_pagetop (window);
- }
+ window->point = (offset == -1) ?
+ window->node->body_start : offset;
+ window_adjust_pagetop (window);
}
if (entry->line_number > 0)
/* next_line starts at line 1? Anyway, the -1 makes it
move to the right line. */
- info_next_line (window, entry->line_number - 1, key);
+ internal_next_line (window, entry->line_number - 1, key);
}
free (line);
- if (defentry)
- {
- free (defentry->label);
- maybe_free (defentry->filename);
- maybe_free (defentry->nodename);
- free (defentry);
- }
+ info_reference_free (defentry);
}
info_free_references (menu);
@@ -2650,16 +2681,14 @@ DECLARE_INFO_COMMAND (info_find_menu, _("Move to the start of this node's menu")
binding.end = window->node->nodelen;
binding.flags = S_FoldCase | S_SkipDest;
- position = search (INFO_MENU_LABEL, &binding);
-
- if (position == -1)
- info_error (msg_no_menu_node, NULL, NULL);
- else
+ if (search (INFO_MENU_LABEL, &binding, &position) == search_success)
{
window->point = position;
window_adjust_pagetop (window);
window->flags |= W_UpdateWindow;
}
+ else
+ info_error ("%s", msg_no_menu_node);
}
/* Visit as many menu items as is possible, each in a separate window. */
@@ -2672,7 +2701,7 @@ DECLARE_INFO_COMMAND (info_visit_menu,
menu = info_menu_of_node (window->node);
if (!menu)
- info_error (msg_no_menu_node, NULL, NULL);
+ info_error ("%s", msg_no_menu_node);
for (i = 0; (!info_error_was_printed) && (entry = menu[i]); i++)
{
@@ -2682,7 +2711,7 @@ DECLARE_INFO_COMMAND (info_visit_menu,
window_tile_windows (TILE_INTERNALS);
if (!new)
- info_error (msg_win_too_small, NULL, NULL);
+ info_error ("%s", msg_win_too_small);
else
{
active_window = new;
@@ -2703,8 +2732,8 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
register int fbi, i;
FILE_BUFFER *current;
REFERENCE **items = NULL;
- int items_index = 0;
- int items_slots = 0;
+ size_t items_index = 0;
+ size_t items_slots = 0;
current = file_buffer_of_window (window);
@@ -2722,8 +2751,7 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
entry->label = xmalloc (4 + strlen (fb->filename));
sprintf (entry->label, "(%s)*", fb->filename);
- add_pointer_to_array
- (entry, items_index, items, items_slots, 10, REFERENCE *);
+ add_pointer_to_array (entry, items_index, items, items_slots, 10);
if (fb->tags)
{
@@ -2742,8 +2770,8 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
fb->filename, fb->tags[i]->nodename);
}
- add_pointer_to_array
- (entry, items_index, items, items_slots, 100, REFERENCE *);
+ add_pointer_to_array (entry, items_index, items,
+ items_slots, 100);
}
}
}
@@ -2780,12 +2808,13 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
will be NULL. */
NODE *
-info_follow_menus (NODE *initial_node, char **menus,
- const char **errstr, char **errarg1, char **errarg2)
+info_follow_menus (NODE *initial_node, char **menus, NODE **err_node,
+ int strict)
{
NODE *node = NULL;
- *errstr = *errarg1 = *errarg2 = NULL;
+ if (err_node)
+ *err_node = NULL;
for (; *menus; menus++)
{
static char *first_arg = NULL;
@@ -2793,6 +2822,8 @@ info_follow_menus (NODE *initial_node, char **menus,
REFERENCE *entry;
char *arg = *menus; /* Remember the name of the menu entry we want. */
+ debug (3, ("looking for %s in %s:%s", arg, initial_node->filename,
+ initial_node->nodename));
/* A leading space is certainly NOT part of a node name. Most
probably, they typed a space after the separating comma. The
strings in menus[] have their whitespace canonicalized, so
@@ -2810,15 +2841,20 @@ info_follow_menus (NODE *initial_node, char **menus,
realize it. */
if (!menu)
{
- if (arg == first_arg)
+ debug (3, ("no menu found"));
+ if (arg == first_arg && !strict)
{
node = make_manpage_node (first_arg);
if (node)
- goto maybe_got_node;
+ {
+ debug (3, ("falling back to manpage node"));
+ goto maybe_got_node;
+ }
}
- *errstr = _("No menu in node `%s'.");
- *errarg1 = node_printed_rep (initial_node);
- return initial_node;
+ if (err_node)
+ *err_node = format_message_node (_("No menu in node `%s'."),
+ node_printed_rep (initial_node));
+ return strict ? NULL : initial_node;
}
/* Find the specified menu item. */
@@ -2831,12 +2867,12 @@ info_follow_menus (NODE *initial_node, char **menus,
int i;
int best_guess = -1;
+ debug (3, ("no entry found: guessing"));
for (i = 0; (entry = menu[i]); i++)
{
if (mbscasecmp (entry->label, arg) == 0)
break;
- else
- if ((best_guess == -1)
+ else if (!strict && (best_guess == -1)
&& (mbsncasecmp (entry->label, arg, strlen (arg)) == 0))
best_guess = i;
}
@@ -2852,9 +2888,11 @@ info_follow_menus (NODE *initial_node, char **menus,
if (arg == first_arg)
{
/* Maybe they typed "info foo" instead of "info -f foo". */
- node = info_get_node (first_arg, 0);
+ node = info_get_node (first_arg, NULL, PARSE_NODE_DFLT);
if (node)
add_file_directory_to_path (first_arg);
+ else if (strict)
+ return NULL;
else
node = make_manpage_node (first_arg);
if (node)
@@ -2862,10 +2900,11 @@ info_follow_menus (NODE *initial_node, char **menus,
}
info_free_references (menu);
- *errstr = _("No menu item `%s' in node `%s'.");
- *errarg1 = arg;
- *errarg2 = node_printed_rep (initial_node);
- return initial_node;
+ if (err_node)
+ *err_node = format_message_node (_("No menu item `%s' in node `%s'."),
+ arg,
+ node_printed_rep (initial_node));
+ return strict ? NULL : initial_node;
}
/* We have found the reference that the user specified. If no
@@ -2874,9 +2913,12 @@ info_follow_menus (NODE *initial_node, char **menus,
entry->filename = xstrdup (initial_node->parent ? initial_node->parent
: initial_node->filename);
+ debug (3, ("entry: %s, %s", entry->filename, entry->nodename));
+
/* Try to find this node. */
- node = info_get_node (entry->filename, entry->nodename);
- if (!node && arg == first_arg)
+ node = info_get_node (entry->filename, entry->nodename,
+ PARSE_NODE_VERBATIM);
+ if (!strict && !node && arg == first_arg)
{
node = make_manpage_node (first_arg);
if (node)
@@ -2887,18 +2929,23 @@ info_follow_menus (NODE *initial_node, char **menus,
file, i.e., "(LABEL)Top". */
if (!node && entry->nodename
&& strcmp (entry->label, entry->nodename) == 0)
- node = info_get_node (entry->label, "Top");
+ node = info_get_node (entry->label, "Top", PARSE_NODE_DFLT);
maybe_got_node:
if (!node)
{
- *errstr = _("Unable to find node referenced by `%s' in `%s'.");
- *errarg1 = xstrdup (entry->label);
- *errarg2 = node_printed_rep (initial_node);
+ debug (3, ("no matching node found"));
+ if (err_node)
+ *err_node = format_message_node (
+ _("Unable to find node referenced by `%s' in `%s'."),
+ entry->label,
+ node_printed_rep (initial_node));
info_free_references (menu);
- return initial_node;
+ return strict ? NULL : initial_node;
}
+ debug (3, ("node: %s, %s", node->filename, node->nodename));
+
info_free_references (menu);
/* Success. Go round the loop again. */
@@ -2957,9 +3004,8 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
if (*line)
{
- const char *errstr;
- char *errarg1, *errarg2;
- NODE *dir_node = info_get_node (NULL, NULL);
+ NODE *err_node;
+ NODE *dir_node = info_get_node (NULL, NULL, PARSE_NODE_DFLT);
char **nodes = split_list_of_nodenames (line);
NODE *node = NULL;
@@ -2971,21 +3017,21 @@ DECLARE_INFO_COMMAND (info_menu_sequence,
if (!file_name)
file_name = window->node->filename;
- dir_node = info_get_node (file_name, NULL);
+ dir_node = info_get_node (file_name, NULL, PARSE_NODE_DFLT);
}
/* If we still cannot find the starting point, give up.
We cannot allow a NULL pointer inside info_follow_menus. */
if (!dir_node)
- info_error (msg_cant_find_node, "Top", NULL);
+ info_error (msg_cant_find_node, "Top");
else
- node = info_follow_menus (dir_node, nodes, &errstr, &errarg1, &errarg2);
+ node = info_follow_menus (dir_node, nodes, &err_node, 0);
free (nodes);
- if (!errstr)
- info_set_node_of_window (1, window, node);
+ if (err_node)
+ show_error_node (err_node);
else
- info_error (errstr, errarg1, errarg2);
+ info_set_node_of_window (1, window, node);
}
free (line);
@@ -3100,7 +3146,8 @@ info_intuit_options_node (WINDOW *window, NODE *initial_node, char *program)
entry->filename = xstrdup (initial_node->parent ? initial_node->parent
: initial_node->filename);
/* Try to find this node. */
- node = info_get_node (entry->filename, entry->nodename);
+ node = info_get_node (entry->filename, entry->nodename,
+ PARSE_NODE_VERBATIM);
info_free_references (menu);
if (!node)
break;
@@ -3167,9 +3214,9 @@ DECLARE_INFO_COMMAND (info_goto_invocation_node,
/* In interactive usage they'd probably expect us to begin looking
from the Top node. */
- top_node = info_get_node (file_name, NULL);
+ top_node = info_get_node (file_name, NULL, PARSE_NODE_DFLT);
if (!top_node)
- info_error (msg_cant_find_node, "Top", NULL);
+ info_error (msg_cant_find_node, "Top");
info_intuit_options_node (window, top_node, program_name);
free (line);
@@ -3232,7 +3279,7 @@ read_nodename_to_kill (WINDOW *window)
char *nodename;
INFO_WINDOW *info_win;
REFERENCE **menu = NULL;
- int menu_index = 0, menu_slots = 0;
+ size_t menu_index = 0, menu_slots = 0;
char *default_nodename = xstrdup (active_window->node->nodename);
char *prompt = xmalloc (strlen (_("Kill node (%s): ")) + strlen (default_nodename));
@@ -3244,8 +3291,7 @@ read_nodename_to_kill (WINDOW *window)
entry->label = xstrdup (info_win->window->node->nodename);
entry->filename = entry->nodename = NULL;
- add_pointer_to_array (entry, menu_index, menu, menu_slots, 10,
- REFERENCE *);
+ add_pointer_to_array (entry, menu_index, menu, menu_slots, 10);
}
nodename = info_read_completing_in_echo_area (window, prompt, menu);
@@ -3288,7 +3334,7 @@ kill_node (WINDOW *window, char *nodename)
if (!info_win)
{
if (*nodename)
- info_error (_("Cannot kill node `%s'"), nodename, NULL);
+ info_error (_("Cannot kill node `%s'"), nodename);
else
window_clear_echo_area ();
@@ -3298,7 +3344,7 @@ kill_node (WINDOW *window, char *nodename)
/* If there are no more nodes left anywhere to view, complain and exit. */
if (info_windows_index == 1 && info_windows[0]->nodes_index == 1)
{
- info_error (_("Cannot kill the last node"), NULL, NULL);
+ info_error ("%s", _("Cannot kill the last node"));
return;
}
@@ -3413,13 +3459,13 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")
{
NODE *node;
- node = info_get_node (line, "*");
+ node = info_get_node (line, "*", PARSE_NODE_DFLT);
if (!node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
+ info_error ("%s", info_recent_file_error);
else
- info_error (_("Cannot find `%s'."), line, NULL);
+ info_error (_("Cannot find `%s'."), line);
}
else
info_set_node_of_window (1, window, node);
@@ -3437,104 +3483,114 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it")
/* */
/* **************************************************************** */
-#define VERBOSE_NODE_DUMPING
-static void write_node_to_stream (NODE *node, FILE *stream);
-static void dump_node_to_stream (char *filename, char *nodename,
- FILE *stream, int dump_subnodes);
+enum
+ {
+ DUMP_SUCCESS,
+ DUMP_INFO_ERROR,
+ DUMP_SYS_ERROR
+ };
+
+static int write_node_to_stream (NODE *node, FILE *stream);
+static int dump_node_to_stream (char *filename, char *nodename,
+ FILE *stream, int dump_subnodes);
static void initialize_dumping (void);
/* Dump the nodes specified by FILENAME and NODENAMES to the file named
- in OUTPUT_FILENAME. If DUMP_SUBNODES is non-zero, recursively dump
+ in OUTPUT_FILENAME. If DUMP_SUBNODES is set, recursively dump
the nodes which appear in the menu of each node dumped. */
void
dump_nodes_to_file (char *filename, char **nodenames,
- char *output_filename, int dump_subnodes)
+ char *output_filename, int flags)
{
- register int i;
+ int i;
FILE *output_stream;
+
+ debug (1, (_("writing file %s"), filename));
/* Get the stream to print the nodes to. Special case of an output
filename of "-" means to dump the nodes to stdout. */
if (strcmp (output_filename, "-") == 0)
output_stream = stdout;
else
- output_stream = fopen (output_filename, "w");
+ output_stream = fopen (output_filename, flags & DUMP_APPEND ? "a" : "w");
if (!output_stream)
{
- info_error (_("Could not create output file `%s'."),
- output_filename, NULL);
+ info_error (_("Could not create output file `%s'."), output_filename);
return;
}
- /* Print each node to stream. */
initialize_dumping ();
- for (i = 0; nodenames[i]; i++)
- dump_node_to_stream (filename, nodenames[i], output_stream, dump_subnodes);
+ /* Print each node to stream. */
+ if (flags & DUMP_APPEND)
+ fputc ('\f', output_stream);
+ for (i = 0; nodenames[i]; i++)
+ {
+ if (dump_node_to_stream (filename, nodenames[i], output_stream,
+ flags & DUMP_SUBNODES) == DUMP_SYS_ERROR)
+ {
+ info_error (_("error writing to %s: %s"), filename, strerror (errno));
+ exit (EXIT_FAILURE);
+ }
+ }
+
if (output_stream != stdout)
fclose (output_stream);
-#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."), NULL, NULL);
-#endif /* VERBOSE_NODE_DUMPING */
+ debug (1, (_("closing %s"), filename));
}
/* A place to remember already dumped nodes. */
-static char **dumped_already = NULL;
-static int dumped_already_index = 0;
-static int dumped_already_slots = 0;
+static struct info_namelist_entry *dumped_already;
static void
initialize_dumping (void)
{
- dumped_already_index = 0;
+ info_namelist_free (dumped_already);
+ dumped_already = NULL;
}
/* Get and print the node specified by FILENAME and NODENAME to STREAM.
If DUMP_SUBNODES is non-zero, recursively dump the nodes which appear
in the menu of each node dumped. */
-static void
+static int
dump_node_to_stream (char *filename, char *nodename,
- FILE *stream, int dump_subnodes)
+ FILE *stream, int dump_subnodes)
{
register int i;
NODE *node;
- node = info_get_node (filename, nodename);
+ node = info_get_node (filename, nodename, PARSE_NODE_DFLT);
if (!node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
+ info_error ("%s", info_recent_file_error);
else
{
if (filename && *nodename != '(')
info_error (msg_cant_file_node,
- filename_non_directory (filename),
- nodename);
+ filename_non_directory (filename),
+ nodename);
else
- info_error (msg_cant_find_node, nodename, NULL);
+ info_error (msg_cant_find_node, nodename);
}
- return;
+ return DUMP_INFO_ERROR;
}
/* If we have already dumped this node, don't dump it again. */
- for (i = 0; i < dumped_already_index; i++)
- if (strcmp (node->nodename, dumped_already[i]) == 0)
- {
- free (node);
- return;
- }
- add_pointer_to_array (node->nodename, dumped_already_index, dumped_already,
- dumped_already_slots, 50, char *);
+ if (info_namelist_add (&dumped_already, node->nodename))
+ {
+ free (node);
+ return DUMP_SUCCESS;
+ }
-#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
- info_error (_("Writing node %s..."), node_printed_rep (node), NULL);
-#endif /* VERBOSE_NODE_DUMPING */
+ debug (1, (_("writing node %s..."), node_printed_rep (node)));
- write_node_to_stream (node, stream);
+ if (write_node_to_stream (node, stream))
+ return DUMP_SYS_ERROR;
/* If we are dumping subnodes, get the list of menu items in this node,
and dump each one recursively. */
@@ -3553,35 +3609,39 @@ dump_node_to_stream (char *filename, char *nodename,
/* We don't dump Info files which are different than the
current one. */
if (!menu[i]->filename)
- dump_node_to_stream
- (filename, menu[i]->nodename, stream, dump_subnodes);
+ if (dump_node_to_stream (filename, menu[i]->nodename,
+ stream, dump_subnodes) == DUMP_SYS_ERROR)
+ return DUMP_SYS_ERROR;
}
info_free_references (menu);
}
}
free (node);
+
+ return DUMP_SUCCESS;
}
-/* Dump NODE to FILENAME. If DUMP_SUBNODES is non-zero, recursively dump
+/* Dump NODE to FILENAME. If DUMP_SUBNODES is set, recursively dump
the nodes which appear in the menu of each node dumped. */
void
-dump_node_to_file (NODE *node, char *filename, int dump_subnodes)
+dump_node_to_file (NODE *node, char *filename, int flags)
{
FILE *output_stream;
char *nodes_filename;
+ debug (1, (_("writing file %s"), filename));
+
/* Get the stream to print this node to. Special case of an output
filename of "-" means to dump the nodes to stdout. */
if (strcmp (filename, "-") == 0)
output_stream = stdout;
else
- output_stream = fopen (filename, "w");
+ output_stream = fopen (filename, flags & DUMP_APPEND ? "a" : "w");
if (!output_stream)
{
- info_error (_("Could not create output file `%s'."), filename,
- NULL);
+ info_error (_("Could not create output file `%s'."), filename);
return;
}
@@ -3591,15 +3651,23 @@ dump_node_to_file (NODE *node, char *filename, int dump_subnodes)
nodes_filename = node->filename;
initialize_dumping ();
- dump_node_to_stream
- (nodes_filename, node->nodename, output_stream, dump_subnodes);
+
+ if (flags & DUMP_APPEND)
+ fputc ('\f', output_stream);
+ fprintf (output_stream, "%s\n", info_find_fullpath (node->filename));
+
+ if (dump_node_to_stream (nodes_filename, node->nodename,
+ output_stream, flags & DUMP_SUBNODES)
+ == DUMP_SYS_ERROR)
+ {
+ info_error (_("error writing to %s: %s"), filename, strerror (errno));
+ exit (EXIT_FAILURE);
+ }
if (output_stream != stdout)
fclose (output_stream);
-#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."), NULL, NULL);
-#endif /* VERBOSE_NODE_DUMPING */
+ debug (1, (_("closing file %s"), filename));
}
#if !defined (DEFAULT_INFO_PRINT_COMMAND)
@@ -3642,14 +3710,12 @@ print_node (NODE *node)
if (!printer_pipe)
{
- info_error (_("Cannot open pipe to `%s'."), print_command, NULL);
+ info_error (_("Cannot open pipe to `%s'."), print_command);
return;
}
-#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
- info_error (_("Printing node %s..."), node_printed_rep (node), NULL);
-#endif /* VERBOSE_NODE_DUMPING */
+ debug (1, (_("printing node %s..."), node_printed_rep (node)));
write_node_to_stream (node, printer_pipe);
if (piping)
@@ -3657,15 +3723,13 @@ print_node (NODE *node)
else
fclose (printer_pipe);
-#if defined (VERBOSE_NODE_DUMPING)
- info_error (_("Done."), NULL, NULL);
-#endif /* VERBOSE_NODE_DUMPING */
+ debug (1, (_("finished printing node %s"), node_printed_rep (node)));
}
-static void
+static int
write_node_to_stream (NODE *node, FILE *stream)
{
- fwrite (node->contents, 1, node->nodelen, stream);
+ return fwrite (node->contents, node->nodelen, 1, stream) != 1;
}
/* **************************************************************** */
@@ -3682,7 +3746,11 @@ int gc_compressed_files = 0;
static void info_gc_file_buffers (void);
static void info_search_1 (WINDOW *window, int count,
- unsigned char key, int case_sensitive, int ask_for_string);
+ unsigned char key, int case_sensitive,
+ int ask_for_string, long start);
+#define DFL_START (-1) /* a special value for the START argument of
+ info_search_1, meaning to use the default
+ starting position */
static char *search_string = NULL;
static int search_string_size = 0;
@@ -3708,74 +3776,112 @@ file_buffer_of_window (WINDOW *window)
return NULL;
}
-/* Search for STRING in NODE starting at START. Return -1 if the string
- was not found, or the location of the string if it was. If WINDOW is
- passed as non-null, set the window's node to be NODE, its point to be
- the found string, and readjust the window's pagetop. The DIR argument
- says which direction to search in. If it is positive, search
- forward, else backwards.
+/* Search for STRING in NODE starting at START. If the string was found,
+ return its location in POFF. If WINDOW is passed as non-null, set the
+ window's node to be NODE, its point to be the found string, and readjust
+ the window's pagetop. The DIR argument says which direction to search
+ in. If it is positive, search forward, else backwards.
The last argument, RESBND, makes sense only when USE_REGEX is set.
If the regexp search succeeds, RESBND is filled with the final state
of the search binding. In particular, its START and END fields contain
bounds of the found string instance.
*/
-static long
+static enum search_result
info_search_in_node_internal (char *string, NODE *node, long int start,
WINDOW *window, int dir, int case_sensitive,
- SEARCH_BINDING *resbnd)
+ int match_nodename, int match_regexp,
+ long *poff, SEARCH_BINDING *resbnd)
{
SEARCH_BINDING binding;
- long offset;
-
- binding.buffer = node->contents;
- binding.start = start;
- binding.end = node->nodelen;
+ enum search_result result = search_not_found;
+
binding.flags = 0;
if (!case_sensitive)
binding.flags |= S_FoldCase;
-
- if (dir < 0)
- {
- binding.end = 0;
- binding.flags |= S_SkipDest;
- }
-
- if (binding.start < 0)
- return -1;
-
/* For incremental searches, we always wish to skip past the string. */
if (isearch_is_active)
binding.flags |= S_SkipDest;
+
+ if (match_nodename)
+ {
+ /* Match_nodename is set when we have changed the node and are
+ about to start searching in the just loaded one. First of all
+ we need to see if the node name matches the search string. It
+ cannot be matched otherwise, because normally, the entire node
+ header line is excluded from searches.
- offset = (use_regex ?
- regexp_search (string, &binding, node->nodelen, resbnd):
- search (string, &binding));
+ If this initial match fails, we continue as usual. */
- if (offset != -1 && window)
+ int start_off = string_in_line (INFO_NODE_LABEL, node->contents);
+ if (start_off != -1)
+ {
+ start_off += skip_whitespace (node->contents + start_off);
+ binding.buffer = node->nodename;
+ binding.start = 0;
+ binding.end = strlen (node->nodename);
+
+ result = (match_regexp ?
+ regexp_search (string, &binding, poff, resbnd):
+ search (string, &binding, poff));
+ if (result == search_success)
+ *poff += start_off;
+ }
+ }
+
+ if (result != search_success)
+ {
+ binding.buffer = node->contents;
+ binding.start = start;
+ binding.end = node->nodelen;
+
+ if (dir < 0)
+ {
+ binding.end = node->body_start;
+ binding.flags |= S_SkipDest;
+ }
+
+ if (binding.start < 0)
+ return -1;
+ else if (binding.start < node->body_start)
+ binding.start = node->body_start;
+
+ result = (match_regexp ?
+ regexp_search (string, &binding, poff, resbnd):
+ search (string, &binding, poff));
+ }
+
+ if (result == search_success && window)
{
set_remembered_pagetop_and_point (window);
if (window->node != node)
window_set_node_of_window (window, node);
- window->point = offset;
+ window->point = *poff;
window_adjust_pagetop (window);
}
- return offset;
+ return result;
}
long
info_search_in_node (char *string, NODE *node, long int start,
- WINDOW *window, int dir, int case_sensitive)
+ WINDOW *window, int dir, int case_sensitive,
+ int match_regexp)
{
- return info_search_in_node_internal (string, node, start,
- window, dir, case_sensitive, NULL);
+ long offset;
+ if (info_search_in_node_internal (string, node, start,
+ window, dir, case_sensitive, 0,
+ match_regexp,
+ &offset, NULL) == search_success)
+ return offset;
+ return -1;
}
/* Search NODE, looking for the largest possible match of STRING. Start the
search at START. Return the absolute position of the match, or -1, if
no part of the string could be found. */
long
-info_target_search_node (NODE *node, char *string, long int start)
+info_target_search_node (NODE *node, char *string, long int start,
+ int use_regex_mask)
{
register int i;
long offset = 0;
@@ -3789,7 +3895,8 @@ info_target_search_node (NODE *node, char *string, long int start)
while (i)
{
target[i] = '\0';
- offset = info_search_in_node (target, node, start, NULL, 1, 0);
+ offset = info_search_in_node (target, node, start, NULL, 1, 0,
+ use_regex & use_regex_mask);
if (offset != -1)
break;
@@ -3824,7 +3931,8 @@ info_search_internal (char *string, WINDOW *window,
FILE_BUFFER *file_buffer;
char *initial_nodename;
long ret, start;
-
+ enum search_result result;
+
file_buffer = file_buffer_of_window (window);
initial_nodename = window->node->nodename;
@@ -3838,16 +3946,23 @@ info_search_internal (char *string, WINDOW *window,
``finding'' a string that is already under the cursor, anyway. */
start = window->point + dir;
- ret = info_search_in_node_internal
- (string, window->node, start, window, dir,
- case_sensitive, resbnd);
-
- if (ret != -1)
+ result = info_search_in_node_internal
+ (string, window->node, start, window, dir,
+ case_sensitive, 0, use_regex, &ret, resbnd);
+
+ switch (result)
{
+ case search_success:
/* We won! */
if (!echo_area_is_active && !isearch_is_active)
window_clear_echo_area ();
return 0;
+
+ case search_not_found:
+ break;
+
+ case search_failure:
+ return -1;
}
start = 0;
@@ -3920,12 +4035,13 @@ info_search_internal (char *string, WINDOW *window,
{
window_message_in_echo_area
(_("Searching subfile %s ..."),
- filename_non_directory (tag->filename), NULL);
+ filename_non_directory (tag->filename));
last_subfile = tag->filename;
}
- node = info_get_node (file_buffer->filename, tag->nodename);
+ node = info_get_node (file_buffer->filename, tag->nodename,
+ PARSE_NODE_VERBATIM);
if (!node)
{
@@ -3933,7 +4049,7 @@ info_search_internal (char *string, WINDOW *window,
if (!echo_area_is_active)
{
if (info_recent_file_error)
- info_error (info_recent_file_error, NULL, NULL);
+ info_error ("%s", info_recent_file_error);
else
info_error (msg_cant_file_node,
filename_non_directory (file_buffer->filename),
@@ -3945,19 +4061,20 @@ info_search_internal (char *string, WINDOW *window,
if (dir < 0)
start = tag->nodelen;
- ret =
+ result =
info_search_in_node_internal (string, node, start, window, dir,
- case_sensitive, resbnd);
+ case_sensitive, 1, use_regex,
+ &ret, resbnd);
/* Did we find the string in this node? */
- if (ret != -1)
+ if (result == search_success)
{
/* Yes! We win. */
remember_window_and_node (window, node);
if (!echo_area_is_active)
{
if (msg)
- window_message_in_echo_area ("%s", (char *) _(msg), NULL);
+ window_message_in_echo_area ("%s", _(msg));
else
window_clear_echo_area ();
}
@@ -3968,7 +4085,8 @@ info_search_internal (char *string, WINDOW *window,
our starting point. */
free (node);
- if (strcmp (initial_nodename, tag->nodename) == 0)
+ if (result == search_failure
+ || strcmp (initial_nodename, tag->nodename) == 0)
return -1;
}
}
@@ -3980,14 +4098,14 @@ DECLARE_INFO_COMMAND (info_search_case_sensitively,
{
last_search_direction = count > 0 ? 1 : -1;
last_search_case_sensitive = 1;
- info_search_1 (window, count, key, 1, 1);
+ info_search_1 (window, count, key, 1, 1, DFL_START);
}
DECLARE_INFO_COMMAND (info_search, _("Read a string and search for it"))
{
last_search_direction = count > 0 ? 1 : -1;
last_search_case_sensitive = 0;
- info_search_1 (window, count, key, 0, 1);
+ info_search_1 (window, count, key, 0, 1, DFL_START);
}
DECLARE_INFO_COMMAND (info_search_backward,
@@ -3995,17 +4113,38 @@ DECLARE_INFO_COMMAND (info_search_backward,
{
last_search_direction = count > 0 ? -1 : 1;
last_search_case_sensitive = 0;
- info_search_1 (window, -count, key, 0, 1);
-}
-
+ info_search_1 (window, -count, key, 0, 1, DFL_START);
+}
+
+/* Common entry point for the search functions. Arguments:
+ WINDOW The window to search in
+ COUNT The sign of this argument defines the search
+ direction (negative for searching backwards);
+ its absolute value gives number of repetitions.
+ CASE_SENSITIVE Whether the search is case-sensitive or not.
+ ASK_FOR_STRING When true, ask for the search string. Otherwise
+ use the previously supplied one (repeated search).
+ START Start position for the search. If DFL_START, use
+ the default start position (see info_search_internal
+ for details.
+*/
static void
info_search_1 (WINDOW *window, int count, unsigned char key,
- int case_sensitive, int ask_for_string)
+ int case_sensitive, int ask_for_string, long start)
{
char *line, *prompt;
int result, old_pagetop;
int direction;
+ SEARCH_BINDING bind, *bindp;
+ if (start == DFL_START)
+ bindp = NULL;
+ else
+ {
+ bind.start = start;
+ bindp = &bind;
+ }
+
if (count < 0)
{
direction = -1;
@@ -4051,14 +4190,21 @@ info_search_1 (WINDOW *window, int count, unsigned char key,
if (*line)
{
if (strlen (line) + 1 > (unsigned int) search_string_size)
- search_string = xrealloc
- (search_string, (search_string_size += 50 + strlen (line)));
+ search_string =
+ xrealloc (search_string,
+ (search_string_size += 50 + strlen (line)));
strcpy (search_string, line);
free (line);
}
}
+ if (mbslen (search_string) < min_search_length)
+ {
+ info_error ("%s", _("Search string too short"));
+ return;
+ }
+
/* If the search string includes upper-case letters, make the search
case-sensitive. */
if (case_sensitive == 0)
@@ -4073,10 +4219,10 @@ info_search_1 (WINDOW *window, int count, unsigned char key,
for (result = 0; result == 0 && count--; )
result = info_search_internal (search_string,
active_window, direction, case_sensitive,
- NULL);
+ bindp);
if (result != 0 && !info_error_was_printed)
- info_error (_("Search failed."), NULL, NULL);
+ info_error ("%s", _("Search failed."));
else if (old_pagetop != active_window->pagetop)
{
int new_pagetop;
@@ -4097,20 +4243,42 @@ DECLARE_INFO_COMMAND (info_search_next,
_("Repeat last search in the same direction"))
{
if (!last_search_direction)
- info_error (_("No previous search string"), NULL, NULL);
+ info_error ("%s", _("No previous search string"));
+ else if (search_skip_screen_p)
+ {
+ /* Find window bottom */
+ long n = window->height + window->pagetop;
+ if (n < window->line_count)
+ n = window->line_starts[n] - window->node->contents;
+ else
+ n = window->node->nodelen;
+ info_search_1 (window, last_search_direction * count,
+ key, last_search_case_sensitive, 0, n);
+ }
else
info_search_1 (window, last_search_direction * count,
- key, last_search_case_sensitive, 0);
+ key, last_search_case_sensitive, 0, DFL_START);
}
DECLARE_INFO_COMMAND (info_search_previous,
_("Repeat last search in the reverse direction"))
{
if (!last_search_direction)
- info_error (_("No previous search string"), NULL, NULL);
+ info_error ("%s", _("No previous search string"));
+ else if (search_skip_screen_p)
+ {
+ /* Find window bottom */
+ long n;
+
+ n = window->line_starts[window->pagetop] - window->node->contents - 1;
+ if (n < 0)
+ n = 0;
+ info_search_1 (window, -last_search_direction * count,
+ key, last_search_case_sensitive, 0, n);
+ }
else
info_search_1 (window, -last_search_direction * count,
- key, last_search_case_sensitive, 0);
+ key, last_search_case_sensitive, 0, DFL_START);
}
/* **************************************************************** */
@@ -4146,8 +4314,8 @@ static unsigned char isearch_terminate_search_key = ESC;
/* Array of search states. */
static SEARCH_STATE **isearch_states = NULL;
-static int isearch_states_index = 0;
-static int isearch_states_slots = 0;
+static size_t isearch_states_index = 0;
+static size_t isearch_states_slots = 0;
/* Push the state of this search. */
static void
@@ -4162,7 +4330,7 @@ push_isearch (WINDOW *window, int search_index, int direction, int failing)
state->failing = failing;
add_pointer_to_array (state, isearch_states_index, isearch_states,
- isearch_states_slots, 20, SEARCH_STATE *);
+ isearch_states_slots, 20);
}
/* Pop the state of this search to WINDOW, SEARCH_INDEX, and DIRECTION. */
@@ -4243,8 +4411,8 @@ show_isearch_prompt (int dir, unsigned char *string, int failing_p)
sprintf (prompt, "%s%s%s", failing_p ? _("Failing ") : "", prefix,
p_rep ? p_rep : "");
- window_message_in_echo_area ("%s", prompt, NULL);
- maybe_free (p_rep);
+ window_message_in_echo_area ("%s", prompt);
+ free (p_rep);
free (prompt);
display_cursor_at_point (active_window);
}
@@ -4427,7 +4595,7 @@ incremental_search (WINDOW *window, int count, unsigned char ignore)
then push it into pending input. */
if (isearch_string_index && func != (VFunction *) info_abort_key)
{
- maybe_free (last_isearch_accepted);
+ free (last_isearch_accepted);
last_isearch_accepted = xstrdup (isearch_string);
}
@@ -4581,8 +4749,9 @@ info_gc_file_buffers (void)
{
for (i = 0; iw->nodes && iw->nodes[i]; i++)
{
- if ((FILENAME_CMP (fb->fullpath, iw->nodes[i]->filename) == 0) ||
- (FILENAME_CMP (fb->filename, iw->nodes[i]->filename) == 0))
+ if (iw->nodes[i]->filename &&
+ ((FILENAME_CMP (fb->fullpath, iw->nodes[i]->filename) == 0) ||
+ (FILENAME_CMP (fb->filename, iw->nodes[i]->filename) == 0)))
{
fb_referenced_p = 1;
break;
@@ -4614,10 +4783,6 @@ info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
long placement = -1;
long start = 0;
NODE *node = window->node;
- int save_use_regex = use_regex;
-
- /* Most of our keywords contain * characters; don't use regexes. */
- use_regex = 0;
if (dir < 0)
start = node->nodelen;
@@ -4626,8 +4791,8 @@ info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
reference in the current node. Otherwise, the first menu or xref
found is moved to. */
- firstmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, start, NULL, dir, 0);
+ firstmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node, start,
+ NULL, dir, 0, 0);
/* FIRSTMENU may point directly to the line defining the menu. Skip that
and go directly to the first item. */
@@ -4637,12 +4802,12 @@ info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
char *text = node->contents + firstmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- firstmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, NULL, dir, 0);
+ firstmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ firstmenu + dir, NULL, dir, 0, 0);
}
firstxref =
- info_search_in_node (INFO_XREF_LABEL, node, start, NULL, dir, 0);
+ info_search_in_node (INFO_XREF_LABEL, node, start, NULL, dir, 0, 0);
#if defined (HANDLE_MAN_PAGES)
if ((firstxref == -1) && (node->flags & N_IsManPage))
@@ -4654,19 +4819,18 @@ info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
if (firstmenu == -1 && firstxref == -1)
{
if (!cursor_movement_scrolls_p)
- info_error (msg_no_xref_node, NULL, NULL);
- use_regex = save_use_regex;
+ info_error ("%s", msg_no_xref_node);
return cursor_movement_scrolls_p;
}
/* There is at least one cross reference or menu entry in this node.
Try hard to find the next available one. */
- nextmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, window->point + dir, NULL, dir, 0);
+ nextmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ window->point + dir, NULL, dir, 0, 0);
- nextxref = info_search_in_node
- (INFO_XREF_LABEL, node, window->point + dir, NULL, dir, 0);
+ nextxref = info_search_in_node (INFO_XREF_LABEL, node,
+ window->point + dir, NULL, dir, 0, 0);
#if defined (HANDLE_MAN_PAGES)
if ((nextxref == -1) && (node->flags & N_IsManPage) && (firstxref != -1))
@@ -4679,13 +4843,10 @@ info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir)
char *text = node->contents + nextmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- nextmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, NULL, dir, 0);
+ nextmenu = info_search_in_node (INFO_MENU_ENTRY_LABEL, node,
+ nextmenu + dir, NULL, dir, 0, 0);
}
- /* No more searches, back to whatever the user wanted. */
- use_regex = save_use_regex;
-
/* If there is both a next menu entry, and a next xref entry, choose the
one which occurs first. Otherwise, select the one which actually
appears in this node following point. */
@@ -4801,7 +4962,7 @@ DECLARE_INFO_COMMAND (info_abort_key, _("Cancel current operation"))
do it. */
if (!info_error_rings_bell_p)
terminal_ring_bell ();
- info_error (_("Quit"), NULL, NULL);
+ info_error ("%s", _("Quit"));
info_initialize_numeric_arg ();
info_clear_pending_input ();
@@ -4877,10 +5038,12 @@ DECLARE_INFO_COMMAND (info_redraw_display, _("Redraw the display"))
set_window_pagetop (window, new_pagetop);
}
}
-/* This command does nothing. It is the fact that a key is bound to it
- that has meaning. See the code at the top of info_session (). */
+
+/* Exit from info */
DECLARE_INFO_COMMAND (info_quit, _("Quit using Info"))
-{}
+{
+ quit_info_immediately = 1;
+}
/* **************************************************************** */
@@ -4903,7 +5066,7 @@ dispatch_error (char *keyseq)
rep = pretty_keyseq (keyseq);
if (!echo_area_is_active)
- info_error (_("Unknown command (%s)."), rep, NULL);
+ info_error (_("Unknown command (%s)."), rep);
else
{
char *temp = xmalloc (1 + strlen (rep) + strlen (_("\"%s\" is invalid")));
@@ -5220,6 +5383,22 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
key = 0;
}
}
+
+DECLARE_INFO_COMMAND (info_display_file_info,
+ _("Show full file name of node being displayed"))
+{
+ const char *fname = info_find_fullpath (window->node->filename);
+ if (fname)
+ {
+ int line = window_line_of_point (window);
+ window_message_in_echo_area ("File name: %s, line %d of %lu (%d%%)",
+ fname, line,
+ (unsigned long) window->line_count,
+ line * 100 / window->line_count);
+ }
+ else
+ window_message_in_echo_area ("Internal node");
+}
/* **************************************************************** */
/* */
@@ -5336,7 +5515,7 @@ info_gather_typeahead (void)
chars_avail = read (tty, &input[0], chars_avail);
}
#else /* !FIONREAD */
-# if defined (O_NDELAY)
+# if defined (O_NDELAY) && defined (F_GETFL) && defined (F_SETFL)
{
int flags;
@@ -5373,6 +5552,19 @@ info_gather_typeahead (void)
if (chars_avail)
chars_avail = read (tty, &input[0], chars_avail);
}
+# else
+# ifdef __MINGW32__
+ {
+ extern long w32_chars_avail (int);
+
+ chars_avail = w32_chars_avail (tty);
+
+ if (chars_avail > space_avail)
+ chars_avail = space_avail;
+ if (chars_avail)
+ chars_avail = read (tty, &input[0], chars_avail);
+ }
+# endif /* _WIN32 */
# endif/* __DJGPP__ */
# endif /* O_NDELAY */
#endif /* !FIONREAD */
@@ -5443,7 +5635,7 @@ info_get_input_char (void)
{
terminal_unprep_terminal ();
close_dribble_file ();
- xexit (0);
+ exit (EXIT_SUCCESS);
}
}
}
diff --git a/info/session.h b/info/session.h
index 2052d07..5a63b56 100644
--- a/info/session.h
+++ b/info/session.h
@@ -1,7 +1,7 @@
/* session.h -- Functions found in session.c.
- $Id: session.h,v 1.10 2008/03/04 09:44:57 gray Exp $
+ $Id: session.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1998, 1999, 2001, 2002, 2004, 2007
+ Copyright 1993, 1998, 1999, 2001, 2002, 2004, 2007, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef SESSION_H
#define SESSION_H
@@ -25,6 +25,8 @@
#include "info.h"
#include "dribble.h"
+extern int quit_info_immediately;
+
/* All commands that can be invoked from within info_session () receive
arguments in the same way. This simple define declares the header
of a function named NAME, with associated documentation DOC. The
@@ -86,16 +88,22 @@ extern void add_char_to_keyseq (char character);
extern void info_gather_typeahead (void);
extern FILE_BUFFER *file_buffer_of_window (WINDOW *window);
extern long info_search_in_node (char *string, NODE *node,
- long int start, WINDOW *window, int dir, int case_sensitive);
+ long int start, WINDOW *window, int dir, int case_sensitive,
+ int use_regexp);
extern long info_target_search_node (NODE *node, char *string,
- long int start);
+ long int start, int use_regexp_mask);
extern void info_select_reference (WINDOW *window, REFERENCE *entry);
extern int info_any_buffered_input_p (void);
extern void print_node (NODE *node);
+
+#define DUMP_APPEND 0x01
+#define DUMP_SUBNODES 0x02
+
extern void dump_node_to_file (NODE *node, char *filename,
- int dump_subnodes);
+ int flags);
extern void dump_nodes_to_file (char *filename, char **nodenames,
- char *output_filename, int dump_subnodes);
+ char *output_filename, int flags);
+
extern char *program_name_from_file_name (char *file_name);
/* Do the physical deletion of WINDOW, and forget this window and
@@ -118,13 +126,11 @@ extern void info_set_input_from_file (char *filename);
extern void begin_multiple_window_info_session (char *filename,
char **nodenames);
extern void begin_info_session (NODE *initial_node);
-extern void begin_info_session_with_error (NODE *initial_node,
- const char *format, void *arg1, void *arg2);
extern void info_session (void);
extern void initialize_info_session (NODE *node, int clear_screen);
extern void info_read_and_dispatch (void);
extern void info_intuit_options_node (WINDOW *window,
- NODE *initial_node, char *program);
+ NODE *initial_node, char *program);
/* Moving the point within a node. */
extern void info_next_line (WINDOW *window, int count, unsigned char key);
@@ -198,7 +204,7 @@ extern void info_kill_node (WINDOW *window, int count, unsigned char key);
extern void info_view_file (WINDOW *window, int count, unsigned char key);
extern void info_menu_sequence (WINDOW *window, int count, unsigned char key);
extern NODE *info_follow_menus (NODE *initial_node, char **menus,
- const char **errstr, char **errarg1, char **errarg2);
+ NODE **err_node, int strict);
extern void info_man (WINDOW *window, int count, unsigned char key);
extern void list_visited_nodes (WINDOW *window, int count, unsigned char key);
extern void select_visited_node (WINDOW *window, int count, unsigned char key);
diff --git a/info/signals.c b/info/signals.c
index 0657f97..39418bd 100644
--- a/info/signals.c
+++ b/info/signals.c
@@ -1,7 +1,7 @@
/* signals.c -- install and maintain signal handlers.
- $Id: signals.c,v 1.10 2007/07/01 21:20:31 karl Exp $
+ $Id: signals.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003, 2004, 2007
+ Copyright 1993, 1994, 1995, 1998, 2002, 2003, 2004, 2007, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "signals.h"
@@ -151,7 +151,7 @@ initialize_info_signal_handler (void)
#endif
}
-static void
+void
redisplay_after_signal (void)
{
terminal_clear_screen ();
@@ -162,7 +162,7 @@ redisplay_after_signal (void)
fflush (stdout);
}
-static void
+void
reset_info_window_sizes (void)
{
terminal_goto_xy (0, 0);
diff --git a/info/signals.h b/info/signals.h
index 08992ad..3960285 100644
--- a/info/signals.h
+++ b/info/signals.h
@@ -1,7 +1,7 @@
/* signals.h -- header to include system dependent signal definitions.
- $Id: signals.h,v 1.5 2007/07/01 21:20:31 karl Exp $
+ $Id: signals.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1994, 1995, 1997, 2002, 2004, 2007
+ Copyright 1993, 1994, 1995, 1997, 2002, 2004, 2007, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_SIGNALS_H
#define INFO_SIGNALS_H
diff --git a/info/tag.c b/info/tag.c
new file mode 100644
index 0000000..f2a907d
--- /dev/null
+++ b/info/tag.c
@@ -0,0 +1,273 @@
+/* tag.c -- Functions to handle Info tags (that is, the special
+ construct for images, not the "tag table" of starting position.)
+ $Id: tag.c 5338 2013-08-22 17:58:30Z karl $
+
+ Copyright 2012, 2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
+
+#include "info.h"
+#include "tag.h"
+#include "info-utils.h"
+
+struct tag_handler
+{
+ const char *name;
+ size_t len;
+ int (*handler) (char *, struct text_buffer *);
+};
+
+struct info_tag
+{
+ struct info_tag *next;
+ char *kw;
+ char *val;
+};
+
+static void
+info_tag_free (struct info_tag *tag)
+{
+ while (tag)
+ {
+ struct info_tag *next = tag->next;
+ free (tag->kw);
+ free (tag->val);
+ free (tag);
+ tag = next;
+ }
+}
+
+
+/* See if KW is one of the tags in the list starting at TAG. */
+
+static struct info_tag *
+info_tag_find (struct info_tag *tag, const char *kw)
+{
+ for (; tag; tag = tag->next)
+ if (strcmp (tag->kw, kw) == 0)
+ return tag;
+ return NULL;
+}
+
+
+/* Found a keyword when parsing the full tag string: alt, text, etc.
+ Return the new tag, update *TMPBUF_PTR and set *KW. */
+
+static struct info_tag *
+tag_found_keyword (struct text_buffer *tmpbuf_ptr, char **kw)
+{
+ struct info_tag *tag = xmalloc (sizeof (*tag));
+ tag->next = NULL; /* have to update in caller */
+
+ text_buffer_add_char (tmpbuf_ptr, 0);
+ if (*kw != tmpbuf_ptr->base) { /* in case tmpbuf got realloc-ed */
+ *kw = tmpbuf_ptr->base; /* ick */
+ }
+ tag->kw = xstrdup (*kw);
+ tag->val = xstrdup (*kw + strlen(*kw) + 1);
+ text_buffer_reset (tmpbuf_ptr);
+
+ return tag;
+}
+
+/* Handle the image tag. */
+
+static int
+tag_image (char *text, struct text_buffer *outbuf)
+{
+ mbi_iterator_t iter;
+ enum { state_kw, state_val, state_qstr, state_delim } state = state_kw;
+ struct text_buffer tmpbuf;
+ char *kw;
+ struct info_tag *tag_head = NULL, *tag;
+ int escaped = 0;
+
+ text_buffer_init (&tmpbuf);
+ for (mbi_init (iter, text, strlen (text)); mbi_avail (iter);
+ mbi_advance (iter))
+ {
+ const char *cur_ptr;
+ size_t cur_len;
+
+ if (mb_isspace (mbi_cur (iter)))
+ {
+ if (state == state_val)
+ {
+ struct info_tag *new_kw = tag_found_keyword (&tmpbuf, &kw);
+ new_kw->next = tag_head;
+ tag_head = new_kw;
+ state = state_delim;
+ continue;
+ }
+ if (state == state_delim)
+ continue;
+ }
+ else if (state == state_delim)
+ state = state_kw;
+ cur_len = mb_len (mbi_cur (iter));
+ cur_ptr = mbi_cur_ptr (iter);
+
+ if (state == state_qstr && escaped)
+ {
+ escaped = 0;
+ }
+ else if (cur_len == 1)
+ {
+ switch (*cur_ptr)
+ {
+ case '=':
+ if (state != state_kw)
+ break;
+ text_buffer_add_char (&tmpbuf, 0);
+ kw = tmpbuf.base;
+ if (!mbi_avail (iter))
+ break;
+ mbi_advance (iter);
+ state = state_val;
+ cur_len = mb_len (mbi_cur (iter));
+ cur_ptr = mbi_cur_ptr (iter);
+ if (!(cur_len == 1 && *cur_ptr == '"'))
+ break;
+ /* fall through */
+
+ case '"':
+ if (state == state_val)
+ {
+ state = state_qstr;
+ continue;
+ }
+ if (state == state_qstr)
+ {
+ struct info_tag *new_kw = tag_found_keyword (&tmpbuf, &kw);
+ new_kw->next = tag_head;
+ tag_head = new_kw;
+ state = state_delim;
+ continue;
+ }
+ break;
+
+ case '\\':
+ if (state == state_qstr)
+ {
+ escaped = 1;
+ continue;
+ }
+ }
+ }
+ text_buffer_add_string (&tmpbuf, cur_ptr, cur_len);
+ }
+
+ tag = info_tag_find (tag_head, "text");
+ if (!tag)
+ tag = info_tag_find (tag_head, "alt");
+
+ if (tag)
+ {
+ text_buffer_add_string (outbuf, tag->val, strlen (tag->val));
+ }
+
+ text_buffer_free (&tmpbuf);
+ info_tag_free (tag_head);
+ return 0;
+}
+
+
+/* We don't do anything with the index tag; it'll just be ignored. */
+
+static struct tag_handler tagtab[] = {
+ { "image", 5, tag_image },
+ { "index", 5, NULL },
+ { NULL }
+};
+
+static struct tag_handler *
+find_tag_handler (char *tag, size_t taglen)
+{
+ struct tag_handler *tp;
+
+ for (tp = tagtab; tp->name; tp++)
+ if (taglen >= tp->len && strncmp (tp->name, tag, tp->len) == 0)
+ return tp;
+ return NULL;
+}
+
+/* Expand \b[...\b] constructs in INPUT (of INPUTLEN bytes). If encountered,
+ put the expanded text into PBUF, store its length in PBUFLEN, and return
+ 1. Otherwise, don't touch neither of the latter and return 0. */
+int
+tags_expand (char *input, size_t inputlen, char **pbuf, size_t *pbuflen)
+{
+ char *endp = input + inputlen;
+ struct text_buffer outbuf;
+ int text_buffer_used = 0;
+ char *p;
+
+ while ((p = input + strlen (input)) < endp) /* go forward to null */
+ {
+ if (memcmp(p + 1, "\b[", 2) == 0) /* opening magic? */
+ {
+ char *q;
+
+ if (!text_buffer_used)
+ {
+ text_buffer_init (&outbuf);
+ text_buffer_used = 1;
+ }
+
+ p += 3;
+ q = p + strlen (p); /* forward to next null */
+ if (memcmp (q + 1, "\b]", 2) == 0) /* closing magic? */
+ {
+ size_t len;
+ struct tag_handler *tp;
+
+ len = strcspn (p, " \t"); /* tag name */
+ tp = find_tag_handler (p, len);
+ if (tp)
+ {
+ while (p[len] == ' ' || p[len] == '\t')
+ ++len; /* move past whitespace */
+
+ text_buffer_add_string (&outbuf, input, p - input - 3);
+ if (!tp->handler || tp->handler (p + len, &outbuf) == 0)
+ {
+ input = q + 3;
+ continue;
+ }
+ }
+ }
+ }
+
+ if (text_buffer_used)
+ text_buffer_add_string (&outbuf, input, p - input);
+
+ input = p + 1;
+ }
+
+ if (text_buffer_used && text_buffer_off (&outbuf))
+ {
+ if (input < endp)
+ text_buffer_add_string (&outbuf, input, endp - input);
+ *pbuflen = text_buffer_off (&outbuf);
+ *pbuf = text_buffer_base (&outbuf);
+ return 1;
+ }
+ return 0;
+}
+
+void
+handle_tag (char *tag)
+{
+ /* Nothing so far */
+}
diff --git a/info/tag.h b/info/tag.h
new file mode 100644
index 0000000..65195b8
--- /dev/null
+++ b/info/tag.h
@@ -0,0 +1,25 @@
+/* tag.c -- Functions to handle Info tags.
+ $Id: tag.h 5337 2013-08-22 17:54:06Z karl $
+
+ Copyright 2012, 2013 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 3 of the License, 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, see <http://www.gnu.org/licenses/>. */
+
+#ifndef TAG_H
+#define TAG_H
+
+int tags_expand (char *input, size_t inputlen, char **pbuf, size_t *pbuflen);
+void handle_tag (char *tag);
+
+#endif
diff --git a/info/termdep.h b/info/termdep.h
index d8343d5..73683b7 100644
--- a/info/termdep.h
+++ b/info/termdep.h
@@ -1,7 +1,7 @@
/* termdep.h -- system things that terminal.c depends on.
- $Id: termdep.h,v 1.5 2007/07/01 21:20:31 karl Exp $
+ $Id: termdep.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1996, 1997, 1998, 2001, 2002, 2007
+ Copyright 1993, 1996, 1997, 1998, 2001, 2002, 2007, 2012, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_TERMDEP_H
#define INFO_TERMDEP_H
@@ -43,7 +43,9 @@
# endif /* M_XENIX */
# endif /* HAVE_SYS_PTEM_H */
# else /* !HAVE_TERMIO_H */
+# ifndef __MINGW32__
# include <sgtty.h>
+# endif
# endif /* !HAVE_TERMIO_H */
#endif /* !HAVE_TERMIOS_H */
@@ -55,4 +57,8 @@
# include <sys/ttold.h>
#endif /* HAVE_SYS_TTOLD_H */
+#ifdef _WIN32
+extern unsigned sleep (unsigned);
+#endif
+
#endif /* not INFO_TERMDEP_H */
diff --git a/info/terminal.c b/info/terminal.c
index 660b8e3..3f430b3 100644
--- a/info/terminal.c
+++ b/info/terminal.c
@@ -1,8 +1,9 @@
/* terminal.c -- how to handle the physical terminal for Info.
- $Id: terminal.c,v 1.7 2008/06/11 09:55:43 gray Exp $
+ $Id: terminal.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
- 1999, 2001, 2002, 2004, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998,
+ 1999, 2001, 2002, 2004, 2007, 2008, 2012, 2013
+ 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
@@ -17,7 +18,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Originally written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "terminal.h"
@@ -43,7 +44,7 @@ char PC; /* Pad character */
short ospeed; /* Terminal output baud rate */
extern int tgetnum (), tgetflag (), tgetent ();
extern char *tgetstr (), *tgoto ();
-extern void tputs ();
+extern int tputs ();
#endif /* not HAVE_TERMCAP_H */
#endif /* not HAVE_NCURSES_TERMCAP_H */
@@ -412,25 +413,21 @@ terminal_scroll_terminal (int start, int end, int amount)
if (terminal_scroll_terminal_hook)
(*terminal_scroll_terminal_hook) (start, end, amount);
- else
+ else if (amount > 0)
{
/* If we are scrolling down, delete AMOUNT lines at END. Then insert
AMOUNT lines at START. */
- if (amount > 0)
- {
- terminal_delete_lines (end, amount);
- terminal_insert_lines (start, amount);
- }
-
+ terminal_delete_lines (end, amount);
+ terminal_insert_lines (start, amount);
+ }
+ else
+ {
/* If we are scrolling up, delete AMOUNT lines before START. This
actually does the upwards scroll. Then, insert AMOUNT lines
after the already scrolled region (i.e., END - AMOUNT). */
- if (amount < 0)
- {
- int abs_amount = -amount;
- terminal_delete_lines (start - abs_amount, abs_amount);
- terminal_insert_lines (end - abs_amount, abs_amount);
- }
+ int abs_amount = -amount;
+ terminal_delete_lines (start - abs_amount, abs_amount);
+ terminal_insert_lines (end - abs_amount, abs_amount);
}
}
@@ -572,7 +569,9 @@ terminal_initialize_terminal (char *terminal_name)
ospeed = B9600;
}
# else
+#ifndef __MINGW32__
ospeed = B9600;
+#endif
# endif /* !TIOCGETP */
#endif
@@ -663,7 +662,9 @@ struct termio original_termio, ttybuff;
/* Buffers containing the terminal mode flags upon entry to info. */
int original_tty_flags = 0;
int original_lmode;
+#ifndef __MINGW32__
struct sgttyb ttybuff;
+#endif
# if defined(TIOCGETC) && defined(M_XENIX)
/* SCO 3.2v5.0.2 defines but does not support TIOCGETC. Gak. Maybe
@@ -758,7 +759,7 @@ terminal_prep_terminal (void)
# endif
#endif
-#if !defined (HAVE_TERMIOS_H) && !defined (HAVE_TERMIO_H)
+#if !defined (HAVE_TERMIOS_H) && !defined (HAVE_TERMIO_H) && !defined(__MINGW32__)
ioctl (tty, TIOCGETP, &ttybuff);
if (!original_tty_flags)
@@ -819,9 +820,11 @@ terminal_prep_terminal (void)
}
# endif /* TIOCGLTC */
+# ifndef __MINGW32__
ttybuff.sg_flags &= ~ECHO;
ttybuff.sg_flags |= CBREAK;
ioctl (tty, TIOCSETN, &ttybuff);
+# endif
#endif /* !HAVE_TERMIOS_H && !HAVE_TERMIO_H */
}
@@ -846,9 +849,11 @@ terminal_unprep_terminal (void)
# if defined (HAVE_TERMIO_H)
ioctl (tty, TCSETA, &original_termio);
# else /* !HAVE_TERMIO_H */
+# ifndef __MINGW32__
ioctl (tty, TIOCGETP, &ttybuff);
ttybuff.sg_flags = original_tty_flags;
ioctl (tty, TIOCSETN, &ttybuff);
+# endif
# if defined (TIOCGETC)
ioctl (tty, TIOCSETC, &original_tchars);
@@ -867,6 +872,6 @@ terminal_unprep_terminal (void)
terminal_end_using_terminal ();
}
-#ifdef __MSDOS__
+#if defined(__MSDOS__) || defined(__MINGW32__)
# include "pcterm.c"
#endif
diff --git a/info/terminal.h b/info/terminal.h
index 135b3ae..325231f 100644
--- a/info/terminal.h
+++ b/info/terminal.h
@@ -1,7 +1,7 @@
/* terminal.h -- The external interface to terminal I/O.
- $Id: terminal.h,v 1.6 2007/07/01 21:20:31 karl Exp $
+ $Id: terminal.h 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1996, 1997, 2001, 2002, 2004, 2007
+ Copyright 1993, 1996, 1997, 2001, 2002, 2004, 2007, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally uWritten by Brian Fox. */
#if !defined (TERMINAL_H)
#define TERMINAL_H
diff --git a/info/tilde.c b/info/tilde.c
index 9bd8852..73bc403 100644
--- a/info/tilde.c
+++ b/info/tilde.c
@@ -1,8 +1,8 @@
/* tilde.c -- tilde expansion code (~/foo := $HOME/foo).
- $Id: tilde.c,v 1.8 2008/06/11 09:55:43 gray Exp $
+ $Id: tilde.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999,
- 2002, 2004, 2006, 2007, 2008 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999,
+ 2002, 2004, 2006, 2007, 2008, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "tilde.h"
@@ -174,7 +174,7 @@ tilde_expand (char *string)
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
char *
-tilde_expand_word (char *filename)
+tilde_expand_word (const char *filename)
{
char *dirname = filename ? xstrdup (filename) : NULL;
@@ -190,11 +190,15 @@ tilde_expand_word (char *filename)
the password database. */
if (!temp_home)
{
+#ifndef __MINGW32__
struct passwd *entry;
entry = (struct passwd *) getpwuid (getuid ());
if (entry)
temp_home = entry->pw_dir;
+#else
+ temp_home = ".";
+#endif
}
temp_name = xmalloc (1 + strlen (&dirname[1])
@@ -210,7 +214,9 @@ tilde_expand_word (char *filename)
}
else
{
+#ifndef __MINGW32__
struct passwd *user_entry;
+#endif
char *username = xmalloc (257);
int i, c;
@@ -223,6 +229,7 @@ tilde_expand_word (char *filename)
}
username[i - 1] = 0;
+#ifndef __MINGW32__
if (!(user_entry = (struct passwd *) getpwnam (username)))
{
/* If the calling program has a special syntax for
@@ -259,6 +266,24 @@ tilde_expand_word (char *filename)
endpwent ();
free (username);
+#else
+ if (tilde_expansion_failure_hook)
+ {
+ char *expansion = (*tilde_expansion_failure_hook) (username);
+
+ if (expansion)
+ {
+ temp_name = xmalloc (1 + strlen (expansion)
+ + strlen (&dirname[i]));
+ strcpy (temp_name, expansion);
+ strcat (temp_name, &dirname[i]);
+ free (expansion);
+ }
+ }
+ free (dirname);
+ dirname = xstrdup (temp_name);
+ free (temp_name);
+#endif
}
}
return dirname;
@@ -296,7 +321,7 @@ main (argc, argv)
printf (" --> %s\n", result);
free (result);
}
- xexit (0);
+ exit (EXIT_SUCCESS);
}
static void memory_error_and_abort ();
diff --git a/info/tilde.h b/info/tilde.h
index 4287cb5..53b2a2f 100644
--- a/info/tilde.h
+++ b/info/tilde.h
@@ -1,10 +1,7 @@
-/* tilde.h: Externally available variables and function in libtilde.a.
- $Id: tilde.h,v 1.6 2007/07/01 21:20:31 karl Exp $
+/* tilde.h: tilde expansion.
+ $Id: tilde.h 5337 2013-08-22 17:54:06Z karl $
- This file has appeared in prior works by the Free Software Foundation;
- thus it carries copyright dates from 1988 through 1993.
-
- Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 2004, 2007
+ Copyright 1988, 1989, 1990, 1991, 1992, 1993, 2004, 2007, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -20,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox (for bash). */
#ifndef TILDE_H
#define TILDE_H
@@ -48,6 +45,6 @@ extern char *tilde_expand (char *string);
/* Do the work of tilde expansion on FILENAME. FILENAME starts with a
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
-extern char *tilde_expand_word (char *filename);
+extern char *tilde_expand_word (const char *filename);
#endif /* not TILDE_H */
diff --git a/info/variables.c b/info/variables.c
index 292e45d..028099c 100644
--- a/info/variables.c
+++ b/info/variables.c
@@ -1,7 +1,7 @@
/* variables.c -- how to manipulate user visible variables in Info.
- $Id: variables.c,v 1.10 2008/06/11 09:55:43 gray Exp $
+ $Id: variables.c 5337 2013-08-22 17:54:06Z karl $
- Copyright (C) 1993, 1997, 2001, 2002, 2004, 2007, 2008
+ Copyright 1993, 1997, 2001, 2002, 2004, 2007, 2008, 2011, 2013
Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "variables.h"
@@ -82,6 +82,13 @@ VARIABLE_ALIST info_variables[] = {
"last node"),
&scroll_last_node, (char**)scroll_last_node_choices },
+ { "min-search-length",
+ N_("Minimal length of a search string"),
+ &min_search_length, NULL },
+
+ { "search-skip-screen",
+ N_("Skip current window when searching"),
+ &search_skip_screen_p, (char **)on_off_choices },
{ NULL }
};
@@ -106,7 +113,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
sprintf (description, "%s (%d): %s.",
var->name, *(var->value), _(var->doc));
- window_message_in_echo_area ("%s", description, NULL);
+ window_message_in_echo_area ("%s", description);
free (description);
}
@@ -159,8 +166,8 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
{
register int i;
REFERENCE **array = NULL;
- int array_index = 0;
- int array_slots = 0;
+ size_t array_index = 0;
+ size_t array_slots = 0;
for (i = 0; var->choices[i]; i++)
{
@@ -171,8 +178,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
entry->nodename = NULL;
entry->filename = NULL;
- add_pointer_to_array
- (entry, array_index, array, array_slots, 10, REFERENCE *);
+ add_pointer_to_array (entry, array_index, array, array_slots, 10);
}
sprintf (prompt, _("Set %s to value (%s): "),
@@ -265,7 +271,7 @@ make_variable_completions_array (void)
{
register int i;
REFERENCE **array = NULL;
- int array_index = 0, array_slots = 0;
+ size_t array_index = 0, array_slots = 0;
for (i = 0; info_variables[i].name; i++)
{
@@ -276,44 +282,52 @@ make_variable_completions_array (void)
entry->nodename = NULL;
entry->filename = NULL;
- add_pointer_to_array
- (entry, array_index, array, array_slots, 200, REFERENCE *);
+ add_pointer_to_array (entry, array_index, array, array_slots, 200);
}
return array;
}
-#if defined(INFOKEY)
-
-void
+int
set_variable_to_value(char *name, char *value)
{
- register int i;
-
- /* Find the variable in our list of variables. */
- for (i = 0; info_variables[i].name; i++)
- if (strcmp(info_variables[i].name, name) == 0)
- break;
-
- if (!info_variables[i].name)
- return;
-
- if (info_variables[i].choices)
- {
- register int j;
+ register int i;
- /* Find the choice in our list of choices. */
- for (j = 0; info_variables[i].choices[j]; j++)
- if (strcmp (info_variables[i].choices[j], value) == 0)
- break;
+ /* Find the variable in our list of variables. */
+ for (i = 0; info_variables[i].name; i++)
+ if (strcmp(info_variables[i].name, name) == 0)
+ break;
- if (info_variables[i].choices[j])
- *info_variables[i].value = j;
- }
- else
+ if (!info_variables[i].name)
+ {
+ errno = ENOENT;
+ return -1;
+ }
+
+ if (info_variables[i].choices)
+ {
+ register int j;
+
+ /* Find the choice in our list of choices. */
+ for (j = 0; info_variables[i].choices[j]; j++)
+ if (strcmp (info_variables[i].choices[j], value) == 0)
+ {
+ *info_variables[i].value = j;
+ return 0;
+ }
+ }
+ else
+ {
+ char *p;
+ long n = strtol (value, &p, 10);
+ if (*p == 0 && INT_MIN <= n && n <= INT_MAX)
{
- *info_variables[i].value = atoi(value);
+ *info_variables[i].value = n;
+ return 0;
}
+ }
+
+ errno = EINVAL;
+ return -1;
}
-#endif /* INFOKEY */
diff --git a/info/variables.h b/info/variables.h
index 309814e..e81f01f 100644
--- a/info/variables.h
+++ b/info/variables.h
@@ -1,10 +1,8 @@
/* variables.h -- Description of user visible variables in Info.
- $Id: variables.h,v 1.9 2008/03/04 09:45:27 gray Exp $
+ $Id: variables.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2011, 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_VARIABLES_H
#define INFO_VARIABLES_H
@@ -63,5 +61,7 @@ extern int window_scroll_step;
extern int cursor_movement_scrolls_p;
extern int ISO_Latin_p;
extern int scroll_last_node;
+extern int min_search_length;
+extern int search_skip_screen_p;
#endif /* not INFO_VARIABLES_H */
diff --git a/info/window.c b/info/window.c
index fdbeb33..52ec24c 100644
--- a/info/window.c
+++ b/info/window.c
@@ -1,8 +1,8 @@
/* window.c -- windows in Info.
- $Id: window.c,v 1.17 2008/09/13 10:01:31 gray Exp $
+ $Id: window.c 5334 2013-08-20 19:15:05Z gray $
- Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003, 2004, 2007, 2008
- Free Software Foundation, Inc.
+ Copyright 1993, 1997, 1998, 2001, 2002, 2003, 2004, 2007, 2008,
+ 2011, 2012, 2013 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
@@ -17,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#include "info.h"
#include "nodes.h"
@@ -25,6 +25,7 @@
#include "display.h"
#include "info-utils.h"
#include "infomap.h"
+#include "tag.h"
/* The window which describes the screen. */
WINDOW *the_screen = NULL;
@@ -136,7 +137,8 @@ window_new_screen_size (int width, int height)
if (!windows->next)
{
windows->height = 0;
- maybe_free (windows->line_starts);
+ free (windows->line_starts);
+ free (windows->log_line_no);
windows->line_starts = NULL;
windows->line_count = 0;
break;
@@ -184,7 +186,7 @@ window_new_screen_size (int width, int height)
if ((win->width != width) && ((win->flags & W_InhibitMode) == 0))
{
win->width = width;
- maybe_free (win->modeline);
+ free (win->modeline);
win->modeline = xmalloc (1 + width);
}
@@ -291,7 +293,7 @@ window_make_window (NODE *node)
chain cannot start at window->height, since that is where the modeline
for the previous window is displayed. The inverse adjustment is made
in window_delete_window (). */
- window = xmalloc (sizeof (WINDOW));
+ window = xzalloc (sizeof (WINDOW));
window->width = the_screen->width;
window->height = (active_window->height / 2) - 1;
#if defined (SPLIT_BEFORE_ACTIVE)
@@ -584,9 +586,11 @@ window_toggle_wrap (WINDOW *window)
if (window != the_echo_area)
{
char **old_starts;
+ size_t *old_xlat;
int old_lines, old_pagetop;
old_starts = window->line_starts;
+ old_xlat = window->log_line_no;
old_lines = window->line_count;
old_pagetop = window->pagetop;
@@ -601,7 +605,8 @@ window_toggle_wrap (WINDOW *window)
if (old_pagetop == window->pagetop)
display_scroll_line_starts
(window, old_pagetop, old_starts, old_lines);
- maybe_free (old_starts);
+ free (old_starts);
+ free (old_xlat);
}
window->flags |= W_UpdateWindow;
}
@@ -645,11 +650,9 @@ window_delete_window (WINDOW *window)
else
prev->next = next;
- if (window->line_starts)
- free (window->line_starts);
-
- if (window->modeline)
- free (window->modeline);
+ free (window->line_starts);
+ free (window->log_line_no);
+ free (window->modeline);
if (window == active_window)
{
@@ -800,18 +803,36 @@ window_physical_lines (NODE *node)
struct calc_closure {
WINDOW *win;
- int line_starts_slots; /* FIXME: size_t */
+ size_t line_starts_slots;
};
+static void
+calc_closure_expand (struct calc_closure *cp)
+{
+ if (cp->win->line_count == cp->line_starts_slots)
+ {
+ if (cp->line_starts_slots == 0)
+ cp->line_starts_slots = 100;
+ cp->win->line_starts = x2nrealloc (cp->win->line_starts,
+ &cp->line_starts_slots,
+ sizeof (cp->win->line_starts[0]));
+ cp->win->log_line_no = xrealloc (cp->win->log_line_no,
+ cp->line_starts_slots *
+ sizeof (cp->win->log_line_no[0]));
+ }
+}
+
static int
-_calc_line_starts (void *closure, size_t line_index,
+_calc_line_starts (void *closure, size_t pline_index, size_t lline_index,
const char *src_line,
char *printed_line, size_t pl_index, size_t pl_count)
{
struct calc_closure *cp = closure;
- add_pointer_to_array (src_line,
- cp->win->line_count, cp->win->line_starts,
- cp->line_starts_slots, 100, char *);
+
+ calc_closure_expand (cp);
+ cp->win->line_starts[cp->win->line_count] = (char*) src_line;
+ cp->win->log_line_no[cp->win->line_count] = lline_index;
+ cp->win->line_count++;
return 0;
}
@@ -821,6 +842,7 @@ calculate_line_starts (WINDOW *window)
struct calc_closure closure;
window->line_starts = NULL;
+ window->log_line_no = NULL;
window->line_count = 0;
if (!window->node)
@@ -830,16 +852,39 @@ calculate_line_starts (WINDOW *window)
closure.line_starts_slots = 0;
process_node_text (window, window->node->contents, 0,
_calc_line_starts, &closure);
+ calc_closure_expand (&closure);
+ window->line_starts[window->line_count] = NULL;
+ window->log_line_no[window->line_count] = 0;
+ window_line_map_init (window);
}
/* Given WINDOW, recalculate the line starts for the node it displays. */
void
recalculate_line_starts (WINDOW *window)
{
- maybe_free (window->line_starts);
+ free (window->line_starts);
+ free (window->log_line_no);
calculate_line_starts (window);
}
+/* Return the number of first physical line corresponding to the logical
+ line LN.
+
+ A logical line can occupy one or more physical lines of output. It
+ occupies more than one physical line if its width is greater than the
+ window width and the flag W_NoWrap is not set for that window.
+ */
+size_t
+window_log_to_phys_line (WINDOW *window, size_t ln)
+{
+ size_t i;
+
+ if (ln > window->line_count)
+ return 0;
+ for (i = ln; i < window->line_count && window->log_line_no[i] < ln; i++)
+ ;
+ return i;
+}
/* Global variable control redisplay of scrolled windows. If non-zero,
it is the desired number of lines to scroll the window in order to
@@ -923,7 +968,13 @@ window_line_of_point (WINDOW *window)
break;
}
- return i - 1;
+ /* Something is wrong with the above logic as it allows a negative
+ index to be returned for small windows. Until someone figures it
+ out, at least don&#39;t core dump. */
+ if (i > 0)
+ return i - 1;
+ else
+ return 0;
}
/* Get and return the goal column for this window. */
@@ -1118,12 +1169,12 @@ window_set_state (WINDOW *window, SEARCH_STATE *state)
static NODE *echo_area_node = NULL;
/* Make the node of the_echo_area be an empty one. */
-static void
+void
free_echo_area (void)
{
if (echo_area_node)
{
- maybe_free (echo_area_node->contents);
+ free (echo_area_node->contents);
free (echo_area_node);
}
@@ -1140,17 +1191,27 @@ window_clear_echo_area (void)
display_update_one_window (the_echo_area);
}
+void
+vwindow_message_in_echo_area (const char *format, va_list ap)
+{
+ free_echo_area ();
+ echo_area_node = build_message_node (format, ap);
+ window_set_node_of_window (the_echo_area, echo_area_node);
+ display_update_one_window (the_echo_area);
+}
+
/* Make a message appear in the echo area, built from FORMAT, ARG1 and ARG2.
The arguments are treated similar to printf () arguments, but not all of
printf () hair is present. The message appears immediately. If there was
already a message appearing in the echo area, it is removed. */
void
-window_message_in_echo_area (const char *format, void *arg1, void *arg2)
+window_message_in_echo_area (const char *format, ...)
{
- free_echo_area ();
- echo_area_node = build_message_node (format, arg1, arg2);
- window_set_node_of_window (the_echo_area, echo_area_node);
- display_update_one_window (the_echo_area);
+ va_list ap;
+
+ va_start (ap, format);
+ vwindow_message_in_echo_area (format, ap);
+ va_end (ap);
}
/* Place a temporary message in the echo area built from FORMAT, ARG1
@@ -1158,20 +1219,24 @@ window_message_in_echo_area (const char *format, void *arg1, void *arg2)
any existing message. A future call to unmessage_in_echo_area ()
restores the old contents. */
static NODE **old_echo_area_nodes = NULL;
-static int old_echo_area_nodes_index = 0;
-static int old_echo_area_nodes_slots = 0;
+static size_t old_echo_area_nodes_index = 0;
+static size_t old_echo_area_nodes_slots = 0;
void
-message_in_echo_area (const char *format, void *arg1, void *arg2)
+message_in_echo_area (const char *format, ...)
{
+ va_list ap;
+
if (echo_area_node)
{
add_pointer_to_array (echo_area_node, old_echo_area_nodes_index,
old_echo_area_nodes, old_echo_area_nodes_slots,
- 4, NODE *);
+ 4);
}
echo_area_node = NULL;
- window_message_in_echo_area (format, arg1, arg2);
+ va_start (ap, format);
+ vwindow_message_in_echo_area (format, ap);
+ va_end (ap);
}
void
@@ -1187,186 +1252,57 @@ unmessage_in_echo_area (void)
}
/* A place to build a message. */
-static char *message_buffer = NULL;
-static int message_buffer_index = 0;
-static int message_buffer_size = 0;
-
-/* Ensure that there is enough space to stuff LENGTH characters into
- MESSAGE_BUFFER. */
-static void
-message_buffer_resize (int length)
-{
- if (!message_buffer)
- {
- message_buffer_size = length + 1;
- message_buffer = xmalloc (message_buffer_size);
- message_buffer_index = 0;
- }
-
- while (message_buffer_size <= message_buffer_index + length)
- message_buffer = (char *)
- xrealloc (message_buffer,
- message_buffer_size += 100 + (2 * length));
-}
+static struct text_buffer message_buffer;
/* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and
ARG2. */
static void
-build_message_buffer (const char *format, void *arg1, void *arg2, void *arg3)
+build_message_buffer (const char *format, va_list ap)
{
- register int i, len;
- void *args[3];
- int arg_index = 0;
-
- args[0] = arg1;
- args[1] = arg2;
- args[2] = arg3;
-
- len = strlen (format);
-
- message_buffer_resize (len);
-
- for (i = 0; format[i]; i++)
- {
- if (format[i] != '%')
- {
- message_buffer[message_buffer_index++] = format[i];
- len--;
- }
- else
- {
- char c;
- const char *fmt_start = format + i;
- char *fmt;
- int fmt_len, formatted_len;
- int paramed = 0;
-
- format_again:
- i++;
- while (format[i] && strchr ("-. +0123456789", format[i]))
- i++;
- c = format[i];
-
- if (c == '\0')
- abort ();
-
- if (c == '$') {
- /* position parameter parameter */
- /* better to use bprintf from bfox's metahtml? */
- arg_index = atoi(fmt_start + 1) - 1;
- if (arg_index < 0)
- arg_index = 0;
- if (arg_index >= 2)
- arg_index = 1;
- paramed = 1;
- goto format_again;
- }
-
- fmt_len = format + i - fmt_start + 1;
- fmt = xmalloc (fmt_len + 1);
- strncpy (fmt, fmt_start, fmt_len);
- fmt[fmt_len] = '\0';
-
- if (paramed) {
- /* removed positioned parameter */
- char *p;
- for (p = fmt + 1; *p && *p != '$'; p++) {
- ;
- }
- strcpy(fmt + 1, p + 1);
- }
-
- /* If we have "%-98s", maybe 98 calls for a longer string. */
- if (fmt_len > 2)
- {
- int j;
-
- for (j = fmt_len - 2; j >= 0; j--)
- if (isdigit (fmt[j]) || fmt[j] == '$')
- break;
-
- formatted_len = atoi (fmt + j);
- }
- else
- formatted_len = c == 's' ? 0 : 1; /* %s can produce empty string */
-
- switch (c)
- {
- case '%': /* Insert a percent sign. */
- message_buffer_resize (len + formatted_len);
- sprintf
- (message_buffer + message_buffer_index, fmt, "%");
- message_buffer_index += formatted_len;
- break;
-
- case 's': /* Insert the current arg as a string. */
- {
- char *string;
- int string_len;
-
- string = (char *)args[arg_index++];
- string_len = strlen (string);
-
- if (formatted_len > string_len)
- string_len = formatted_len;
- message_buffer_resize (len + string_len);
- sprintf
- (message_buffer + message_buffer_index, fmt, string);
- message_buffer_index += string_len;
- }
- break;
-
- case 'd': /* Insert the current arg as an integer. */
- {
- long long_val;
- int integer;
-
- long_val = (long)args[arg_index++];
- integer = (int)long_val;
-
- message_buffer_resize (len + formatted_len > 32
- ? formatted_len : 32);
- sprintf
- (message_buffer + message_buffer_index, fmt, integer);
- message_buffer_index = strlen (message_buffer);
- }
- break;
+ text_buffer_vprintf (&message_buffer, format, ap);
+}
- case 'c': /* Insert the current arg as a character. */
- {
- long long_val;
- int character;
+/* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
+ contents. */
+NODE *
+build_message_node (const char *format, va_list ap)
+{
+ NODE *node;
- long_val = (long)args[arg_index++];
- character = (int)long_val;
+ initialize_message_buffer ();
+ build_message_buffer (format, ap);
- message_buffer_resize (len + formatted_len);
- sprintf
- (message_buffer + message_buffer_index, fmt, character);
- message_buffer_index += formatted_len;
- }
- break;
+ node = message_buffer_to_node ();
+ return node;
+}
- default:
- abort ();
- }
- free (fmt);
- }
- }
- message_buffer[message_buffer_index] = '\0';
+NODE *
+format_message_node (const char *format, ...)
+{
+ NODE *node;
+ va_list ap;
+
+ va_start (ap, format);
+ node = build_message_node (format, ap);
+ va_end (ap);
+ return node;
}
-/* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
- contents. */
NODE *
-build_message_node (const char *format, void *arg1, void *arg2)
+string_to_node (char *contents)
{
NODE *node;
- message_buffer_index = 0;
- build_message_buffer (format, arg1, arg2, 0);
+ node = xzalloc (sizeof (NODE));
+ node->filename = NULL;
+ node->parent = NULL;
+ node->nodename = NULL;
+ node->flags = 0;
+ node->display_pos =0;
- node = message_buffer_to_node ();
+ /* Make sure that this buffer ends with a newline. */
+ node->nodelen = 1 + strlen (contents);
+ node->contents = contents;
return node;
}
@@ -1376,7 +1312,7 @@ message_buffer_to_node (void)
{
NODE *node;
- node = xmalloc (sizeof (NODE));
+ node = xzalloc (sizeof (NODE));
node->filename = NULL;
node->parent = NULL;
node->nodename = NULL;
@@ -1384,9 +1320,9 @@ message_buffer_to_node (void)
node->display_pos =0;
/* Make sure that this buffer ends with a newline. */
- node->nodelen = 1 + strlen (message_buffer);
+ node->nodelen = 1 + strlen (message_buffer.base);
node->contents = xmalloc (1 + node->nodelen);
- strcpy (node->contents, message_buffer);
+ strcpy (node->contents, message_buffer.base);
node->contents[node->nodelen - 1] = '\n';
node->contents[node->nodelen] = '\0';
return node;
@@ -1396,14 +1332,19 @@ message_buffer_to_node (void)
void
initialize_message_buffer (void)
{
- message_buffer_index = 0;
+ message_buffer.off = 0;
}
-/* Print FORMAT with ARG1,2 to the end of the current message buffer. */
+/* Print supplied arguments using FORMAT to the end of the current message
+ buffer. */
void
-printf_to_message_buffer (const char *format, void *arg1, void *arg2, void *arg3)
+printf_to_message_buffer (const char *format, ...)
{
- build_message_buffer (format, arg1, arg2, arg3);
+ va_list ap;
+
+ va_start (ap, format);
+ build_message_buffer (format, ap);
+ va_end (ap);
}
/* Return the current horizontal position of the "cursor" on the most
@@ -1411,14 +1352,15 @@ printf_to_message_buffer (const char *format, void *arg1, void *arg2, void *arg3
int
message_buffer_length_this_line (void)
{
- register int i;
-
- if (!message_buffer_index)
+ char *p;
+
+ if (!message_buffer.base || !*message_buffer.base)
return 0;
- for (i = message_buffer_index; i && message_buffer[i - 1] != '\n'; i--);
-
- return string_width (message_buffer + i, 0);
+ p = strrchr (message_buffer.base, '\n');
+ if (!p)
+ p = message_buffer.base;
+ return string_width (p, 0);
}
/* Pad STRING to COUNT characters by inserting blanks. */
@@ -1533,12 +1475,13 @@ info_tag (mbi_iterator_t iter, int handle, size_t *plen)
FUN is called for every line collected from the node. Its arguments:
- int (*fun) (void *closure, size_t line_no,
+ int (*fun) (void *closure, size_t phys_line_no, size_t log_line_no,
const char *src_line, char *prt_line,
size_t prt_bytes, size_t prt_chars)
closure -- An opaque pointer passed as 5th parameter to process_node_text;
- line_no -- Number of processed line (starts from 0);
+ line_no -- Number of processed physical line (starts from 0);
+ log_line_no -- Number of processed logical line (starts from 0);
src_line -- Pointer to the source line (unmodified);
prt_line -- Collected line contents, ready for output;
prt_bytes -- Number of bytes in prt_line;
@@ -1555,14 +1498,16 @@ info_tag (mbi_iterator_t iter, int handle, size_t *plen)
size_t
process_node_text (WINDOW *win, char *start,
int do_tags,
- int (*fun) (void *, size_t, const char *, char *, size_t, size_t),
+ int (*fun) (void *, size_t, size_t,
+ const char *, char *, size_t, size_t),
void *closure)
{
char *printed_line; /* Buffer for a printed line. */
size_t pl_count = 0; /* Number of *characters* written to PRINTED_LINE */
size_t pl_index = 0; /* Index into PRINTED_LINE. */
size_t in_index = 0;
- size_t line_index = 0; /* Number of lines done so far. */
+ size_t line_index = 0; /* Number of physical lines done so far. */
+ size_t logline_index = 0;/* Number of logical lines */
size_t allocated_win_width;
mbi_iterator_t iter;
@@ -1579,10 +1524,11 @@ process_node_text (WINDOW *win, char *start,
mbi_advance (iter))
{
const char *carried_over_ptr;
- size_t carried_over_len, carried_over_count;
+ size_t carried_over_len = 0;
+ size_t carried_over_count = 0;
const char *cur_ptr = mbi_cur_ptr (iter);
- int cur_len = mb_len (mbi_cur (iter));
- int replen;
+ size_t cur_len = mb_len (mbi_cur (iter));
+ size_t replen = 0;
int delim = 0;
int rc;
@@ -1595,7 +1541,7 @@ process_node_text (WINDOW *win, char *start,
if (*cur_ptr == '\r' || *cur_ptr == '\n')
{
replen = win->width - pl_count;
- delim = 1;
+ delim = *cur_ptr;
}
else if (ansi_escape (iter, &cur_len))
{
@@ -1610,7 +1556,7 @@ process_node_text (WINDOW *win, char *start,
else
{
if (*cur_ptr == '\t')
- delim = 1;
+ delim = *cur_ptr;
cur_ptr = printed_representation (cur_ptr, cur_len, pl_count,
&cur_len);
replen = cur_len;
@@ -1692,10 +1638,13 @@ process_node_text (WINDOW *win, char *start,
printed_line[pl_index] = '\0';
}
- rc = fun (closure, line_index, mbi_cur_ptr (iter) - in_index,
+ rc = fun (closure, line_index, logline_index,
+ mbi_cur_ptr (iter) - in_index,
printed_line, pl_index, pl_count);
++line_index;
+ if (delim == '\r' || delim == '\n')
+ ++logline_index;
/* Reset all data to the start of the line. */
pl_index = 0;
@@ -1733,7 +1682,8 @@ process_node_text (WINDOW *win, char *start,
}
if (pl_count)
- fun (closure, line_index, mbi_cur_ptr (iter) - in_index,
+ fun (closure, line_index, logline_index,
+ mbi_cur_ptr (iter) - in_index,
printed_line, pl_index, pl_count);
free (printed_line);
@@ -1754,7 +1704,7 @@ clean_manpage (char *manpage)
mbi_advance (iter))
{
const char *cur_ptr = mbi_cur_ptr (iter);
- int cur_len = mb_len (mbi_cur (iter));
+ size_t cur_len = mb_len (mbi_cur (iter));
if (cur_len == 1)
{
@@ -1831,7 +1781,7 @@ window_line_map_init (WINDOW *win)
*/
int
window_scan_line (WINDOW *win, int line, int phys,
- void (*fun) (void *closure, long cpos, int replen),
+ void (*fun) (void *closure, long cpos, size_t replen),
void *closure)
{
mbi_iterator_t iter;
@@ -1852,8 +1802,8 @@ window_scan_line (WINDOW *win, int line, int phys,
mbi_advance (iter))
{
const char *cur_ptr = mbi_cur_ptr (iter);
- int cur_len = mb_len (mbi_cur (iter));
- int replen;
+ size_t cur_len = mb_len (mbi_cur (iter));
+ size_t replen;
if (cur_ptr >= endp)
break;
@@ -1903,7 +1853,7 @@ window_scan_line (WINDOW *win, int line, int phys,
}
static void
-add_line_map (void *closure, long cpos, int replen)
+add_line_map (void *closure, long cpos, size_t replen)
{
WINDOW *win = closure;
diff --git a/info/window.h b/info/window.h
index 648120d..8cb755f 100644
--- a/info/window.h
+++ b/info/window.h
@@ -1,10 +1,8 @@
/* window.h -- Structure and flags used in manipulating Info windows.
- $Id: window.h,v 1.12 2008/09/13 10:02:01 gray Exp $
+ $Id: window.h 5337 2013-08-22 17:54:06Z karl $
- This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 1997, 2004, 2007 Free Software Foundation, Inc.
+ Copyright 1993, 1997, 2004, 2007, 2011 2013
+ 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
@@ -19,7 +17,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
- Written by Brian Fox (bfox@ai.mit.edu). */
+ Originally written by Brian Fox. */
#ifndef INFO_WINDOW_H
#define INFO_WINDOW_H
@@ -70,16 +68,18 @@ typedef struct window_struct
{
struct window_struct *next; /* Next window in this chain. */
struct window_struct *prev; /* Previous window in this chain. */
- int width; /* Width of this window. */
- int height; /* Height of this window. */
- int first_row; /* Offset of the first line in the_screen. */
- int goal_column; /* The column we would like the cursor to appear in. */
+ size_t width; /* Width of this window. */
+ size_t height; /* Height of this window. */
+ size_t first_row; /* Offset of the first line in the_screen. */
+ size_t goal_column; /* The column we would like the cursor to appear in. */
Keymap keymap; /* Keymap used to read commands in this window. */
WINDOW_STATE_DECL; /* Node, pagetop and point. */
LINE_MAP line_map; /* Current line map */
char *modeline; /* Calculated text of the modeline for this window. */
char **line_starts; /* Array of printed line starts for this node. */
- int line_count; /* Number of lines appearing in LINE_STARTS. */
+ size_t line_count; /* Number of lines appearing in LINE_STARTS. */
+ size_t *log_line_no; /* Number of logical line corresponding to each
+ physical one. */
int flags; /* See below for details. */
} WINDOW;
@@ -179,16 +179,25 @@ extern void window_unmark_chain (WINDOW *chain, int flag);
/* Make WINDOW start displaying at PERCENT percentage of its node. */
extern void window_goto_percentage (WINDOW *window, int percent);
-/* Build a new node which has FORMAT printed with ARG1 and ARG2 as the
+/* Build a new node which has AP printed according to FORMAT as the
contents. */
-extern NODE *build_message_node (const char *format, void *arg1, void *arg2);
+extern NODE *build_message_node (const char *format, va_list ap);
+
+extern NODE *format_message_node (const char *format, ...)
+ TEXINFO_PRINTFLIKE(1,2);
+
+/* Build a new node with the given CONTENTS.
+ Note: CONTENTS is "stolen", i.e. the pointer to it is saved in the
+ new node. */
+extern NODE *string_to_node (char *contents);
/* Useful functions can be called from outside of window.c. */
extern void initialize_message_buffer (void);
-/* Print FORMAT with ARG1,2 to the end of the current message buffer. */
-extern void printf_to_message_buffer (const char *format, void *arg1, void *arg2,
- void *arg3);
+/* Print arguments according to FORMAT to the end of the current message
+ buffer. */
+extern void printf_to_message_buffer (const char *format, ...)
+ TEXINFO_PRINTFLIKE(1,2);
/* Convert the contents of the message buffer to a node. */
extern NODE *message_buffer_to_node (void);
@@ -199,17 +208,27 @@ extern int message_buffer_length_this_line (void);
/* Pad STRING to COUNT characters by inserting blanks. */
extern int pad_to (int count, char *string);
-/* Make a message appear in the echo area, built from FORMAT, ARG1 and ARG2.
- The arguments are treated similar to printf () arguments, but not all of
- printf () hair is present. The message appears immediately. If there was
+/* Make a message appear in the echo area, built from arguments formatted
+ according to FORMAT.
+
+ The message appears immediately. If there was
already a message appearing in the echo area, it is removed. */
-extern void window_message_in_echo_area (const char *format, void *arg1, void *arg2);
+extern void window_message_in_echo_area (const char *format, ...)
+ TEXINFO_PRINTFLIKE(1,2);
+
+extern void vwindow_message_in_echo_area (const char *format, va_list ap);
-/* Place a temporary message in the echo area built from FORMAT, ARG1
- and ARG2. The message appears immediately, but does not destroy
+extern void free_echo_area (void);
+
+/* Place a temporary message in the echo area built from arguments
+ formatted as per FORMAT.
+
+ The message appears immediately, but does not destroy
any existing message. A future call to unmessage_in_echo_area ()
restores the old contents. */
-extern void message_in_echo_area (const char *format, void *arg1, void *arg2);
+extern void message_in_echo_area (const char *format, ...)
+ TEXINFO_PRINTFLIKE(1,2);
+
extern void unmessage_in_echo_area (void);
/* Clear the echo area, removing any message that is already present.
@@ -254,17 +273,20 @@ extern int window_chars_to_goal (WINDOW *win, int goal);
extern size_t process_node_text
(WINDOW *win, char *start, int do_tags,
- int (*fun) (void *, size_t, const char *, char *, size_t, size_t),
+ int (*fun) (void *, size_t, size_t, const char *, char *,
+ size_t, size_t),
void *closure);
-void clean_manpage (char *manpage);
+extern void clean_manpage (char *manpage);
extern void window_compute_line_map (WINDOW *win);
-int window_point_to_column (WINDOW *win, long point, long *np);
+extern int window_point_to_column (WINDOW *win, long point, long *np);
+
+extern void window_line_map_init (WINDOW *win);
-void window_line_map_init (WINDOW *win);
+extern long window_end_of_line (WINDOW *win);
-long window_end_of_line (WINDOW *win);
+extern size_t window_log_to_phys_line (WINDOW *window, size_t ln);
#endif /* not INFO_WINDOW_H */