diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2006-07-17 16:12:37 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2006-07-17 16:12:37 +0000 |
commit | 9f77d94b9a58350d763499ea39873c6020b60da9 (patch) | |
tree | 710c75c43c07e91771e598b34a15217e8928560c /gnu/usr.bin/texinfo/info | |
parent | 6382053c52b4c3b43d337c169d7b476c6081457f (diff) |
conflict resolution
Diffstat (limited to 'gnu/usr.bin/texinfo/info')
35 files changed, 1992 insertions, 1731 deletions
diff --git a/gnu/usr.bin/texinfo/info/Makefile.am b/gnu/usr.bin/texinfo/info/Makefile.am index 9d5d989089a..f75bfd08c73 100644 --- a/gnu/usr.bin/texinfo/info/Makefile.am +++ b/gnu/usr.bin/texinfo/info/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.4 2002/06/10 13:51:03 espie Exp $ +# $Id: Makefile.am,v 1.5 2006/07/17 16:12:36 espie Exp $ # Makefile.am for texinfo/info. # Run automake in .. to produce Makefile.in from this. # @@ -10,37 +10,25 @@ # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -noinst_PROGRAMS = makedoc - # Use `ginfo' for building to avoid confusion with the standard `info' # target. Removes the `g' in the install rule before applying any # user-specified name transformations. bin_PROGRAMS = ginfo infokey -transform = s/ginfo/info/; @program_transform_name@ +transform = s/ginfo/info/; $(program_transform_name) localedir = $(datadir)/locale +infodir2 = $(datadir)/info # -I. for funs.h. # Automake puts -I.. and -I$(srcdir) into DEFS by default, but # we need to override it, so include them ourselves. INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -I.. -I$(srcdir) -DEFS = -DINFODIR=\"$(infodir)\" -DLOCALEDIR=\"$(localedir)\" @DEFS@ -LDADD = ../lib/libtxi.a @TERMLIBS@ @LIBINTL@ +DEFS += -DLOCALEDIR=\"$(localedir)\" -DINFODIR=\"$(infodir)\" \ + -DINFODIR2=\"$(infodir2)\" +LDADD = ../lib/libtxi.a $(TERMLIBS) $(LIBINTL) EXTRA_DIST = README pcterm.c -if TEXINFO_MAINT -# The files `doc.c' and `funs.h' are created by ./makedoc run over the source -# files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file -# listing the functions found. `doc.c' is a structure containing pointers -# to those functions along with completable names and documentation strings. -BUILT_SOURCES = doc.c funs.h key.c -else -# don't make installers rebuild them. -generated_sources = doc.c funs.h key.c -endif - -makedoc_SOURCES = makedoc.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 \ @@ -48,9 +36,28 @@ ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \ infomap.c infomap.h 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 \ - variables.c variables.h window.c window.h \ - $(BUILT_SOURCES) $(generated_sources) -infokey_SOURCES = infokey.c infokey.h key.c key.h + variables.c variables.h window.c window.h +nodist_ginfo_SOURCES = doc.c funs.h +infokey_SOURCES = infokey.c infokey.h key.h +nodist_infokey_SOURCES = key.c funs.h + +# The files `doc.c', `key.c' and `funs.h' are created by ./makedoc run over the +# source files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file +# listing the functions found. `doc.c' is a structure containing pointers +# to those functions along with completable names and documentation strings. +# +generated_sources = doc.c key.c funs.h + +# We need a linear ordering to prevent race condition in parallel make. +# See the node ``(automake)Multiple Outputs'' for an explanation. +doc.c: key.c +key.c: funs.h + +# These files are not distributed. +DISTCLEANFILES = $(generated_sources) + +noinst_PROGRAMS = makedoc +makedoc_SOURCES = makedoc.c # Files with Info commands defined that makedoc should read. cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \ @@ -58,9 +65,10 @@ cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \ $(srcdir)/footnotes.c $(srcdir)/variables.c # The $(EXEEXT) should be added by Automake, but isn't. Fine. -$(BUILT_SOURCES): makedoc$(EXEEXT) $(cmd_sources) -# This is insufficient. We really need them not to be in the -# distribution in the first place, but it seems Automake does not -# currently allow that. - rm -f $(BUILT_SOURCES) - ./makedoc $(cmd_sources) +$(generated_sources): makedoc$(EXEEXT) $(cmd_sources) + rm -f $(generated_sources) + $(top_builddir)/$(native_tools)/info/makedoc $(cmd_sources) + +# The following hack is necessary to hint make before the automatic +# dependencies are built. +BUILT_SOURCES = funs.h diff --git a/gnu/usr.bin/texinfo/info/Makefile.in b/gnu/usr.bin/texinfo/info/Makefile.in index e89ea582a08..cf84054351b 100644 --- a/gnu/usr.bin/texinfo/info/Makefile.in +++ b/gnu/usr.bin/texinfo/info/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.6 from Makefile.am. +# Makefile.in generated by automake 1.9.4 from Makefile.am. # @configure_input@ -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004 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,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.in,v 1.8 2002/06/10 13:51:03 espie Exp $ +# $Id: Makefile.in,v 1.9 2006/07/17 16:12:36 espie Exp $ # Makefile.am for texinfo/info. # Run automake in .. to produce Makefile.in from this. # @@ -25,43 +25,21 @@ # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even the # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -SHELL = @SHELL@ + +SOURCES = $(ginfo_SOURCES) $(nodist_ginfo_SOURCES) $(infokey_SOURCES) $(nodist_infokey_SOURCES) $(makedoc_SOURCES) srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. - -ACLOCAL = @ACLOCAL@ -AUTOCONF = @AUTOCONF@ -AUTOMAKE = @AUTOMAKE@ -AUTOHEADER = @AUTOHEADER@ - am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) NORMAL_INSTALL = : PRE_INSTALL = : @@ -69,76 +47,204 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -host_alias = @host_alias@ +build_triplet = @build@ host_triplet = @host@ - -EXEEXT = @EXEEXT@ -OBJEXT = @OBJEXT@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -transform = s/ginfo/info/; @program_transform_name@ +bin_PROGRAMS = ginfo$(EXEEXT) infokey$(EXEEXT) +noinst_PROGRAMS = makedoc$(EXEEXT) +subdir = info +DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/codeset.m4 \ + $(top_srcdir)/m4/gettext.m4 $(top_srcdir)/m4/glibc21.m4 \ + $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/intdiv0.m4 \ + $(top_srcdir)/m4/intmax.m4 $(top_srcdir)/m4/inttypes-pri.m4 \ + $(top_srcdir)/m4/inttypes.m4 $(top_srcdir)/m4/inttypes_h.m4 \ + $(top_srcdir)/m4/lcmessage.m4 $(top_srcdir)/m4/lib-ld.m4 \ + $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \ + $(top_srcdir)/m4/longdouble.m4 $(top_srcdir)/m4/longlong.m4 \ + $(top_srcdir)/m4/mkstemp.m4 $(top_srcdir)/m4/nls.m4 \ + $(top_srcdir)/m4/onceonly_2_57.m4 $(top_srcdir)/m4/po.m4 \ + $(top_srcdir)/m4/printf-posix.m4 $(top_srcdir)/m4/progtest.m4 \ + $(top_srcdir)/m4/signed.m4 $(top_srcdir)/m4/size_max.m4 \ + $(top_srcdir)/m4/stdint_h.m4 $(top_srcdir)/m4/strcase.m4 \ + $(top_srcdir)/m4/uintmax_t.m4 $(top_srcdir)/m4/ulonglong.m4 \ + $(top_srcdir)/m4/wchar_t.m4 $(top_srcdir)/m4/wint_t.m4 \ + $(top_srcdir)/m4/xsize.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_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) \ + 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 $(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_LDADD = $(LDADD) +infokey_DEPENDENCIES = ../lib/libtxi.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +am_makedoc_OBJECTS = makedoc.$(OBJEXT) +makedoc_OBJECTS = $(am_makedoc_OBJECTS) +makedoc_LDADD = $(LDADD) +makedoc_DEPENDENCIES = ../lib/libtxi.a $(am__DEPENDENCIES_1) \ + $(am__DEPENDENCIES_1) +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(ginfo_SOURCES) $(nodist_ginfo_SOURCES) $(infokey_SOURCES) \ + $(nodist_infokey_SOURCES) $(makedoc_SOURCES) +DIST_SOURCES = $(ginfo_SOURCES) $(infokey_SOURCES) $(makedoc_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +transform = s/ginfo/info/; $(program_transform_name) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BUILD_INCLUDED_LIBINTL = @BUILD_INCLUDED_LIBINTL@ CATOBJEXT = @CATOBJEXT@ CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ DATADIRNAME = @DATADIRNAME@ +DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" -DINFODIR=\"$(infodir)\" \ + -DINFODIR2=\"$(infodir2)\" DEPDIR = @DEPDIR@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ GENCAT = @GENCAT@ GLIBC21 = @GLIBC21@ GMSGFMT = @GMSGFMT@ -HAVE_LIB = @HAVE_LIB@ +HAVE_ASPRINTF = @HAVE_ASPRINTF@ +HAVE_POSIX_PRINTF = @HAVE_POSIX_PRINTF@ +HAVE_SNPRINTF = @HAVE_SNPRINTF@ +HAVE_WPRINTF = @HAVE_WPRINTF@ +HELP2MAN = @HELP2MAN@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTALL_WARNINGS_FALSE = @INSTALL_WARNINGS_FALSE@ +INSTALL_WARNINGS_TRUE = @INSTALL_WARNINGS_TRUE@ INSTOBJEXT = @INSTOBJEXT@ INTLBISON = @INTLBISON@ INTLLIBS = @INTLLIBS@ INTLOBJS = @INTLOBJS@ INTL_LIBTOOL_SUFFIX_PREFIX = @INTL_LIBTOOL_SUFFIX_PREFIX@ -LIB = @LIB@ +LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ -LTLIB = @LTLIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGMERGE = @MSGMERGE@ +OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ POSUB = @POSUB@ RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ STRIP = @STRIP@ TERMLIBS = @TERMLIBS@ +TOOLS_ONLY_FALSE = @TOOLS_ONLY_FALSE@ +TOOLS_ONLY_TRUE = @TOOLS_ONLY_TRUE@ USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ am__include = @am__include@ +am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ install_sh = @install_sh@ - -noinst_PROGRAMS = makedoc - -# Use `ginfo' for building to avoid confusion with the standard `info' -# target. Removes the `g' in the install rule before applying any -# user-specified name transformations. -bin_PROGRAMS = ginfo infokey - +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +native_tools = @native_tools@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ localedir = $(datadir)/locale +infodir2 = $(datadir)/info # -I. for funs.h. # Automake puts -I.. and -I$(srcdir) into DEFS by default, but # we need to override it, so include them ourselves. INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -I.. -I$(srcdir) -DEFS = -DINFODIR=\"$(infodir)\" -DLOCALEDIR=\"$(localedir)\" @DEFS@ -LDADD = ../lib/libtxi.a @TERMLIBS@ @LIBINTL@ - +LDADD = ../lib/libtxi.a $(TERMLIBS) $(LIBINTL) EXTRA_DIST = README pcterm.c - -# The files `doc.c' and `funs.h' are created by ./makedoc run over the source -# files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file -# listing the functions found. `doc.c' is a structure containing pointers -# to those functions along with completable names and documentation strings. -@TEXINFO_MAINT_TRUE@BUILT_SOURCES = doc.c funs.h key.c -# don't make installers rebuild them. -@TEXINFO_MAINT_FALSE@generated_sources = doc.c funs.h key.c - -makedoc_SOURCES = makedoc.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 \ @@ -146,109 +252,85 @@ ginfo_SOURCES = dir.c display.c display.h doc.h dribble.c dribble.h \ infomap.c infomap.h 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 \ - variables.c variables.h window.c window.h \ - $(BUILT_SOURCES) $(generated_sources) + variables.c variables.h window.c window.h + +nodist_ginfo_SOURCES = doc.c funs.h +infokey_SOURCES = infokey.c infokey.h key.h +nodist_infokey_SOURCES = key.c funs.h -infokey_SOURCES = infokey.c infokey.h key.c key.h +# The files `doc.c', `key.c' and `funs.h' are created by ./makedoc run over the +# source files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file +# listing the functions found. `doc.c' is a structure containing pointers +# to those functions along with completable names and documentation strings. +# +generated_sources = doc.c key.c funs.h + +# These files are not distributed. +DISTCLEANFILES = $(generated_sources) +makedoc_SOURCES = makedoc.c # Files with Info commands defined that makedoc should read. cmd_sources = $(srcdir)/session.c $(srcdir)/echo-area.c $(srcdir)/infodoc.c \ $(srcdir)/m-x.c $(srcdir)/indices.c $(srcdir)/nodemenu.c \ $(srcdir)/footnotes.c $(srcdir)/variables.c -subdir = info -mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -bin_PROGRAMS = ginfo$(EXEEXT) infokey$(EXEEXT) -noinst_PROGRAMS = makedoc$(EXEEXT) -PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) - -@TEXINFO_MAINT_TRUE@am__objects_1 = doc.$(OBJEXT) key.$(OBJEXT) -@TEXINFO_MAINT_FALSE@am__objects_2 = doc.$(OBJEXT) key.$(OBJEXT) -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) \ - terminal.$(OBJEXT) tilde.$(OBJEXT) variables.$(OBJEXT) \ - window.$(OBJEXT) $(am__objects_1) $(am__objects_2) -ginfo_OBJECTS = $(am_ginfo_OBJECTS) -ginfo_LDADD = $(LDADD) -ginfo_DEPENDENCIES = ../lib/libtxi.a -ginfo_LDFLAGS = -am_infokey_OBJECTS = infokey.$(OBJEXT) key.$(OBJEXT) -infokey_OBJECTS = $(am_infokey_OBJECTS) -infokey_LDADD = $(LDADD) -infokey_DEPENDENCIES = ../lib/libtxi.a -infokey_LDFLAGS = -am_makedoc_OBJECTS = makedoc.$(OBJEXT) -makedoc_OBJECTS = $(am_makedoc_OBJECTS) -makedoc_LDADD = $(LDADD) -makedoc_DEPENDENCIES = ../lib/libtxi.a -makedoc_LDFLAGS = -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -depcomp = $(SHELL) $(top_srcdir)/depcomp -am__depfiles_maybe = depfiles -@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dir.Po ./$(DEPDIR)/display.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/doc.Po ./$(DEPDIR)/dribble.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/echo-area.Po ./$(DEPDIR)/filesys.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/footnotes.Po ./$(DEPDIR)/gc.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/indices.Po ./$(DEPDIR)/info-utils.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/info.Po ./$(DEPDIR)/infodoc.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/infokey.Po ./$(DEPDIR)/infomap.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/key.Po ./$(DEPDIR)/m-x.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/makedoc.Po ./$(DEPDIR)/man.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/nodemenu.Po ./$(DEPDIR)/nodes.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/search.Po ./$(DEPDIR)/session.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/signals.Po ./$(DEPDIR)/terminal.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/tilde.Po ./$(DEPDIR)/variables.Po \ -@AMDEP_TRUE@ ./$(DEPDIR)/window.Po -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -CFLAGS = @CFLAGS@ -DIST_SOURCES = $(ginfo_SOURCES) $(infokey_SOURCES) $(makedoc_SOURCES) -DIST_COMMON = README Makefile.am Makefile.in -SOURCES = $(ginfo_SOURCES) $(infokey_SOURCES) $(makedoc_SOURCES) +# The following hack is necessary to hint make before the automatic +# dependencies are built. +BUILT_SOURCES = funs.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .o .obj -$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(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; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu info/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --gnu info/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) -binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(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) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) - $(mkinstalldirs) $(DESTDIR)$(bindir) + 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 \ - p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \ - f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ - echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ - $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ + 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 uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ - f=`echo "$$f" | sed -e 's,^.*/,,'`; \ - echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ - rm -f $(DESTDIR)$(bindir)/$$f; \ + f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ + rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: @@ -267,7 +349,7 @@ makedoc$(EXEEXT): $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES) $(LINK) $(makedoc_LDFLAGS) $(makedoc_OBJECTS) $(makedoc_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) core *.core + -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @@ -300,29 +382,21 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/variables.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Po@am__quote@ -distclean-depend: - -rm -rf ./$(DEPDIR) - .c.o: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: -@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ -@AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - $(COMPILE) -c `cygpath -w $<` -CCDEPMODE = @CCDEPMODE@ -install-info-am: +@am__fastdepCC_TRUE@ if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCC_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` uninstall-info-am: -ETAGS = etags -ETAGSFLAGS = - -tags: TAGS - ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -331,6 +405,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique +tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -342,8 +417,24 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - test -z "$(ETAGS_ARGS)$$tags$$unique" \ - || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + 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; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: @@ -352,25 +443,29 @@ GTAGS: && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) - -top_distdir = .. -distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) - @for file in $(DISTFILES); do \ + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkinstalldirs) "$(distdir)$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ - cp -pR $$d/$$file $(distdir)$$dir \ - || exit 1; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ @@ -378,13 +473,15 @@ distdir: $(DISTFILES) fi; \ done check-am: all-am -check: check-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(PROGRAMS) - installdirs: - $(mkinstalldirs) $(DESTDIR)$(bindir) - -install: install-am + for dir in "$(DESTDIR)$(bindir)"; do \ + test -z "$$dir" || $(mkdir_p) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am @@ -395,7 +492,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - INSTALL_STRIP_FLAG=-s \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -403,7 +500,8 @@ mostlyclean-generic: clean-generic: distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @@ -415,14 +513,17 @@ clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am - -distclean-am: clean-am distclean-compile distclean-depend \ - distclean-generic distclean-tags + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am dvi-am: +html: html-am + info: info-am info-am: @@ -431,39 +532,53 @@ install-data-am: install-exec-am: install-binPROGRAMS +install-info: install-info-am + install-man: installcheck-am: maintainer-clean: maintainer-clean-am - + -rm -rf ./$(DEPDIR) + -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + uninstall-am: uninstall-binPROGRAMS uninstall-info-am -.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ - clean-generic clean-noinstPROGRAMS distclean distclean-compile \ - distclean-depend distclean-generic distclean-tags distdir dvi \ - dvi-am info info-am install install-am install-binPROGRAMS \ - install-data install-data-am install-exec install-exec-am \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic tags uninstall uninstall-am \ - uninstall-binPROGRAMS uninstall-info-am +.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-exec \ + install-exec-am install-info install-info-am install-man \ + 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 \ + uninstall-info-am + +# We need a linear ordering to prevent race condition in parallel make. +# See the node ``(automake)Multiple Outputs'' for an explanation. +doc.c: key.c +key.c: funs.h # The $(EXEEXT) should be added by Automake, but isn't. Fine. -$(BUILT_SOURCES): makedoc$(EXEEXT) $(cmd_sources) -# This is insufficient. We really need them not to be in the -# distribution in the first place, but it seems Automake does not -# currently allow that. - rm -f $(BUILT_SOURCES) - ./makedoc $(cmd_sources) +$(generated_sources): 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/gnu/usr.bin/texinfo/info/dir.c b/gnu/usr.bin/texinfo/info/dir.c index f36a920126f..a42e77dec1f 100644 --- a/gnu/usr.bin/texinfo/info/dir.c +++ b/gnu/usr.bin/texinfo/info/dir.c @@ -1,7 +1,7 @@ /* dir.c -- how to build a special "dir" node from "localdir" files. - $Id: dir.c,v 1.3 2000/02/09 02:18:39 espie Exp $ + $Id: dir.c,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2004 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 @@ -28,7 +28,11 @@ 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 (), insert_text_into_fb_at_binding (); +static void add_menu_to_file_buffer (char *contents, long int 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); static char *dirs_to_add[] = { "dir", "localdir", (char *)NULL @@ -45,8 +49,7 @@ typedef struct } dir_file_list_entry_type; static int -new_dir_file_p (test) - struct stat *test; +new_dir_file_p (struct stat *test) { static unsigned dir_file_list_len = 0; static dir_file_list_entry_type *dir_file_list = NULL; @@ -70,8 +73,7 @@ new_dir_file_p (test) void -maybe_build_dir_node (dirname) - char *dirname; +maybe_build_dir_node (char *dirname) { int path_index, update_tags; char *this_dir; @@ -162,10 +164,7 @@ maybe_build_dir_node (dirname) to the menu found in FB->contents. Second argument SIZE is the total size of CONTENTS. */ static void -add_menu_to_file_buffer (contents, size, fb) - char *contents; - long size; - FILE_BUFFER *fb; +add_menu_to_file_buffer (char *contents, long int size, FILE_BUFFER *fb) { SEARCH_BINDING contents_binding, fb_binding; long contents_offset, fb_offset; @@ -271,11 +270,8 @@ add_menu_to_file_buffer (contents, size, fb) } static void -insert_text_into_fb_at_binding (fb, binding, text, textlen) - FILE_BUFFER *fb; - SEARCH_BINDING *binding; - char *text; - int textlen; +insert_text_into_fb_at_binding (FILE_BUFFER *fb, + SEARCH_BINDING *binding, char *text, int textlen) { char *contents; long start, end; diff --git a/gnu/usr.bin/texinfo/info/display.c b/gnu/usr.bin/texinfo/info/display.c index 8a557f36371..160cccac532 100644 --- a/gnu/usr.bin/texinfo/info/display.c +++ b/gnu/usr.bin/texinfo/info/display.c @@ -1,7 +1,7 @@ /* display.c -- How to display Info windows. - $Id: display.c,v 1.3 2002/06/10 13:51:03 espie Exp $ + $Id: display.c,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2003, 2004 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,15 +17,19 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" #include "display.h" -extern int info_any_buffered_input_p (); /* Found in session.c. */ +extern int info_any_buffered_input_p (void); /* Found in session.c. */ -static void free_display (); -static DISPLAY_LINE **make_display (); +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. */ @@ -36,8 +40,7 @@ int display_inhibited = 0; /* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */ void -display_initialize_display (width, height) - int width, height; +display_initialize_display (int width, int height) { free_display (the_display); the_display = make_display (width, height); @@ -46,13 +49,11 @@ display_initialize_display (width, height) /* Clear all of the lines in DISPLAY making the screen blank. */ void -display_clear_display (display) - DISPLAY_LINE **display; +display_clear_display (DISPLAY_LINE **display) { register int i; - register DISPLAY_LINE *display_line; - for (i = 0; (display_line = display[i]); i++) + for (i = 0; display[i]; i++) { display[i]->text[0] = '\0'; display[i]->textlen = 0; @@ -66,8 +67,7 @@ int display_was_interrupted_p = 0; /* Update the windows pointed to by WINDOW in the_display. This actually writes the text on the screen. */ void -display_update_display (window) - WINDOW *window; +display_update_display (WINDOW *window) { register WINDOW *win; @@ -91,11 +91,36 @@ display_update_display (window) 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); +} + /* Display WIN on the_display. Unlike display_update_display (), this function only does one window. */ void -display_update_one_window (win) - WINDOW *win; +display_update_one_window (WINDOW *win) { register char *nodetext; /* Current character to display. */ register char *last_node_char; /* Position of the last character in node. */ @@ -136,7 +161,7 @@ display_update_one_window (win) for (; nodetext < last_node_char; nodetext++) { - char *rep, *rep_carried_over, rep_temp[2]; + char *rep = NULL, *rep_carried_over, rep_temp[2]; int replen; if (isprint (*nodetext)) @@ -152,6 +177,43 @@ display_update_one_window (win) { replen = win->width - pl_index + pl_ignore; } + else if (*nodetext == '\0' + && (nodetext + 2) < last_node_char + && *(nodetext + 1) == '\b' + && *(nodetext + 2) == '[') + { + /* Found new style tag/cookie \0\b[ + Read until the closing tag \0\b] */ + int element_len = 0; + char *element; + + /* Skip the escapes. */ + nodetext += 3; + + while (!(*nodetext == '\0' + && *(nodetext + 1) == '\b' + && *(nodetext + 2) == ']')) + { + nodetext++; + element_len++; + } + + element = (char *) malloc (element_len + 1); + strncpy (element, nodetext - element_len, element_len); + + /* Skip the escapes. */ + nodetext += 2; + pl_ignore += element_len + 5; + /* Append string terminator. */ + element[element_len] = '\0'; + + handle_tag (element); + + /* Over and out */ + free (element); + + continue; + } else { rep = printed_representation (*nodetext, pl_index); @@ -211,7 +273,7 @@ display_update_one_window (win) to the next line. */ for (i = 0; pl_index < (win->width + pl_ignore - 1);) printed_line[pl_index++] = rep[i++]; - + rep_carried_over = rep + i; /* If printing the last character in this window couldn't @@ -233,8 +295,10 @@ display_update_one_window (win) entry = display[line_index + win->first_row]; /* If the screen line is inversed, then we have to clear - the line from the screen first. Why, I don't know. */ - if (entry->inverse + the line from the screen first. Why, I don't know. + (But don't do this if we have no visible entries, as can + happen if the window is shrunk very small.) */ + if ((entry && entry->inverse) /* Need to erase the line if it has escape sequences. */ || (raw_escapes_p && strchr (entry->text, '\033') != 0)) { @@ -272,7 +336,7 @@ display_update_one_window (win) fflush (stdout); /* Update the display text buffer. */ - if (strlen (printed_line) > screenwidth) + if (strlen (printed_line) > (unsigned int) screenwidth) /* printed_line[] can include more than screenwidth characters if we are under -R and there are escape sequences in it. However, entry->text was @@ -322,7 +386,7 @@ display_update_one_window (win) printed_line[0] = '\0'; begin = nodetext; - + while ((nodetext < last_node_char) && (*nodetext != '\n')) nodetext++; } @@ -384,8 +448,7 @@ display_update_one_window (win) for no scrolling to take place in the case that the terminal doesn't support it. This doesn't matter to us. */ void -display_scroll_display (start, end, amount) - int start, end, amount; +display_scroll_display (int start, int end, int amount) { register int i, last; DISPLAY_LINE *temp; @@ -455,10 +518,8 @@ display_scroll_display (start, end, amount) starts that used to appear in this window. OLD_COUNT is the number of lines that appear in the OLD_STARTS array. */ void -display_scroll_line_starts (window, old_pagetop, old_starts, old_count) - WINDOW *window; - int old_pagetop, old_count; - char **old_starts; +display_scroll_line_starts (WINDOW *window, int old_pagetop, + char **old_starts, int old_count) { register int i, old, new; /* Indices into the line starts arrays. */ int last_new, last_old; /* Index of the last visible line. */ @@ -530,8 +591,7 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count) /* Move the screen cursor to directly over the current character in WINDOW. */ void -display_cursor_at_point (window) - WINDOW *window; +display_cursor_at_point (WINDOW *window) { int vpos, hpos; @@ -549,8 +609,7 @@ display_cursor_at_point (window) /* Make a DISPLAY_LINE ** with width and height. */ static DISPLAY_LINE ** -make_display (width, height) - int width, height; +make_display (int width, int height) { register int i; DISPLAY_LINE **display; @@ -570,8 +629,7 @@ make_display (width, height) /* Free the storage allocated to DISPLAY. */ static void -free_display (display) - DISPLAY_LINE **display; +free_display (DISPLAY_LINE **display) { register int i; register DISPLAY_LINE *display_line; diff --git a/gnu/usr.bin/texinfo/info/display.h b/gnu/usr.bin/texinfo/info/display.h index 4ddaa9e3725..e0e6ef0c9f0 100644 --- a/gnu/usr.bin/texinfo/info/display.h +++ b/gnu/usr.bin/texinfo/info/display.h @@ -1,10 +1,10 @@ /* display.h -- How the display in Info is done. - $Id: display.h,v 1.2 1999/01/11 16:38:07 espie Exp $ + $Id: display.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -45,33 +45,34 @@ extern int display_inhibited; extern int display_was_interrupted_p; /* Initialize THE_DISPLAY to WIDTH and HEIGHT, with nothing in it. */ -extern void display_initialize_display (); +extern void display_initialize_display (int width, int height); /* Clear all of the lines in DISPLAY making the screen blank. */ -extern void display_clear_display (); +extern void display_clear_display (DISPLAY_LINE **display); /* Update the windows pointed to by WINDOWS in THE_DISPLAY. This actually writes the text on the screen. */ -extern void display_update_display (); +extern void display_update_display (WINDOW *window); /* Display WIN on THE_DISPLAY. Unlike display_update_display (), this function only does one window. */ -extern void display_update_one_window (); +extern void display_update_one_window (WINDOW *win); /* Move the screen cursor to directly over the current character in WINDOW. */ -extern void display_cursor_at_point (); +extern void display_cursor_at_point (WINDOW *window); /* Scroll the region of the_display starting at START, ending at END, and moving the lines AMOUNT lines. If AMOUNT is less than zero, the lines are moved up in the screen, otherwise down. Actually, it is possible for no scrolling to take place in the case that the terminal doesn't support it. This doesn't matter to us. */ -extern void display_scroll_display (); +extern void display_scroll_display (int start, int end, int amount); /* Try to scroll lines in WINDOW. OLD_PAGETOP is the pagetop of WINDOW before having had its line starts recalculated. OLD_STARTS is the list of line starts that used to appear in this window. OLD_COUNT is the number of lines that appear in the OLD_STARTS array. */ -extern void display_scroll_line_starts (); +extern void display_scroll_line_starts (WINDOW *window, int old_pagetop, + char **old_starts, int old_count); #endif /* not INFO_DISPLAY_H */ diff --git a/gnu/usr.bin/texinfo/info/echo-area.c b/gnu/usr.bin/texinfo/info/echo-area.c index 0faad8942dd..e002b1bf2da 100644 --- a/gnu/usr.bin/texinfo/info/echo-area.c +++ b/gnu/usr.bin/texinfo/info/echo-area.c @@ -1,7 +1,8 @@ /* echo-area.c -- how to read a line in the echo area. - $Id: echo-area.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: echo-area.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2004 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 @@ -49,18 +50,19 @@ static int input_line_point; static int input_line_beg; static int input_line_end; static NODE input_line_node = { - (char *)NULL, (char *)NULL, (char *)NULL, input_line, EA_MAX_INPUT, 0 + (char *)NULL, (char *)NULL, (char *)NULL, input_line, + EA_MAX_INPUT, 0, N_IsInternal }; -static void echo_area_initialize_node (); -static void push_echo_area (), pop_echo_area (); -static int echo_area_stack_contains_completions_p (); +static void echo_area_initialize_node (void); +static void push_echo_area (void), pop_echo_area (void); +static int echo_area_stack_contains_completions_p (void); -static void ea_kill_text (); +static void ea_kill_text (int from, int to); /* Non-zero means we force the user to complete. */ static int echo_area_must_complete_p = 0; -static int completions_window_p (); +static int completions_window_p (WINDOW *window); /* If non-null, this is a window which was specifically created to display possible completions output. We remember it so we can delete it when @@ -76,8 +78,7 @@ static long calling_window_pagetop = 0; /* Remember the node and pertinent variables of the calling window. */ static void -remember_calling_window (window) - WINDOW *window; +remember_calling_window (WINDOW *window) { /* Only do this if the calling window is not the completions window, or, if it is the completions window and there is no other window. */ @@ -94,7 +95,7 @@ remember_calling_window (window) /* Restore the caller's window so that it shows the node that it was showing on entry to info_read_xxx_echo_area (). */ static void -restore_calling_window () +restore_calling_window (void) { register WINDOW *win, *compwin = (WINDOW *)NULL; @@ -124,7 +125,10 @@ restore_calling_window () !echo_area_stack_contains_completions_p ()) { WINDOW *next; - int pagetop, start, end, amount; + int pagetop = 0; + int start = 0; + int end = 0; + int amount = 0; next = compwin->next; if (next) @@ -156,8 +160,7 @@ restore_calling_window () /* Set up a new input line with PROMPT. */ static void -initialize_input_line (prompt) - char *prompt; +initialize_input_line (char *prompt) { input_line_prompt = prompt; if (prompt) @@ -169,7 +172,7 @@ initialize_input_line (prompt) } static char * -echo_area_after_read () +echo_area_after_read (void) { char *return_value; @@ -198,9 +201,7 @@ echo_area_after_read () active window, so that we can restore it when we need to. PROMPT, if non-null, is a prompt to print before reading the line. */ char * -info_read_in_echo_area (window, prompt) - WINDOW *window; - char *prompt; +info_read_in_echo_area (WINDOW *window, char *prompt) { char *line; @@ -246,11 +247,11 @@ info_read_in_echo_area (window, prompt) /* (re) Initialize the echo area node. */ static void -echo_area_initialize_node () +echo_area_initialize_node (void) { register int i; - for (i = input_line_end; i < sizeof (input_line); i++) + for (i = input_line_end; (unsigned int) i < sizeof (input_line); i++) input_line[i] = ' '; input_line[i - 1] = '\n'; @@ -262,7 +263,7 @@ echo_area_initialize_node () echo area node, but its primary purpose is to side effect the input line buffer contents. */ void -echo_area_prep_read () +echo_area_prep_read (void) { if (the_echo_area->node != &input_line_node) echo_area_initialize_node (); @@ -559,7 +560,7 @@ DECLARE_INFO_COMMAND (ea_yank, _("Yank back the contents of the last kill")) if (!kill_ring_index) { - inform_in_echo_area (_("Kill ring is empty")); + inform_in_echo_area ((char *) _("Kill ring is empty")); return; } @@ -576,8 +577,8 @@ DECLARE_INFO_COMMAND (ea_yank_pop, _("Yank back a previous kill")) { register int len; - if (((ea_last_executed_command != ea_yank) && - (ea_last_executed_command != ea_yank_pop)) || + if (((ea_last_executed_command != (VFunction *) ea_yank) && + (ea_last_executed_command != (VFunction *) ea_yank_pop)) || (kill_ring_index == 0)) return; @@ -670,8 +671,7 @@ DECLARE_INFO_COMMAND (ea_backward_kill_word, otherwise it is prepended. If the last command was not a kill command, then a new slot is made for this kill. */ static void -ea_kill_text (from, to) - int from, to; +ea_kill_text (int from, int to) { register int i, counter, distance; int killing_backwards, slot; @@ -776,7 +776,7 @@ static int completions_found_slots = 0; static REFERENCE *LCD_completion; /* Internal functions used by the user calls. */ -static void build_completions (), completions_must_be_rebuilt (); +static void build_completions (void), completions_must_be_rebuilt (void); /* Variable which holds the output of completions. */ static NODE *possible_completions_output_node = (NODE *)NULL; @@ -785,8 +785,7 @@ static char *compwin_name = "*Completions*"; /* Return non-zero if WINDOW is a window used for completions output. */ static int -completions_window_p (window) - WINDOW *window; +completions_window_p (WINDOW *window) { int result = 0; @@ -800,11 +799,8 @@ completions_window_p (window) /* Workhorse for completion readers. If FORCE is non-zero, the user cannot exit unless the line read completes, or is empty. */ char * -info_read_completing_internal (window, prompt, completions, force) - WINDOW *window; - char *prompt; - REFERENCE **completions; - int force; +info_read_completing_internal (WINDOW *window, char *prompt, + REFERENCE **completions, int force) { char *line; @@ -869,9 +865,9 @@ info_read_completing_internal (window, prompt, completions, force) if (i == completions_found_index) { if (!completions_found_index) - inform_in_echo_area (_("No completions")); + inform_in_echo_area ((char *) _("No completions")); else - inform_in_echo_area (_("Not complete")); + inform_in_echo_area ((char *) _("Not complete")); continue; } } @@ -897,10 +893,8 @@ info_read_completing_internal (window, prompt, completions, force) /* Read a line in the echo area with completion over COMPLETIONS. */ char * -info_read_completing_in_echo_area (window, prompt, completions) - WINDOW *window; - char *prompt; - REFERENCE **completions; +info_read_completing_in_echo_area (WINDOW *window, + char *prompt, REFERENCE **completions) { return (info_read_completing_internal (window, prompt, completions, 1)); } @@ -908,10 +902,8 @@ info_read_completing_in_echo_area (window, prompt, completions) /* Read a line in the echo area allowing completion over COMPLETIONS, but not requiring it. */ char * -info_read_maybe_completing (window, prompt, completions) - WINDOW *window; - char *prompt; - REFERENCE **completions; +info_read_maybe_completing (WINDOW *window, + char *prompt, REFERENCE **completions) { return (info_read_completing_internal (window, prompt, completions, 0)); } @@ -929,22 +921,23 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) if (!completions_found_index) { terminal_ring_bell (); - inform_in_echo_area (_("No completions")); + inform_in_echo_area ((char *) _("No completions")); } else if ((completions_found_index == 1) && (key != '?')) { - inform_in_echo_area (_("Sole completion")); + inform_in_echo_area ((char *) _("Sole completion")); } else { register int i, l; - int limit, count, max_label = 0; + int limit, iterations, max_label = 0; initialize_message_buffer (); printf_to_message_buffer (completions_found_index == 1 - ? _("One completion:\n") - : _("%d completions:\n"), - completions_found_index); + ? (char *) _("One completion:\n") + : (char *) _("%d completions:\n"), + (void *) (long) completions_found_index, + NULL, NULL); /* Find the maximum length of a label. */ for (i = 0; i < completions_found_index; i++) @@ -967,15 +960,15 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) limit = 1; /* How many iterations of the printing loop? */ - count = (completions_found_index + (limit - 1)) / limit; + iterations = (completions_found_index + (limit - 1)) / limit; /* Watch out for special case. If the number of completions is less than LIMIT, then just do the inner printing loop. */ if (completions_found_index < limit) - count = 1; + iterations = 1; /* Print the sorted items, up-and-down alphabetically. */ - for (i = 0; i < count; i++) + for (i = 0; i < iterations; i++) { register int j; @@ -990,17 +983,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); + printf_to_message_buffer ("%s", label, NULL, NULL); if (j + 1 < limit) { for (k = 0; k < max_label - printed_length; k++) - printf_to_message_buffer (" "); + printf_to_message_buffer (" ", NULL, NULL, NULL); } } - l += count; + l += iterations; } - printf_to_message_buffer ("\n"); + printf_to_message_buffer ("\n", NULL, NULL, NULL); } /* Make a new node to hold onto possible completions. Don't destroy @@ -1028,7 +1021,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) { /* If we can split the window to display most of the completion items, then do so. */ - if (calling_window->height > (count * 2) + if (calling_window->height > (iterations * 2) && calling_window->height / 2 >= WINDOW_MIN_SIZE) { int start, pagetop; @@ -1046,7 +1039,7 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions")) window_make_window (possible_completions_output_node); active_window = the_echo_area; window_change_window_height - (compwin, -(compwin->height - (count + 2))); + (compwin, -(compwin->height - (iterations + 2))); window_adjust_pagetop (calling_window); remember_calling_window (calling_window); @@ -1105,7 +1098,7 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion")) return; } - if (ea_last_executed_command == ea_complete) + if (ea_last_executed_command == (VFunction *) ea_complete) { /* If the keypress is a SPC character, and we have already tried completing once, and there are several completions, then check @@ -1153,9 +1146,11 @@ DECLARE_INFO_COMMAND (ea_complete, _("Insert completion")) } /* Utility REFERENCE used to store possible LCD. */ -static REFERENCE LCD_reference = { (char *)NULL, (char *)NULL, (char *)NULL }; +static REFERENCE LCD_reference = { + (char *)NULL, (char *)NULL, (char *)NULL, 0, 0, 0 +}; -static void remove_completion_duplicates (); +static void remove_completion_duplicates (void); /* Variables which remember the state of the most recent call to build_completions (). */ @@ -1164,7 +1159,7 @@ static REFERENCE **last_completion_items = (REFERENCE **)NULL; /* How to tell the completion builder to reset internal state. */ static void -completions_must_be_rebuilt () +completions_must_be_rebuilt (void) { maybe_free (last_completion_request); last_completion_request = (char *)NULL; @@ -1174,7 +1169,7 @@ completions_must_be_rebuilt () /* Build a list of possible completions from echo_area_completion_items, and the contents of input_line. */ static void -build_completions () +build_completions (void) { register int i, len; register REFERENCE *entry; @@ -1222,7 +1217,8 @@ build_completions () if (!informed_of_lengthy_job && completions_found_index > 100) { informed_of_lengthy_job = 1; - window_message_in_echo_area (_("Building completions...")); + window_message_in_echo_area ((char *) _("Building completions..."), + NULL, NULL); } } @@ -1291,15 +1287,17 @@ build_completions () /* Function called by qsort. */ static int -compare_references (entry1, entry2) - REFERENCE **entry1, **entry2; +compare_references (const void *entry1, const void *entry2) { - return (strcasecmp ((*entry1)->label, (*entry2)->label)); + REFERENCE **e1 = (REFERENCE **) entry1; + REFERENCE **e2 = (REFERENCE **) entry2; + + return (strcasecmp ((*e1)->label, (*e2)->label)); } /* Prune duplicate entries from COMPLETIONS_FOUND. */ static void -remove_completion_duplicates () +remove_completion_duplicates (void) { register int i, j; REFERENCE **temp; @@ -1359,8 +1357,7 @@ DECLARE_INFO_COMMAND (ea_scroll_completions_window, _("Scroll the completions wi /* Function which gets called when an Info window is deleted while the echo area is active. WINDOW is the window which has just been deleted. */ void -echo_area_inform_of_deleted_window (window) - WINDOW *window; +echo_area_inform_of_deleted_window (WINDOW *window) { /* If this is the calling_window, forget what we remembered about it. */ if (window == calling_window) @@ -1400,7 +1397,7 @@ static int pushed_echo_areas_slots = 0; /* Pushing the echo_area has a side effect of zeroing the completion_items. */ static void -push_echo_area () +push_echo_area (void) { PUSHED_EA *pushed; @@ -1422,7 +1419,7 @@ push_echo_area () } static void -pop_echo_area () +pop_echo_area (void) { PUSHED_EA *popped; @@ -1460,7 +1457,7 @@ pop_echo_area () /* Returns non-zero if any of the prior stacked calls to read in the echo area produced a completions window. */ static int -echo_area_stack_contains_completions_p () +echo_area_stack_contains_completions_p (void) { register int i; @@ -1483,7 +1480,7 @@ echo_area_stack_contains_completions_p () #endif /* HAVE_SYS_TIME_H */ static void -pause_or_input () +pause_or_input (void) { #ifdef FD_SET struct timeval timer; @@ -1503,14 +1500,14 @@ pause_or_input () for input or a couple of seconds, whichever comes first. Then flush the informational message that was printed. */ void -inform_in_echo_area (message) - char *message; +inform_in_echo_area (const char *message) { - register int i; + int i; char *text; + int avail = EA_MAX_INPUT + 1 - input_line_end; text = xstrdup (message); - for (i = 0; text[i] && text[i] != '\n'; i++) + for (i = 0; text[i] && text[i] != '\n' && i < avail; i++) ; text[i] = 0; diff --git a/gnu/usr.bin/texinfo/info/echo-area.h b/gnu/usr.bin/texinfo/info/echo-area.h index dfac04dd91e..d4a98a8ba4d 100644 --- a/gnu/usr.bin/texinfo/info/echo-area.h +++ b/gnu/usr.bin/texinfo/info/echo-area.h @@ -1,10 +1,10 @@ /* echo-area.h -- Functions used in reading information from the echo area. - $Id: echo-area.h,v 1.2 1999/01/11 16:38:07 espie Exp $ + $Id: echo-area.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -33,32 +33,53 @@ extern int echo_area_is_active, info_aborted_echo_area; killed some text. */ extern int echo_area_last_command_was_kill; -extern void inform_in_echo_area (), echo_area_inform_of_deleted_window (); -extern void echo_area_prep_read (); +extern void inform_in_echo_area (const char *message); +extern void echo_area_inform_of_deleted_window (WINDOW *window); +extern void echo_area_prep_read (void); extern VFunction *ea_last_executed_command; +extern char * info_read_completing_internal (WINDOW *window, char *prompt, + REFERENCE **completions, int force); /* Read a line of text in the echo area. Return a malloc ()'ed string, or NULL if the user aborted out of this read. WINDOW is the currently active window, so that we can restore it when we need to. PROMPT, if non-null, is a prompt to print before reading the line. */ -extern char *info_read_in_echo_area (); +extern char *info_read_in_echo_area (WINDOW *window, char *prompt); /* Read a line in the echo area with completion over COMPLETIONS. Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */ -char *info_read_completing_in_echo_area (); +char *info_read_completing_in_echo_area (WINDOW *window, + char *prompt, REFERENCE **completions); /* Read a line in the echo area allowing completion over COMPLETIONS, but not requiring it. Takes arguments of WINDOW, PROMPT, and COMPLETIONS, a REFERENCE **. */ -extern char *info_read_maybe_completing (); - -extern void ea_insert (), ea_quoted_insert (); -extern void ea_beg_of_line (), ea_backward (), ea_delete (), ea_end_of_line (); -extern void ea_forward (), ea_abort (), ea_rubout (), ea_complete (); -extern void ea_newline (), ea_kill_line (), ea_transpose_chars (); -extern void ea_yank (), ea_tab_insert (), ea_possible_completions (); -extern void ea_backward_word (), ea_kill_word (), ea_forward_word (); -extern void ea_yank_pop (), ea_backward_kill_word (); -extern void ea_scroll_completions_window (); +extern char *info_read_maybe_completing (WINDOW *window, + char *prompt, REFERENCE **completions); + +extern void ea_insert (WINDOW *window, int count, unsigned char key); +extern void ea_quoted_insert (WINDOW *window, int count, unsigned char key); +extern void ea_beg_of_line (WINDOW *window, int count, unsigned char key); +extern void ea_backward (WINDOW *window, int count, unsigned char key); +extern void ea_delete (WINDOW *window, int count, unsigned char key); +extern void ea_end_of_line (WINDOW *window, int count, unsigned char key); +extern void ea_forward (WINDOW *window, int count, unsigned char key); +extern void ea_abort (WINDOW *window, int count, unsigned char key); +extern void ea_rubout (WINDOW *window, int count, unsigned char key); +extern void ea_complete (WINDOW *window, int count, unsigned char key); +extern void ea_newline (WINDOW *window, int count, unsigned char key); +extern void ea_kill_line (WINDOW *window, int count, unsigned char key); +extern void ea_backward_kill_line (WINDOW *window, int count, unsigned char key); +extern void ea_transpose_chars (WINDOW *window, int count, unsigned char key); +extern void ea_yank (WINDOW *window, int count, unsigned char key); +extern void ea_tab_insert (WINDOW *window, int count, unsigned char key); +extern void ea_possible_completions (WINDOW *window, int count, unsigned char key); +extern void ea_backward_word (WINDOW *window, int count, unsigned char key); +extern void ea_kill_word (WINDOW *window, int count, unsigned char key); +extern void ea_forward_word (WINDOW *window, int count, unsigned char key); +extern void ea_yank_pop (WINDOW *window, int count, unsigned char key); +extern void ea_backward_kill_word (WINDOW *window, int count, unsigned char key); +extern void ea_scroll_completions_window (WINDOW *window, int count, + unsigned char key); #endif /* not INFO_ECHO_AREA_H */ diff --git a/gnu/usr.bin/texinfo/info/filesys.c b/gnu/usr.bin/texinfo/info/filesys.c index 5cf455f22b1..b3cac992a29 100644 --- a/gnu/usr.bin/texinfo/info/filesys.c +++ b/gnu/usr.bin/texinfo/info/filesys.c @@ -1,7 +1,8 @@ /* filesys.c -- filesystem specific functions. - $Id: filesys.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: filesys.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 2000 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2000, 2002, 2003, 2004 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 @@ -25,9 +26,12 @@ #include "filesys.h" /* Local to this file. */ -static char *info_file_in_path (), *lookup_info_filename (); -static char *info_absolute_file (); -static void remember_info_filename (), maybe_initialize_infopath (); +static char *info_file_in_path (char *filename, char *path); +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 { @@ -76,8 +80,7 @@ static char *local_temp_filename = (char *)NULL; static int local_temp_filename_size = 0; char * -info_find_fullpath (partial) - char *partial; +info_find_fullpath (char *partial) { int initial_character; char *temp; @@ -140,7 +143,7 @@ info_find_fullpath (partial) if (temp) { remember_info_filename (partial, temp); - if (strlen (temp) > local_temp_filename_size) + if (strlen (temp) > (unsigned int) local_temp_filename_size) local_temp_filename = (char *) xrealloc (local_temp_filename, (local_temp_filename_size = (50 + strlen (temp)))); @@ -156,8 +159,7 @@ info_find_fullpath (partial) one that is a regular file, return it as a new string. Otherwise, return a NULL pointer. */ static char * -info_file_in_path (filename, path) - char *filename, *path; +info_file_in_path (char *filename, char *path) { struct stat finfo; char *temp_dirname; @@ -254,8 +256,7 @@ info_file_in_path (filename, path) return a NULL pointer. We do it by taking the file name apart into its directory and basename parts, and calling info_file_in_path.*/ static char * -info_absolute_file (fname) - char *fname; +info_absolute_file (char *fname) { char *containing_dir = xstrdup (fname); char *base = filename_non_directory (containing_dir); @@ -266,43 +267,41 @@ info_absolute_file (fname) return info_file_in_path (filename_non_directory (fname), containing_dir); } -/* Given a string containing units of information separated by - the PATH_SEP character, return the next one pointed to by - IDX, or NULL if there are no more. - Advance IDX to the character after the colon. */ + +/* Given a string containing units of information separated by the + PATH_SEP character, return the next one after IDX, or NULL if there + are no more. Advance IDX to the character after the colon. */ + char * -extract_colon_unit (string, idx) - char *string; - int *idx; +extract_colon_unit (char *string, int *idx) { - register int i, start; + unsigned int i = (unsigned int) *idx; + unsigned int start = i; + + if (!string || i >= strlen (string)) + return NULL; - i = start = *idx; - if ((i >= strlen (string)) || !string) - return ((char *) NULL); + if (!string[i]) /* end of string */ + return NULL; + /* Advance to next PATH_SEP. */ while (string[i] && string[i] != PATH_SEP[0]) i++; - if (i == start) - { - return ((char *) NULL); - } - else - { - char *value; - - value = (char *) xmalloc (1 + (i - start)); - strncpy (value, &string[start], (i - start)); - value[i - start] = '\0'; - if (string[i]) - ++i; - *idx = i; - return (value); - } + + { + char *value = xmalloc ((i - start) + 1); + strncpy (value, &string[start], (i - start)); + value[i - start] = 0; + + i++; /* move past PATH_SEP */ + *idx = i; + return value; + } } /* A structure which associates a filename with its expansion. */ -typedef struct { +typedef struct +{ char *filename; char *expansion; } FILENAME_LIST; @@ -315,8 +314,7 @@ static int names_and_files_slots = 0; /* Find the result for having already called info_find_fullpath () with FILENAME. */ static char * -lookup_info_filename (filename) - char *filename; +lookup_info_filename (char *filename) { if (filename && names_and_files) { @@ -332,8 +330,7 @@ lookup_info_filename (filename) /* Add a filename and its expansion to our list. */ static void -remember_info_filename (filename, expansion) - char *filename, *expansion; +remember_info_filename (char *filename, char *expansion) { FILENAME_LIST *new; @@ -357,7 +354,7 @@ remember_info_filename (filename, expansion) } static void -maybe_initialize_infopath () +maybe_initialize_infopath (void) { if (!infopath_size) { @@ -371,9 +368,7 @@ maybe_initialize_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 (path, where) - char *path; - int where; +info_add_path (char *path, int where) { int len; @@ -407,7 +402,7 @@ info_add_path (path, where) /* Make INFOPATH have absolutely nothing in it. */ void -zap_infopath () +zap_infopath (void) { if (infopath) free (infopath); @@ -432,9 +427,7 @@ zap_infopath () FIXME: is it a good idea to show the EOL type on the modeline? */ long -convert_eols (text, textlen) - char *text; - long textlen; +convert_eols (char *text, long int textlen) { register char *s = text; register char *d = text; @@ -458,11 +451,8 @@ convert_eols (text, 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 (pathname, filesize, finfo, is_compressed) - char *pathname; - long *filesize; - struct stat *finfo; - int *is_compressed; +filesys_read_info_file (char *pathname, long int *filesize, + struct stat *finfo, int *is_compressed) { long st_size; @@ -471,7 +461,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed) if (compressed_filename_p (pathname)) { *is_compressed = 1; - return (filesys_read_compressed (pathname, filesize, finfo)); + return (filesys_read_compressed (pathname, filesize)); } else { @@ -523,10 +513,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed) #define FILESYS_PIPE_BUFFER_SIZE (16 * BASIC_PIPE_BUFFER) char * -filesys_read_compressed (pathname, filesize, finfo) - char *pathname; - long *filesize; - struct stat *finfo; +filesys_read_compressed (char *pathname, long int *filesize) { FILE *stream; char *command, *decompressor; @@ -552,7 +539,7 @@ filesys_read_compressed (pathname, filesize, finfo) temp = (char *)xmalloc (5 + strlen (command)); sprintf (temp, "%s...", command); - message_in_echo_area ("%s", temp); + message_in_echo_area ("%s", temp, NULL); free (temp); } #endif /* !BUILDING_LIBRARY */ @@ -614,8 +601,7 @@ filesys_read_compressed (pathname, filesize, finfo) /* Return non-zero if FILENAME belongs to a compressed file. */ int -compressed_filename_p (filename) - char *filename; +compressed_filename_p (char *filename) { char *decompressor; @@ -631,8 +617,7 @@ compressed_filename_p (filename) /* Return the command string that would be used to decompress FILENAME. */ char * -filesys_decompressor_for_file (filename) - char *filename; +filesys_decompressor_for_file (char *filename) { register int i; char *extension = (char *)NULL; @@ -675,9 +660,7 @@ static char *errmsg_buf = (char *)NULL; static int errmsg_buf_size = 0; char * -filesys_error_string (filename, error_num) - char *filename; - int error_num; +filesys_error_string (char *filename, int error_num) { int len; char *result; @@ -700,8 +683,7 @@ filesys_error_string (filename, error_num) in combination. */ int -is_dir_name (filename) - char *filename; +is_dir_name (char *filename) { unsigned i; diff --git a/gnu/usr.bin/texinfo/info/filesys.h b/gnu/usr.bin/texinfo/info/filesys.h index 2c8501665ac..361428afd75 100644 --- a/gnu/usr.bin/texinfo/info/filesys.h +++ b/gnu/usr.bin/texinfo/info/filesys.h @@ -1,7 +1,7 @@ /* filesys.h -- external declarations for filesys.c. - $Id: filesys.h,v 1.3 2000/02/09 02:18:39 espie Exp $ + $Id: filesys.h,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002, 2004 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 @@ -28,11 +28,11 @@ extern char *infopath; /* Make INFOPATH have absolutely nothing in it. */ -extern void zap_infopath (); +extern void zap_infopath (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 (); +extern void info_add_path (char *path, int where); /* Defines that are passed along with the pathname to info_add_path (). */ #define INFOPATH_PREPEND 0 @@ -41,27 +41,29 @@ extern void info_add_path (); /* 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 (); +extern char *info_find_fullpath (char *partial); /* 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. */ -long convert_eols (); +long convert_eols (char *text, long textlen); /* Read the contents of PATHNAME, returning a buffer with the contents of 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 (); -extern char *filesys_read_compressed (); +extern char *filesys_read_info_file (char *pathname, long int *filesize, + struct stat *finfo, int *is_compressed); + +extern char *filesys_read_compressed (char *pathname, long int *filesize); /* Return the command string that would be used to decompress FILENAME. */ -extern char *filesys_decompressor_for_file (); -extern int compressed_filename_p (); +extern char *filesys_decompressor_for_file (char *filename); +extern int compressed_filename_p (char *filename); /* A function which returns a pointer to a static buffer containing an error message for FILENAME and ERROR_NUM. */ -extern char *filesys_error_string (); +extern char *filesys_error_string (char *filename, int error_num); /* The number of the most recent file system error. */ extern int filesys_error_number; @@ -69,10 +71,10 @@ extern int filesys_error_number; /* Given a string containing units of information separated by colons, return the next one pointed to by IDX, or NULL if there are no more. Advance IDX to the character after the colon. */ -extern char *extract_colon_unit (); +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 (); +extern int is_dir_name (char *filename); /* The default value of INFOPATH. */ #if !defined (DEFAULT_INFOPATH) diff --git a/gnu/usr.bin/texinfo/info/footnotes.c b/gnu/usr.bin/texinfo/info/footnotes.c index 03e40054c6f..1b2a5883c30 100644 --- a/gnu/usr.bin/texinfo/info/footnotes.c +++ b/gnu/usr.bin/texinfo/info/footnotes.c @@ -1,7 +1,8 @@ /* footnotes.c -- Some functions for manipulating footnotes. - $Id: footnotes.c,v 1.3 2000/02/09 02:18:39 espie Exp $ + $Id: footnotes.c,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2002, 2004 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,21 +18,23 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" -/* Non-zero means attempt to show footnotes when displaying a new window. */ -int auto_footnotes_p = 1; +/* Nonzero means attempt to show footnotes when displaying a new window. */ +int auto_footnotes_p = 0; static char *footnote_nodename = "*Footnotes*"; +NODE * make_footnotes_node (NODE *node); + #define FOOTNOTE_HEADER_FORMAT \ - "*** Footnotes appearing in the node \"%s\" ***\n" + "*** Footnotes appearing in the node `%s' ***\n" /* Find the window currently showing footnotes. */ static WINDOW * -find_footnotes_window () +find_footnotes_window (void) { WINDOW *win; @@ -48,8 +51,7 @@ find_footnotes_window () return the manufactured node. If NODE has no footnotes, return a NULL pointer. */ NODE * -make_footnotes_node (node) - NODE *node; +make_footnotes_node (NODE *node) { NODE *fn_node, *result = (NODE *)NULL; long fn_start; @@ -160,8 +162,7 @@ make_footnotes_node (node) in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the window to show them couldn't be made. */ int -info_get_or_remove_footnotes (window) - WINDOW *window; +info_get_or_remove_footnotes (WINDOW *window) { WINDOW *fn_win; NODE *new_footnotes; @@ -209,7 +210,7 @@ info_get_or_remove_footnotes (window) /* If we are hacking automatic footnotes, and there are footnotes but we couldn't display them, print a message to that effect. */ if (auto_footnotes_p) - inform_in_echo_area (_("Footnotes could not be displayed")); + inform_in_echo_area ((char *) _("Footnotes could not be displayed")); return (FN_UNABLE); } } @@ -256,11 +257,11 @@ DECLARE_INFO_COMMAND (info_show_footnotes, switch (result) { case FN_UNFOUND: - info_error (msg_no_foot_node); + info_error ((char *) msg_no_foot_node, NULL, NULL); break; case FN_UNABLE: - info_error (msg_win_too_small); + info_error ((char *) msg_win_too_small, NULL, NULL); break; } } diff --git a/gnu/usr.bin/texinfo/info/footnotes.h b/gnu/usr.bin/texinfo/info/footnotes.h index c9ed1448485..73f696c04d7 100644 --- a/gnu/usr.bin/texinfo/info/footnotes.h +++ b/gnu/usr.bin/texinfo/info/footnotes.h @@ -1,7 +1,7 @@ /* footnotes.h -- Some functions for manipulating footnotes. - $Id: footnotes.h,v 1.3 2000/02/09 02:18:39 espie Exp $ + $Id: footnotes.h,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002, 2004 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 @@ -35,7 +35,7 @@ and displayed. Returns FN_UNFOUND if there were no footnotes found in WINDOW's node. Returns FN_UNABLE if there were footnotes, but the window to show them couldn't be made. */ -extern int info_get_or_remove_footnotes (); +extern int info_get_or_remove_footnotes (WINDOW *window); /* Non-zero means attempt to show footnotes when displaying a new window. */ extern int auto_footnotes_p; diff --git a/gnu/usr.bin/texinfo/info/gc.h b/gnu/usr.bin/texinfo/info/gc.h index 3f62a14dcbe..1ac10178dad 100644 --- a/gnu/usr.bin/texinfo/info/gc.h +++ b/gnu/usr.bin/texinfo/info/gc.h @@ -1,10 +1,10 @@ /* gc.h -- Functions for garbage collecting unused node contents. - $Id: gc.h,v 1.2 1999/01/11 16:38:08 espie Exp $ + $Id: gc.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -28,10 +28,10 @@ /* Add POINTER to the list of garbage collectible pointers. A pointer is not actually garbage collected until no info window contains a node whose contents member is equal to the pointer. */ -extern void add_gcable_pointer (); +extern void add_gcable_pointer (char *pointer); /* Grovel the list of info windows and gc-able pointers finding those node->contents which are collectible, and free them. */ -extern void gc_pointers (); +extern void gc_pointers (void); #endif /* not INFO_GC_H */ diff --git a/gnu/usr.bin/texinfo/info/indices.c b/gnu/usr.bin/texinfo/info/indices.c index e292b859618..34776b9407a 100644 --- a/gnu/usr.bin/texinfo/info/indices.c +++ b/gnu/usr.bin/texinfo/info/indices.c @@ -1,7 +1,8 @@ /* indices.c -- deal with an Info file index. - $Id: indices.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: indices.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2002 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2002, 2003, 2004 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 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" #include "indices.h" @@ -54,9 +55,7 @@ static int index_nodenames_slots = 0; /* Add the name of NODE, and the range of the associated index elements (passed in ARRAY) to index_nodenames. */ static void -add_index_to_index_nodenames (array, node) - REFERENCE **array; - NODE *node; +add_index_to_index_nodenames (REFERENCE **array, NODE *node) { register int i, last; INDEX_NAME_ASSOC *assoc; @@ -87,8 +86,7 @@ add_index_to_index_nodenames (array, node) indices are concatenated and the result returned. If WINDOW's info file doesn't have any indices, a NULL pointer is returned. */ REFERENCE ** -info_indices_of_window (window) - WINDOW *window; +info_indices_of_window (WINDOW *window) { FILE_BUFFER *fb; @@ -98,8 +96,7 @@ info_indices_of_window (window) } REFERENCE ** -info_indices_of_file_buffer (file_buffer) - FILE_BUFFER *file_buffer; +info_indices_of_file_buffer (FILE_BUFFER *file_buffer) { register int i; REFERENCE **result = (REFERENCE **)NULL; @@ -180,10 +177,7 @@ DECLARE_INFO_COMMAND (info_index_search, /* Look up SEARCH_STRING in the index for this file. If SEARCH_STRING is NULL, prompt user for input. */ void -do_info_index_search (window, count, search_string) - WINDOW *window; - int count; - char *search_string; +do_info_index_search (WINDOW *window, int count, char *search_string) { FILE_BUFFER *fb; char *line; @@ -202,14 +196,15 @@ do_info_index_search (window, count, search_string) (FILENAME_CMP (initial_index_filename, fb->filename) != 0)) { info_free_references (index_index); - window_message_in_echo_area (_("Finding index entries...")); + window_message_in_echo_area ((char *) _("Finding index entries..."), + NULL, NULL); index_index = info_indices_of_file_buffer (fb); } /* If there is no index, quit now. */ if (!index_index) { - info_error (_("No indices found.")); + info_error ((char *) _("No indices found."), NULL, NULL); return; } @@ -219,7 +214,7 @@ do_info_index_search (window, count, search_string) line = xstrdup (search_string); else { - line = info_read_maybe_completing (window, _("Index entry: "), + line = info_read_maybe_completing (window, (char *) _("Index entry: "), index_index); window = active_window; @@ -282,9 +277,7 @@ do_info_index_search (window, count, search_string) } int -index_entry_exists (window, string) - WINDOW *window; - char *string; +index_entry_exists (WINDOW *window, char *string) { register int i; FILE_BUFFER *fb; @@ -339,14 +332,14 @@ DECLARE_INFO_COMMAND (info_next_index_match, yet. */ if (!index_search) { - info_error (_("No previous index search string.")); + info_error ((char *) _("No previous index search string."), NULL, NULL); return; } /* If there is no index, that is an error. */ if (!index_index) { - info_error (_("No index entries.")); + info_error ((char *) _("No index entries."), NULL, NULL); return; } @@ -379,8 +372,8 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* If that failed, print an error. */ if ((i < 0) || (!index_index[i])) { - info_error (_("No %sindex entries containing \"%s\"."), - index_offset > 0 ? _("more ") : "", index_search); + info_error ((char *) _("No %sindex entries containing `%s'."), + index_offset > 0 ? (char *) _("more ") : "", index_search); return; } @@ -390,7 +383,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* Report to the user on what we have found. */ { register int j; - char *name = _("CAN'T SEE THIS"); + const char *name = _("CAN'T SEE THIS"); char *match; for (j = 0; index_nodenames[j]; j++) @@ -409,26 +402,27 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (partial && show_index_match) { - int j, ls, start, upper; + int k, ls, start, upper; ls = strlen (index_search); start = partial - ls; upper = isupper (match[start]) ? 1 : 0; - for (j = 0; j < ls; j++) + for (k = 0; k < ls; k++) if (upper) - match[j + start] = info_tolower (match[j + start]); + match[k + start] = info_tolower (match[k + start]); else - match[j + start] = info_toupper (match[j + start]); + match[k + start] = info_toupper (match[k + start]); } { char *format; format = replace_in_documentation - (_("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)")); + ((char *) _("Found `%s' in %s. (`\\[next-index-match]' tries to find next.)"), + 0); - window_message_in_echo_area (format, match, name); + window_message_in_echo_area (format, match, (char *) name); } free (match); @@ -439,7 +433,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, if (!node) { - info_error (msg_cant_file_node, + info_error ((char *) msg_cant_file_node, index_index[i]->filename, index_index[i]->nodename); return; } @@ -470,9 +464,7 @@ DECLARE_INFO_COMMAND (info_next_index_match, /* For every menu item in DIR, search the indices of that file for SEARCH_STRING. */ REFERENCE ** -apropos_in_all_indices (search_string, inform) - char *search_string; - int inform; +apropos_in_all_indices (char *search_string, int inform) { register int i, dir_index; REFERENCE **all_indices = (REFERENCE **)NULL; @@ -546,7 +538,8 @@ apropos_in_all_indices (search_string, inform) } if (this_fb && inform) - message_in_echo_area (_("Scanning indices of \"%s\"..."), files_name); + message_in_echo_area ((char *) _("Scanning indices of `%s'..."), + files_name, NULL); this_index = info_indices_of_file_buffer (this_fb); free (this_node); @@ -600,20 +593,17 @@ apropos_in_all_indices (search_string, inform) } #define APROPOS_NONE \ - N_("No available info files have \"%s\" in their indices.") + N_("No available info files have `%s' in their indices.") void -info_apropos (string) - char *string; +info_apropos (char *string) { REFERENCE **apropos_list; apropos_list = apropos_in_all_indices (string, 0); if (!apropos_list) - { - info_error (_(APROPOS_NONE), string); - } + info_error ((char *) _(APROPOS_NONE), string, NULL); else { register int i; @@ -633,7 +623,7 @@ DECLARE_INFO_COMMAND (info_index_apropos, { char *line; - line = info_read_in_echo_area (window, _("Index apropos: ")); + line = info_read_in_echo_area (window, (char *) _("Index apropos: ")); window = active_window; @@ -653,9 +643,7 @@ DECLARE_INFO_COMMAND (info_index_apropos, apropos_list = apropos_in_all_indices (line, 1); if (!apropos_list) - { - info_error (_(APROPOS_NONE), line); - } + info_error ((char *) _(APROPOS_NONE), line, NULL); else { register int i; @@ -663,7 +651,8 @@ DECLARE_INFO_COMMAND (info_index_apropos, initialize_message_buffer (); printf_to_message_buffer - (_("\n* Menu: Nodes whoses indices contain \"%s\":\n"), line); + ((char *) _("\n* Menu: Nodes whose indices contain `%s':\n"), + line, NULL, NULL); line_buffer = (char *)xmalloc (500); for (i = 0; apropos_list[i]; i++) @@ -677,7 +666,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); + printf_to_message_buffer ("%s\n", line_buffer, NULL, NULL); } free (line_buffer); } @@ -744,4 +733,3 @@ DECLARE_INFO_COMMAND (info_index_apropos, if (!info_error_was_printed) window_clear_echo_area (); } - diff --git a/gnu/usr.bin/texinfo/info/indices.h b/gnu/usr.bin/texinfo/info/indices.h index bd0a7273cf9..61893a75368 100644 --- a/gnu/usr.bin/texinfo/info/indices.h +++ b/gnu/usr.bin/texinfo/info/indices.h @@ -1,10 +1,10 @@ /* indices.h -- Functions defined in indices.c. - $Id: indices.h,v 1.2 1999/01/11 16:38:08 espie Exp $ + $Id: indices.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -28,15 +28,18 @@ /* User-visible variable controls the output of info-index-next. */ extern int show_index_match; -extern REFERENCE **info_indices_of_window (), **info_indices_of_file_buffer (); -extern void info_apropos (); +extern REFERENCE **info_indices_of_window (WINDOW *window); +extern REFERENCE **info_indices_of_file_buffer (FILE_BUFFER *file_buffer); +extern void info_apropos (char *string); /* For every menu item in DIR, search the indices of that file for STRING. */ -REFERENCE **apropos_in_all_indices (); +REFERENCE **apropos_in_all_indices (char *search_string, int inform); /* User visible functions declared in indices.c. */ -extern void info_index_search (), info_next_index_match (); -extern void do_info_index_search (); -extern int index_intry_exists (); +extern void info_index_search (WINDOW *window, int count, unsigned char key); +extern void info_next_index_match (WINDOW *window, int count, unsigned char key); +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); #endif /* not INFO_INDICES_H */ diff --git a/gnu/usr.bin/texinfo/info/info-utils.h b/gnu/usr.bin/texinfo/info/info-utils.h index c259da8f2be..8e20a3adcf0 100644 --- a/gnu/usr.bin/texinfo/info/info-utils.h +++ b/gnu/usr.bin/texinfo/info/info-utils.h @@ -1,7 +1,8 @@ /* info-utils.h -- Exported functions and variables from info-utils.c. - $Id: info-utils.h,v 1.3 2000/02/09 02:18:39 espie Exp $ + $Id: info-utils.h,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 96, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1998, 2002, 2003, 2004 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 @@ -34,6 +35,7 @@ typedef struct { char *filename; /* File where this node can be found. */ char *nodename; /* Name of the node. */ int start, end; /* Offsets within the containing node of LABEL. */ + int line_number; /* Specific line number a menu item points to. */ } REFERENCE; /* When non-zero, various display and input functions handle ISO Latin @@ -53,69 +55,73 @@ extern char *info_parsed_nodename; 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 (); +void info_parse_node (char *string, int newlines_okay); /* 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. */ -extern REFERENCE **info_menu_of_node (); +extern REFERENCE **info_menu_of_node (NODE *node); /* Return a NULL terminated array of REFERENCE * which represents the cross refrences found in NODE. If there are no cross references in NODE, just return a NULL pointer. */ -extern REFERENCE **info_xrefs_of_node (); +extern REFERENCE **info_xrefs_of_node (NODE *node); /* Glean cross references from BINDING->buffer + BINDING->start until BINDING->end. Return an array of REFERENCE * that represents each cross reference in this range. */ -extern REFERENCE **info_xrefs (); +extern REFERENCE **info_xrefs (SEARCH_BINDING *binding); /* Get the entry associated with LABEL in REFERENCES. Return a pointer to the reference if found, or NULL. */ -extern REFERENCE *info_get_labeled_reference (); +extern REFERENCE *info_get_labeled_reference (char *label, + REFERENCE **references); /* Glean menu entries from BINDING->buffer + BINDING->start until we have looked at the entire contents of BINDING. Return an array of REFERENCE * that represents each menu item in this range. */ -extern REFERENCE **info_menu_items (); +extern REFERENCE **info_menu_items (SEARCH_BINDING *binding); /* A utility function for concatenating REFERENCE **. Returns a new REFERENCE ** which is the concatenation of REF1 and REF2. The REF1 and REF2 arrays are freed, but their contents are not. */ -REFERENCE **info_concatenate_references (); +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 REFERENCES. */ -extern void info_free_references (); +extern void info_free_references (REFERENCE **references); /* Search for sequences of whitespace or newlines in STRING, replacing all such sequences with just a single space. Remove whitespace from start and end of string. */ -void canonicalize_whitespace (); +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 (); +extern char *printed_representation (unsigned char character, int hpos); /* Return a pointer to the part of PATHNAME that simply defines the file. */ -extern char *filename_non_directory (); +extern char *filename_non_directory (char *pathname); /* Return non-zero if NODE is one especially created by Info. */ -extern int internal_info_node_p (); +extern int internal_info_node_p (NODE *node); /* Make NODE appear to be one especially created by Info, and give it NAME. */ -extern void name_internal_node (); +extern void name_internal_node (NODE *node, char *name); /* Return the window displaying NAME, the name of an internally created Info window. */ -extern WINDOW *get_internal_info_window (); +extern WINDOW *get_internal_info_window (char *name); /* Return a window displaying the node NODE. */ -extern WINDOW *get_window_of_node (); +extern WINDOW *get_window_of_node (NODE *node); /* Return the node addressed by LABEL in NODE (usually one of "Prev:", "Next:", "Up:", "File:", or "Node:". After a call to this function, the globals `info_parsed_nodename' and `info_parsed_filename' contain the information. */ -extern void info_parse_label (/* label, node */); +extern void info_parse_label (char *label, NODE *node); #define info_file_label_of_node(n) info_parse_label (INFO_FILE_LABEL, n) #define info_next_label_of_node(n) info_parse_label (INFO_NEXT_LABEL, n) diff --git a/gnu/usr.bin/texinfo/info/info.c b/gnu/usr.bin/texinfo/info/info.c index 15d4a0a6798..44f9cb8c169 100644 --- a/gnu/usr.bin/texinfo/info/info.c +++ b/gnu/usr.bin/texinfo/info/info.c @@ -1,8 +1,8 @@ /* info.c -- Display nodes of Info files in multiple windows. - $Id: info.c,v 1.8 2003/10/03 23:39:58 deraadt Exp $ + $Id: info.c,v 1.9 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02 - Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, + 2004 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 @@ -77,8 +77,11 @@ int dump_subnodes = 0; /* Non-zero means make default keybindings be loosely modeled on vi(1). */ int vi_keys_p = 0; -/* Non-zero means don't remove ANSI escape sequences from man pages. */ -int raw_escapes_p = 0; +/* Non-zero means don't remove ANSI escape sequences. */ +int raw_escapes_p = 1; + +/* Non-zero means print the absolute location of the file to be loaded. */ +static int print_where_p = 0; #ifdef __MSDOS__ /* Non-zero indicates that screen output should be made 'speech-friendly'. @@ -103,15 +106,18 @@ static struct option long_options[] = { { "file", 1, 0, 'f' }, { "help", 0, &print_help_p, 1 }, { "index-search", 1, 0, IDXSRCH_OPTION }, + { "location", 0, &print_where_p, 1 }, { "node", 1, 0, 'n' }, { "output", 1, 0, 'o' }, { "raw-escapes", 0, &raw_escapes_p, 1 }, + { "no-raw-escapes", 0, &raw_escapes_p, 0 }, { "restore", 1, 0, RESTORE_OPTION }, { "show-options", 0, 0, 'O' }, { "subnodes", 0, &dump_subnodes, 1 }, { "usage", 0, 0, 'O' }, { "version", 0, &print_version_p, 1 }, { "vi-keys", 0, &vi_keys_p, 1 }, + { "where", 0, &print_where_p, 1 }, #ifdef __MSDOS__ { "speech-friendly", 0, &speech_friendly, 1 }, #endif @@ -120,18 +126,17 @@ static struct option long_options[] = { /* String describing the shorthand versions of the long options found above. */ #ifdef __MSDOS__ -static char *short_options = "d:n:f:ho:ORsb"; +static char *short_options = "d:n:f:ho:ORswb"; #else -static char *short_options = "d:n:f:ho:ORs"; +static char *short_options = "d:n:f:ho:ORws"; #endif /* When non-zero, the Info window system has been initialized. */ int info_windows_initialized_p = 0; /* Some "forward" declarations. */ -static void info_short_help (), remember_info_program_name (); -static void init_messages (); -extern void add_file_directory_to_path (); +static void info_short_help (void); +static void init_messages (void); /* **************************************************************** */ @@ -141,9 +146,7 @@ extern void add_file_directory_to_path (); /* **************************************************************** */ int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int getopt_long_index; /* Index returned by getopt_long (). */ NODE *initial_node; /* First node loaded by Info. */ @@ -153,12 +156,14 @@ main (argc, argv) setlocale (LC_ALL, ""); #endif +#ifdef ENABLE_NLS /* Set the text message domain. */ bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); +#endif init_messages (); - + while (1) { int option_character; @@ -166,7 +171,7 @@ main (argc, argv) option_character = getopt_long (argc, argv, short_options, long_options, &getopt_long_index); - /* getopt_long () returns EOF when there are no more long options. */ + /* getopt_long returns EOF when there are no more long options. */ if (option_character == EOF) break; @@ -199,6 +204,7 @@ main (argc, argv) user_filename = xstrdup (optarg); break; + /* Treat -h like --help. */ case 'h': print_help_p = 1; break; @@ -228,6 +234,11 @@ main (argc, argv) dump_subnodes = 1; break; + /* For compatibility with man, -w is --where. */ + case 'w': + print_where_p = 1; + break; + #ifdef __MSDOS__ /* User wants speech-friendly output. */ case 'b': @@ -280,11 +291,10 @@ main (argc, argv) { printf ("%s (GNU %s) %s\n", program_name, PACKAGE, VERSION); puts (""); - printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\ -There is NO warranty. You may redistribute this software\n\ + puts ("Copyright (C) 2004 Free Software Foundation, Inc."); + printf (_("There is NO warranty. You may redistribute this software\n\ under the terms of the GNU General Public License.\n\ -For more information about these matters, see the files named COPYING.\n"), - "2002"); +For more information about these matters, see the files named COPYING.\n")); xexit (0); } @@ -321,7 +331,13 @@ For more information about these matters, see the files named COPYING.\n"), { info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND); #ifdef INFODIR /* from the Makefile */ - info_add_path (INFODIR, INFOPATH_PREPEND); + 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 } } @@ -348,10 +364,10 @@ For more information about these matters, see the files named COPYING.\n"), if (!initial_node) { if (info_recent_file_error) - info_error (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"); + info_error ((char *) msg_cant_find_node, + user_nodenames ? user_nodenames[0] : "Top", NULL); xexit (1); } @@ -363,7 +379,9 @@ For more information about these matters, see the files named COPYING.\n"), { free (initial_node); - if (user_output_filename) + 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 @@ -377,13 +395,27 @@ For more information about these matters, see the files named COPYING.\n"), file name is either "dir", or the contents of user_filename if one was specified. */ { - char *errstr, *errarg1, *errarg2; + const char *errstr; + char *errarg1, *errarg2; + NODE *new_initial_node = info_follow_menus (initial_node, argv + optind, - &errstr, &errarg1, &errarg2); + &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. */ @@ -393,14 +425,14 @@ For more information about these matters, see the files named COPYING.\n"), dump_node_to_file (initial_node, user_output_filename, dump_subnodes); else - info_error (errstr, errarg1, errarg2); + info_error ((char *) errstr, errarg1, errarg2); } else { if (errstr) - begin_info_session_with_error (initial_node, errstr, - errarg1, errarg2); + begin_info_session_with_error (initial_node, (char *) 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. */ @@ -477,11 +509,12 @@ For more information about these matters, see the files named COPYING.\n"), xexit (0); } + + return 0; /* Avoid bogus warnings. */ } void -add_file_directory_to_path (filename) - char *filename; +add_file_directory_to_path (char *filename) { char *directory_name = xstrdup (filename); char *temp = filename_non_directory (directory_name); @@ -515,9 +548,7 @@ int info_error_rings_bell_p = 1; then the message is printed in the echo area. Otherwise, a message is output to stderr. */ void -info_error (format, arg1, arg2) - char *format; - void *arg1, *arg2; +info_error (char *format, void *arg1, void *arg2) { info_error_was_printed = 1; @@ -553,7 +584,7 @@ info_error (format, arg1, arg2) /* Produce a scaled down description of the available options to Info. */ static void -info_short_help () +info_short_help (void) { #ifdef __MSDOS__ static const char speech_friendly_string[] = N_("\ @@ -562,7 +593,7 @@ info_short_help () static const char speech_friendly_string[] = ""; #endif - + printf (_("\ Usage: %s [OPTION]... [MENU-ITEM...]\n\ \n\ @@ -577,10 +608,12 @@ Options:\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.\n\ - -R, --raw-escapes don't remove ANSI escapes from man pages.\n\ + -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\ -O, --show-options, --usage go to command-line options node.\n%s\ --subnodes recursively output menu items.\n\ + -w, --where, --location print physical location of Info file.\n\ --vi-keys use vi-like and less-like key bindings.\n\ --version display version information and exit.\n\ \n\ @@ -613,25 +646,25 @@ Texinfo home page: http://www.gnu.org/software/texinfo/")); use them that way. This also has the advantage that there's only one copy of the strings. */ -char *msg_cant_find_node; -char *msg_cant_file_node; -char *msg_cant_find_window; -char *msg_cant_find_point; -char *msg_cant_kill_last; -char *msg_no_menu_node; -char *msg_no_foot_node; -char *msg_no_xref_node; -char *msg_no_pointer; -char *msg_unknown_command; -char *msg_term_too_dumb; -char *msg_at_node_bottom; -char *msg_at_node_top; -char *msg_one_window; -char *msg_win_too_small; -char *msg_cant_make_help; +const char *msg_cant_find_node; +const char *msg_cant_file_node; +const char *msg_cant_find_window; +const char *msg_cant_find_point; +const char *msg_cant_kill_last; +const char *msg_no_menu_node; +const char *msg_no_foot_node; +const char *msg_no_xref_node; +const char *msg_no_pointer; +const char *msg_unknown_command; +const char *msg_term_too_dumb; +const char *msg_at_node_bottom; +const char *msg_at_node_top; +const char *msg_one_window; +const char *msg_win_too_small; +const char *msg_cant_make_help; static void -init_messages () +init_messages (void) { msg_cant_find_node = _("Cannot find node `%s'."); msg_cant_file_node = _("Cannot find node `(%s)%s'."); diff --git a/gnu/usr.bin/texinfo/info/info.h b/gnu/usr.bin/texinfo/info/info.h index deb57e704ff..92d1cbe7925 100644 --- a/gnu/usr.bin/texinfo/info/info.h +++ b/gnu/usr.bin/texinfo/info/info.h @@ -1,7 +1,8 @@ /* info.h -- Header file which includes all of the other headers. - $Id: info.h,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: info.h,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 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 @@ -125,37 +126,35 @@ extern int raw_escapes_p; /* Print FORMAT with ARG1 and ARG2. 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 (); +extern void info_error (char *format, void *arg1, void *arg2); + +extern void add_file_directory_to_path (char *filename); /* Error message defines. */ -extern char *msg_cant_find_node; -extern char *msg_cant_file_node; -extern char *msg_cant_find_window; -extern char *msg_cant_find_point; -extern char *msg_cant_kill_last; -extern char *msg_no_menu_node; -extern char *msg_no_foot_node; -extern char *msg_no_xref_node; -extern char *msg_no_pointer; -extern char *msg_unknown_command; -extern char *msg_term_too_dumb; -extern char *msg_at_node_bottom; -extern char *msg_at_node_top; -extern char *msg_one_window; -extern char *msg_win_too_small; -extern char *msg_cant_make_help; +extern const char *msg_cant_find_node; +extern const char *msg_cant_file_node; +extern const char *msg_cant_find_window; +extern const char *msg_cant_find_point; +extern const char *msg_cant_kill_last; +extern const char *msg_no_menu_node; +extern const char *msg_no_foot_node; +extern const char *msg_no_xref_node; +extern const char *msg_no_pointer; +extern const char *msg_unknown_command; +extern const char *msg_term_too_dumb; +extern const char *msg_at_node_bottom; +extern const char *msg_at_node_top; +extern const char *msg_one_window; +extern const char *msg_win_too_small; +extern const char *msg_cant_make_help; -extern char *filename_non_directory (); /* Found in info-utils.c. */ - #if defined(INFOKEY) -extern void set_variable_to_value (); /* Found in variables.c. */ +/* Found in variables.c. */ +extern void set_variable_to_value (char *name, char *value); #endif /* INFOKEY */ -#if !defined (BUILDING_LIBRARY) -extern int info_windows_initialized_p; /* Found in session.c */ -/* Found in window.c. */ -extern void message_in_echo_area (), unmessage_in_echo_area (); -#endif /* !BUILDING_LIBRARY */ +/* Found in m-x.c. */ +extern char *read_function_name (char *prompt, WINDOW *window); #endif /* !INFO_H */ diff --git a/gnu/usr.bin/texinfo/info/infodoc.c b/gnu/usr.bin/texinfo/info/infodoc.c index 8d0c42dad4c..cb365e2fe2f 100644 --- a/gnu/usr.bin/texinfo/info/infodoc.c +++ b/gnu/usr.bin/texinfo/info/infodoc.c @@ -1,7 +1,8 @@ -/* infodoc.c -- Functions which build documentation nodes. - $Id: infodoc.c,v 1.4 2002/06/10 13:51:03 espie Exp $ +/* infodoc.c -- functions which build documentation nodes. + $Id: infodoc.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 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 @@ -36,7 +37,7 @@ static NODE *internal_info_help_node = (NODE *)NULL; static char *internal_info_help_node_contents = (char *)NULL; /* The (more or less) static text which appears in the internal info - help node. The actual key bindings are inserted. Keep the + help node. The actual key bindings are inserted. Keep the underlines (****, etc.) in the same N_ call as the text lines they refer to, so translations can make the number of *'s or -'s match. */ #if defined(INFOKEY) @@ -66,12 +67,12 @@ static char *info_internal_help_text[] = { "\n", N_("Moving within a node:\n\ ---------------------\n"), - N_("\\%-10[scroll-forward] Scroll forward a page.\n"), - N_("\\%-10[scroll-backward] Scroll backward a page.\n"), N_("\\%-10[beginning-of-node] Go to the beginning of this node.\n"), N_("\\%-10[end-of-node] Go to the end of this node.\n"), - N_("\\%-10[scroll-forward] Scroll forward 1 line.\n"), - N_("\\%-10[scroll-backward] Scroll backward 1 line.\n"), + N_("\\%-10[next-line] Scroll forward 1 line.\n"), + N_("\\%-10[prev-line] Scroll backward 1 line.\n"), + N_("\\%-10[scroll-forward] Scroll forward a page.\n"), + N_("\\%-10[scroll-backward] Scroll backward a page.\n"), "\n", N_("Other commands:\n\ ---------------\n"), @@ -184,12 +185,10 @@ static char *info_help_keys_text[][2] = { #endif /* !INFOKEY */ -static char *where_is_internal (); +static char *where_is_internal (Keymap map, InfoCommand *cmd); void -dump_map_to_message_buffer (prefix, map) - char *prefix; - Keymap map; +dump_map_to_message_buffer (char *prefix, Keymap map) { register int i; unsigned prefix_len = strlen (prefix); @@ -225,13 +224,16 @@ dump_map_to_message_buffer (prefix, map) if (last - 1 != i) { - 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)); + printf_to_message_buffer ("%s .. ", pretty_keyseq (new_prefix), + NULL, NULL); + new_prefix[prefix_len] = last - 1; + printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix), + NULL, NULL); i = last - 1; } else - printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix)); + printf_to_message_buffer ("%s\t", pretty_keyseq (new_prefix), + NULL, NULL); #if defined (NAMED_FUNCTIONS) /* Print the name of the function, and some padding before the @@ -240,22 +242,23 @@ dump_map_to_message_buffer (prefix, map) int length_so_far; int desired_doc_start = 40; /* Must be multiple of 8. */ - printf_to_message_buffer ("(%s)", name); + printf_to_message_buffer ("(%s)", name, NULL, NULL); length_so_far = message_buffer_length_this_line (); - if ((desired_doc_start + strlen (doc)) >= the_screen->width) - printf_to_message_buffer ("\n "); + if ((desired_doc_start + strlen (doc)) + >= (unsigned int) the_screen->width) + printf_to_message_buffer ("\n ", NULL, NULL, NULL); else { while (length_so_far < desired_doc_start) { - printf_to_message_buffer ("\t"); + printf_to_message_buffer ("\t", NULL, NULL, NULL); length_so_far += character_width ('\t', length_so_far); } } } #endif /* NAMED_FUNCTIONS */ - printf_to_message_buffer ("%s\n", doc); + printf_to_message_buffer ("%s\n", doc, NULL, NULL); } } free (new_prefix); @@ -268,8 +271,7 @@ dump_map_to_message_buffer (prefix, map) make q do the right thing in both cases. */ static void -create_internal_info_help_node (help_is_only_window_p) - int help_is_only_window_p; +create_internal_info_help_node (int help_is_only_window_p) { register int i; NODE *node; @@ -290,8 +292,9 @@ create_internal_info_help_node (help_is_only_window_p) for (i = 0; info_internal_help_text[i]; i++) { #ifdef INFOKEY - printf_to_message_buffer (replace_in_documentation ( - _(info_internal_help_text[i]), help_is_only_window_p)); + printf_to_message_buffer (replace_in_documentation + ((char *) _(info_internal_help_text[i]), help_is_only_window_p), + NULL, NULL, NULL); #else /* Don't translate blank lines, gettext outputs the po file header in that case. We want a blank line. */ @@ -299,24 +302,27 @@ create_internal_info_help_node (help_is_only_window_p) ? _(info_internal_help_text[i]) : info_internal_help_text[i]; char *key = info_help_keys_text[i][vi_keys_p]; - + /* If we have only one window (because the window size was too small to split it), CTRL-x 0 doesn't work to `quit' help. */ if (STREQ (key, "CTRL-x 0") && help_is_only_window_p) key = "l"; - printf_to_message_buffer (msg, key); + printf_to_message_buffer (msg, key, NULL, NULL); #endif /* !INFOKEY */ } - printf_to_message_buffer ("---------------------\n\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")); + printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL); + printf_to_message_buffer ((char *) _("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 ((char *) _("Commands available in Info windows:\n\n"), + NULL, NULL, NULL); dump_map_to_message_buffer ("", info_keymap); - printf_to_message_buffer ("---------------------\n\n"); - printf_to_message_buffer (_("Commands available in the echo area:\n\n")); + printf_to_message_buffer ("---------------------\n\n", NULL, NULL, NULL); + printf_to_message_buffer ((char *) _("Commands available in the echo area:\n\n"), + NULL, NULL, NULL); dump_map_to_message_buffer ("", echo_area_keymap); #if defined (NAMED_FUNCTIONS) @@ -328,43 +334,46 @@ create_internal_info_help_node (help_is_only_window_p) { InfoCommand *cmd = DocInfoCmd(&function_doc_array[i]); - if (InfoFunction(cmd) != info_do_lowercase_version - && !where_is_internal (info_keymap, cmd) + if (InfoFunction(cmd) != (VFunction *) info_do_lowercase_version + && !where_is_internal (info_keymap, cmd) && !where_is_internal (echo_area_keymap, cmd)) { if (!printed_one_mx) { - 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); - else - printf_to_message_buffer - (_("The following commands cannot be invoked at all:\n\n")); + printf_to_message_buffer ("---------------------\n\n", + NULL, NULL, NULL); + if (exec_keys && exec_keys[0]) + printf_to_message_buffer + ((char *) _("The following commands can only be invoked via %s:\n\n"), + exec_keys, NULL, NULL); + else + printf_to_message_buffer + ((char *) _("The following commands cannot be invoked at all:\n\n"), + NULL, NULL, NULL); printed_one_mx = 1; } printf_to_message_buffer ("%s %s\n %s\n", - exec_keys, + exec_keys, function_doc_array[i].func_name, replace_in_documentation (strlen (function_doc_array[i].doc) - ? _(function_doc_array[i].doc) - : "") - ); + ? (char *) _(function_doc_array[i].doc) : "", 0) + ); } } if (printed_one_mx) - printf_to_message_buffer ("\n"); + printf_to_message_buffer ("\n", NULL, NULL, NULL); maybe_free (exec_keys); #endif /* NAMED_FUNCTIONS */ printf_to_message_buffer ("%s", replace_in_documentation - (_("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"))); + ((char *) _("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"), 0), + NULL, NULL); node = message_buffer_to_node (); internal_info_help_node_contents = node->contents; } @@ -403,7 +412,7 @@ create_internal_info_help_node (help_is_only_window_p) #define HELP_SPLIT_SIZE 24 static WINDOW * -info_find_or_create_help_window () +info_find_or_create_help_window (void) { int help_is_only_window_p; WINDOW *eligible = NULL; @@ -437,9 +446,8 @@ info_find_or_create_help_window () argument is false if help will be the only window (so l must be used to quit help), true if help will be one of several visible windows (so CTRL-x 0 must be used to quit help). */ - help_is_only_window_p - = (help_window && !windows->next - || !help_window && eligible->height < HELP_SPLIT_SIZE); + help_is_only_window_p = ((help_window && !windows->next) + || (!help_window && eligible->height < HELP_SPLIT_SIZE)); create_internal_info_help_node (help_is_only_window_p); /* Either use the existing window to display the help node, or create @@ -486,7 +494,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message")) } else { - info_error (msg_cant_make_help); + info_error ((char *) msg_cant_make_help, NULL, NULL); } } @@ -528,9 +536,9 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'") if (!node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else - info_error (msg_cant_file_node, "Info", nodename); + info_error ((char *) msg_cant_file_node, "Info", nodename); } else { @@ -558,8 +566,7 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'") /* Return the documentation associated with the Info command FUNCTION. */ char * -function_documentation (cmd) - InfoCommand *cmd; +function_documentation (InfoCommand *cmd) { char *doc; @@ -579,15 +586,14 @@ function_documentation (cmd) #endif /* !INFOKEY */ - return replace_in_documentation ((strlen (doc) == 0) ? doc : _(doc)); + return replace_in_documentation ((strlen (doc) == 0) ? doc : (char *) _(doc), 0); } #if defined (NAMED_FUNCTIONS) /* Return the user-visible name of the function associated with the Info command FUNCTION. */ char * -function_name (cmd) - InfoCommand *cmd; +function_name (InfoCommand *cmd) { #if defined (INFOKEY) @@ -608,8 +614,7 @@ function_name (cmd) /* Return a pointer to the info command for function NAME. */ InfoCommand * -named_function (name) - char *name; +named_function (char *name) { register int i; @@ -623,9 +628,7 @@ named_function (name) /* Return the documentation associated with KEY in MAP. */ char * -key_documentation (key, map) - char key; - Keymap map; +key_documentation (char key, Keymap map) { InfoCommand *function = map[key].function; @@ -647,7 +650,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) for (;;) { - message_in_echo_area (_("Describe key: %s"), pretty_keyseq (keys)); + message_in_echo_area ((char *) _("Describe key: %s"), + pretty_keyseq (keys), NULL); keystroke = info_get_input_char (); unmessage_in_echo_area (); @@ -661,7 +665,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) return; } - *k++ = '\e'; + *k++ = '\e'; keystroke = UnMeta (keystroke); map = (Keymap)map[ESC].function; } @@ -673,7 +677,8 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) if (map[keystroke].function == (InfoCommand *)NULL) { - message_in_echo_area (_("%s is undefined."), pretty_keyseq (keys)); + message_in_echo_area ((char *) _("%s is undefined."), + pretty_keyseq (keys), NULL); return; } else if (map[keystroke].type == ISKMAP) @@ -686,28 +691,29 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) char *keyname, *message, *fundoc, *funname = ""; #if defined (INFOKEY) - /* If the key is bound to do-lowercase-version, but its - lower-case variant is undefined, say that this key is - also undefined. This is especially important for unbound - edit keys that emit an escape sequence: it's terribly - confusing to see a message "Home (do-lowercase-version)" - or some such when Home is unbound. */ - if (InfoFunction(map[keystroke].function) == info_do_lowercase_version) - { - unsigned char lowerkey = Meta_p(keystroke) - ? Meta (tolower (UnMeta (keystroke))) - : tolower (keystroke); - - if (map[lowerkey].function == (InfoCommand *)NULL) - { - message_in_echo_area (_("%s is undefined."), - pretty_keyseq (keys)); - return; - } - } + /* If the key is bound to do-lowercase-version, but its + lower-case variant is undefined, say that this key is + also undefined. This is especially important for unbound + edit keys that emit an escape sequence: it's terribly + confusing to see a message "Home (do-lowercase-version)" + or some such when Home is unbound. */ + if (InfoFunction(map[keystroke].function) + == (VFunction *) info_do_lowercase_version) + { + unsigned char lowerkey = Meta_p(keystroke) + ? Meta (tolower (UnMeta (keystroke))) + : tolower (keystroke); + + if (map[lowerkey].function == (InfoCommand *)NULL) + { + message_in_echo_area ((char *) _("%s is undefined."), + pretty_keyseq (keys), NULL); + return; + } + } #endif - keyname = pretty_keyseq (keys); + keyname = pretty_keyseq (keys); #if defined (NAMED_FUNCTIONS) funname = function_name (map[keystroke].function); @@ -724,7 +730,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); + window_message_in_echo_area ("%s", message, NULL); free (message); break; } @@ -733,8 +739,7 @@ DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY")) /* Return the pretty printable name of a single character. */ char * -pretty_keyname (key) - unsigned char key; +pretty_keyname (unsigned char key) { static char rep_buffer[30]; char *rep; @@ -784,11 +789,10 @@ pretty_keyname (key) /* Return the pretty printable string which represents KEYSEQ. */ -static void pretty_keyseq_internal (); +static void pretty_keyseq_internal (char *keyseq, char *rep); char * -pretty_keyseq (keyseq) - char *keyseq; +pretty_keyseq (char *keyseq) { static char keyseq_rep[200]; @@ -799,8 +803,7 @@ pretty_keyseq (keyseq) } static void -pretty_keyseq_internal (keyseq, rep) - char *keyseq, *rep; +pretty_keyseq_internal (char *keyseq, char *rep) { if (term_kP && strncmp(keyseq, term_kP, strlen(term_kP)) == 0) { @@ -868,8 +871,7 @@ pretty_keyseq_internal (keyseq, rep) /* Return a pointer to the last character in s that is found in f. */ static char * -strrpbrk (s, f) - const char *s, *f; +strrpbrk (const char *s, const char *f) { register const char *e = s + strlen(s); register const char *t; @@ -878,16 +880,14 @@ strrpbrk (s, f) { for (t = f; *t; t++) if (*e == *t) - return (char *)e; + return (char *)e; } return NULL; } /* Replace the names of functions with the key that invokes them. */ char * -replace_in_documentation (string, help_is_only_window_p) - char *string; - int help_is_only_window_p; +replace_in_documentation (char *string, int help_is_only_window_p) { unsigned reslen = strlen (string); register int i, start, next; @@ -905,146 +905,146 @@ replace_in_documentation (string, help_is_only_window_p) /* Is this the start of a replaceable function name? */ if (string[i] == '\\') - { - char *fmt = NULL; - unsigned min = 0; - unsigned max = 0; - - if(string[j] == '%') - { - if (string[++j] == '-') - j++; - if (isdigit(string[j])) - { - min = atoi(string + j); - while (isdigit(string[j])) - j++; - if (string[j] == '.' && isdigit(string[j + 1])) - { - j += 1; - max = atoi(string + j); - while (isdigit(string[j])) - j++; - } - fmt = (char *)xmalloc (j - i + 2); - strncpy (fmt, string + i + 1, j - i); - fmt[j - i - 1] = 's'; - fmt[j - i] = '\0'; - } - else - j = i + 1; - } - if (string[j] == '[') - { - unsigned arg = 0; - char *argstr = NULL; - char *rep_name, *fun_name, *rep; - InfoCommand *command; - char *repstr = NULL; - unsigned replen; - - /* Copy in the old text. */ - strncpy (result + next, string + start, i - start); - next += (i - start); - start = j + 1; - - /* Look for an optional numeric arg. */ - i = start; - if (isdigit(string[i]) - || (string[i] == '-' && isdigit(string[i + 1])) ) - { - arg = atoi(string + i); - if (string[i] == '-') - i++; - while (isdigit(string[i])) - i++; - } - start = i; - - /* Move to the end of the function name. */ - for (i = start; string[i] && (string[i] != ']'); i++); - - rep_name = (char *)xmalloc (1 + i - start); - strncpy (rep_name, string + start, i - start); - rep_name[i - start] = '\0'; - - /* If we have only one window (because the window size was too - small to split it), we have to quit help by going back one - noew in the history list, not deleting the window. */ - if (strcmp (rep_name, "quit-help") == 0) - fun_name = help_is_only_window_p ? "history-node" - : "delete-window"; - else - fun_name = rep_name; - - /* Find a key which invokes this function in the info_keymap. */ - command = named_function (fun_name); - - free (rep_name); - - /* If the internal documentation string fails, there is a - serious problem with the associated command's documentation. - We croak so that it can be fixed immediately. */ - if (!command) - abort (); - - if (arg) - { - char *argrep, *p; - - argrep = where_is (info_keymap, InfoCmd(info_add_digit_to_numeric_arg)); - p = argrep ? strrpbrk (argrep, "0123456789-") : NULL; - if (p) - { - argstr = (char *)xmalloc (p - argrep + 21); - strncpy (argstr, argrep, p - argrep); - sprintf (argstr + (p - argrep), "%d", arg); - } - else - command = NULL; - } - rep = command ? where_is (info_keymap, command) : NULL; - if (!rep) - rep = "N/A"; - replen = (argstr ? strlen (argstr) + 1 : 0) + strlen (rep); - repstr = (char *)xmalloc (replen); - repstr[0] = '\0'; - if (argstr) - { - strcat(repstr, argstr); - strcat(repstr, " "); - free (argstr); - } - strcat(repstr, rep); - - if (fmt) - { - if (replen > max) - replen = max; - if (replen < min) - replen = min; - } - if (next + replen > reslen) - { - reslen = next + replen + 1; - result = (char *)xrealloc (result, reslen + 1); - } - - if (fmt) - sprintf (result + next, fmt, repstr); - else - strcpy (result + next, repstr); - - next = strlen (result); - free (repstr); - - start = i; - if (string[i]) - start++; - } - - maybe_free (fmt); - } + { + char *fmt = NULL; + unsigned min = 0; + unsigned max = 0; + + if(string[j] == '%') + { + if (string[++j] == '-') + j++; + if (isdigit(string[j])) + { + min = atoi(string + j); + while (isdigit(string[j])) + j++; + if (string[j] == '.' && isdigit(string[j + 1])) + { + j += 1; + max = atoi(string + j); + while (isdigit(string[j])) + j++; + } + fmt = (char *)xmalloc (j - i + 2); + strncpy (fmt, string + i + 1, j - i); + fmt[j - i - 1] = 's'; + fmt[j - i] = '\0'; + } + else + j = i + 1; + } + if (string[j] == '[') + { + unsigned arg = 0; + char *argstr = NULL; + char *rep_name, *fun_name, *rep; + InfoCommand *command; + char *repstr = NULL; + unsigned replen; + + /* Copy in the old text. */ + strncpy (result + next, string + start, i - start); + next += (i - start); + start = j + 1; + + /* Look for an optional numeric arg. */ + i = start; + if (isdigit(string[i]) + || (string[i] == '-' && isdigit(string[i + 1])) ) + { + arg = atoi(string + i); + if (string[i] == '-') + i++; + while (isdigit(string[i])) + i++; + } + start = i; + + /* Move to the end of the function name. */ + for (i = start; string[i] && (string[i] != ']'); i++); + + rep_name = (char *)xmalloc (1 + i - start); + strncpy (rep_name, string + start, i - start); + rep_name[i - start] = '\0'; + + /* If we have only one window (because the window size was too + small to split it), we have to quit help by going back one + noew in the history list, not deleting the window. */ + if (strcmp (rep_name, "quit-help") == 0) + fun_name = help_is_only_window_p ? "history-node" + : "delete-window"; + else + fun_name = rep_name; + + /* Find a key which invokes this function in the info_keymap. */ + command = named_function (fun_name); + + free (rep_name); + + /* If the internal documentation string fails, there is a + serious problem with the associated command's documentation. + We croak so that it can be fixed immediately. */ + if (!command) + abort (); + + if (arg) + { + char *argrep, *p; + + argrep = where_is (info_keymap, InfoCmd(info_add_digit_to_numeric_arg)); + p = argrep ? strrpbrk (argrep, "0123456789-") : NULL; + if (p) + { + argstr = (char *)xmalloc (p - argrep + 21); + strncpy (argstr, argrep, p - argrep); + sprintf (argstr + (p - argrep), "%d", arg); + } + else + command = NULL; + } + rep = command ? where_is (info_keymap, command) : NULL; + if (!rep) + rep = "N/A"; + replen = (argstr ? strlen (argstr) : 0) + strlen (rep) + 1; + repstr = (char *)xmalloc (replen); + repstr[0] = '\0'; + if (argstr) + { + strcat(repstr, argstr); + strcat(repstr, " "); + free (argstr); + } + strcat(repstr, rep); + + if (fmt) + { + if (replen > max) + replen = max; + if (replen < min) + replen = min; + } + if (next + replen > reslen) + { + reslen = next + replen + 1; + result = (char *)xrealloc (result, reslen + 1); + } + + if (fmt) + sprintf (result + next, fmt, repstr); + else + strcpy (result + next, repstr); + + next = strlen (result); + free (repstr); + + start = i; + if (string[i]) + start++; + } + + maybe_free (fmt); + } } strcpy (result + next, string + start); return (result); @@ -1057,9 +1057,7 @@ static int where_is_rep_index = 0; static int where_is_rep_size = 0; char * -where_is (map, cmd) - Keymap map; - InfoCommand *cmd; +where_is (Keymap map, InfoCommand *cmd) { char *rep; @@ -1076,7 +1074,7 @@ where_is (map, cmd) name = function_name (cmd); if (!name) - return NULL; /* no such function */ + return NULL; /* no such function */ rep = where_is_internal (map, InfoCmd(info_execute_command)); if (!rep) @@ -1092,9 +1090,7 @@ where_is (map, cmd) /* Return the printed rep of the keystrokes that invoke FUNCTION, as found in MAP, or NULL. */ static char * -where_is_internal (map, cmd) - Keymap map; - InfoCommand *cmd; +where_is_internal (Keymap map, InfoCommand *cmd) { #if defined(INFOKEY) @@ -1107,7 +1103,15 @@ where_is_internal (map, cmd) return NULL; #else /* !INFOKEY */ - + /* There is a bug in that create_internal_info_help_node calls + where_is_internal without setting where_is_rep_index to zero. This + was found by Mandrake and reported by Thierry Vignaud + <tvignaud@mandrakesoft.com> around April 24, 2002. + + I think the best fix is to make where_is_rep_index another + parameter to this recursively-called function, instead of a static + variable. But this [!INFOKEY] branch of the code is not enabled + any more, so let's just skip the whole thing. --karl, 28sep02. */ register int i; /* If the function is directly invokable in MAP, return the representation @@ -1145,14 +1149,12 @@ where_is_internal (map, cmd) #endif /* INFOKEY */ } -extern char *read_function_name (); - DECLARE_INFO_COMMAND (info_where_is, _("Show what to type to execute a given command")) { char *command_name; - command_name = read_function_name (_("Where is command: "), window); + command_name = read_function_name ((char *) _("Where is command: "), window); if (!command_name) { @@ -1174,20 +1176,24 @@ DECLARE_INFO_COMMAND (info_where_is, if (!location || !location[0]) { - info_error (_("`%s' is not on any keys"), command_name); + info_error ((char *) _("`%s' is not on any keys"), + command_name, NULL); } else { if (strstr (location, function_name (command))) window_message_in_echo_area - (_("%s can only be invoked via %s."), command_name, location); + ((char *) _("%s can only be invoked via %s."), + command_name, location); else window_message_in_echo_area - (_("%s can be invoked via %s."), command_name, location); + ((char *) _("%s can be invoked via %s."), + command_name, location); } } else - info_error (_("There is no function named `%s'"), command_name); + info_error ((char *) _("There is no function named `%s'"), + command_name, NULL); } free (command_name); diff --git a/gnu/usr.bin/texinfo/info/infomap.c b/gnu/usr.bin/texinfo/info/infomap.c index 9ae2c2d40f1..14735655b36 100644 --- a/gnu/usr.bin/texinfo/info/infomap.c +++ b/gnu/usr.bin/texinfo/info/infomap.c @@ -1,7 +1,8 @@ /* infomap.c -- keymaps for Info. - $Id: infomap.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: infomap.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2001, 02 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 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 @@ -29,10 +30,13 @@ #include "variables.h" #endif /* INFOKEY */ +static int keymap_bind_keyseq (Keymap map, const char *keyseq, + KEYMAP_ENTRY *keyentry); + /* Return a new keymap which has all the uppercase letters mapped to run the function info_do_lowercase_version (). */ Keymap -keymap_make_keymap () +keymap_make_keymap (void) { int i; Keymap keymap; @@ -58,85 +62,196 @@ keymap_make_keymap () return (keymap); } +#if defined(INFOKEY) +static FUNCTION_KEYSEQ * +find_function_keyseq (Keymap map, int c, Keymap rootmap) +{ + FUNCTION_KEYSEQ *k; + + if (map[c].type != ISFUNC) + abort(); + if (map[c].function == NULL) + return NULL; + for (k = map[c].function->keys; k; k = k->next) + { + const unsigned char *p; + Keymap m = rootmap; + if (k->map != rootmap) + continue; + for (p = (unsigned char *) k->keyseq; *p && m[*p].type == ISKMAP; p++) + m = (Keymap)m[*p].function; + if (*p != c || p[1]) + continue; + if (m[*p].type != ISFUNC) + abort (); + break; + } + return k; +} + +static void +add_function_keyseq (InfoCommand *function, + const char *keyseq, Keymap rootmap) +{ + FUNCTION_KEYSEQ *ks; + + if (function == NULL || + function == InfoCmd(info_do_lowercase_version) || + function == InfoCmd(ea_insert)) + return; + ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ)); + ks->next = function->keys; + ks->map = rootmap; + ks->keyseq = xstrdup(keyseq); + function->keys = ks; +} + +static void +remove_function_keyseq (InfoCommand *function, + const char *keyseq, Keymap rootmap) +{ + + FUNCTION_KEYSEQ *k, *kp; + + if (function == NULL || + 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) + break; + if (!k) + abort (); + if (kp) + kp->next = k->next; + else + function->keys = k->next; +} +#endif /* INFOKEY */ + /* Return a new keymap which is a copy of MAP. */ Keymap -keymap_copy_keymap (map) - Keymap map; +keymap_copy_keymap (Keymap map, Keymap rootmap, Keymap newroot) { int i; Keymap keymap; +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ keymap = keymap_make_keymap (); + if (!newroot) + newroot = keymap; for (i = 0; i < 256; i++) { keymap[i].type = map[i].type; - keymap[i].function = map[i].function; + switch (map[i].type) + { + case ISFUNC: + keymap[i].function = map[i].function; +#if defined(INFOKEY) + ks = find_function_keyseq (map, i, rootmap); + if (ks) + 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); + break; + } } return (keymap); } /* Free the keymap and its descendants. */ void -keymap_discard_keymap (map) - Keymap (map); +keymap_discard_keymap (Keymap map, Keymap rootmap) { int i; if (!map) return; + if (!rootmap) + rootmap = map; for (i = 0; i < 256; i++) { +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ switch (map[i].type) { case ISFUNC: +#if defined(INFOKEY) + ks = find_function_keyseq(map, i, rootmap); + if (ks) + remove_function_keyseq (map[i].function, ks->keyseq, rootmap); +#endif /* INFOKEY */ break; case ISKMAP: - keymap_discard_keymap ((Keymap)map[i].function); + keymap_discard_keymap ((Keymap)map[i].function, rootmap); break; } } + free(map); } /* Conditionally bind key sequence. */ -int -keymap_bind_keyseq (map, keyseq, keyentry) - Keymap map; - const unsigned char *keyseq; - KEYMAP_ENTRY *keyentry; +static int +keymap_bind_keyseq (Keymap map, + const char *keyseq, KEYMAP_ENTRY *keyentry) { Keymap m = map; - const unsigned char *s = keyseq; + const unsigned char *s = (unsigned char *) keyseq; int c; if (s == NULL || *s == '\0') return 0; while ((c = *s++) != '\0') { +#if defined(INFOKEY) + FUNCTION_KEYSEQ *ks; +#endif /* INFOKEY */ switch (m[c].type) { case ISFUNC: +#if defined(INFOKEY) + 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 || ( -#if !defined(INFOKEY) m != map && -#endif /* !INFOKEY */ m[c].function == InfoCmd(info_do_lowercase_version)) )) return 0; +#endif /* !INFOKEY */ if (*s != '\0') { m[c].type = ISKMAP; + /* Here we are casting the Keymap pointer returned from + keymap_make_keymap to an InfoCommand pointer. Ugh. + This makes the `function' structure garbage + if it's actually interpreted as an InfoCommand. + Should really be using a union, and taking steps to + avoid the possible error. */ m[c].function = (InfoCommand *)keymap_make_keymap (); } break; case ISKMAP: +#if defined(INFOKEY) + if (*s == '\0') + keymap_discard_keymap ((Keymap)m[c].function, map); +#else /* !INFOKEY */ if (*s == '\0') return 0; +#endif break; } if (*s != '\0') @@ -146,18 +261,7 @@ keymap_bind_keyseq (map, keyseq, keyentry) else { #if defined(INFOKEY) - FUNCTION_KEYSEQ *k; - - for (k = keyentry->function->keys; k && k->map != map; k = k->next) - ; - if (!k) - { - FUNCTION_KEYSEQ *ks = (FUNCTION_KEYSEQ *)xmalloc (sizeof(FUNCTION_KEYSEQ)); - ks->next = keyentry->function->keys; - ks->map = map; - ks->keyseq = xstrdup (keyseq); - keyentry->function->keys = ks; - } + add_function_keyseq (keyentry->function, keyseq, map); #endif /* INFOKEY */ m[c] = *keyentry; } @@ -505,8 +609,8 @@ initialize_vi_like_keymaps () map['b'].function = ea_backward_word; map['d'].function = ea_kill_word; map['f'].function = ea_forward_word; - map['h'].function = ea_forward; - map['l'].function = ea_backward; + map['h'].function = ea_backward; + map['l'].function = ea_forward; map['w'].function = ea_forward_word; map['x'].function = ea_delete; map['X'].function = ea_kill_word; @@ -600,8 +704,8 @@ initialize_vi_like_keymaps () map['H'].function = info_get_help_window; map['i'].function = info_index_search; map['I'].function = info_goto_invocation_node; - map['j'].function = info_down_line; - map['k'].function = info_up_line; + map['j'].function = info_next_line; + map['k'].function = info_prev_line; map['l'].function = info_history_node; map['m'].function = info_menu_item; map['n'].function = info_search_next; @@ -1078,8 +1182,8 @@ static unsigned char default_vi_like_info_keys[] = 'H', NUL, A_info_get_help_window, 'i', NUL, A_info_index_search, 'I', NUL, A_info_goto_invocation_node, - 'j', NUL, A_info_down_line, - 'k', NUL, A_info_up_line, + '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, @@ -1317,8 +1421,7 @@ static unsigned int user_vars_len; * Return the size of a file, or 0 if the size can't be determined. */ static unsigned long -filesize(f) - int f; +filesize(int f) { long pos = lseek(f, 0L, SEEK_CUR); long sz = -1L; @@ -1334,8 +1437,7 @@ filesize(f) Integers are stored as two bytes, low order first, in radix INFOKEY_RADIX. */ static int -getint(sp) - unsigned char **sp; +getint(unsigned char **sp) { int n; @@ -1350,7 +1452,7 @@ getint(sp) /* Fetch the contents of the standard infokey file "$HOME/.info". Return true if ok, false if not. */ static int -fetch_user_maps() +fetch_user_maps(void) { char *filename = NULL; char *homedir; @@ -1378,9 +1480,10 @@ fetch_user_maps() #endif if (filename == NULL || (f = open(filename, O_RDONLY)) == (-1)) { - if (filename) + if (filename && errno != ENOENT) { - info_error(filesys_error_string(filename, errno)); + info_error(filesys_error_string(filename, errno), + NULL, NULL); free(filename); } return 0; @@ -1394,11 +1497,11 @@ fetch_user_maps() /* 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); + info_error((char *) _("Ignoring invalid infokey file `%s' - too small"), + filename, NULL); else - info_error(_("Ignoring invalid infokey file `%s' - too big"), - filename); + info_error((char *) _("Ignoring invalid infokey file `%s' - too big"), + filename, NULL); close(f); free(filename); return 0; @@ -1408,9 +1511,10 @@ fetch_user_maps() buf = (unsigned char *)xmalloc((int)len); nread = read(f, buf, (unsigned int) len); close(f); - if (nread != len) + if ((unsigned int) nread != len) { - info_error(_("Error reading infokey file `%s' - short read"), filename); + info_error((char *) _("Error reading infokey file `%s' - short read"), + filename, NULL); free(buf); free(filename); return 0; @@ -1428,26 +1532,33 @@ fetch_user_maps() || buf[len - 1] != INFOKEY_MAGIC_E3 ) { - info_error(_("Invalid infokey file `%s' (bad magic numbers) -- run infokey to update it"), filename); + info_error((char *) _("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, buf + 4) != 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); + info_error + ((char *) _("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; p - buf < len - 4; p += n) + for (p = buf + 4 + strlen(VERSION) + 1; + (unsigned int) (p - buf) < len - 4; + p += n) { int s = *p++; n = getint(&p); - if (n < 0 || n > len - 4 - (p - buf)) + 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); + info_error((char *) _("Invalid infokey file `%s' (bad section length) -- run infokey to update it"), + filename, NULL); free(filename); return 0; } @@ -1467,7 +1578,8 @@ fetch_user_maps() user_vars_len = n; break; default: - info_error(_("Invalid infokey file `%s' (bad section code) -- run infokey to update it"), filename); + info_error((char *) _("Invalid infokey file `%s' (bad section code) -- run infokey to update it"), + filename, NULL); free(filename); return 0; } @@ -1482,27 +1594,26 @@ fetch_user_maps() doesn't define. */ static int -decode_keys(src, slen, dst, dlen) - 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; -#define To_dst(c) do { if (d - dst < dlen) *d++ = (c); } while (0) +#define To_dst(c) do { \ + if ((unsigned int) (d - dst) < dlen) *d++ = (c); \ +} while (0) - while (s - src < slen) + while ((unsigned int) (s - src) < slen) { unsigned char c = ISMETA(*s) ? UNMETA(*s) : *s; if (c == SK_ESCAPE) { - unsigned char *t; + char *t; static char lit[] = { SK_ESCAPE, NUL }; - switch (s + 1 - src < slen ? s[1] : '\0') + 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; @@ -1543,21 +1654,17 @@ decode_keys(src, slen, dst, dlen) /* Convert an infokey file section to keymap bindings. Return false if the default bindings are to be suppressed. */ static int -section_to_keymaps(map, table, len) - 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; - unsigned int seqlen; - KEYMAP_ENTRY ke; + unsigned char *seq = NULL; + unsigned int seqlen = 0; enum { getseq, gotseq, getaction } state = getseq; stop = len > 0 ? table[0] : 0; - for (p = table + 1; p - table < len; p++) + for (p = table + 1; (unsigned int) (p - table) < len; p++) { switch (state) { @@ -1598,30 +1705,30 @@ section_to_keymaps(map, table, len) action < A_NCOMMANDS ? &function_doc_array[action] : NULL; - keymap_bind_keyseq(map, keyseq, &ke); + keymap_bind_keyseq(map, + (const char *) keyseq, &ke); } } break; } } if (state != getseq) - info_error(_("Bad data in infokey file -- some key bindings ignored")); + info_error((char *) _("Bad data in infokey file -- some key bindings ignored"), + NULL, NULL); return !stop; } /* Convert an infokey file section to variable settings. */ static void -section_to_vars(table, len) - 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; p - table < len; p++) + for (p = table; (unsigned int) (p - table) < len; p++) { switch (state) { @@ -1649,23 +1756,23 @@ section_to_vars(table, len) case gotval: if (!*p) { - set_variable_to_value(var, val); + 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")); + info_error((char *) _("Bad data in infokey file -- some var settings ignored"), + NULL, NULL); } void -initialize_info_keymaps () +initialize_info_keymaps (void) { int i; int suppress_info_default_bindings = 0; int suppress_ea_default_bindings = 0; - Keymap map; if (!info_keymap) { @@ -1721,3 +1828,4 @@ initialize_info_keymaps () } #endif /* defined(INFOKEY) */ +/* vim: set sw=2 cino={1s>2sn-s^-se-s: */ diff --git a/gnu/usr.bin/texinfo/info/m-x.c b/gnu/usr.bin/texinfo/info/m-x.c index 4fa90d48e0c..8b265943740 100644 --- a/gnu/usr.bin/texinfo/info/m-x.c +++ b/gnu/usr.bin/texinfo/info/m-x.c @@ -1,7 +1,8 @@ /* m-x.c -- Meta-x minibuffer reader. - $Id: m-x.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: m-x.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2001, 2002, 2004 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 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" #include "funs.h" @@ -32,9 +33,7 @@ name. A return value of NULL indicates that no function name could be read. */ char * -read_function_name (prompt, window) - char *prompt; - WINDOW *window; +read_function_name (char *prompt, WINDOW *window) { register int i; char *line; @@ -71,7 +70,7 @@ DECLARE_INFO_COMMAND (describe_command, { char *line; - line = read_function_name (_("Describe command: "), window); + line = read_function_name ((char *) _("Describe command: "), window); if (!line) { @@ -138,7 +137,8 @@ DECLARE_INFO_COMMAND (info_execute_command, (strncmp (line, "echo-area-", 10) == 0)) { free (line); - info_error (_("Cannot execute an `echo-area' command here.")); + info_error ((char *) _("Cannot execute an `echo-area' command here."), + NULL, NULL); return; } @@ -148,7 +148,10 @@ DECLARE_INFO_COMMAND (info_execute_command, if (!command) return; - (*InfoFunction(command)) (active_window, count, 0); + if (InfoFunction(command)) + (*InfoFunction(command)) (active_window, count, 0); + else + info_error ((char *) _("Undefined command: %s"), line, NULL); } } diff --git a/gnu/usr.bin/texinfo/info/makedoc.c b/gnu/usr.bin/texinfo/info/makedoc.c index 919ea090480..e024b688933 100644 --- a/gnu/usr.bin/texinfo/info/makedoc.c +++ b/gnu/usr.bin/texinfo/info/makedoc.c @@ -1,7 +1,8 @@ /* makedoc.c -- make doc.c and funs.h from input files. - $Id: makedoc.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: makedoc.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 99, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 1999, 2001, 2002, 2003, 2004 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 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ /* This program grovels the contents of the source files passed as arguments and writes out a file of function pointers and documentation strings, and @@ -27,7 +28,7 @@ #include "info.h" #include "infokey.h" -static void fatal_file_error (); +static void fatal_file_error (char *filename); /* Name of the header file which receives the declarations of functions. */ static char *funs_filename = "funs.h"; @@ -40,7 +41,7 @@ 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'.", (char *)NULL }; @@ -104,16 +105,15 @@ int emacs_tags_slots = 0; #define DECLARATION_STRING "\nDECLARE_INFO_COMMAND" -static void process_one_file (); -static void maybe_dump_tags (); -static FILE *must_fopen (); -static void init_func_key (); -static unsigned int next_func_key (); +static void process_one_file (char *filename, FILE *doc_stream, + FILE *key_stream, FILE *funs_stream); +static void maybe_dump_tags (FILE *stream); +static FILE *must_fopen (char *filename, char *mode); +static void init_func_key (unsigned int val); +static unsigned int next_func_key (void); int -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { register int i; int tags_only = 0; @@ -142,14 +142,15 @@ main (argc, argv) doc_filename = NULL_DEVICE; key_filename = NULL_DEVICE; } - + funs_stream = must_fopen (funs_filename, "w"); doc_stream = must_fopen (doc_filename, "w"); key_stream = must_fopen (key_filename, "w"); fprintf (funs_stream, - "/* %s -- Generated declarations for Info commands. */\n", - funs_filename); + "/* %s -- Generated declarations for Info commands. */\n\n\ +#include \"info.h\"\n", + funs_filename); for (i = 0; doc_header[i]; i++) { @@ -220,7 +221,7 @@ main (argc, argv) #endif /* !INFOKEY */ - fprintf (key_stream, " (char *)0\n};\n"); + fprintf (key_stream, " { (char *)NULL, 0 }\n};\n"); fprintf (funs_stream, "\n#define A_NCOMMANDS %u\n", next_func_key()); fclose (funs_stream); @@ -229,13 +230,12 @@ main (argc, argv) if (tags_only) maybe_dump_tags (stdout); - xexit (0); + return 0; } /* Dumping out the contents of an Emacs tags table. */ static void -maybe_dump_tags (stream) - FILE *stream; +maybe_dump_tags (FILE *stream) { register int i; @@ -283,8 +283,7 @@ maybe_dump_tags (stream) /* Keeping track of names, line numbers and character offsets of functions found in source files. */ static EMACS_TAG_BLOCK * -make_emacs_tag_block (filename) - char *filename; +make_emacs_tag_block (char *filename) { EMACS_TAG_BLOCK *block; @@ -298,11 +297,8 @@ make_emacs_tag_block (filename) } static void -add_tag_to_block (block, name, line, char_offset) - EMACS_TAG_BLOCK *block; - char *name; - int line; - long char_offset; +add_tag_to_block (EMACS_TAG_BLOCK *block, + char *name, int line, long int char_offset) { EMACS_TAG *tag; @@ -318,11 +314,8 @@ add_tag_to_block (block, name, line, char_offset) function declarations. Output the declarations in various forms to the DOC_STREAM, KEY_STREAM, and FUNS_STREAM. */ static void -process_one_file (filename, doc_stream, key_stream, funs_stream) - char *filename; - FILE *doc_stream; - FILE *key_stream; - FILE *funs_stream; +process_one_file (char *filename, FILE *doc_stream, + FILE *key_stream, FILE *funs_stream) { int descriptor, decl_len; char *buffer, *decl_str; @@ -504,9 +497,12 @@ process_one_file (filename, doc_stream, key_stream, funs_stream) #if defined (INFOKEY) #if defined (NAMED_FUNCTIONS) - fprintf (doc_stream, " { %s, \"%s\", (FUNCTION_KEYSEQ *)0, %s },\n", func, func_name, doc); + fprintf (doc_stream, + " { (VFunction *)%s, \"%s\", (FUNCTION_KEYSEQ *)0, %s },\n", + func, func_name, doc); #else /* !NAMED_FUNCTIONS */ - fprintf (doc_stream, " { %s, (FUNCTION_KEYSEQ *)0, %s },\n", func, doc); + fprintf (doc_stream, + " { (VFunction *) %s, (FUNCTION_KEYSEQ *)0, %s },\n", func, doc); #endif /* !NAMED_FUNCTIONS */ fprintf (key_stream, " { \"%s\", A_%s },\n", func_name, func); @@ -528,7 +524,9 @@ process_one_file (filename, doc_stream, key_stream, funs_stream) #if defined (INFOKEY) fprintf (funs_stream, "#define A_%s %u\n", func, next_func_key()); #endif /* INFOKEY */ - fprintf (funs_stream, "extern void %s ();\n", func); + fprintf (funs_stream, + "extern void %s (WINDOW *window, int count, unsigned char key);\n", + func); free (func); free (doc); } @@ -547,16 +545,14 @@ process_one_file (filename, doc_stream, key_stream, funs_stream) } static void -fatal_file_error (filename) - char *filename; +fatal_file_error (char *filename) { fprintf (stderr, _("Couldn't manipulate the file %s.\n"), filename); xexit (2); } static FILE * -must_fopen (filename, mode) - char *filename, *mode; +must_fopen (char *filename, char *mode) { FILE *stream; @@ -570,14 +566,13 @@ must_fopen (filename, mode) static unsigned int func_key; static void -init_func_key(val) - unsigned int val; +init_func_key(unsigned int val) { func_key = val; } static unsigned int -next_func_key() +next_func_key(void) { return func_key++; } diff --git a/gnu/usr.bin/texinfo/info/man.c b/gnu/usr.bin/texinfo/info/man.c index db92d09499b..0462047eacb 100644 --- a/gnu/usr.bin/texinfo/info/man.c +++ b/gnu/usr.bin/texinfo/info/man.c @@ -1,7 +1,8 @@ /* man.c: How to read and format man files. - $Id: man.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: man.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1995, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1995, 1997, 1998, 1999, 2000, 2002, 2003, 2004 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 @@ -52,22 +53,20 @@ static char const * const exec_extensions[] = { static char const * const exec_extensions[] = { "", NULL }; #endif -static char *read_from_fd (); -static void clean_manpage (); -static NODE *manpage_node_of_file_buffer (); -static char *get_manpage_contents (); +static char *read_from_fd (int fd); +static void clean_manpage (char *manpage); +static NODE *manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, + char *pagename); +static char *get_manpage_contents (char *pagename); NODE * -make_manpage_node (pagename) - char *pagename; +make_manpage_node (char *pagename) { return (info_get_node (MANPAGE_FILE_BUFFER_NAME, pagename)); } NODE * -get_manpage_node (file_buffer, pagename) - FILE_BUFFER *file_buffer; - char *pagename; +get_manpage_node (FILE_BUFFER *file_buffer, char *pagename) { NODE *node; @@ -120,23 +119,25 @@ get_manpage_node (file_buffer, pagename) for (in = 0; in < info_win->nodes_index; in++) { - NODE *node = info_win->nodes[in]; + NODE *tmp_node = info_win->nodes[in]; /* It really only suffices to see that node->filename is "*manpages*". But after several hours of debugging this, would you blame me for being a bit paranoid? */ - if (node && node->filename && node->contents && - strcmp (node->filename, - MANPAGE_FILE_BUFFER_NAME) == 0 && - node->contents >= old_contents && - node->contents + node->nodelen <= old_contents_end) + if (tmp_node && tmp_node->filename + && tmp_node->contents + && strcmp (tmp_node->filename, + MANPAGE_FILE_BUFFER_NAME) == 0 + && tmp_node->contents >= old_contents + && tmp_node->contents + tmp_node->nodelen + <= old_contents_end) { info_win->nodes[in] = manpage_node_of_file_buffer (file_buffer, - node->nodename); - free (node->nodename); - free (node); + tmp_node->nodename); + free (tmp_node->nodename); + free (tmp_node); } } } @@ -150,7 +151,7 @@ get_manpage_node (file_buffer, pagename) } FILE_BUFFER * -create_manpage_file_buffer () +create_manpage_file_buffer (void) { FILE_BUFFER *file_buffer = make_file_buffer (); file_buffer->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME); @@ -159,7 +160,7 @@ create_manpage_file_buffer () file_buffer->filesize = 0; file_buffer->contents = (char *)NULL; file_buffer->flags = (N_IsInternal | N_CannotGC | N_IsManPage); - + return (file_buffer); } @@ -167,8 +168,7 @@ create_manpage_file_buffer () one that is an executable file, return it as a new string. Otherwise, return a NULL pointer. */ static char * -executable_file_in_path (filename, path) - char *filename, *path; +executable_file_in_path (char *filename, char *path) { struct stat finfo; char *temp_dirname; @@ -222,7 +222,7 @@ executable_file_in_path (filename, path) /* Return the full pathname of the system man page formatter. */ static char * -find_man_formatter () +find_man_formatter (void) { return (executable_file_in_path ("man", (char *)getenv ("PATH"))); } @@ -231,8 +231,7 @@ static char *manpage_pagename = (char *)NULL; static char *manpage_section = (char *)NULL; static void -get_page_and_section (pagename) - char *pagename; +get_page_and_section (char *pagename) { register int i; @@ -267,21 +266,19 @@ get_page_and_section (pagename) #if PIPE_USE_FORK static void -reap_children (sig) - int sig; +reap_children (int sig) { wait (NULL); } #endif static char * -get_manpage_contents (pagename) - char *pagename; +get_manpage_contents (char *pagename) { static char *formatter_args[4] = { (char *)NULL }; int pipes[2]; pid_t child; - RETSIGTYPE (*sigsave) (); + RETSIGTYPE (*sigsave) (int signum); char *formatted_page = NULL; int arg_index = 1; @@ -375,8 +372,7 @@ get_manpage_contents (pagename) } static void -clean_manpage (manpage) - char *manpage; +clean_manpage (char *manpage) { register int i, j; int newline_count = 0; @@ -400,7 +396,7 @@ clean_manpage (manpage) /* A malformed man page could have a \b as its first character, in which case decrementing j by 2 will cause us to write into newpage[-1], smashing the hidden info stored there by malloc. */ - if (manpage[i] == '\b' || manpage[i] == '\f' && j > 0) + if (manpage[i] == '\b' || (manpage[i] == '\f' && j > 0)) j -= 2; else if (!raw_escapes_p) { @@ -433,9 +429,7 @@ clean_manpage (manpage) } static NODE * -manpage_node_of_file_buffer (file_buffer, pagename) - FILE_BUFFER *file_buffer; - char *pagename; +manpage_node_of_file_buffer (FILE_BUFFER *file_buffer, char *pagename) { NODE *node = (NODE *)NULL; TAG *tag = (TAG *)NULL; @@ -469,8 +463,7 @@ manpage_node_of_file_buffer (file_buffer, pagename) } static char * -read_from_fd (fd) - int fd; +read_from_fd (int fd) { struct timeval timeout; char *buffer = (char *)NULL; @@ -550,8 +543,7 @@ static char *reference_section_starters[] = static SEARCH_BINDING frs_binding; static SEARCH_BINDING * -find_reference_section (node) - NODE *node; +find_reference_section (NODE *node) { register int i; long position = -1; @@ -590,8 +582,7 @@ find_reference_section (node) } REFERENCE ** -xrefs_of_manpage (node) - NODE *node; +xrefs_of_manpage (NODE *node) { SEARCH_BINDING *reference_section; REFERENCE **refs = (REFERENCE **)NULL; @@ -659,10 +650,7 @@ xrefs_of_manpage (node) } long -locate_manpage_xref (node, start, dir) - NODE *node; - long start; - int dir; +locate_manpage_xref (NODE *node, long int start, int dir) { REFERENCE **refs; long position = -1; @@ -709,9 +697,7 @@ locate_manpage_xref (node, start, dir) a START and END value of 0 -- strlen (window-line-containing-point). The BUFFER is a pointer to the start of that line. */ REFERENCE ** -manpage_xrefs_in_binding (node, binding) - NODE *node; - SEARCH_BINDING *binding; +manpage_xrefs_in_binding (NODE *node, SEARCH_BINDING *binding) { register int i; REFERENCE **all_refs = xrefs_of_manpage (node); diff --git a/gnu/usr.bin/texinfo/info/man.h b/gnu/usr.bin/texinfo/info/man.h index 490b4c3b356..9e16ed2e57d 100644 --- a/gnu/usr.bin/texinfo/info/man.h +++ b/gnu/usr.bin/texinfo/info/man.h @@ -1,10 +1,10 @@ /* man.h: Defines and external function declarations for man.c. - $Id: man.h,v 1.2 1999/01/11 16:38:08 espie Exp $ + $Id: man.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -27,11 +27,13 @@ #define MANPAGE_FILE_BUFFER_NAME "*manpages*" -extern NODE *make_manpage_node (/* char *pagename */); -extern NODE *get_manpage_node (/* FILE_BUFFER *file_buffer, char *pagename */); -extern FILE_BUFFER *create_manpage_file_buffer (/* void */); -extern long locate_manpage_xref (/* NODE *node, long start, int dir */); -extern REFERENCE **xrefs_of_manpage (/* NODE *node */); -extern REFERENCE **manpage_xrefs_in_binding (/* NODE *node, SEARCH_BINDING *binding */); +extern NODE *make_manpage_node (char *pagename); +extern NODE *get_manpage_node (FILE_BUFFER *file_buffer, + char *pagename); +extern FILE_BUFFER *create_manpage_file_buffer (void); +extern long locate_manpage_xref (NODE *node, long int start, int dir); +extern REFERENCE **xrefs_of_manpage (NODE *node); +extern REFERENCE **manpage_xrefs_in_binding (NODE *node, + SEARCH_BINDING *binding); #endif /* INFO_MAN_H */ diff --git a/gnu/usr.bin/texinfo/info/nodemenu.c b/gnu/usr.bin/texinfo/info/nodemenu.c index 1e92a2b6b8c..a0506664948 100644 --- a/gnu/usr.bin/texinfo/info/nodemenu.c +++ b/gnu/usr.bin/texinfo/info/nodemenu.c @@ -1,7 +1,8 @@ /* nodemenu.c -- produce a menu of all visited nodes. - $Id: nodemenu.c,v 1.3 2000/02/09 02:18:40 espie Exp $ + $Id: nodemenu.c,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002, 2003, 2004 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 @@ -21,9 +22,11 @@ #include "info.h" +NODE * get_visited_nodes (Function *filter_func); + /* Return a line describing the format of a node information line. */ -static char * -nodemenu_format_info () +static const char * +nodemenu_format_info (void) { return (_("\n\ * Menu:\n\ @@ -42,8 +45,7 @@ nodemenu_format_info () * (dir)Top:: 40 589 /usr/gnu/info/dir */ static char * -format_node_info (node) - NODE *node; +format_node_info (NODE *node) { register int i, len; char *parent, *containing_file; @@ -101,7 +103,7 @@ format_node_info (node) if (node->filename && *(node->filename)) { len = pad_to (51, line_buffer); - sprintf (line_buffer + len, node->filename); + strcpy (line_buffer + len, node->filename); } return xstrdup (line_buffer); @@ -109,10 +111,12 @@ format_node_info (node) /* Little string comparison routine for qsort (). */ static int -compare_strings (string1, string2) - char **string1, **string2; +compare_strings (const void *entry1, const void *entry2) { - return (strcasecmp (*string1, *string2)); + char **e1 = (char **) entry1; + char **e2 = (char **) entry2; + + return (strcasecmp (*e1, *e2)); } /* The name of the nodemenu node. */ @@ -123,8 +127,7 @@ static char *nodemenu_nodename = "*Node Menu*"; which nodes will appear in the listing. FILTER_FUNC takes an argument of NODE, and returns non-zero if the node should appear in the listing. */ NODE * -get_visited_nodes (filter_func) - Function *filter_func; +get_visited_nodes (Function *filter_func) { register int i, iw_index; INFO_WINDOW *info_win; @@ -196,14 +199,16 @@ get_visited_nodes (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"))); + ((char *) _("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); - printf_to_message_buffer ("%s\n", nodemenu_format_info ()); + printf_to_message_buffer ("%s\n", (char *) nodemenu_format_info (), + NULL, NULL); for (i = 0; (lines != (char **)NULL) && (i < lines_index); i++) { - printf_to_message_buffer ("%s\n", lines[i]); + printf_to_message_buffer ("%s\n", lines[i], NULL, NULL); free (lines[i]); } @@ -308,7 +313,8 @@ DECLARE_INFO_COMMAND (select_visited_node, free (node); line = - info_read_completing_in_echo_area (window, _("Select visited node: "), menu); + info_read_completing_in_echo_area (window, + (char *) _("Select visited node: "), menu); window = active_window; @@ -328,7 +334,7 @@ DECLARE_INFO_COMMAND (select_visited_node, entry = info_get_labeled_reference (line, menu); if (!entry) - info_error (_("The reference disappeared! (%s)."), line); + info_error ((char *) _("The reference disappeared! (%s)."), line, NULL); else info_select_reference (window, entry); } diff --git a/gnu/usr.bin/texinfo/info/nodes.h b/gnu/usr.bin/texinfo/info/nodes.h index 1c196a2fc51..975b90f504e 100644 --- a/gnu/usr.bin/texinfo/info/nodes.h +++ b/gnu/usr.bin/texinfo/info/nodes.h @@ -1,7 +1,7 @@ /* nodes.h -- How we represent nodes internally. - $Id: nodes.h,v 1.3 2000/02/09 02:18:40 espie Exp $ + $Id: nodes.h,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002, 2004 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 @@ -123,33 +123,34 @@ extern int info_loaded_files_slots; already, or it may not. If it does not already appear, find the file, and add it to the list of loaded files. If the file cannot be found, return a NULL FILE_BUFFER *. */ -extern FILE_BUFFER *info_find_file (); +extern FILE_BUFFER *info_find_file (char *filename); /* Force load the file named FILENAME, and return the information structure describing this file. Even if the file was already loaded, this loads a new buffer, rebuilds tags and nodes, and returns a new FILE_BUFFER *. */ -extern FILE_BUFFER *info_load_file (); +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. If the node cannot be found, return a NULL pointer. */ -extern NODE *info_get_node (); +extern NODE *info_get_node (char *filename, char *nodename); /* 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 NULL pointer. */ -extern NODE *info_get_node_of_file_buffer (); +extern NODE *info_get_node_of_file_buffer (char *nodename, + FILE_BUFFER *file_buffer); /* Grovel FILE_BUFFER->contents finding tags and nodes, and filling in the various slots. This can also be used to rebuild a tag or node table. */ -extern void build_tags_and_nodes (); +extern void build_tags_and_nodes (FILE_BUFFER *file_buffer); /* When non-zero, this is a string describing the most recent file error. */ extern char *info_recent_file_error; /* Create a new, empty file buffer. */ -extern FILE_BUFFER *make_file_buffer (); +extern FILE_BUFFER *make_file_buffer (void); #endif /* not NODES_H */ diff --git a/gnu/usr.bin/texinfo/info/search.h b/gnu/usr.bin/texinfo/info/search.h index bf10560032e..235c3b34a53 100644 --- a/gnu/usr.bin/texinfo/info/search.h +++ b/gnu/usr.bin/texinfo/info/search.h @@ -1,7 +1,7 @@ /* search.h -- Structure used to search large bodies of text, with bounds. - $Id: search.h,v 1.3 2000/02/09 02:18:40 espie Exp $ + $Id: search.h,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2002, 2004 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 @@ -42,26 +42,34 @@ typedef struct { #define S_FoldCase 0x01 /* Set means fold case in searches. */ #define S_SkipDest 0x02 /* Set means return pointing after the dest. */ -SEARCH_BINDING *make_binding (), *copy_binding (); -extern long search_forward (), search_backward (), search (); -extern int looking_at (); +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 int looking_at (char *string, SEARCH_BINDING *binding); /* Note that STRING_IN_LINE () always returns the offset of the 1st character after the string. */ -extern int string_in_line (); +extern int string_in_line (char *string, char *line); /* Function names that start with "skip" are passed a string, and return an offset from the start of that string. Function names that start with "find" are passed a SEARCH_BINDING, and return an absolute position marker of the item being searched for. "Find" functions return a value of -1 if the item being looked for couldn't be found. */ -extern int skip_whitespace (), skip_non_whitespace (); -extern int skip_whitespace_and_newlines (), skip_line (); -extern int skip_node_characters (), skip_node_separator (); +extern int skip_whitespace (char *string); +extern int skip_non_whitespace (char *string); +extern int skip_whitespace_and_newlines (char *string); +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 (), find_tags_table (); -extern long find_node_in_binding (); +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); #endif /* not INFO_SEARCH_H */ diff --git a/gnu/usr.bin/texinfo/info/session.c b/gnu/usr.bin/texinfo/info/session.c index 43b8e22ce5f..31b4a283bd3 100644 --- a/gnu/usr.bin/texinfo/info/session.c +++ b/gnu/usr.bin/texinfo/info/session.c @@ -1,7 +1,7 @@ /* session.c -- user windowing interface to Info. - $Id: session.c,v 1.5 2002/06/10 13:51:03 espie Exp $ + $Id: session.c,v 1.6 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02 + Copyright (C) 1993, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify @@ -18,9 +18,10 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" +#include "search.h" #include <sys/ioctl.h> #if defined (HAVE_SYS_TIME_H) @@ -32,14 +33,11 @@ # include "man.h" #endif -#ifdef M_XENIX -/* SCO 3.2v5.0.2 defines but does not correctly declare strncasecmp. - Since we use it as a symbol, have to get it right. --gildea, 1jul99. */ -extern int strncasecmp (const char *, const char *, size_t); -#endif - -static void info_clear_pending_input (), info_set_pending_input (); -static void info_handle_pointer (); +static void info_clear_pending_input (void); +static void info_set_pending_input (unsigned char key); +static void info_handle_pointer (char *label, WINDOW *window); +static void display_info_keyseq (int expecting_future_input); +char *node_printed_rep (NODE *node); /* **************************************************************** */ /* */ @@ -66,17 +64,15 @@ static int info_windows_index = 0; /* Number of slots allocated to `info_windows'. */ static int info_windows_slots = 0; -void remember_window_and_node (), forget_window_and_nodes (); -void initialize_info_session (), info_session (); -void display_startup_message_and_start (); +void remember_window_and_node (WINDOW *window, NODE *node); +void forget_window_and_nodes (WINDOW *window); +void display_startup_message_and_start (void); /* Begin an info session finding the nodes specified by FILENAME and NODENAMES. For each loaded node, create a new window. Always split the largest of the available windows. */ void -begin_multiple_window_info_session (filename, nodenames) - char *filename; - char **nodenames; +begin_multiple_window_info_session (char *filename, char **nodenames) { register int i; WINDOW *window = (WINDOW *)NULL; @@ -114,7 +110,7 @@ begin_multiple_window_info_session (filename, nodenames) if (!largest) { display_update_display (windows); - info_error (msg_cant_find_window); + info_error ((char *) msg_cant_find_window, NULL, NULL); info_session (); xexit (0); } @@ -129,7 +125,7 @@ begin_multiple_window_info_session (filename, nodenames) else { display_update_display (windows); - info_error (msg_win_too_small); + info_error ((char *) msg_win_too_small, NULL, NULL); info_session (); xexit (0); } @@ -141,11 +137,8 @@ begin_multiple_window_info_session (filename, nodenames) /* 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 (initial_node, format, arg1, arg2) - NODE *initial_node; - char *format; - void *arg1; - void *arg2; +begin_info_session_with_error (NODE *initial_node, char *format, + void *arg1, void *arg2) { initialize_info_session (initial_node, 1); info_error (format, arg1, arg2); @@ -154,28 +147,28 @@ begin_info_session_with_error (initial_node, format, arg1, arg2) /* Start an info session with INITIAL_NODE. */ void -begin_info_session (initial_node) - NODE *initial_node; +begin_info_session (NODE *initial_node) { initialize_info_session (initial_node, 1); display_startup_message_and_start (); } void -display_startup_message_and_start () +display_startup_message_and_start (void) { char *format; format = replace_in_documentation - (_("Welcome to Info version %s. Type \\[get-help-window] for help, \\[menu-item] for menu item.")); + ((char *) _("Welcome to Info version %s. Type \\[get-help-window] for help, \\[menu-item] for menu item."), + 0); - window_message_in_echo_area (format, VERSION); + window_message_in_echo_area (format, VERSION, NULL); info_session (); } /* Run an info session with an already initialized window and node. */ void -info_session () +info_session (void) { display_update_display (windows); info_last_executed_command = NULL; @@ -192,7 +185,7 @@ info_session () /* Here is a window-location dependent event loop. Called from the functions info_session (), and from read_xxx_in_echo_area (). */ void -info_read_and_dispatch () +info_read_and_dispatch (void) { unsigned char key; int done; @@ -200,12 +193,12 @@ info_read_and_dispatch () while (!done && !quit_info_immediately) { - int lk; + int lk = 0; /* If we haven't just gone up or down a line, there is no goal column for this window. */ - if ((info_last_executed_command != info_next_line) && - (info_last_executed_command != info_prev_line)) + if ((info_last_executed_command != (VFunction *) info_next_line) && + (info_last_executed_command != (VFunction *) info_prev_line)) active_window->goal_column = -1; if (echo_area_is_active) @@ -242,30 +235,28 @@ info_read_and_dispatch () if (lk == echo_area_last_command_was_kill) echo_area_last_command_was_kill = 0; - if (ea_last_executed_command == ea_newline || + if (ea_last_executed_command == (VFunction *) ea_newline || info_aborted_echo_area) { ea_last_executed_command = (VFunction *)NULL; done = 1; } - if (info_last_executed_command == info_quit) + if (info_last_executed_command == (VFunction *) info_quit) quit_info_immediately = 1; } - else if (info_last_executed_command == info_quit) + else if (info_last_executed_command == (VFunction *) info_quit) done = 1; } } /* Found in signals.c */ -extern void initialize_info_signal_handler (); +extern void initialize_info_signal_handler (void ); /* Initialize the first info session by starting the terminal, window, and display systems. If CLEAR_SCREEN is 0, don't clear the screen. */ void -initialize_info_session (node, clear_screen) - NODE *node; - int clear_screen; +initialize_info_session (NODE *node, int clear_screen) { char *term_name = getenv ("TERM"); terminal_initialize_terminal (term_name); @@ -275,7 +266,7 @@ initialize_info_session (node, clear_screen) if (!term_name) term_name = "dumb"; - info_error (msg_term_too_dumb, term_name); + info_error ((char *) msg_term_too_dumb, term_name, NULL); xexit (1); } @@ -293,7 +284,7 @@ initialize_info_session (node, clear_screen) /* Tell the window system how to notify us when a window needs to be asynchronously deleted (e.g., user resizes window very small). */ - window_deletion_notifier = forget_window_and_nodes; + window_deletion_notifier = (VFunction *) forget_window_and_nodes; /* If input has not been redirected yet, make it come from unbuffered standard input. */ @@ -308,8 +299,7 @@ initialize_info_session (node, clear_screen) /* Tell Info that input is coming from the file FILENAME. */ void -info_set_input_from_file (filename) - char *filename; +info_set_input_from_file (char *filename) { FILE *stream; @@ -331,8 +321,7 @@ info_set_input_from_file (filename) /* Return the INFO_WINDOW containing WINDOW, or NULL if there isn't one. */ static INFO_WINDOW * -get_info_window_of_window (window) - WINDOW *window; +get_info_window_of_window (WINDOW *window) { register int i; INFO_WINDOW *info_win = (INFO_WINDOW *)NULL; @@ -348,8 +337,7 @@ get_info_window_of_window (window) values if the window and node are the same as the current one being displayed. */ void -set_remembered_pagetop_and_point (window) - WINDOW *window; +set_remembered_pagetop_and_point (WINDOW *window) { INFO_WINDOW *info_win; @@ -367,9 +355,7 @@ set_remembered_pagetop_and_point (window) } void -remember_window_and_node (window, node) - WINDOW *window; - NODE *node; +remember_window_and_node (WINDOW *window, NODE *node) { /* See if we already have this window in our list. */ INFO_WINDOW *info_win = get_info_window_of_window (window); @@ -428,7 +414,7 @@ remember_window_and_node (window, node) #define DEBUG_FORGET_WINDOW_AND_NODES #if defined (DEBUG_FORGET_WINDOW_AND_NODES) static void -consistency_check_info_windows () +consistency_check_info_windows (void) { register int i; @@ -448,8 +434,7 @@ consistency_check_info_windows () /* Remove WINDOW and its associated list of nodes from INFO_WINDOWS. */ void -forget_window_and_nodes (window) - WINDOW *window; +forget_window_and_nodes (WINDOW *window) { register int i; INFO_WINDOW *info_win = (INFO_WINDOW *)NULL; @@ -496,10 +481,7 @@ forget_window_and_nodes (window) the footnotes for this window. If REMEMBER is nonzero, first call set_remembered_pagetop_and_point. */ void -info_set_node_of_window (remember, window, node) - int remember; - WINDOW *window; - NODE *node; +info_set_node_of_window (int remember, WINDOW *window, NODE *node) { if (remember) set_remembered_pagetop_and_point (window); @@ -526,9 +508,7 @@ info_set_node_of_window (remember, window, node) /* Change the pagetop of WINDOW to DESIRED_TOP, perhaps scrolling the screen to do so. */ void -set_window_pagetop (window, desired_top) - WINDOW *window; - int desired_top; +set_window_pagetop (WINDOW *window, int desired_top) { int point_line, old_pagetop; @@ -591,8 +571,7 @@ set_window_pagetop (window, desired_top) /* Immediately make WINDOW->point visible on the screen, and move the terminal cursor there. */ static void -info_show_point (window) - WINDOW *window; +info_show_point (WINDOW *window) { int old_pagetop; @@ -615,13 +594,11 @@ info_show_point (window) /* Move WINDOW->point from OLD line index to NEW line index. */ static void -move_to_new_line (old, new, window) - int old, new; - WINDOW *window; +move_to_new_line (int old, int new, WINDOW *window) { if (old == -1) { - info_error (msg_cant_find_point); + info_error ((char *) msg_cant_find_point, NULL, NULL); } else { @@ -869,23 +846,22 @@ int default_scroll_size = -1; /* meaning half screen size */ /* Move to 1st menu item, Next, Up/Next, or error in this window. */ static void -forward_move_node_structure (window, behaviour) - WINDOW *window; - int behaviour; +forward_move_node_structure (WINDOW *window, int behaviour) { switch (behaviour) { case IS_PageOnly: - info_error (msg_at_node_bottom); + info_error ((char *) msg_at_node_bottom, NULL, NULL); break; case IS_NextOnly: info_next_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) - info_error (msg_no_pointer, _("Next")); + info_error ((char *) msg_no_pointer, (char *) _("Next"), NULL); else { - window_message_in_echo_area (_("Following Next node...")); + window_message_in_echo_area ((char *) _("Following Next node..."), + NULL, NULL); info_handle_pointer ("Next", window); } break; @@ -902,7 +878,8 @@ forward_move_node_structure (window, behaviour) if (menu) { info_free_references (menu); - window_message_in_echo_area (_("Selecting first menu item...")); + window_message_in_echo_area ((char *) _("Selecting first menu item..."), + NULL, NULL); info_menu_digit (window, 1, '1'); return; } @@ -913,7 +890,8 @@ forward_move_node_structure (window, behaviour) info_next_label_of_node (window->node); if (INFO_LABEL_FOUND ()) { - window_message_in_echo_area (_("Selecting Next node...")); + window_message_in_echo_area ((char *) _("Selecting Next node..."), + NULL, NULL); info_handle_pointer ("Next", window); return; } @@ -983,8 +961,8 @@ forward_move_node_structure (window, behaviour) /* This node has a "Next" pointer, and it is not the same as the first menu item found in this node. */ window_message_in_echo_area - (_("Moving Up %d time(s), then Next."), - up_counter); + ((char *) _("Moving Up %d time(s), then Next."), + (void *) (long) up_counter, NULL); info_handle_pointer ("Next", window); return; @@ -1007,7 +985,8 @@ forward_move_node_structure (window, behaviour) window->point = info_win->points[old_current]; recalculate_line_starts (window); window->flags |= W_UpdateWindow; - info_error (_("No more nodes within this document.")); + info_error ((char *) _("No more nodes within this document."), + NULL, NULL); } } } @@ -1018,23 +997,22 @@ forward_move_node_structure (window, behaviour) /* Move Prev, Up or error in WINDOW depending on BEHAVIOUR. */ static void -backward_move_node_structure (window, behaviour) - WINDOW *window; - int behaviour; +backward_move_node_structure (WINDOW *window, int behaviour) { switch (behaviour) { case IS_PageOnly: - info_error (msg_at_node_top); + info_error ((char *) msg_at_node_top, NULL, NULL); break; case IS_NextOnly: info_prev_label_of_node (window->node); if (!info_parsed_nodename && !info_parsed_filename) - info_error (_("No `Prev' for this node.")); + info_error ((char *) _("No `Prev' for this node."), NULL, NULL); else { - window_message_in_echo_area (_("Moving Prev in this window.")); + window_message_in_echo_area ((char *) _("Moving Prev in this window."), + NULL, NULL); info_handle_pointer ("Prev", window); } break; @@ -1048,10 +1026,13 @@ backward_move_node_structure (window, behaviour) info_up_label_of_node (window->node); 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.")); + info_error ((char *) + _("No `Prev' or `Up' for this node within this document."), + NULL, NULL); else { - window_message_in_echo_area (_("Moving Up in this window.")); + window_message_in_echo_area ((char *) _("Moving Up in this window."), + NULL, NULL); info_handle_pointer ("Up", window); } } @@ -1089,7 +1070,8 @@ backward_move_node_structure (window, behaviour) /* Move to the previous node. If this node now contains a menu, and we have not inhibited movement to it, move to the node corresponding to the last menu item. */ - window_message_in_echo_area (_("Moving Prev in this window.")); + window_message_in_echo_area ((char *) _("Moving Prev in this window."), + NULL, NULL); info_handle_pointer ("Prev", window); if (!inhibit_menu_traversing) @@ -1099,7 +1081,7 @@ backward_move_node_structure (window, behaviour) { info_free_references (menu); window_message_in_echo_area - (_("Moving to `Prev's last menu item.")); + ((char *) _("Moving to `Prev's last menu item."), NULL, NULL); info_menu_digit (window, 1, '0'); } } @@ -1140,15 +1122,13 @@ DECLARE_INFO_COMMAND (info_global_prev_node, } } -static void _scroll_forward(); -static void _scroll_backward(); +static void _scroll_forward(WINDOW *window, int count, + unsigned char key, int behaviour); +static void _scroll_backward(WINDOW *window, int count, + unsigned char key, int behaviour); static void -_scroll_forward(window, count, key, behaviour) - WINDOW *window; - int count; - unsigned char key; - int behaviour; +_scroll_forward(WINDOW *window, int count, unsigned char key, int behaviour) { if (count < 0) _scroll_backward (window, -count, key, behaviour); @@ -1188,11 +1168,7 @@ _scroll_forward(window, count, key, behaviour) } static void -_scroll_backward(window, count, key, behaviour) - WINDOW *window; - int count; - unsigned char key; - int behaviour; +_scroll_backward(WINDOW *window, int count, unsigned char key, int behaviour) { if (count < 0) _scroll_forward (window, -count, key, behaviour); @@ -1406,7 +1382,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); + info_error ((char *) msg_one_window, NULL, NULL); return; } @@ -1446,7 +1422,7 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window")) if (!windows->next && !echo_area_is_active) { - info_error (msg_one_window); + info_error ((char *) msg_one_window, NULL, NULL); return; } @@ -1457,7 +1433,7 @@ DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window")) if (window == the_echo_area || (window == windows && !echo_area_is_active)) { - register WINDOW *win, *last; + register WINDOW *win, *last = NULL; for (win = windows; win; win = win->next) last = win; @@ -1502,7 +1478,7 @@ DECLARE_INFO_COMMAND (info_split_window, _("Split the current window")) if (!split) { - info_error (msg_win_too_small); + info_error ((char *) msg_win_too_small, NULL, NULL); } else { @@ -1570,11 +1546,11 @@ DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window")) { if (!windows->next) { - info_error (msg_cant_kill_last); + info_error ((char *) msg_cant_kill_last, NULL, NULL); } else if (window->flags & W_WindowIsPerm) { - info_error (_("Cannot delete a permanent window")); + info_error ((char *) _("Cannot delete a permanent window"), NULL, NULL); } else { @@ -1591,8 +1567,7 @@ DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window")) /* Do the physical deletion of WINDOW, and forget this window and associated nodes. */ void -info_delete_window_internal (window) - WINDOW *window; +info_delete_window_internal (WINDOW *window) { if (windows->next && ((window->flags & W_WindowIsPerm) == 0)) { @@ -1660,7 +1635,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); + info_error ((char *) msg_one_window, NULL, NULL); return; } @@ -1712,8 +1687,7 @@ DECLARE_INFO_COMMAND (info_toggle_wrap, /* Return (FILENAME)NODENAME for NODE, or just NODENAME if NODE's filename is not set. */ char * -node_printed_rep (node) - NODE *node; +node_printed_rep (NODE *node) { char *rep; @@ -1734,9 +1708,7 @@ node_printed_rep (node) /* Using WINDOW for various defaults, select the node referenced by ENTRY in it. If the node is selected, the window and node are remembered. */ void -info_select_reference (window, entry) - WINDOW *window; - REFERENCE *entry; +info_select_reference (WINDOW *window, REFERENCE *entry) { NODE *node; char *filename, *nodename, *file_system_error; @@ -1781,9 +1753,9 @@ info_select_reference (window, entry) if (!node) { if (file_system_error) - info_error (file_system_error); + info_error (file_system_error, NULL, NULL); else - info_error (msg_cant_find_node, nodename); + info_error ((char *) msg_cant_find_node, nodename, NULL); } maybe_free (file_system_error); @@ -1798,9 +1770,7 @@ info_select_reference (window, entry) Select the parsed node in WINDOW and remember it, or error if the node couldn't be found. */ static void -info_parse_and_select (line, window) - char *line; - WINDOW *window; +info_parse_and_select (char *line, WINDOW *window) { REFERENCE entry; @@ -1818,9 +1788,7 @@ info_parse_and_select (line, window) WINDOW. The node should have been pointed to by the LABEL pointer of WINDOW->node. */ static void -info_handle_pointer (label, window) - char *label; - WINDOW *window; +info_handle_pointer (char *label, WINDOW *window) { if (info_parsed_filename || info_parsed_nodename) { @@ -1861,9 +1829,9 @@ info_handle_pointer (label, window) else { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else - info_error (msg_cant_file_node, filename, nodename); + info_error ((char *) msg_cant_file_node, filename, nodename); } free (filename); @@ -1871,7 +1839,7 @@ info_handle_pointer (label, window) } else { - info_error (msg_no_pointer, label); + info_error ((char *) msg_no_pointer, label, NULL); } } @@ -1927,7 +1895,7 @@ DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file")) } if (!node) - info_error (_("This window has no additional nodes")); + info_error ((char *) _("This window has no additional nodes"), NULL, NULL); else info_set_node_of_window (1, window, node); } @@ -1960,7 +1928,7 @@ DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file")) } if (!node) - info_error (_("This window has no additional nodes")); + info_error ((char *) _("This window has no additional nodes"), NULL, NULL); else info_set_node_of_window (1, window, node); } @@ -1976,13 +1944,13 @@ DECLARE_INFO_COMMAND (info_last_menu_item, DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item")) { register int i, item; - register REFERENCE *entry, **menu; + register REFERENCE **menu; menu = info_menu_of_node (window->node); if (!menu) { - info_error (msg_no_menu_node); + info_error ((char *) msg_no_menu_node, NULL, NULL); return; } @@ -1994,54 +1962,118 @@ DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item")) for (i = 0; menu[i + 1]; i++); else { - for (i = 0; (entry = menu[i]); i++) + for (i = 0; menu[i]; i++) if (i == item - 1) break; } if (menu[i]) - info_select_reference (window, menu[i]); + { + info_select_reference (window, menu[i]); + if (menu[i]->line_number > 0) + info_next_line (window, menu[i]->line_number - 1, key); + } else - info_error (_("There aren't %d items in this menu."), item); + info_error ((char *) _("There aren't %d items in this menu."), + (void *) (long) item, NULL); info_free_references (menu); return; } + + +/* Return a pointer to the xref in XREF_LIST that is nearest to POS, or + NULL if XREF_LIST is empty. That is, if POS is within any of the + given xrefs, return that one. Otherwise, return the one with the + nearest beginning or end. If there are two that are equidistant, + prefer the one forward. The return is in newly-allocated memory, + since the caller frees it. + + This is called from info_menu_or_ref_item with XREF_LIST being all + the xrefs in the node, and POS being point. The ui function that + starts it all off is select-reference-this-line. + + This is not the same logic as in info.el. Info-get-token prefers + searching backwards to searching forwards, and has a hardwired search + limit of 200 chars (in Emacs 21.2). */ + +static REFERENCE ** +nearest_xref (REFERENCE **xref_list, long int pos) +{ + int this_xref; + int nearest = -1; + long best_delta = -1; + + for (this_xref = 0; xref_list[this_xref]; this_xref++) + { + long delta; + REFERENCE *xref = xref_list[this_xref]; + if (xref->start <= pos && pos <= xref->end) + { /* POS is within this xref, we're done */ + nearest = this_xref; + break; + } + + /* See how far POS is from this xref. Take into account the + `*Note' that begins the xref, since as far as the user is + concerned, that's where it starts. */ + delta = MIN (labs (pos - (xref->start - strlen (INFO_XREF_LABEL))), + labs (pos - xref->end)); + + /* It's the <= instead of < that makes us choose the forward xref + of POS if two are equidistant. Of course, because of all the + punctuation surrounding xrefs, it's not necessarily obvious + where one ends. */ + if (delta <= best_delta || best_delta < 0) + { + nearest = this_xref; + best_delta = delta; + } + } + + /* Maybe there was no list to search through. */ + if (nearest < 0) + return NULL; + + /* Ok, we have a nearest xref, make a list of it. */ + { + REFERENCE **ret = xmalloc (sizeof (REFERENCE *) * 2); + ret[0] = info_copy_reference (xref_list[nearest]); + ret[1] = NULL; + return ret; + } +} + + /* Read a menu or followed reference from the user defaulting to the reference found on the current line, and select that node. The reading is done with completion. BUILDER is the function used to build the list of references. ASK_P is non-zero if the user should be prompted, or zero to select the default item. */ static void -info_menu_or_ref_item (window, count, key, builder, ask_p) - WINDOW *window; - int count; - unsigned char key; - REFERENCE **(*builder) (); - int ask_p; -{ - REFERENCE **menu, *entry, *defentry = (REFERENCE *)NULL; +info_menu_or_ref_item (WINDOW *window, int count, + unsigned char key, REFERENCE **(*builder) (NODE *node), int ask_p) +{ char *line; - - menu = (*builder) (window->node); + REFERENCE *entry; + REFERENCE *defentry = NULL; + REFERENCE **menu = (*builder) (window->node); if (!menu) { if (builder == info_menu_of_node) - info_error (msg_no_menu_node); + info_error ((char *) msg_no_menu_node, NULL, NULL); else - info_error (msg_no_xref_node); + info_error ((char *) msg_no_xref_node, NULL, NULL); return; } /* Default the selected reference to the one which is on the line that point is in. */ { - REFERENCE **refs = (REFERENCE **)NULL; - int point_line; - - point_line = window_line_of_point (window); + REFERENCE **refs = NULL; + int point_line = window_line_of_point (window); if (point_line != -1) { @@ -2070,50 +2102,43 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) refs = manpage_xrefs_in_binding (window->node, &binding); else #endif /* HANDLE_MAN_PAGES */ - { - refs = info_xrefs (&binding); - if (!refs && point_line > 0) - { - /* People get annoyed that Info cannot find an xref - which starts on a previous line and ends on this - one. So if we fail to find a reference on this - line, let's try the one before. */ - binding.start = - window->line_starts[point_line - 1] - binding.buffer; - refs = info_xrefs (&binding); - } - } + refs = nearest_xref (menu, window->point); } - if (refs) + if (refs && refs[0]) { - if ((strcmp (refs[0]->label, "Menu") != 0) || - (builder == info_xrefs_of_node)) + if (strcmp (refs[0]->label, "Menu") != 0 + || builder == info_xrefs_of_node) { int which = 0; - /* Find the closest reference to point. */ - if (builder == info_xrefs_of_node) + /* For xrefs, find the closest reference to point, + unless we only have one reference (as we will if + we've called nearest_xref above). It would be better + to have only one piece of code, but the conditions + when we call this are tangled. */ + if (builder == info_xrefs_of_node && refs[1]) { int closest = -1; for (; refs[which]; which++) { - if ((window->point >= refs[which]->start) && - (window->point <= refs[which]->end)) + if (window->point >= refs[which]->start + && window->point <= refs[which]->end) { closest = which; break; } else if (window->point < refs[which]->start) - { - break; - } + break; } - if (closest == -1) - which--; - else - which = closest; + if (which > 0) + { + if (closest == -1) + which--; + else + which = closest; + } } if (which < 0) @@ -2122,6 +2147,7 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) defentry->label = xstrdup (refs[which]->label); defentry->filename = refs[which]->filename; defentry->nodename = refs[which]->nodename; + defentry->line_number = refs[which]->line_number; if (defentry->filename) defentry->filename = xstrdup (defentry->filename); @@ -2139,24 +2165,27 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) char *prompt; /* Build the prompt string. */ - if (defentry) - prompt = (char *)xmalloc (20 + strlen (defentry->label)); - else - prompt = (char *)xmalloc (20); - if (builder == info_menu_of_node) { if (defentry) - sprintf (prompt, _("Menu item (%s): "), defentry->label); + { + prompt = xmalloc (strlen (defentry->label) + + strlen (_("Menu item (%s): "))); + sprintf (prompt, _("Menu item (%s): "), defentry->label); + } else - sprintf (prompt, _("Menu item: ")); + prompt = xstrdup (_("Menu item: ")); } else { if (defentry) - sprintf (prompt, _("Follow xref (%s): "), defentry->label); + { + prompt = xmalloc (strlen (defentry->label) + + strlen (_("Follow xref (%s): "))); + sprintf (prompt, _("Follow xref (%s): "), defentry->label); + } else - sprintf (prompt, _("Follow xref: ")); + prompt = xstrdup (_("Follow xref: ")); } line = info_read_completing_in_echo_area (window, prompt, menu); @@ -2234,11 +2263,12 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) } if (!entry && defentry) - info_error (_("The reference disappeared! (%s)."), line); + info_error ((char *) _("The reference disappeared! (%s)."), line, NULL); else { NODE *orig = window->node; info_select_reference (window, entry); + if (builder == info_xrefs_of_node && window->node != orig && !(window->node->flags & N_FromAnchor)) { /* Search for this reference in the node. */ @@ -2259,6 +2289,11 @@ info_menu_or_ref_item (window, count, key, builder, ask_p) 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); } free (line); @@ -2306,7 +2341,7 @@ DECLARE_INFO_COMMAND (info_find_menu, _("Move to the start of this node's menu") position = search (INFO_MENU_LABEL, &binding); if (position == -1) - info_error (msg_no_menu_node); + info_error ((char *) msg_no_menu_node, NULL, NULL); else { window->point = position; @@ -2325,7 +2360,7 @@ DECLARE_INFO_COMMAND (info_visit_menu, menu = info_menu_of_node (window->node); if (!menu) - info_error (msg_no_menu_node); + info_error ((char *) msg_no_menu_node, NULL, NULL); for (i = 0; (!info_error_was_printed) && (entry = menu[i]); i++) { @@ -2335,7 +2370,7 @@ DECLARE_INFO_COMMAND (info_visit_menu, window_tile_windows (TILE_INTERNALS); if (!new) - info_error (msg_win_too_small); + info_error ((char *) msg_win_too_small, NULL, NULL); else { active_window = new; @@ -2400,11 +2435,12 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it")) } } } - line = info_read_maybe_completing (window, _("Goto node: "), items); + line = info_read_maybe_completing (window, (char *) _("Goto node: "), + items); info_free_references (items); } #else /* !GOTO_COMPLETES */ - line = info_read_in_echo_area (window, _("Goto node: ")); + line = info_read_in_echo_area (window, (char *) _("Goto node: ")); #endif /* !GOTO_COMPLETES */ /* If the user aborted, quit now. */ @@ -2432,10 +2468,8 @@ DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it")) will be NULL. */ NODE * -info_follow_menus (initial_node, menus, errstr, errarg1, errarg2) - NODE *initial_node; - char **menus; - char **errstr, **errarg1, **errarg2; +info_follow_menus (NODE *initial_node, char **menus, + const char **errstr, char **errarg1, char **errarg2) { NODE *node = NULL; *errstr = *errarg1 = *errarg2 = NULL; @@ -2490,7 +2524,8 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2) if (strcasecmp (entry->label, arg) == 0) break; else - if (strncasecmp (entry->label, arg, strlen (arg)) == 0) + if ((best_guess == -1) + && (strncasecmp (entry->label, arg, strlen (arg)) == 0)) best_guess = i; } @@ -2568,8 +2603,7 @@ info_follow_menus (initial_node, menus, errstr, errarg1, errarg2) Return array terminated with NULL. */ static char ** -split_list_of_nodenames (str) - char *str; +split_list_of_nodenames (char *str) { unsigned len = 2; char **nodes = xmalloc (len * sizeof (char *)); @@ -2598,7 +2632,7 @@ split_list_of_nodenames (str) DECLARE_INFO_COMMAND (info_menu_sequence, _("Read a list of menus starting from dir and follow them")) { - char *line = info_read_in_echo_area (window, _("Follow menus: ")); + char *line = info_read_in_echo_area (window, (char *) _("Follow menus: ")); /* If the user aborted, quit now. */ if (!line) @@ -2611,10 +2645,11 @@ DECLARE_INFO_COMMAND (info_menu_sequence, if (*line) { - char *errstr, *errarg1, *errarg2; + const char *errstr; + char *errarg1, *errarg2; NODE *dir_node = info_get_node (NULL, NULL); char **nodes = split_list_of_nodenames (line); - NODE *node; + NODE *node = NULL; /* If DIR_NODE is NULL, they might be reading a file directly, like in "info -d . -f ./foo". Try using "Top" instead. */ @@ -2630,16 +2665,15 @@ DECLARE_INFO_COMMAND (info_menu_sequence, /* 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"); + info_error ((char *) msg_cant_find_node, "Top", NULL); else - node - = info_follow_menus (dir_node, nodes, &errstr, &errarg1, &errarg2); + node = info_follow_menus (dir_node, nodes, &errstr, &errarg1, &errarg2); free (nodes); if (!errstr) info_set_node_of_window (1, window, node); else - info_error (errstr, errarg1, errarg2); + info_error ((char *) errstr, errarg1, errarg2); } free (line); @@ -2652,10 +2686,7 @@ DECLARE_INFO_COMMAND (info_menu_sequence, or NULL if there's nothing in this menu seems to fit the bill. If EXACT is non-zero, allow only exact matches. */ static REFERENCE * -entry_in_menu (arg, menu, exact) - char *arg; - REFERENCE **menu; - int exact; +entry_in_menu (char *arg, REFERENCE **menu, int exact) { REFERENCE *entry; @@ -2689,10 +2720,7 @@ entry_in_menu (arg, menu, exact) invocation info and its command-line options, by looking for menu items and chains of menu items with characteristic names. */ void -info_intuit_options_node (window, initial_node, program) - WINDOW *window; - NODE *initial_node; - char *program; +info_intuit_options_node (WINDOW *window, NODE *initial_node, char *program) { /* The list of node names typical for GNU manuals where the program usage and specifically the command-line arguments are described. @@ -2727,7 +2755,7 @@ info_intuit_options_node (window, initial_node, program) in the menu hierarchy... */ for (node = initial_node; node; initial_node = node) { - REFERENCE *entry; + REFERENCE *entry = NULL; /* Build and return a list of the menu items in this node. */ menu = info_menu_of_node (initial_node); @@ -2740,13 +2768,15 @@ info_intuit_options_node (window, initial_node, program) /* Look for node names typical for usage nodes in this menu. */ for (try_node = invocation_nodes; *try_node; try_node++) { - char nodename[200]; + char *nodename; + nodename = xmalloc (strlen (program) + strlen (*try_node)); sprintf (nodename, *try_node, program); /* The last resort "%s" is dangerous, so we restrict it to exact matches here. */ entry = entry_in_menu (nodename, menu, strcmp (*try_node, "%s") == 0); + free (nodename); if (entry) break; } @@ -2774,8 +2804,7 @@ info_intuit_options_node (window, initial_node, program) /* Given a name of an Info file, find the name of the package it describes by removing the leading directories and extensions. */ char * -program_name_from_file_name (file_name) - char *file_name; +program_name_from_file_name (char *file_name) { int i; char *program_name = xstrdup (filename_non_directory (file_name)); @@ -2798,7 +2827,7 @@ program_name_from_file_name (file_name) DECLARE_INFO_COMMAND (info_goto_invocation_node, _("Find the node describing program invocation")) { - char *invocation_prompt = _("Find Invocation node of [%s]: "); + const char *invocation_prompt = _("Find Invocation node of [%s]: "); char *program_name, *line; char *default_program_name, *prompt, *file_name; NODE *top_node; @@ -2816,7 +2845,7 @@ DECLARE_INFO_COMMAND (info_goto_invocation_node, free (prompt); if (!line) { - info_abort_key (); + info_abort_key (window, 0, 0); return; } if (*line) @@ -2828,7 +2857,7 @@ DECLARE_INFO_COMMAND (info_goto_invocation_node, from the Top node. */ top_node = info_get_node (file_name, NULL); if (!top_node) - info_error (msg_cant_find_node, "Top"); + info_error ((char *) msg_cant_find_node, "Top", NULL); info_intuit_options_node (window, top_node, program_name); free (line); @@ -2840,7 +2869,7 @@ DECLARE_INFO_COMMAND (info_man, _("Read a manpage reference and select it")) { char *line; - line = info_read_in_echo_area (window, _("Get Manpage: ")); + line = info_read_in_echo_area (window, (char *) _("Get Manpage: ")); if (!line) { @@ -2885,8 +2914,7 @@ DECLARE_INFO_COMMAND (info_dir_node, _("Select the node `(dir)'")) /* Read the name of a node to kill. The list of available nodes comes from the nodes appearing in the current window configuration. */ static char * -read_nodename_to_kill (window) - WINDOW *window; +read_nodename_to_kill (WINDOW *window) { int iw; char *nodename; @@ -2894,7 +2922,7 @@ read_nodename_to_kill (window) REFERENCE **menu = NULL; int menu_index = 0, menu_slots = 0; char *default_nodename = xstrdup (active_window->node->nodename); - char *prompt = xmalloc (40 + strlen (default_nodename)); + char *prompt = xmalloc (strlen (_("Kill node (%s): ")) + strlen (default_nodename)); sprintf (prompt, _("Kill node (%s): "), default_nodename); @@ -2926,9 +2954,7 @@ read_nodename_to_kill (window) /* Delete NODENAME from this window, showing the most recently selected node in this window. */ static void -kill_node (window, nodename) - WINDOW *window; - char *nodename; +kill_node (WINDOW *window, char *nodename) { int iw, i; INFO_WINDOW *info_win; @@ -2950,7 +2976,7 @@ kill_node (window, nodename) if (!info_win) { if (*nodename) - info_error (_("Cannot kill node `%s'"), nodename); + info_error ((char *) _("Cannot kill node `%s'"), nodename, NULL); else window_clear_echo_area (); @@ -2960,7 +2986,7 @@ kill_node (window, 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")); + info_error ((char *) _("Cannot kill the last node"), NULL, NULL); return; } @@ -3064,7 +3090,7 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it") { char *line; - line = info_read_in_echo_area (window, _("Find file: ")); + line = info_read_in_echo_area (window, (char *) _("Find file: ")); if (!line) { info_abort_key (active_window, 1, 0); @@ -3079,9 +3105,9 @@ DECLARE_INFO_COMMAND (info_view_file, _("Read the name of a file and select it") if (!node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else - info_error (_("Cannot find `%s'."), line); + info_error ((char *) _("Cannot find `%s'."), line, NULL); } else info_set_node_of_window (1, window, node); @@ -3100,19 +3126,17 @@ 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 (); -static void dump_node_to_stream (); -static void initialize_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); +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 the nodes which appear in the menu of each node dumped. */ void -dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes) - char *filename; - char **nodenames; - char *output_filename; - int dump_subnodes; +dump_nodes_to_file (char *filename, char **nodenames, + char *output_filename, int dump_subnodes) { register int i; FILE *output_stream; @@ -3126,7 +3150,8 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes) if (!output_stream) { - info_error (_("Could not create output file `%s'."), output_filename); + info_error ((char *) _("Could not create output file `%s'."), + output_filename, NULL); return; } @@ -3139,7 +3164,7 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes) fclose (output_stream); #if defined (VERBOSE_NODE_DUMPING) - info_error (_("Done.")); + info_error ((char *) _("Done."), NULL, NULL); #endif /* VERBOSE_NODE_DUMPING */ } @@ -3149,7 +3174,7 @@ static int dumped_already_index = 0; static int dumped_already_slots = 0; static void -initialize_dumping () +initialize_dumping (void) { dumped_already_index = 0; } @@ -3158,10 +3183,8 @@ initialize_dumping () If DUMP_SUBNODES is non-zero, recursively dump the nodes which appear in the menu of each node dumped. */ static void -dump_node_to_stream (filename, nodename, stream, dump_subnodes) - char *filename, *nodename; - FILE *stream; - int dump_subnodes; +dump_node_to_stream (char *filename, char *nodename, + FILE *stream, int dump_subnodes) { register int i; NODE *node; @@ -3171,14 +3194,15 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) if (!node) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else { if (filename && *nodename != '(') - info_error (msg_cant_file_node, filename_non_directory (filename), - nodename); + info_error ((char *) msg_cant_file_node, + filename_non_directory (filename), + nodename); else - info_error (msg_cant_find_node, nodename); + info_error ((char *) msg_cant_find_node, nodename, NULL); } return; } @@ -3195,7 +3219,7 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) #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)); + info_error ((char *) _("Writing node %s..."), node_printed_rep (node), NULL); #endif /* VERBOSE_NODE_DUMPING */ write_node_to_stream (node, stream); @@ -3230,10 +3254,7 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes) /* Dump NODE to FILENAME. If DUMP_SUBNODES is non-zero, recursively dump the nodes which appear in the menu of each node dumped. */ void -dump_node_to_file (node, filename, dump_subnodes) - NODE *node; - char *filename; - int dump_subnodes; +dump_node_to_file (NODE *node, char *filename, int dump_subnodes) { FILE *output_stream; char *nodes_filename; @@ -3247,7 +3268,8 @@ dump_node_to_file (node, filename, dump_subnodes) if (!output_stream) { - info_error (_("Could not create output file `%s'."), filename); + info_error ((char *) _("Could not create output file `%s'."), filename, + NULL); return; } @@ -3264,7 +3286,7 @@ dump_node_to_file (node, filename, dump_subnodes) fclose (output_stream); #if defined (VERBOSE_NODE_DUMPING) - info_error (_("Done.")); + info_error ((char *) _("Done."), NULL, NULL); #endif /* VERBOSE_NODE_DUMPING */ } @@ -3280,8 +3302,7 @@ DECLARE_INFO_COMMAND (info_print_node, /* Print NODE on a printer piping it into INFO_PRINT_COMMAND. */ void -print_node (node) - NODE *node; +print_node (NODE *node) { FILE *printer_pipe; char *print_command = getenv ("INFO_PRINT_COMMAND"); @@ -3309,13 +3330,13 @@ print_node (node) if (!printer_pipe) { - info_error (_("Cannot open pipe to `%s'."), print_command); + info_error ((char *) _("Cannot open pipe to `%s'."), print_command, NULL); 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)); + info_error ((char *) _("Printing node %s..."), node_printed_rep (node), NULL); #endif /* VERBOSE_NODE_DUMPING */ write_node_to_stream (node, printer_pipe); @@ -3325,14 +3346,12 @@ print_node (node) fclose (printer_pipe); #if defined (VERBOSE_NODE_DUMPING) - info_error (_("Done.")); + info_error ((char *) _("Done."), NULL, NULL); #endif /* VERBOSE_NODE_DUMPING */ } static void -write_node_to_stream (node, stream) - NODE *node; - FILE *stream; +write_node_to_stream (NODE *node, FILE *stream) { fwrite (node->contents, 1, node->nodelen, stream); } @@ -3349,11 +3368,11 @@ write_node_to_stream (node, stream) to gc even those file buffer contents which had to be uncompressed. */ int gc_compressed_files = 0; -static void info_gc_file_buffers (); -static void info_search_1 (); +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); static char *search_string = (char *)NULL; -static int search_string_index = 0; static int search_string_size = 0; static int isearch_is_active = 0; @@ -3362,8 +3381,7 @@ static int last_search_case_sensitive = 0; /* Return the file buffer which belongs to WINDOW's node. */ FILE_BUFFER * -file_buffer_of_window (window) - WINDOW *window; +file_buffer_of_window (WINDOW *window) { /* If this window has no node, then it has no file buffer. */ if (!window->node) @@ -3385,12 +3403,8 @@ file_buffer_of_window (window) DIR says which direction to search in. If it is positive, search forward, else backwards. */ long -info_search_in_node (string, node, start, window, dir, case_sensitive) - char *string; - NODE *node; - long start; - WINDOW *window; - int dir, case_sensitive; +info_search_in_node (char *string, NODE *node, long int start, + WINDOW *window, int dir, int case_sensitive) { SEARCH_BINDING binding; long offset; @@ -3432,13 +3446,10 @@ info_search_in_node (string, node, start, window, dir, case_sensitive) 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, string, start) - NODE *node; - char *string; - long start; +info_target_search_node (NODE *node, char *string, long int start) { register int i; - long offset; + long offset = 0; char *target; target = xstrdup (string); @@ -3467,10 +3478,8 @@ info_target_search_node (node, string, start) If the search fails, return non-zero, else zero. Side-effect window leaving the node and point where the string was found current. */ static int -info_search_internal (string, window, dir, case_sensitive) - char *string; - WINDOW *window; - int dir, case_sensitive; +info_search_internal (char *string, WINDOW *window, + int dir, int case_sensitive) { register int i; FILE_BUFFER *file_buffer; @@ -3507,7 +3516,7 @@ info_search_internal (string, window, dir, case_sensitive) file's node list. */ if (file_buffer->tags) { - register int current_tag, number_of_tags; + register int current_tag = 0, number_of_tags; char *last_subfile; TAG *tag; @@ -3557,8 +3566,8 @@ info_search_internal (string, window, dir, case_sensitive) if (!echo_area_is_active && (last_subfile != tag->filename)) { window_message_in_echo_area - (_("Searching subfile %s ..."), - filename_non_directory (tag->filename)); + ((char *) _("Searching subfile %s ..."), + filename_non_directory (tag->filename), NULL); last_subfile = tag->filename; } @@ -3571,9 +3580,9 @@ info_search_internal (string, window, dir, case_sensitive) if (!echo_area_is_active) { if (info_recent_file_error) - info_error (info_recent_file_error); + info_error (info_recent_file_error, NULL, NULL); else - info_error (msg_cant_file_node, + info_error ((char *) msg_cant_file_node, filename_non_directory (file_buffer->filename), tag->nodename); } @@ -3632,12 +3641,8 @@ DECLARE_INFO_COMMAND (info_search_backward, } static void -info_search_1 (window, count, key, case_sensitive, ask_for_string) - WINDOW *window; - int count; - unsigned char key; - int case_sensitive; - int ask_for_string; +info_search_1 (WINDOW *window, int count, unsigned char key, + int case_sensitive, int ask_for_string) { char *line, *prompt; int result, old_pagetop; @@ -3664,7 +3669,12 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string) if (ask_for_string) { - prompt = (char *)xmalloc (50 + strlen (search_string)); + prompt = (char *)xmalloc (strlen (_("%s%sfor string [%s]: ")) + + strlen (_("Search backward")) + + strlen (_("Search")) + + strlen (_(" case-sensitively ")) + + strlen (_(" ")) + + strlen (search_string)); sprintf (prompt, _("%s%sfor string [%s]: "), direction < 0 ? _("Search backward") : _("Search"), @@ -3676,18 +3686,17 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string) if (!line) { - info_abort_key (); + info_abort_key (window, 0, 0); return; } if (*line) { - if (strlen (line) + 1 > search_string_size) + if (strlen (line) + 1 > (unsigned int) search_string_size) search_string = (char *) xrealloc (search_string, (search_string_size += 50 + strlen (line))); strcpy (search_string, line); - search_string_index = strlen (line); free (line); } } @@ -3708,7 +3717,7 @@ info_search_1 (window, count, key, case_sensitive, ask_for_string) active_window, direction, case_sensitive); if (result != 0 && !info_error_was_printed) - info_error (_("Search failed.")); + info_error ((char *) _("Search failed."), NULL, NULL); else if (old_pagetop != active_window->pagetop) { int new_pagetop; @@ -3729,7 +3738,7 @@ DECLARE_INFO_COMMAND (info_search_next, _("Repeat last search in the same direction")) { if (!last_search_direction) - info_error (_("No previous search string")); + info_error ((char *) _("No previous search string"), NULL, NULL); else info_search_1 (window, last_search_direction * count, key, last_search_case_sensitive, 0); @@ -3739,7 +3748,7 @@ DECLARE_INFO_COMMAND (info_search_previous, _("Repeat last search in the reverse direction")) { if (!last_search_direction) - info_error (_("No previous search string")); + info_error ((char *) _("No previous search string"), NULL, NULL); else info_search_1 (window, -last_search_direction * count, key, last_search_case_sensitive, 0); @@ -3751,7 +3760,8 @@ DECLARE_INFO_COMMAND (info_search_previous, /* */ /* **************************************************************** */ -static void incremental_search (); +static void incremental_search (WINDOW *window, int count, + unsigned char ignore); DECLARE_INFO_COMMAND (isearch_forward, _("Search interactively for a string as you type it")) @@ -3775,14 +3785,6 @@ static int isearch_string_index = 0; static int isearch_string_size = 0; static unsigned char isearch_terminate_search_key = ESC; -/* Structure defining the current state of an incremental search. */ -typedef struct { - WINDOW_STATE_DECL; /* The node, pagetop and point. */ - int search_index; /* Offset of the last char in the search string. */ - int direction; /* The direction that this search is heading in. */ - int failing; /* Whether or not this search failed. */ -} SEARCH_STATE; - /* Array of search states. */ static SEARCH_STATE **isearch_states = (SEARCH_STATE **)NULL; static int isearch_states_index = 0; @@ -3790,9 +3792,7 @@ static int isearch_states_slots = 0; /* Push the state of this search. */ static void -push_isearch (window, search_index, direction, failing) - WINDOW *window; - int search_index, direction, failing; +push_isearch (WINDOW *window, int search_index, int direction, int failing) { SEARCH_STATE *state; @@ -3808,9 +3808,7 @@ push_isearch (window, search_index, direction, failing) /* Pop the state of this search to WINDOW, SEARCH_INDEX, and DIRECTION. */ static void -pop_isearch (window, search_index, direction, failing) - WINDOW *window; - int *search_index, *direction, *failing; +pop_isearch (WINDOW *window, int *search_index, int *direction, int *failing) { SEARCH_STATE *state; @@ -3830,7 +3828,7 @@ pop_isearch (window, search_index, direction, failing) /* Free the memory used by isearch_states. */ static void -free_isearch_states () +free_isearch_states (void) { register int i; @@ -3844,14 +3842,12 @@ free_isearch_states () /* Display the current search in the echo area. */ static void -show_isearch_prompt (dir, string, failing_p) - int dir; - unsigned char *string; - int failing_p; +show_isearch_prompt (int dir, unsigned char *string, int failing_p) { register int i; - char *prefix, *prompt, *p_rep; - int prompt_len, p_rep_index, p_rep_size; + const char *prefix; + char *prompt, *p_rep; + unsigned int prompt_len, p_rep_index, p_rep_size; if (dir < 0) prefix = _("I-search backward: "); @@ -3879,22 +3875,21 @@ show_isearch_prompt (dir, string, failing_p) p_rep_index += strlen (rep); } - prompt_len = strlen (prefix) + p_rep_index + 20; - prompt = (char *)xmalloc (prompt_len); + prompt_len = strlen (prefix) + p_rep_index + 1; + if (failing_p) + prompt_len += strlen (_("Failing ")); + prompt = xmalloc (prompt_len); sprintf (prompt, "%s%s%s", failing_p ? _("Failing ") : "", prefix, p_rep ? p_rep : ""); - window_message_in_echo_area ("%s", prompt); + window_message_in_echo_area ("%s", prompt, NULL); maybe_free (p_rep); free (prompt); display_cursor_at_point (active_window); } static void -incremental_search (window, count, ignore) - WINDOW *window; - int count; - unsigned char ignore; +incremental_search (WINDOW *window, int count, unsigned char ignore) { unsigned char key; int last_search_result, search_result, dir; @@ -3917,7 +3912,7 @@ incremental_search (window, count, ignore) /* Show the search string in the echo area. */ isearch_string[isearch_string_index] = '\0'; - show_isearch_prompt (dir, isearch_string, search_result); + show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result); isearch_is_active = 1; @@ -3938,7 +3933,7 @@ incremental_search (window, count, ignore) key = info_get_input_char (); window_get_state (window, &mystate); - if (key == DEL) + if (key == DEL || key == Control ('h')) { /* User wants to delete one level of search? */ if (!isearch_states_index) @@ -3951,7 +3946,8 @@ incremental_search (window, count, ignore) pop_isearch (window, &isearch_string_index, &dir, &search_result); isearch_string[isearch_string_index] = '\0'; - show_isearch_prompt (dir, isearch_string, search_result); + show_isearch_prompt (dir, (unsigned char *) isearch_string, + search_result); goto after_search; } } @@ -3969,9 +3965,15 @@ incremental_search (window, count, ignore) if (!Meta_p (key) || key > 32) { - func = InfoFunction(window->keymap[key].function); - - if (isprint (key) || func == (VFunction *)NULL) + /* If this key is not a keymap, get its associated function, + if any. If it is a keymap, then it's probably ESC from an + arrow key, and we handle that case below. */ + char type = window->keymap[key].type; + func = type == ISFUNC + ? InfoFunction(window->keymap[key].function) + : NULL; /* function member is a Keymap if ISKMAP */ + + if (isprint (key) || (type == ISFUNC && func == NULL)) { insert_and_search: @@ -3983,15 +3985,16 @@ incremental_search (window, count, ignore) isearch_string[isearch_string_index] = '\0'; goto search_now; } - else if (func == isearch_forward || func == isearch_backward) + else if (func == (VFunction *) isearch_forward + || func == (VFunction *) isearch_backward) { /* If this key invokes an incremental search, then this means that we will either search again in the same direction, search again in the reverse direction, or insert the last search string that was accepted through incremental searching. */ - if ((func == isearch_forward && dir > 0) || - (func == isearch_backward && dir < 0)) + if ((func == (VFunction *) isearch_forward && dir > 0) || + (func == (VFunction *) isearch_backward && dir < 0)) { /* If the user has typed no characters, then insert the last successful search into the current search string. */ @@ -4000,8 +4003,8 @@ incremental_search (window, count, ignore) /* Of course, there must be something to insert. */ if (last_isearch_accepted) { - if (strlen (last_isearch_accepted) + 1 >= - isearch_string_size) + if (strlen ((char *) last_isearch_accepted) + 1 + >= (unsigned int) isearch_string_size) isearch_string = (char *) xrealloc (isearch_string, isearch_string_size += 10 + @@ -4027,7 +4030,7 @@ incremental_search (window, count, ignore) dir = -dir; } } - else if (func == info_abort_key) + else if (func == (VFunction *) info_abort_key) { /* If C-g pressed, and the search is failing, pop the search stack back to the last unfailed search. */ @@ -4038,7 +4041,8 @@ incremental_search (window, count, ignore) pop_isearch (window, &isearch_string_index, &dir, &search_result); isearch_string[isearch_string_index] = '\0'; - show_isearch_prompt (dir, isearch_string, search_result); + show_isearch_prompt (dir, (unsigned char *) isearch_string, + search_result); continue; } else @@ -4054,7 +4058,7 @@ incremental_search (window, count, ignore) non-null. Exit the search, remembering the search string. If the key is not the same as the isearch_terminate_search_key, then push it into pending input. */ - if (isearch_string_index && func != info_abort_key) + if (isearch_string_index && func != (VFunction *) info_abort_key) { maybe_free (last_isearch_accepted); last_isearch_accepted = xstrdup (isearch_string); @@ -4073,7 +4077,7 @@ incremental_search (window, count, ignore) || info_any_buffered_input_p ())) info_set_pending_input (key); - if (func == info_abort_key) + if (func == (VFunction *) info_abort_key) { if (isearch_states_index) window_set_state (window, &orig_state); @@ -4091,7 +4095,7 @@ incremental_search (window, count, ignore) /* Search for the contents of isearch_string. */ search_now: - show_isearch_prompt (dir, isearch_string, search_result); + show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result); /* If the search string includes upper-case letters, make the search case-sensitive. */ @@ -4133,7 +4137,7 @@ incremental_search (window, count, ignore) terminal_ring_bell (); after_search: - show_isearch_prompt (dir, isearch_string, search_result); + show_isearch_prompt (dir, (unsigned char *) isearch_string, search_result); if (search_result == 0) { @@ -4167,7 +4171,7 @@ incremental_search (window, count, ignore) Garbage collecting a file buffer means to free the file buffers contents. */ static void -info_gc_file_buffers () +info_gc_file_buffers (void) { register int fb_index, iw_index, i; register FILE_BUFFER *fb; @@ -4226,11 +4230,7 @@ info_gc_file_buffers () /* Move to the next or previous cross reference in this node. */ static void -info_move_to_xref (window, count, key, dir) - WINDOW *window; - int count; - unsigned char key; - int dir; +info_move_to_xref (WINDOW *window, int count, unsigned char key, int dir) { long firstmenu, firstxref; long nextmenu, nextxref; @@ -4272,7 +4272,7 @@ info_move_to_xref (window, count, key, dir) if (firstmenu == -1 && firstxref == -1) { - info_error (msg_no_xref_node); + info_error ((char *) msg_no_xref_node, NULL, NULL); return; } @@ -4361,10 +4361,11 @@ DECLARE_INFO_COMMAND (info_select_reference_this_line, _("Select reference or menu item appearing on this line")) { char *line; - NODE *orig; - line = window->line_starts[window_line_of_point (window)]; - orig = window->node; + if (window->line_starts) + line = window->line_starts[window_line_of_point (window)]; + else + line = ""; /* If this line contains a menu item, select that one. */ if (strncmp ("* ", line, 2) == 0) @@ -4387,7 +4388,7 @@ DECLARE_INFO_COMMAND (info_abort_key, _("Cancel current operation")) do it. */ if (!info_error_rings_bell_p) terminal_ring_bell (); - info_error (_("Quit")); + info_error ((char *) _("Quit"), NULL, NULL); info_initialize_numeric_arg (); info_clear_pending_input (); @@ -4482,19 +4483,18 @@ DECLARE_INFO_COMMAND (info_do_lowercase_version, {} static void -dispatch_error (keyseq) - char *keyseq; +dispatch_error (char *keyseq) { char *rep; rep = pretty_keyseq (keyseq); if (!echo_area_is_active) - info_error (_("Unknown command (%s)."), rep); + info_error ((char *) _("Unknown command (%s)."), rep, NULL); else { - char *temp = xmalloc (1 + strlen (rep) + strlen (_("\"\" is invalid"))); - sprintf (temp, _("\"%s\" is invalid"), rep); + char *temp = xmalloc (1 + strlen (rep) + strlen (_("\"%s\" is invalid"))); + sprintf (temp, _("`%s' is invalid"), rep); terminal_ring_bell (); inform_in_echo_area (temp); free (temp); @@ -4509,7 +4509,7 @@ static int info_keyseq_displayed_p = 0; /* Initialize the length of the current key sequence. */ void -initialize_keyseq () +initialize_keyseq (void) { info_keyseq_index = 0; info_keyseq_displayed_p = 0; @@ -4517,8 +4517,7 @@ initialize_keyseq () /* Add CHARACTER to the current key sequence. */ void -add_char_to_keyseq (character) - char character; +add_char_to_keyseq (char character) { if (info_keyseq_index + 2 >= info_keyseq_size) info_keyseq = (char *)xrealloc (info_keyseq, info_keyseq_size += 10); @@ -4530,9 +4529,8 @@ add_char_to_keyseq (character) /* Display the current value of info_keyseq. If argument EXPECTING is non-zero, input is expected to be read after the key sequence is displayed, so add an additional prompting character to the sequence. */ -void -display_info_keyseq (expecting_future_input) - int expecting_future_input; +static void +display_info_keyseq (int expecting_future_input) { char *rep; @@ -4544,7 +4542,7 @@ display_info_keyseq (expecting_future_input) inform_in_echo_area (rep); else { - window_message_in_echo_area (rep); + window_message_in_echo_area (rep, NULL, NULL); display_cursor_at_point (active_window); } info_keyseq_displayed_p = 1; @@ -4552,7 +4550,7 @@ display_info_keyseq (expecting_future_input) /* Called by interactive commands to read a keystroke. */ unsigned char -info_get_another_input_char () +info_get_another_input_char (void) { int ready = !info_keyseq_displayed_p; /* ready if new and pending key */ @@ -4589,9 +4587,7 @@ info_get_another_input_char () /* Do the command associated with KEY in MAP. If the associated command is really a keymap, then read another key, and dispatch into that map. */ void -info_dispatch_on_key (key, map) - unsigned char key; - Keymap map; +info_dispatch_on_key (unsigned char key, Keymap map) { #if !defined(INFOKEY) if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert)) @@ -4621,7 +4617,7 @@ info_dispatch_on_key (key, map) if (func != (VFunction *)NULL) { /* Special case info_do_lowercase_version (). */ - if (func == info_do_lowercase_version) + if (func == (VFunction *) info_do_lowercase_version) { #if defined(INFOKEY) unsigned char lowerkey; @@ -4729,7 +4725,7 @@ DECLARE_INFO_COMMAND (info_universal_argument, /* Create a default argument. */ void -info_initialize_numeric_arg () +info_initialize_numeric_arg (void) { info_numeric_arg = info_numeric_arg_sign = 1; info_explicit_arg = 0; @@ -4770,8 +4766,9 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop, key = UnMeta (key); #endif /* !defined(INFOKEY) */ - if (keymap[key].type == ISFUNC && - InfoFunction(keymap[key].function) == info_universal_argument) + if (keymap[key].type == ISFUNC + && InfoFunction(keymap[key].function) + == (VFunction *) info_universal_argument) { info_numeric_arg *= 4; key = 0; @@ -4821,22 +4818,21 @@ static int pending_input_character = 0; /* How to make there be no pending input. */ static void -info_clear_pending_input () +info_clear_pending_input (void) { pending_input_character = 0; } /* How to set the pending input character. */ static void -info_set_pending_input (key) - unsigned char key; +info_set_pending_input (unsigned char key) { pending_input_character = key; } /* How to see if there is any pending input. */ unsigned char -info_input_pending_p () +info_input_pending_p (void) { return (pending_input_character); } @@ -4849,8 +4845,7 @@ static unsigned char info_input_buffer[MAX_INFO_INPUT_BUFFERING]; /* Add KEY to the buffer of characters to be read. */ static void -info_push_typeahead (key) - unsigned char key; +info_push_typeahead (unsigned char key) { /* Flush all pending input in the case of C-g pressed. */ if (key == Control ('g')) @@ -4861,14 +4856,14 @@ info_push_typeahead (key) else { info_input_buffer[push_index++] = key; - if (push_index >= sizeof (info_input_buffer)) + if ((unsigned int) push_index >= sizeof (info_input_buffer)) push_index = 0; } } /* Return the amount of space available in INFO_INPUT_BUFFER for new chars. */ static int -info_input_buffer_space_available () +info_input_buffer_space_available (void) { if (pop_index > push_index) return (pop_index - push_index); @@ -4880,22 +4875,21 @@ info_input_buffer_space_available () Return the key in KEY. Result is non-zero if there was a key, or 0 if there wasn't. */ static int -info_get_key_from_typeahead (key) - unsigned char *key; +info_get_key_from_typeahead (unsigned char *key) { if (push_index == pop_index) return (0); *key = info_input_buffer[pop_index++]; - if (pop_index >= sizeof (info_input_buffer)) + if ((unsigned int) pop_index >= sizeof (info_input_buffer)) pop_index = 0; return (1); } int -info_any_buffered_input_p () +info_any_buffered_input_p (void) { info_gather_typeahead (); return (push_index != pop_index); @@ -4904,7 +4898,7 @@ info_any_buffered_input_p () /* If characters are available to be read, then read them and stuff them into info_input_buffer. Otherwise, do nothing. */ void -info_gather_typeahead () +info_gather_typeahead (void) { register int i = 0; int tty, space_avail; @@ -4978,7 +4972,7 @@ info_gather_typeahead () /* How to read a single character. */ unsigned char -info_get_input_char () +info_get_input_char (void) { unsigned char keystroke; diff --git a/gnu/usr.bin/texinfo/info/signals.h b/gnu/usr.bin/texinfo/info/signals.h index ff82a0b3bee..2874e7717bf 100644 --- a/gnu/usr.bin/texinfo/info/signals.h +++ b/gnu/usr.bin/texinfo/info/signals.h @@ -1,10 +1,7 @@ -/* signals.h -- Header to include system dependent signal definitions. - $Id: signals.h,v 1.2 1999/01/11 16:38:09 espie Exp $ +/* signals.h -- header to include system dependent signal definitions. + $Id: signals.h,v 1.3 2006/07/17 16:12:36 espie Exp $ - This file is part of GNU Info, a program for reading online documentation - stored in Info format. - - Copyright (C) 1993, 94, 95, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1994, 1995, 1997, 2002, 2004 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 +17,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #ifndef INFO_SIGNALS_H #define INFO_SIGNALS_H @@ -37,7 +34,10 @@ # define sigmask(x) (1 << ((x)-1)) #endif /* !HAVE_SIGPROCMASK && !sigmask */ -#if !defined (HAVE_SIGPROCMASK) +/* Without SA_NOCLDSTOP, sigset_t might end up being undefined even + though we have sigprocmask, on older systems, according to Nelson + Beebe. The test is from coreutils/sort.c, via Paul Eggert. */ +#if !defined (HAVE_SIGPROCMASK) || !defined (SA_NOCLDSTOP) # if !defined (SIG_BLOCK) # define SIG_UNBLOCK 1 # define SIG_BLOCK 2 diff --git a/gnu/usr.bin/texinfo/info/termdep.h b/gnu/usr.bin/texinfo/info/termdep.h index 554452674b9..62b3b822a4d 100644 --- a/gnu/usr.bin/texinfo/info/termdep.h +++ b/gnu/usr.bin/texinfo/info/termdep.h @@ -1,7 +1,8 @@ -/* termdep.h -- System things that terminal.c depends on. - $Id: termdep.h,v 1.4 2002/06/10 13:51:03 espie Exp $ +/* termdep.h -- system things that terminal.c depends on. + $Id: termdep.h,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 96, 97, 98, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1996, 1997, 1998, 2001, 2002 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 diff --git a/gnu/usr.bin/texinfo/info/terminal.c b/gnu/usr.bin/texinfo/info/terminal.c index 075de35b77c..733d7b9a661 100644 --- a/gnu/usr.bin/texinfo/info/terminal.c +++ b/gnu/usr.bin/texinfo/info/terminal.c @@ -1,8 +1,8 @@ -/* terminal.c -- How to handle the physical terminal for Info. - $Id: terminal.c,v 1.6 2002/06/10 13:51:03 espie Exp $ +/* terminal.c -- how to handle the physical terminal for Info. + $Id: terminal.c,v 1.7 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98, 99, 2001 - Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1997, 1998, + 1999, 2001, 2002, 2004 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 +18,7 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Written by Brian Fox (bfox@ai.mit.edu). */ + Originally written by Brian Fox (bfox@ai.mit.edu). */ #include "info.h" #include "terminal.h" @@ -103,9 +103,6 @@ static char *visible_bell; /* The string to write to turn on the meta key, if this term has one. */ static char *term_mm; -/* The string to write to turn off the meta key, if this term has one. */ -static char *term_mo; - /* The string to turn on inverse mode, if this term has one. */ static char *term_invbeg; @@ -116,8 +113,7 @@ static char *term_invend; return its argument, all the code I've looked at (termutils, less) does so, so fine. */ static int -output_character_function (c) - int c; +output_character_function (int c) { putc (c, stdout); return c; @@ -132,9 +128,9 @@ output_character_function (c) /* Tell the terminal that we will be doing cursor addressable motion. */ static void -terminal_begin_using_terminal () +terminal_begin_using_terminal (void) { - RETSIGTYPE (*sigsave) (); + RETSIGTYPE (*sigsave) (int signum); if (term_keypad_on) send_to_terminal (term_keypad_on); @@ -163,9 +159,9 @@ terminal_begin_using_terminal () /* Tell the terminal that we will not be doing any more cursor addressable motion. */ static void -terminal_end_using_terminal () +terminal_end_using_terminal (void) { - RETSIGTYPE (*sigsave) (); + RETSIGTYPE (*sigsave) (int signum); if (term_keypad_off) send_to_terminal (term_keypad_off); @@ -230,8 +226,7 @@ char *term_kx = NULL; /* del */ /* Move the cursor to the terminal location of X and Y. */ void -terminal_goto_xy (x, y) - int x, y; +terminal_goto_xy (int x, int y) { if (terminal_goto_xy_hook) (*terminal_goto_xy_hook) (x, y); @@ -244,8 +239,7 @@ terminal_goto_xy (x, y) /* Print STRING to the terminal at the current position. */ void -terminal_put_text (string) - char *string; +terminal_put_text (char *string) { if (terminal_put_text_hook) (*terminal_put_text_hook) (string); @@ -257,9 +251,7 @@ terminal_put_text (string) /* Print NCHARS from STRING to the terminal at the current position. */ void -terminal_write_chars (string, nchars) - char *string; - int nchars; +terminal_write_chars (char *string, int nchars) { if (terminal_write_chars_hook) (*terminal_write_chars_hook) (string, nchars); @@ -272,7 +264,7 @@ terminal_write_chars (string, nchars) /* Clear from the current position of the cursor to the end of the line. */ void -terminal_clear_to_eol () +terminal_clear_to_eol (void) { if (terminal_clear_to_eol_hook) (*terminal_clear_to_eol_hook) (); @@ -284,7 +276,7 @@ terminal_clear_to_eol () /* Clear the entire terminal screen. */ void -terminal_clear_screen () +terminal_clear_screen (void) { if (terminal_clear_screen_hook) (*terminal_clear_screen_hook) (); @@ -296,7 +288,7 @@ terminal_clear_screen () /* Move the cursor up one line. */ void -terminal_up_line () +terminal_up_line (void) { if (terminal_up_line_hook) (*terminal_up_line_hook) (); @@ -308,7 +300,7 @@ terminal_up_line () /* Move the cursor down one line. */ void -terminal_down_line () +terminal_down_line (void) { if (terminal_down_line_hook) (*terminal_down_line_hook) (); @@ -320,7 +312,7 @@ terminal_down_line () /* Turn on reverse video if possible. */ void -terminal_begin_inverse () +terminal_begin_inverse (void) { if (terminal_begin_inverse_hook) (*terminal_begin_inverse_hook) (); @@ -332,7 +324,7 @@ terminal_begin_inverse () /* Turn off reverse video if possible. */ void -terminal_end_inverse () +terminal_end_inverse (void) { if (terminal_end_inverse_hook) (*terminal_end_inverse_hook) (); @@ -345,7 +337,7 @@ terminal_end_inverse () /* Ring the terminal bell. The bell is run visibly if it both has one and terminal_use_visible_bell_p is non-zero. */ void -terminal_ring_bell () +terminal_ring_bell (void) { if (terminal_ring_bell_hook) (*terminal_ring_bell_hook) (); @@ -360,8 +352,7 @@ terminal_ring_bell () /* At the line START, delete COUNT lines from the terminal display. */ static void -terminal_delete_lines (start, count) - int start, count; +terminal_delete_lines (int start, int count) { int lines; @@ -384,8 +375,7 @@ terminal_delete_lines (start, count) /* At the line START, insert COUNT lines in the terminal display. */ static void -terminal_insert_lines (start, count) - int start, count; +terminal_insert_lines (int start, int count) { int lines; @@ -412,8 +402,7 @@ terminal_insert_lines (start, count) towards the top of the screen, else they are scrolled towards the bottom of the screen. */ void -terminal_scroll_terminal (start, end, amount) - int start, end, amount; +terminal_scroll_terminal (int start, int end, int amount) { if (!terminal_can_scroll) return; @@ -449,8 +438,7 @@ terminal_scroll_terminal (start, end, amount) /* Re-initialize the terminal considering that the TERM/TERMCAP variable has changed. */ void -terminal_new_terminal (terminal_name) - char *terminal_name; +terminal_new_terminal (char *terminal_name) { if (terminal_new_terminal_hook) (*terminal_new_terminal_hook) (terminal_name); @@ -462,7 +450,7 @@ terminal_new_terminal (terminal_name) /* Set the global variables SCREENWIDTH and SCREENHEIGHT. */ void -terminal_get_screen_size () +terminal_get_screen_size (void) { if (terminal_get_screen_size_hook) (*terminal_get_screen_size_hook) (); @@ -522,8 +510,7 @@ terminal_get_screen_size () TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta key. Finally, the terminal screen is cleared. */ void -terminal_initialize_terminal (terminal_name) - char *terminal_name; +terminal_initialize_terminal (char *terminal_name) { char *buffer; @@ -632,12 +619,10 @@ terminal_initialize_terminal (terminal_name) if (terminal_has_meta_p) { term_mm = tgetstr ("mm", &buffer); - term_mo = tgetstr ("mo", &buffer); } else { term_mm = NULL; - term_mo = NULL; } /* Attempt to find the arrow keys. */ @@ -704,7 +689,7 @@ struct ltchars original_ltchars; /* Prepare to start using the terminal to read characters singly. */ void -terminal_prep_terminal () +terminal_prep_terminal (void) { int tty; @@ -844,7 +829,7 @@ terminal_prep_terminal () /* Restore the tty settings back to what they were before we started using this terminal. */ void -terminal_unprep_terminal () +terminal_unprep_terminal (void) { int tty; diff --git a/gnu/usr.bin/texinfo/info/tilde.c b/gnu/usr.bin/texinfo/info/tilde.c index 59d4fe6b6b7..121eec7c959 100644 --- a/gnu/usr.bin/texinfo/info/tilde.c +++ b/gnu/usr.bin/texinfo/info/tilde.c @@ -1,8 +1,8 @@ /* tilde.c -- tilde expansion code (~/foo := $HOME/foo). - $Id: tilde.c,v 1.3 2000/02/09 02:18:40 espie Exp $ + $Id: tilde.c,v 1.4 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 98, 99 - Free Software Foundation, Inc. + Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1996, 1998, 1999, + 2002, 2004 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 @@ -22,6 +22,7 @@ /* Include config.h before doing alloca. */ #include "info.h" +#include "tilde.h" #if defined (TEST) || defined (STATIC_MALLOC) static void *xmalloc (), *xrealloc (); @@ -59,9 +60,7 @@ char **tilde_additional_suffixes = default_suffixes; the tilde which starts the expansion. Place the length of the text which identified this tilde starter in LEN, excluding the tilde itself. */ static int -tilde_find_prefix (string, len) - char *string; - int *len; +tilde_find_prefix (char *string, int *len) { register int i, j, string_len; register char **prefixes = tilde_additional_prefixes; @@ -92,8 +91,7 @@ tilde_find_prefix (string, len) /* Find the end of a tilde expansion in STRING, and return the index of the character which ends the tilde definition. */ static int -tilde_find_suffix (string) - char *string; +tilde_find_suffix (char *string) { register int i, j, string_len; register char **suffixes = tilde_additional_suffixes; @@ -116,10 +114,9 @@ tilde_find_suffix (string) /* Return a new string which is the result of tilde expanding STRING. */ char * -tilde_expand (string) - char *string; +tilde_expand (char *string) { - char *result, *tilde_expand_word (); + char *result; int result_size, result_index; result_size = result_index = 0; @@ -179,8 +176,7 @@ tilde_expand (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 (filename) - char *filename; +tilde_expand_word (char *filename) { char *dirname = filename ? xstrdup (filename) : NULL; @@ -236,9 +232,7 @@ tilde_expand_word (filename) expansion, then let them try. */ if (tilde_expansion_failure_hook) { - char *expansion; - - expansion = (*tilde_expansion_failure_hook) (username); + char *expansion = (*tilde_expansion_failure_hook) (username); if (expansion) { diff --git a/gnu/usr.bin/texinfo/info/variables.c b/gnu/usr.bin/texinfo/info/variables.c index 9f30900429f..9c0cdb481c1 100644 --- a/gnu/usr.bin/texinfo/info/variables.c +++ b/gnu/usr.bin/texinfo/info/variables.c @@ -1,7 +1,7 @@ -/* variables.c -- How to manipulate user visible variables in Info. - $Id: variables.c,v 1.4 2002/06/10 13:51:03 espie Exp $ +/* variables.c -- how to manipulate user visible variables in Info. + $Id: variables.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 2001 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2001, 2002, 2004 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 @@ -77,7 +77,7 @@ DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable")) char *description; /* Get the variable's name. */ - var = read_variable_name (_("Describe variable: "), window); + var = read_variable_name ((char *) _("Describe variable: "), window); if (!var) return; @@ -92,7 +92,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); + window_message_in_echo_area ("%s", description, NULL); free (description); } @@ -102,7 +102,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable")) char *line; /* Get the variable's name and value. */ - var = read_variable_name (_("Set variable: "), window); + var = read_variable_name ((char *) _("Set variable: "), window); if (!var) return; @@ -201,9 +201,7 @@ DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable")) address of a VARIABLE_ALIST member. A return value of NULL indicates that no variable could be read. */ VARIABLE_ALIST * -read_variable_name (prompt, window) - char *prompt; - WINDOW *window; +read_variable_name (char *prompt, WINDOW *window) { register int i; char *line; @@ -249,7 +247,7 @@ read_variable_name (prompt, window) /* Make an array of REFERENCE which actually contains the names of the variables available in Info. */ REFERENCE ** -make_variable_completions_array () +make_variable_completions_array (void) { register int i; REFERENCE **array = (REFERENCE **)NULL; @@ -274,9 +272,7 @@ make_variable_completions_array () #if defined(INFOKEY) void -set_variable_to_value(name, value) - char *name; - char *value; +set_variable_to_value(char *name, char *value) { register int i; diff --git a/gnu/usr.bin/texinfo/info/variables.h b/gnu/usr.bin/texinfo/info/variables.h index ba6f1f33176..61d0b7b4889 100644 --- a/gnu/usr.bin/texinfo/info/variables.h +++ b/gnu/usr.bin/texinfo/info/variables.h @@ -1,10 +1,10 @@ /* variables.h -- Description of user visible variables in Info. - $Id: variables.h,v 1.2 1999/01/11 16:38:10 espie Exp $ + $Id: variables.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -42,14 +42,15 @@ typedef struct { /* Read the name of an Info variable in the echo area and return the address of a VARIABLE_ALIST member. A return value of NULL indicates that no variable could be read. */ -extern VARIABLE_ALIST *read_variable_name (); +extern VARIABLE_ALIST *read_variable_name (char *prompt, WINDOW *window); /* Make an array of REFERENCE which actually contains the names of the variables available in Info. */ -extern REFERENCE **make_variable_completions_array (); +extern REFERENCE **make_variable_completions_array (void); /* Set the value of an info variable. */ -extern void set_variable (); +extern void set_variable (WINDOW *window, int count, unsigned char key); +extern void describe_variable (WINDOW *window, int count, unsigned char key); /* The list of user-visible variables. */ extern int auto_footnotes_p; diff --git a/gnu/usr.bin/texinfo/info/window.c b/gnu/usr.bin/texinfo/info/window.c index 23a9c7addc5..967105dbec4 100644 --- a/gnu/usr.bin/texinfo/info/window.c +++ b/gnu/usr.bin/texinfo/info/window.c @@ -1,7 +1,8 @@ /* window.c -- windows in Info. - $Id: window.c,v 1.4 2002/06/10 13:51:03 espie Exp $ + $Id: window.c,v 1.5 2006/07/17 16:12:36 espie Exp $ - Copyright (C) 1993, 97, 98, 2001, 02 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 1998, 2001, 2002, 2003, 2004 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 @@ -50,8 +51,7 @@ WINDOW *active_window = NULL; Create the first window ever. You pass the dimensions of the total screen size. */ void -window_initialize_windows (width, height) - int width, height; +window_initialize_windows (int width, int height) { the_screen = xmalloc (sizeof (WINDOW)); the_echo_area = xmalloc (sizeof (WINDOW)); @@ -82,7 +82,7 @@ window_initialize_windows (width, height) area. */ the_echo_area->height = ECHO_AREA_HEIGHT; active_window->height = the_screen->height - 1 - the_echo_area->height; - window_new_screen_size (width, height, NULL); + window_new_screen_size (width, height); /* The echo area uses a different keymap than normal info windows. */ the_echo_area->keymap = echo_area_keymap; @@ -102,8 +102,7 @@ window_initialize_windows (width, height) VFunction *window_deletion_notifier = NULL; void -window_new_screen_size (width, height) - int width, height; +window_new_screen_size (int width, int height) { register WINDOW *win; int delta_height, delta_each, delta_leftover; @@ -231,7 +230,7 @@ window_new_screen_size (width, height) if ((win->height < WINDOW_MIN_HEIGHT) || (win->height > avail)) { - WINDOW *lastwin; + WINDOW *lastwin = NULL; /* Split the space among the available windows. */ delta_each = avail / numwins; @@ -261,8 +260,7 @@ window_new_screen_size (width, height) window. If the window could not be made return a NULL pointer. The active window is not changed.*/ WINDOW * -window_make_window (node) - NODE *node; +window_make_window (NODE *node) { WINDOW *window; @@ -376,9 +374,7 @@ window_make_window (node) the previous and next windows in the chain. If there is only one user window, then no change takes place. */ void -window_change_window_height (window, amount) - WINDOW *window; - int amount; +window_change_window_height (WINDOW *window, int amount) { register WINDOW *win, *prev, *next; @@ -509,8 +505,7 @@ window_change_window_height (window, amount) internal nodes as well, otherwise do not change the height of such windows. */ void -window_tile_windows (style) - int style; +window_tile_windows (int style) { WINDOW *win, *last_adjusted; int numwins, avail, per_win_height, leftover; @@ -563,8 +558,7 @@ window_tile_windows (style) /* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy redisplay. */ void -window_toggle_wrap (window) - WINDOW *window; +window_toggle_wrap (WINDOW *window) { if (window->flags & W_NoWrap) window->flags &= ~W_NoWrap; @@ -598,9 +592,7 @@ window_toggle_wrap (window) /* Set WINDOW to display NODE. */ void -window_set_node_of_window (window, node) - WINDOW *window; - NODE *node; +window_set_node_of_window (WINDOW *window, NODE *node) { window->node = node; window->pagetop = 0; @@ -618,8 +610,7 @@ window_set_node_of_window (window, node) If the active window is the next or previous window, choose that window as the recipient of the extra space. Otherwise, prefer the next window. */ void -window_delete_window (window) - WINDOW *window; +window_delete_window (WINDOW *window) { WINDOW *next, *prev, *window_to_fix; @@ -690,9 +681,7 @@ window_delete_window (window) /* For every window in CHAIN, set the flags member to have FLAG set. */ void -window_mark_chain (chain, flag) - WINDOW *chain; - int flag; +window_mark_chain (WINDOW *chain, int flag) { register WINDOW *win; @@ -702,9 +691,7 @@ window_mark_chain (chain, flag) /* For every window in CHAIN, clear the flags member of FLAG. */ void -window_unmark_chain (chain, flag) - WINDOW *chain; - int flag; +window_unmark_chain (WINDOW *chain, int flag) { register WINDOW *win; @@ -715,8 +702,7 @@ window_unmark_chain (chain, flag) /* Return the number of characters it takes to display CHARACTER on the screen at HPOS. */ int -character_width (character, hpos) - int character, hpos; +character_width (int character, int hpos) { int printable_limit = 127; int width = 1; @@ -750,9 +736,7 @@ character_width (character, hpos) /* Return the number of characters it takes to display STRING on the screen at HPOS. */ int -string_width (string, hpos) - char *string; - int hpos; +string_width (char *string, int hpos) { register int i, width, this_char_width; @@ -781,8 +765,7 @@ string_width (string, hpos) /* Quickly guess the approximate number of lines that NODE would take to display. This really only counts carriage returns. */ int -window_physical_lines (node) - NODE *node; +window_physical_lines (NODE *node) { register int i, lines; char *contents; @@ -801,8 +784,7 @@ window_physical_lines (node) /* Calculate a list of line starts for the node belonging to WINDOW. The line starts are pointers to the actual text within WINDOW->NODE. */ void -calculate_line_starts (window) - WINDOW *window; +calculate_line_starts (WINDOW *window) { register int i, hpos; char **line_starts = NULL; @@ -868,7 +850,7 @@ calculate_line_starts (window) cwidth = character_width (c, hpos); /* If this character fits within this line, just do the next one. */ - if ((hpos + cwidth) < window->width) + if ((hpos + cwidth) < (unsigned int) window->width) { i++; hpos += cwidth; @@ -917,8 +899,7 @@ calculate_line_starts (window) /* Given WINDOW, recalculate the line starts for the node it displays. */ void -recalculate_line_starts (window) - WINDOW *window; +recalculate_line_starts (WINDOW *window) { maybe_free (window->line_starts); calculate_line_starts (window); @@ -932,8 +913,7 @@ int window_scroll_step = 0; /* Adjust the pagetop of WINDOW such that the cursor point will be visible. */ void -window_adjust_pagetop (window) - WINDOW *window; +window_adjust_pagetop (WINDOW *window) { register int line = 0; char *contents; @@ -990,8 +970,7 @@ window_adjust_pagetop (window) /* Return the index of the line containing point. */ int -window_line_of_point (window) - WINDOW *window; +window_line_of_point (WINDOW *window) { register int i, start = 0; @@ -1013,8 +992,7 @@ window_line_of_point (window) /* Get and return the goal column for this window. */ int -window_get_goal_column (window) - WINDOW *window; +window_get_goal_column (WINDOW *window) { if (!window->node) return (-1); @@ -1029,8 +1007,7 @@ window_get_goal_column (window) /* Get and return the printed column offset of the cursor in this window. */ int -window_get_cursor_column (window) - WINDOW *window; +window_get_cursor_column (WINDOW *window) { int i, hpos, end; char *line; @@ -1068,11 +1045,9 @@ window_get_cursor_column (window) /* Count the number of characters in LINE that precede the printed column offset of GOAL. */ int -window_chars_to_goal (line, goal) - char *line; - int goal; +window_chars_to_goal (char *line, int goal) { - register int i, check, hpos; + register int i, check = 0, hpos; for (hpos = 0, i = 0; line[i] != '\n'; i++) { @@ -1098,8 +1073,7 @@ window_chars_to_goal (line, goal) /* Create a modeline for WINDOW, and store it in window->modeline. */ void -window_make_modeline (window) - WINDOW *window; +window_make_modeline (WINDOW *window) { register int i; char *modeline; @@ -1143,7 +1117,7 @@ window_make_modeline (window) int modeline_len = 0; char *parent = NULL, *filename = "*no file*"; char *nodename = "*no node*"; - char *update_message = NULL; + const char *update_message = NULL; NODE *node = window->node; if (node) @@ -1213,9 +1187,7 @@ window_make_modeline (window) /* Make WINDOW start displaying at PERCENT percentage of its node. */ void -window_goto_percentage (window, percent) - WINDOW *window; - int percent; +window_goto_percentage (WINDOW *window, int percent) { int desired_line; @@ -1234,9 +1206,7 @@ window_goto_percentage (window, percent) /* Get the state of WINDOW, and save it in STATE. */ void -window_get_state (window, state) - WINDOW *window; - WINDOW_STATE *state; +window_get_state (WINDOW *window, SEARCH_STATE *state) { state->node = window->node; state->pagetop = window->pagetop; @@ -1245,9 +1215,7 @@ window_get_state (window, state) /* Set the node, pagetop, and point of WINDOW. */ void -window_set_state (window, state) - WINDOW *window; - WINDOW_STATE *state; +window_set_state (WINDOW *window, SEARCH_STATE *state) { if (window->node != state->node) window_set_node_of_window (window, state->node); @@ -1263,7 +1231,7 @@ static NODE *echo_area_node = NULL; /* Make the node of the_echo_area be an empty one. */ static void -free_echo_area () +free_echo_area (void) { if (echo_area_node) { @@ -1278,7 +1246,7 @@ free_echo_area () /* Clear the echo area, removing any message that is already present. The echo area is cleared immediately. */ void -window_clear_echo_area () +window_clear_echo_area (void) { free_echo_area (); display_update_one_window (the_echo_area); @@ -1289,9 +1257,7 @@ window_clear_echo_area () 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 (format, arg1, arg2) - char *format; - void *arg1, *arg2; +window_message_in_echo_area (char *format, void *arg1, void *arg2) { free_echo_area (); echo_area_node = build_message_node (format, arg1, arg2); @@ -1308,9 +1274,7 @@ static int old_echo_area_nodes_index = 0; static int old_echo_area_nodes_slots = 0; void -message_in_echo_area (format, arg1, arg2) - char *format; - void *arg1, *arg2; +message_in_echo_area (char *format, void *arg1, void *arg2) { if (echo_area_node) { @@ -1323,7 +1287,7 @@ message_in_echo_area (format, arg1, arg2) } void -unmessage_in_echo_area () +unmessage_in_echo_area (void) { free_echo_area (); @@ -1342,8 +1306,7 @@ static int message_buffer_size = 0; /* Ensure that there is enough space to stuff LENGTH characters into MESSAGE_BUFFER. */ static void -message_buffer_resize (length) - int length; +message_buffer_resize (int length) { if (!message_buffer) { @@ -1361,9 +1324,7 @@ message_buffer_resize (length) /* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and ARG2. */ static void -build_message_buffer (format, arg1, arg2, arg3) - char *format; - void *arg1, *arg2, *arg3; +build_message_buffer (char *format, void *arg1, void *arg2, void *arg3) { register int i, len; void *args[3]; @@ -1510,9 +1471,7 @@ build_message_buffer (format, arg1, arg2, arg3) /* Build a new node which has FORMAT printed with ARG1 and ARG2 as the contents. */ NODE * -build_message_node (format, arg1, arg2) - char *format; - void *arg1, *arg2; +build_message_node (char *format, void *arg1, void *arg2) { NODE *node; @@ -1525,7 +1484,7 @@ build_message_node (format, arg1, arg2) /* Convert the contents of the message buffer to a node. */ NODE * -message_buffer_to_node () +message_buffer_to_node (void) { NODE *node; @@ -1547,16 +1506,14 @@ message_buffer_to_node () /* Useful functions can be called from outside of window.c. */ void -initialize_message_buffer () +initialize_message_buffer (void) { message_buffer_index = 0; } /* Print FORMAT with ARG1,2 to the end of the current message buffer. */ void -printf_to_message_buffer (format, arg1, arg2, arg3) - char *format; - void *arg1, *arg2, *arg3; +printf_to_message_buffer (char *format, void *arg1, void *arg2, void *arg3) { build_message_buffer (format, arg1, arg2, arg3); } @@ -1564,7 +1521,7 @@ printf_to_message_buffer (format, arg1, arg2, arg3) /* Return the current horizontal position of the "cursor" on the most recently output message buffer line. */ int -message_buffer_length_this_line () +message_buffer_length_this_line (void) { register int i; @@ -1578,9 +1535,7 @@ message_buffer_length_this_line () /* Pad STRING to COUNT characters by inserting blanks. */ int -pad_to (count, string) - int count; - char *string; +pad_to (int count, char *string) { register int i; diff --git a/gnu/usr.bin/texinfo/info/window.h b/gnu/usr.bin/texinfo/info/window.h index 7c61f55464b..ceefd2ae018 100644 --- a/gnu/usr.bin/texinfo/info/window.h +++ b/gnu/usr.bin/texinfo/info/window.h @@ -1,10 +1,10 @@ /* window.h -- Structure and flags used in manipulating Info windows. - $Id: window.h,v 1.2 1999/01/11 16:38:10 espie Exp $ + $Id: window.h,v 1.3 2006/07/17 16:12:36 espie Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 97 Free Software Foundation, Inc. + Copyright (C) 1993, 1997, 2004 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 @@ -25,8 +25,8 @@ #ifndef INFO_WINDOW_H #define INFO_WINDOW_H -#include "nodes.h" #include "infomap.h" +#include "nodes.h" /* Smallest number of visible lines in a window. The actual height is always one more than this number because each window has a modeline. */ @@ -75,6 +75,14 @@ typedef struct { WINDOW_STATE_DECL; /* What gets saved. */ } WINDOW_STATE; +/* Structure defining the current state of an incremental search. */ +typedef struct { + WINDOW_STATE_DECL; /* The node, pagetop and point. */ + int search_index; /* Offset of the last char in the search string. */ + int direction; /* The direction that this search is heading in. */ + int failing; /* Whether or not this search failed. */ +} SEARCH_STATE; + #define W_UpdateWindow 0x01 /* WINDOW needs updating. */ #define W_WindowIsPerm 0x02 /* This WINDOW is a permanent object. */ #define W_WindowVisible 0x04 /* This WINDOW is currently visible. */ @@ -95,24 +103,24 @@ extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */ extern int window_scroll_step; /* Make the modeline member for WINDOW. */ -extern void window_make_modeline (); +extern void window_make_modeline (WINDOW *window); /* Initalize the window system by creating THE_SCREEN and THE_ECHO_AREA. Create the first window ever, and make it permanent. You pass WIDTH and HEIGHT; the dimensions of the total screen size. */ -extern void window_initialize_windows (); +extern void window_initialize_windows (int width, int height); /* Make a new window showing NODE, and return that window structure. The new window is made to be the active window. If NODE is passed as NULL, then show the node showing in the active window. If the window could not be made return a NULL pointer. The active window is not changed.*/ -extern WINDOW *window_make_window (); +extern WINDOW *window_make_window (NODE *node); /* Delete WINDOW from the list of known windows. If this window was the active window, make the next window in the chain be the active window, or the previous window in the chain if there is no next window. */ -extern void window_delete_window (); +extern void window_delete_window (WINDOW *window); /* A function to call when the screen changes size, and some windows have to get deleted. The function is called with the window to be deleted @@ -121,111 +129,113 @@ extern void window_delete_window (); extern VFunction *window_deletion_notifier; /* Set WINDOW to display NODE. */ -extern void window_set_node_of_window (); +extern void window_set_node_of_window (WINDOW *window, NODE *node); /* Tell the window system that the size of the screen has changed. This causes lots of interesting things to happen. The permanent windows are resized, as well as every visible window. You pass WIDTH and HEIGHT; the dimensions of the total screen size. */ -extern void window_new_screen_size (); +extern void window_new_screen_size (int width, int height); /* Change the height of WINDOW by AMOUNT. This also automagically adjusts the previous and next windows in the chain. If there is only one user window, then no change takes place. */ -extern void window_change_window_height (); +extern void window_change_window_height (WINDOW *window, int amount); /* Adjust the pagetop of WINDOW such that the cursor point will be visible. */ -extern void window_adjust_pagetop (); +extern void window_adjust_pagetop (WINDOW *window); /* Tile all of the windows currently displayed in the global variable WINDOWS. If argument DO_INTERNALS is non-zero, tile windows displaying internal nodes as well. */ #define DONT_TILE_INTERNALS 0 #define TILE_INTERNALS 1 -extern void window_tile_windows (); +extern void window_tile_windows (int style); /* Toggle the state of line wrapping in WINDOW. This can do a bit of fancy redisplay. */ -extern void window_toggle_wrap (); +extern void window_toggle_wrap (WINDOW *window); /* For every window in CHAIN, set the flags member to have FLAG set. */ -extern void window_mark_chain (); +extern void window_mark_chain (WINDOW *chain, int flag); /* For every window in CHAIN, clear the flags member of FLAG. */ -extern void window_unmark_chain (); +extern void window_unmark_chain (WINDOW *chain, int flag); /* Make WINDOW start displaying at PERCENT percentage of its node. */ -extern void window_goto_percentage (); +extern void window_goto_percentage (WINDOW *window, int percent); /* Build a new node which has FORMAT printed with ARG1 and ARG2 as the contents. */ -extern NODE *build_message_node (); +extern NODE *build_message_node (char *format, void *arg1, void *arg2); /* Useful functions can be called from outside of window.c. */ -extern void initialize_message_buffer (); +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 (); +extern void printf_to_message_buffer (char *format, void *arg1, void *arg2, + void *arg3); /* Convert the contents of the message buffer to a node. */ -extern NODE *message_buffer_to_node (); +extern NODE *message_buffer_to_node (void); /* Return the length of the most recently printed line in message buffer. */ -extern int message_buffer_length_this_line (); +extern int message_buffer_length_this_line (void); /* Pad STRING to COUNT characters by inserting blanks. */ -extern int pad_to (); +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 already a message appearing in the echo area, it is removed. */ -extern void window_message_in_echo_area (); +extern void window_message_in_echo_area (char *format, void *arg1, void *arg2); /* Place a temporary message in the echo area built from FORMAT, ARG1 and ARG2. 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 (); -extern void unmessage_in_echo_area (); +extern void message_in_echo_area (char *format, void *arg1, void *arg2); +extern void unmessage_in_echo_area (void); /* Clear the echo area, removing any message that is already present. The echo area is cleared immediately. */ -extern void window_clear_echo_area (); +extern void window_clear_echo_area (void); /* Quickly guess the approximate number of lines to that NODE would take to display. This really only counts carriage returns. */ -extern int window_physical_lines (); +extern int window_physical_lines (NODE *node); /* Calculate a list of line starts for the node belonging to WINDOW. The line starts are pointers to the actual text within WINDOW->NODE. */ -extern void calculate_line_starts (); +extern void calculate_line_starts (WINDOW *window); /* Given WINDOW, recalculate the line starts for the node it displays. */ -extern void recalculate_line_starts (); +extern void recalculate_line_starts (WINDOW *window); /* Return the number of characters it takes to display CHARACTER on the screen at HPOS. */ -extern int character_width (); +extern int character_width (int character, int hpos); /* Return the number of characters it takes to display STRING on the screen at HPOS. */ -extern int string_width (); +extern int string_width (char *string, int hpos); /* Return the index of the line containing point. */ -extern int window_line_of_point (); +extern int window_line_of_point (WINDOW *window); /* Get and return the goal column for this window. */ -extern int window_get_goal_column (); +extern int window_get_goal_column (WINDOW *window); /* Get and return the printed column offset of the cursor in this window. */ -extern int window_get_cursor_column (); +extern int window_get_cursor_column (WINDOW *window); /* Get and Set the node, pagetop, and point of WINDOW. */ -extern void window_get_state (), window_set_state (); +extern void window_get_state (WINDOW *window, SEARCH_STATE *state); +extern void window_set_state (WINDOW *window, SEARCH_STATE *state); /* Count the number of characters in LINE that precede the printed column offset of GOAL. */ -extern int window_chars_to_goal (); +extern int window_chars_to_goal (char *line, int goal); #endif /* not INFO_WINDOW_H */ |