aboutsummaryrefslogtreecommitdiff
path: root/texinfo/info
diff options
context:
space:
mode:
authorJeff Law <law@cygnus.com>1998-03-22 20:43:15 +0000
committerJeff Law <law@cygnus.com>1998-03-22 20:43:15 +0000
commit875e3bc946d2d2ee88b930488150d2bfd4d032eb (patch)
tree4ef3666114905be6c619e972c6a78cc06a2f2d12 /texinfo/info
parentfdd91b18b912af3c209fd8d992f6e0137ef7e642 (diff)
This commit was generated by cvs2svn to compensate for changes in r18765,
which included commits to RCS files with non-trunk default branches. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@18766 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'texinfo/info')
-rw-r--r--texinfo/info/Makefile.in451
-rw-r--r--texinfo/info/README6
-rw-r--r--texinfo/info/dir.c190
-rw-r--r--texinfo/info/display.c502
-rw-r--r--texinfo/info/display.h13
-rw-r--r--texinfo/info/doc.h16
-rw-r--r--texinfo/info/dribble.c2
-rw-r--r--texinfo/info/filesys.c308
-rw-r--r--texinfo/info/filesys.h15
-rw-r--r--texinfo/info/footnotes.c114
-rw-r--r--texinfo/info/footnotes.h16
-rw-r--r--texinfo/info/gc.c2
-rw-r--r--texinfo/info/gc.h13
-rw-r--r--texinfo/info/indices.c522
-rw-r--r--texinfo/info/indices.h15
-rw-r--r--texinfo/info/info-utils.c197
-rw-r--r--texinfo/info/info-utils.h16
-rw-r--r--texinfo/info/info.c514
-rw-r--r--texinfo/info/info.h143
-rw-r--r--texinfo/info/infodoc.c527
-rw-r--r--texinfo/info/infomap.c140
-rw-r--r--texinfo/info/infomap.h10
-rw-r--r--texinfo/info/m-x.c57
-rw-r--r--texinfo/info/makedoc.c263
-rw-r--r--texinfo/info/man.h13
-rw-r--r--texinfo/info/nodemenu.c126
-rw-r--r--texinfo/info/nodes.c796
-rw-r--r--texinfo/info/nodes.h111
-rw-r--r--texinfo/info/search.c180
-rw-r--r--texinfo/info/search.h26
-rw-r--r--texinfo/info/session.c2886
-rw-r--r--texinfo/info/session.h16
-rw-r--r--texinfo/info/signals.c121
-rw-r--r--texinfo/info/signals.h19
-rw-r--r--texinfo/info/terminal.h16
-rw-r--r--texinfo/info/tilde.c231
-rw-r--r--texinfo/info/tilde.h12
-rw-r--r--texinfo/info/variables.c195
-rw-r--r--texinfo/info/variables.h21
-rw-r--r--texinfo/info/window.c654
-rw-r--r--texinfo/info/window.h70
41 files changed, 4910 insertions, 4635 deletions
diff --git a/texinfo/info/Makefile.in b/texinfo/info/Makefile.in
index 776872ef68e..24c555e3459 100644
--- a/texinfo/info/Makefile.in
+++ b/texinfo/info/Makefile.in
@@ -1,232 +1,327 @@
-# Makefile for texinfo/info. -*- Indented-Text -*-
-# $Id: Makefile.in,v 1.1 1997/08/21 22:57:59 jason Exp $
-#
-# Copyright (C) 1993,96 Free Software Foundation, Inc.
-
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
+# Makefile.in generated automatically by automake 1.2 from Makefile.am
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#### Start of system configuration section. ####
+SHELL = /bin/sh
srcdir = @srcdir@
-VPATH = $(srcdir):$(common)
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
-common = $(srcdir)/../libtxi
-util = $(srcdir)/../util
+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
-EXEEXT = @EXEEXT@
-CC = @CC@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+
+NORMAL_INSTALL = true
+PRE_INSTALL = true
+POST_INSTALL = true
+NORMAL_UNINSTALL = true
+PRE_UNINSTALL = true
+POST_UNINSTALL = true
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+DATADIRNAME = @DATADIRNAME@
+EXEEXT = @EXEEXT@
+GENCAT = @GENCAT@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GT_NO = @GT_NO@
+GT_YES = @GT_YES@
+INSTOBJEXT = @INSTOBJEXT@
+INTLDEPS = @INTLDEPS@
+INTLLIBS = @INTLLIBS@
+INTLOBJS = @INTLOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+PACKAGE = @PACKAGE@
+POFILES = @POFILES@
+POSUB = @POSUB@
+RANLIB = @RANLIB@
+TERMLIBS = @TERMLIBS@
+TEXCONFIG = @TEXCONFIG@
+TEXMF = @TEXMF@
+USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+l = @l@
+
+noinst_PROGRAMS = makedoc
+
+# Use `ginfo' for building to avoid confusion with the standard `info'
+# target. The install rule removes the `g' before applying any
+# user-specified name transformations.
+bin_PROGRAMS = ginfo
+transform = s/ginfo/info/; @program_transform_name@
+
+localedir = $(datadir)/locale
+
+# -I. for funs.h.
+INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
+LDADD = ../lib/libtxi.a @TERMLIBS@ @INTLLIBS@
+
+makedoc_SOURCES = makedoc.c
+ginfo_SOURCES = dir.c display.c display.h doc.c doc.h dribble.c dribble.h \
+ echo-area.c echo-area.h \
+ filesys.c filesys.h footnotes.c footnotes.h funs.h gc.c gc.h \
+ indices.c indices.h info-utils.c info-utils.h info.c info.h infodoc.c \
+ infomap.c infomap.h m-x.c man.c man.h nodemenu.c nodes.c nodes.h \
+ 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
+
+EXTRA_DIST = README
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = ../config.h
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = ginfo$(EXEEXT)
+noinst_PROGRAMS = makedoc$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+
+
+DEFS = @DEFS@ -I. -I$(srcdir) -I..
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+ginfo_OBJECTS = dir.o display.o doc.o dribble.o echo-area.o filesys.o \
+footnotes.o gc.o indices.o info-utils.o info.o infodoc.o infomap.o \
+m-x.o man.o nodemenu.o nodes.o search.o session.o signals.o terminal.o \
+tilde.o variables.o window.o
+ginfo_LDADD = $(LDADD)
+ginfo_DEPENDENCIES = ../lib/libtxi.a
+ginfo_LDFLAGS =
+makedoc_OBJECTS = makedoc.o
+makedoc_LDADD = $(LDADD)
+makedoc_DEPENDENCIES = ../lib/libtxi.a
+makedoc_LDFLAGS =
+CFLAGS = @CFLAGS@
+COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS)
+LINK = $(CC) $(CFLAGS) $(LDFLAGS) -o $@
+DIST_COMMON = README Makefile.am Makefile.in
-LN = ln
-RM = rm -f
-MKDIR = mkdir
-MAKEINFO= ../makeinfo/makeinfo$(EXEEXT)
-DEFS = @DEFS@
+DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
-LDEFS = -DHANDLE_MAN_PAGES -DNAMED_FUNCTIONS=1 -DDEFAULT_INFOPATH='"$(DEFAULT_INFOPATH)"'
+TAR = tar
+GZIP = --best
+SOURCES = $(ginfo_SOURCES) $(makedoc_SOURCES)
+OBJECTS = $(ginfo_OBJECTS) $(makedoc_OBJECTS)
-TERMLIBS = @TERMLIBS@
-LIBS = $(TERMLIBS) -L../libtxi -ltxi @LIBS@
-LOADLIBES = $(LIBS)
+default: all
-SHELL = /bin/sh
+.SUFFIXES:
+.SUFFIXES: .c .o
+$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
+ cd $(top_srcdir) && $(AUTOMAKE) --cygnus info/Makefile
-CFLAGS = @CFLAGS@
-LDFLAGS = @LDFLAGS@
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) \
+ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-bindir = @bindir@
-# Prefix for each installed program, normally empty or `g'.
-binprefix =
-# Prefix for each installed man page, normally empty or `g'.
-manprefix =
-mandir = @mandir@/man1
-manext = 1
-infodir = @infodir@
-DEFAULT_INFOPATH= $(infodir):.
-#### End of system configuration section. ####
+mostlyclean-binPROGRAMS:
+
+clean-binPROGRAMS:
+ test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
-SRCS = dir.c display.c echo_area.c filesys.c \
- info-utils.c info.c infodoc.c infomap.c \
- m-x.c nodes.c search.c session.c \
- signals.c terminal.c tilde.c window.c \
- xmalloc.c indices.c makedoc.c nodemenu.c \
- footnotes.c dribble.c variables.c gc.c man.c \
- clib.c
+distclean-binPROGRAMS:
-HDRS = display.h doc.h echo_area.h filesys.h \
- general.h getopt.h info-utils.h info.h \
- infomap.h nodes.h search.h session.h \
- signals.h termdep.h terminal.h tilde.h \
- indices.h window.h footnotes.h dribble.h \
- variables.h gc.h clib.h
+maintainer-clean-binPROGRAMS:
-OBJS = dir.o display.o doc.o echo_area.o filesys.o info-utils.o info.o \
- infodoc.o infomap.o m-x.o nodes.o search.o session.o signals.o \
- terminal.o tilde.o window.o indices.o xmalloc.o nodemenu.o \
- footnotes.o dribble.o variables.o gc.o man.o clib.o
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ $(mkinstalldirs) $(bindir)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ if test -f $$p; then \
+ echo " $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`"; \
+ $(INSTALL_PROGRAM) $$p $(bindir)/`echo $$p|sed '$(transform)'`; \
+ else :; fi; \
+ done
-# The names of files which declare info commands.
-CMDFILES = $(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
+uninstall-binPROGRAMS:
+ $(NORMAL_UNINSTALL)
+ list='$(bin_PROGRAMS)'; for p in $$list; do \
+ rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
+ done
-# The name of the program which builds documentation structure from CMDFILES.
-MAKEDOC_OBJECTS = makedoc.o clib.o xmalloc.o
-MAKEDOC_SOURCE = makedoc.c clib.c xmalloc.c
+mostlyclean-noinstPROGRAMS:
-infofiles = info.info info-stnd.info
+clean-noinstPROGRAMS:
+ test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+
+distclean-noinstPROGRAMS:
+
+maintainer-clean-noinstPROGRAMS:
.c.o:
- $(CC) -c $(CPPFLAGS) $(LDEFS) $(DEFS) -I. -I$(srcdir) -I$(common) $(CFLAGS) $<
+ $(COMPILE) -c $<
+
+mostlyclean-compile:
+ rm -f *.o core
+
+clean-compile:
+
+distclean-compile:
+ rm -f *.tab.c
-all: info$(EXEEXT) $(infofiles)
-sub-all: all
+maintainer-clean-compile:
-dvi: all-dvi
+ginfo$(EXEEXT): $(ginfo_OBJECTS) $(ginfo_DEPENDENCIES)
+ @rm -f ginfo$(EXEEXT)
+ $(LINK) $(ginfo_LDFLAGS) $(ginfo_OBJECTS) $(ginfo_LDADD) $(LIBS)
-install: all
- $(INSTALL_PROGRAM) info$(EXEEXT) $(bindir)/$(binprefix)info$(EXEEXT)
- -$(INSTALL_DATA) $(srcdir)/info.1 $(mandir)/$(manprefix)info.$(manext)
- $(POST_INSTALL)
+makedoc$(EXEEXT): $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES)
+ @rm -f makedoc$(EXEEXT)
+ $(LINK) $(makedoc_LDFLAGS) $(makedoc_OBJECTS) $(makedoc_LDADD) $(LIBS)
-install-info:
- -d=$(srcdir); test -f ./info.info && d=.; $(INSTALL_DATA) $$d/info.info $(infodir)/info.info
- -d=$(srcdir); test -f ./info-stnd.info && d=.; $(INSTALL_DATA) $$d/info-stnd.info $(infodir)/info-stnd.info
- ../util/install-info --info-dir=$(infodir) $(infodir)/info.info
- ../util/install-info --info-dir=$(infodir) $(infodir)/info-stnd.info
+tags: TAGS
-uninstall:
- $(RM) $(bindir)/info$(EXEEXT)
- $(RM) $(infodir)/info.info
- $(RM) $(infodir)/info-stnd.info
- $(RM) $(mandir)/$(manprefix)info.$(manext)
+ID: $(HEADERS) $(SOURCES)
+ here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
-info$(EXEEXT): $(OBJS) ../libtxi/libtxi.a
- $(CC) $(LDFLAGS) -o $@ $(OBJS) $(LOADLIBES)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
+ tags=; \
+ here=`pwd`; \
+ test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
-all-info: info.info info-stnd.info
+mostlyclean-tags:
-info.info: info.texi
- $(MAKEINFO) --no-split -I$(srcdir) info.texi
+clean-tags:
-info-stnd.info: info-stnd.texi
- $(MAKEINFO) --no-split -I$(srcdir) info-stnd.texi
+distclean-tags:
+ rm -f TAGS ID
-dvi all-dvi: info.dvi info-stnd.dvi
-info.dvi: info.texi
- PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info.texi
+maintainer-clean-tags:
-info-stnd.dvi: info-stnd.texi
- PATH="$(util):$${PATH}" TEXINPUTS="$(srcdir):$(common):$${TEXINPUTS}" texi2dvi $(srcdir)/info-stnd.texi
+distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-makedoc$(EXEEXT): $(MAKEDOC_OBJECTS) ../libtxi/libtxi.a
- $(CC) $(LDFLAGS) -o $@ $(MAKEDOC_OBJECTS) $(LOADLIBES)
+subdir = info
-Makefile: $(srcdir)/Makefile.in ../config.status
- cd ..; $(SHELL) config.status
+distdir: $(DISTFILES)
+ @for file in $(DISTFILES); do \
+ if test -f $$file; then d=.; else d=$(srcdir); fi; \
+ test -f $(distdir)/$$file \
+ || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
+ || cp -p $$d/$$file $(distdir)/$$file; \
+ done
+info:
+dvi:
+check: all
+ $(MAKE)
+installcheck:
+install-info:
+install-exec: install-binPROGRAMS
+ @$(NORMAL_INSTALL)
-clean:
- $(RM) info$(EXEEXT) funs.h doc.c makedoc$(EXEEXT) $(OBJS) $(MAKEDOC_OBJECTS)
+install-data:
+ @$(NORMAL_INSTALL)
-distclean: clean texclean
- $(RM) Makefile config.status config.cache *~ core core.* *.core
- $(RM) *.BAK makedoc-TAGS TAGS \#* *.info*
+install: install-exec install-data all
+ @:
-mostlyclean: clean
+uninstall: uninstall-binPROGRAMS
-realclean: distclean
- $(RM) info.info info-stnd.info
+all: Makefile $(PROGRAMS)
-TAGS: $(SRCS) makedoc-TAGS
- etags $(SRCS)
- cat makedoc-TAGS >>TAGS && $(RM) makedoc-TAGS
+install-strip:
+ $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
+installdirs:
+ $(mkinstalldirs) $(bindir)
-makedoc-TAGS: $(CMDFILES)
- ./makedoc -tags $(CMDFILES) >makedoc-TAGS
-texclean:
- $(RM) *.toc *.aux *.log *.cp *.fn *.tp *.vr *.pg *.ky *.cps
- $(RM) *.tps *.fns *.kys *.pgs *.vrs
+mostlyclean-generic:
+ test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+
+clean-generic:
+ test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ rm -f Makefile $(DISTCLEANFILES)
+ rm -f config.cache config.log stamp-h stamp-h[0-9]*
+ test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+ test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+mostlyclean: mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
+ mostlyclean-compile mostlyclean-tags \
+ mostlyclean-generic
+
+clean: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile clean-tags \
+ clean-generic mostlyclean
+
+distclean: distclean-binPROGRAMS distclean-noinstPROGRAMS \
+ distclean-compile distclean-tags distclean-generic \
+ clean
+ rm -f config.status
+
+maintainer-clean: maintainer-clean-binPROGRAMS \
+ maintainer-clean-noinstPROGRAMS \
+ maintainer-clean-compile maintainer-clean-tags \
+ maintainer-clean-generic distclean
+ @echo "This command is intended for maintainers to use;"
+ @echo "it deletes files that may require special tools to rebuild."
+
+.PHONY: default mostlyclean-binPROGRAMS distclean-binPROGRAMS \
+clean-binPROGRAMS maintainer-clean-binPROGRAMS uninstall-binPROGRAMS \
+install-binPROGRAMS mostlyclean-noinstPROGRAMS distclean-noinstPROGRAMS \
+clean-noinstPROGRAMS maintainer-clean-noinstPROGRAMS \
+mostlyclean-compile distclean-compile clean-compile \
+maintainer-clean-compile tags mostlyclean-tags distclean-tags \
+clean-tags maintainer-clean-tags distdir info dvi installcheck \
+install-info install-exec install-data install uninstall all \
+installdirs mostlyclean-generic distclean-generic clean-generic \
+maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-check: info
# 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.
-funs.h: makedoc$(EXEEXT) $(CMDFILES)
- -@if test -f funs.h; then mv -f funs.h old-funs.h; fi; :
- -@if test -f doc.c; then mv -f doc.c old-doc.c; fi; :
- ./makedoc$(EXEEXT) $(CMDFILES)
- -@if cmp -s old-funs.h funs.h; then mv old-funs.h funs.h; \
- else $(RM) old-funs.h; fi; :
- -@if cmp -s old-doc.c doc.c; then mv old-doc.c doc.c; \
- else $(RM) old-doc.c; fi; :
-
-doc.c: funs.h
-dribble.o: dribble.c dribble.h
-display.o: display.c
-echo_area.o: echo_area.c
-filesys.o: filesys.c
-info-utils.o: info-utils.c
-info.o: info.c filesys.h
-infodoc.o: infodoc.c
-infomap.o: infomap.c
-m-x.o: m-x.c
-nodes.o: nodes.c
-search.o: search.c
-session.o: session.c
-signals.o: signals.c
-terminal.o: terminal.c
-tilde.o: tilde.c
-window.o: window.c
-xmalloc.o: xmalloc.c
-indices.o: indices.c
-makedoc.o: makedoc.c
-
-dir.o: dir.c
-display.o: nodes.h info-utils.h search.h
-display.o: terminal.h window.h display.h
-echo_area.o: info.h
-filesys.o: general.h tilde.h filesys.h
-footnotes.o: footnotes.h
-info-utils.o: info-utils.h nodes.h search.h
-info.o: info.h $(common)/getopt.h
-infodoc.o: info.h doc.h
-infomap.o: infomap.h funs.h
-gc.o: info.h
-m-x.o: info.h
-nodes.o: search.h filesys.h
-nodes.o: nodes.h info-utils.h
-search.o: general.h search.h nodes.h
-session.o: info.h
-signals.o: info.h signals.h
-terminal.o: terminal.h termdep.h
-tilde.o: tilde.h
-variables.c: variables.h
-window.o: nodes.h window.h display.h
-window.o: info-utils.h search.h infomap.h
-
-# Prevent GNU make v3 from overflowing arg limit on SysV.
+#
+# I do not know how to get this right.
+# BUILT_SOURCES = doc.c funs.h
+#
+#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
+#
+#$(BUILTSOURCES): makedoc $(cmd_sources)
+# ./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:
-
-# eof
diff --git a/texinfo/info/README b/texinfo/info/README
index d8f1ab624d8..90d3e2cd522 100644
--- a/texinfo/info/README
+++ b/texinfo/info/README
@@ -1,9 +1,3 @@
-The file NEWS contains information about what has changed since the last
-release.
-
-The file ../INSTALL contains instructions on how to install Info.
-
-
Info 2.0 is a complete rewrite of the original standalone Info I wrote in
1987, the first program I wrote for rms. That program was something like
my second Unix program ever, and my die-hard machine language coding habits
diff --git a/texinfo/info/dir.c b/texinfo/info/dir.c
index 4ccf8561310..651e48a6e36 100644
--- a/texinfo/info/dir.c
+++ b/texinfo/info/dir.c
@@ -1,9 +1,7 @@
-/* dir.c -- How to build a special "dir" node from "localdir" files. */
+/* dir.c -- How to build a special "dir" node from "localdir" files.
+ $Id: dir.c,v 1.6 1997/07/27 21:09:20 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,13 +19,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if defined (HAVE_SYS_FILE_H)
-#include <sys/file.h>
-#endif /* HAVE_SYS_FILE_H */
-#include <sys/errno.h>
+#include "info.h"
#include "info-utils.h"
#include "filesys.h"
#include "tilde.h"
@@ -37,23 +29,53 @@
dirs_to_add which are found in INFOPATH. */
static void add_menu_to_file_buffer (), insert_text_into_fb_at_binding ();
-static void build_dir_node_internal ();
static char *dirs_to_add[] = {
"dir", "localdir", (char *)NULL
};
+
+/* Return zero if the file represented in the stat structure TEST has
+ already been seen, nonzero else. */
+
+typedef struct
+{
+ unsigned long device;
+ unsigned long inode;
+} dir_file_list_entry_type;
+
+static int
+new_dir_file_p (test)
+ struct stat *test;
+{
+ static unsigned dir_file_list_len = 0;
+ static dir_file_list_entry_type *dir_file_list = NULL;
+ unsigned i;
+
+ for (i = 0; i < dir_file_list_len; i++)
+ {
+ dir_file_list_entry_type entry;
+ entry = dir_file_list[i];
+ if (entry.device == test->st_dev && entry.inode == test->st_ino)
+ return 0;
+ }
+
+ dir_file_list_len++;
+ dir_file_list = xrealloc (dir_file_list,
+ dir_file_list_len * sizeof (dir_file_list_entry_type));
+ dir_file_list[dir_file_list_len - 1].device = test->st_dev;
+ dir_file_list[dir_file_list_len - 1].inode = test->st_ino;
+ return 1;
+}
+
+
void
maybe_build_dir_node (dirname)
char *dirname;
{
- FILE_BUFFER *dir_buffer;
int path_index, update_tags;
char *this_dir;
-
- /* Check to see if the file has already been built. If so, then
- do not build it again. */
- dir_buffer = info_find_file (dirname);
+ FILE_BUFFER *dir_buffer = info_find_file (dirname);
/* If there is no "dir" in the current info path, we cannot build one
from nothing. */
@@ -64,6 +86,10 @@ maybe_build_dir_node (dirname)
if (dir_buffer->flags & N_CannotGC)
return;
+ /* Initialize the list we use to avoid reading the same dir file twice
+ with the dir file just found. */
+ new_dir_file_p (&dir_buffer->finfo);
+
path_index = update_tags = 0;
/* Using each element of the path, check for one of the files in
@@ -71,62 +97,56 @@ maybe_build_dir_node (dirname)
Only files explictly named are eligible. This is a design decision.
There can be an info file name "localdir.info" which contains
information on the setting up of "localdir" files. */
- while (this_dir = extract_colon_unit (infopath, &path_index))
+ while ((this_dir = extract_colon_unit (infopath, &path_index)))
{
register int da_index;
char *from_file;
/* Expand a leading tilde if one is present. */
if (*this_dir == '~')
- {
- char *tilde_expanded_dirname;
-
- tilde_expanded_dirname = tilde_expand_word (this_dir);
- if (tilde_expanded_dirname != this_dir)
- {
- free (this_dir);
- this_dir = tilde_expanded_dirname;
- }
- }
-
- /* For every file named in DIRS_TO_ADD found in the search path,
- add the contents of that file's menu to our "dir" node. */
- for (da_index = 0; from_file = dirs_to_add[da_index]; da_index++)
- {
- struct stat finfo;
- char *fullpath;
- int namelen, statable;
-
- namelen = strlen (from_file);
-
- fullpath = (char *)xmalloc (3 + strlen (this_dir) + namelen);
- strcpy (fullpath, this_dir);
- if (fullpath[strlen (fullpath) - 1] != '/')
- strcat (fullpath, "/");
- strcat (fullpath, from_file);
-
- statable = (stat (fullpath, &finfo) == 0);
-
- /* Only add the contents of this file if it is not identical to the
- file of the DIR buffer. */
- if ((statable && S_ISREG (finfo.st_mode)) &&
- (strcmp (dir_buffer->fullpath, fullpath) != 0))
- {
- long filesize;
- char *contents;
-
- contents = filesys_read_info_file (fullpath, &filesize, &finfo);
-
- if (contents)
- {
- update_tags++;
- add_menu_to_file_buffer (contents, filesize, dir_buffer);
- free (contents);
- }
- }
-
- free (fullpath);
- }
+ {
+ char *tilde_expanded_dirname;
+
+ tilde_expanded_dirname = tilde_expand_word (this_dir);
+ if (tilde_expanded_dirname != this_dir)
+ {
+ free (this_dir);
+ this_dir = tilde_expanded_dirname;
+ }
+ }
+
+ /* For every different file named in DIRS_TO_ADD found in the
+ search path, add that file's menu to our "dir" node. */
+ for (da_index = 0; (from_file = dirs_to_add[da_index]); da_index++)
+ {
+ struct stat finfo;
+ int statable;
+ int namelen = strlen (from_file);
+ char *fullpath = xmalloc (3 + strlen (this_dir) + namelen);
+
+ strcpy (fullpath, this_dir);
+ if (fullpath[strlen (fullpath) - 1] != '/')
+ strcat (fullpath, "/");
+ strcat (fullpath, from_file);
+
+ statable = (stat (fullpath, &finfo) == 0);
+
+ /* Only add this file if we have not seen it before. */
+ if (statable && S_ISREG (finfo.st_mode) && new_dir_file_p (&finfo))
+ {
+ long filesize;
+ char *contents = filesys_read_info_file (fullpath, &filesize,
+ &finfo);
+ if (contents)
+ {
+ update_tags++;
+ add_menu_to_file_buffer (contents, filesize, dir_buffer);
+ free (contents);
+ }
+ }
+
+ free (fullpath);
+ }
free (this_dir);
}
@@ -176,37 +196,37 @@ add_menu_to_file_buffer (contents, size, fb)
if (fb_offset == -1)
{
/* Find the start of the second node in this file buffer. If there
- is only one node, we will be adding the contents to the end of
- this node. */
+ is only one node, we will be adding the contents to the end of
+ this node. */
fb_offset = find_node_separator (&fb_binding);
/* If not even a single node separator, give up. */
if (fb_offset == -1)
- return;
+ return;
fb_binding.start = fb_offset;
fb_binding.start +=
- skip_node_separator (fb_binding.buffer + fb_binding.start);
+ skip_node_separator (fb_binding.buffer + fb_binding.start);
/* Try to find the next node separator. */
fb_offset = find_node_separator (&fb_binding);
/* If found one, consider that the start of the menu. Otherwise, the
- start of this menu is the end of the file buffer (i.e., fb->size). */
+ start of this menu is the end of the file buffer (i.e., fb->size). */
if (fb_offset != -1)
- fb_binding.start = fb_offset;
+ fb_binding.start = fb_offset;
else
- fb_binding.start = fb_binding.end;
+ fb_binding.start = fb_binding.end;
insert_text_into_fb_at_binding
- (fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL));
+ (fb, &fb_binding, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL));
fb_binding.buffer = fb->contents;
fb_binding.start = 0;
fb_binding.end = fb->filesize;
fb_offset = search_forward (INFO_MENU_LABEL, &fb_binding);
if (fb_offset == -1)
- abort ();
+ abort ();
}
/* CONTENTS_OFFSET and FB_OFFSET point to the starts of the menus that
@@ -224,23 +244,23 @@ add_menu_to_file_buffer (contents, size, fb)
int num_found = 0;
while ((fb_binding.start > 0) &&
- (whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1])))
+ (whitespace_or_newline (fb_binding.buffer[fb_binding.start - 1])))
{
- num_found++;
- fb_binding.start--;
+ num_found++;
+ fb_binding.start--;
}
/* Optimize if possible. */
if (num_found >= 2)
{
- fb_binding.buffer[fb_binding.start++] = '\n';
- fb_binding.buffer[fb_binding.start++] = '\n';
+ fb_binding.buffer[fb_binding.start++] = '\n';
+ fb_binding.buffer[fb_binding.start++] = '\n';
}
else
{
- /* Do it the hard way. */
- insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2);
- fb_binding.start += 2;
+ /* Do it the hard way. */
+ insert_text_into_fb_at_binding (fb, &fb_binding, "\n\n", 2);
+ fb_binding.start += 2;
}
}
diff --git a/texinfo/info/display.c b/texinfo/info/display.c
index 0194afafa20..3f2abe34cb1 100644
--- a/texinfo/info/display.c
+++ b/texinfo/info/display.c
@@ -1,9 +1,7 @@
-/* display.c -- How to display Info windows. */
+/* display.c -- How to display Info windows.
+ $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,10 +19,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include "info.h"
#include "display.h"
extern int info_any_buffered_input_p (); /* Found in session.c. */
@@ -57,7 +52,7 @@ display_clear_display (display)
register int i;
register DISPLAY_LINE *display_line;
- for (i = 0; display_line = display[i]; i++)
+ for (i = 0; (display_line = display[i]); i++)
{
display[i]->text[0] = '\0';
display[i]->textlen = 0;
@@ -83,13 +78,13 @@ display_update_display (window)
{
/* Only re-display visible windows which need updating. */
if (((win->flags & W_WindowVisible) == 0) ||
- ((win->flags & W_UpdateWindow) == 0) ||
- (win->height == 0))
- continue;
+ ((win->flags & W_UpdateWindow) == 0) ||
+ (win->height == 0))
+ continue;
display_update_one_window (win);
if (display_was_interrupted_p)
- break;
+ break;
}
/* Always update the echo area. */
@@ -102,12 +97,12 @@ void
display_update_one_window (win)
WINDOW *win;
{
- register char *nodetext; /* Current character to display. */
+ register char *nodetext; /* Current character to display. */
register char *last_node_char; /* Position of the last character in node. */
- register int i; /* General use index. */
- char *printed_line; /* Buffer for a printed line. */
- int pl_index = 0; /* Index into PRINTED_LINE. */
- int line_index = 0; /* Number of lines done so far. */
+ register int i; /* General use index. */
+ char *printed_line; /* Buffer for a printed line. */
+ int pl_index = 0; /* Index into PRINTED_LINE. */
+ int line_index = 0; /* Number of lines done so far. */
DISPLAY_LINE **display = the_display;
/* If display is inhibited, that counts as an interrupted display. */
@@ -142,165 +137,165 @@ display_update_one_window (win)
int replen;
if (isprint (*nodetext))
- {
- rep_temp[0] = *nodetext;
- replen = 1;
- rep_temp[1] = '\0';
- rep = rep_temp;
- }
+ {
+ rep_temp[0] = *nodetext;
+ replen = 1;
+ rep_temp[1] = '\0';
+ rep = rep_temp;
+ }
else
- {
- if (*nodetext == '\r' || *nodetext == '\n')
- {
- replen = win->width - pl_index;
- }
- else
- {
- rep = printed_representation (*nodetext, pl_index);
- replen = strlen (rep);
- }
- }
+ {
+ if (*nodetext == '\r' || *nodetext == '\n')
+ {
+ replen = win->width - pl_index;
+ }
+ else
+ {
+ rep = printed_representation (*nodetext, pl_index);
+ replen = strlen (rep);
+ }
+ }
/* If this character can be printed without passing the width of
- the line, then stuff it into the line. */
+ the line, then stuff it into the line. */
if (replen + pl_index < win->width)
- {
- /* Optimize if possible. */
- if (replen == 1)
- {
- printed_line[pl_index++] = *rep;
- }
- else
- {
- for (i = 0; i < replen; i++)
- printed_line[pl_index++] = rep[i];
- }
- }
+ {
+ /* Optimize if possible. */
+ if (replen == 1)
+ {
+ printed_line[pl_index++] = *rep;
+ }
+ else
+ {
+ for (i = 0; i < replen; i++)
+ printed_line[pl_index++] = rep[i];
+ }
+ }
else
- {
- DISPLAY_LINE *entry;
-
- /* If this character cannot be printed in this line, we have
- found the end of this line as it would appear on the screen.
- Carefully print the end of the line, and then compare. */
- if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t')
- {
- printed_line[pl_index] = '\0';
- rep_carried_over = (char *)NULL;
- }
- else
- {
- /* The printed representation of this character extends into
- the next line. Remember the offset of the last character
- printed out of REP so that we can carry the character over
- to the next line. */
- for (i = 0; pl_index < (win->width - 1);)
- printed_line[pl_index++] = rep[i++];
-
- rep_carried_over = rep + i;
-
- /* If printing the last character in this window couldn't
- possibly cause the screen to scroll, place a backslash
- in the rightmost column. */
- if (1 + line_index + win->first_row < the_screen->height)
- {
- if (win->flags & W_NoWrap)
- printed_line[pl_index++] = '$';
- else
- printed_line[pl_index++] = '\\';
- }
- printed_line[pl_index] = '\0';
- }
-
- /* We have the exact line as it should appear on the screen.
- Check to see if this line matches the one already appearing
- on the screen. */
- 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)
- {
- terminal_goto_xy (0, line_index + win->first_row);
- terminal_clear_to_eol ();
- entry->inverse = 0;
- entry->text[0] = '\0';
- entry->textlen = 0;
- }
-
- /* Find the offset where these lines differ. */
- for (i = 0; i < pl_index; i++)
- if (printed_line[i] != entry->text[i])
- break;
-
- /* If the lines are not the same length, or if they differed
- at all, we must do some redrawing. */
- if ((i != pl_index) || (pl_index != entry->textlen))
- {
- /* Move to the proper point on the terminal. */
- terminal_goto_xy (i, line_index + win->first_row);
-
- /* If there is any text to print, print it. */
- if (i != pl_index)
- terminal_put_text (printed_line + i);
-
- /* If the printed text didn't extend all the way to the edge
- of the window, and text was appearing between here and the
- edge of the window, clear from here to the end of the line. */
- if ((pl_index < win->width && pl_index < entry->textlen) ||
- (entry->inverse))
- terminal_clear_to_eol ();
-
- fflush (stdout);
-
- /* Update the display text buffer. */
- strcpy (entry->text + i, printed_line + i);
- entry->textlen = pl_index;
-
- /* Lines showing node text are not in inverse. Only modelines
- have that distinction. */
- entry->inverse = 0;
- }
-
- /* We have done at least one line. Increment our screen line
- index, and check against the bottom of the window. */
- if (++line_index == win->height)
- break;
-
- /* A line has been displayed, and the screen reflects that state.
- If there is typeahead pending, then let that typeahead be read
- now, instead of continuing with the display. */
- if (info_any_buffered_input_p ())
- {
- free (printed_line);
- display_was_interrupted_p = 1;
- return;
- }
-
- /* Reset PL_INDEX to the start of the line. */
- pl_index = 0;
-
- /* If there are characters from REP left to print, stuff them
- into the buffer now. */
- if (rep_carried_over)
- for (; rep[pl_index]; pl_index++)
- printed_line[pl_index] = rep[pl_index];
-
- /* If this window has chosen not to wrap lines, skip to the end
- of the physical line in the buffer, and start a new line here. */
- if (pl_index && (win->flags & W_NoWrap))
- {
- char *begin;
-
- pl_index = 0;
- printed_line[0] = '\0';
-
- begin = nodetext;
-
- while ((nodetext < last_node_char) && (*nodetext != '\n'))
- nodetext++;
- }
- }
+ {
+ DISPLAY_LINE *entry;
+
+ /* If this character cannot be printed in this line, we have
+ found the end of this line as it would appear on the screen.
+ Carefully print the end of the line, and then compare. */
+ if (*nodetext == '\n' || *nodetext == '\r' || *nodetext == '\t')
+ {
+ printed_line[pl_index] = '\0';
+ rep_carried_over = (char *)NULL;
+ }
+ else
+ {
+ /* The printed representation of this character extends into
+ the next line. Remember the offset of the last character
+ printed out of REP so that we can carry the character over
+ to the next line. */
+ for (i = 0; pl_index < (win->width - 1);)
+ printed_line[pl_index++] = rep[i++];
+
+ rep_carried_over = rep + i;
+
+ /* If printing the last character in this window couldn't
+ possibly cause the screen to scroll, place a backslash
+ in the rightmost column. */
+ if (1 + line_index + win->first_row < the_screen->height)
+ {
+ if (win->flags & W_NoWrap)
+ printed_line[pl_index++] = '$';
+ else
+ printed_line[pl_index++] = '\\';
+ }
+ printed_line[pl_index] = '\0';
+ }
+
+ /* We have the exact line as it should appear on the screen.
+ Check to see if this line matches the one already appearing
+ on the screen. */
+ 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)
+ {
+ terminal_goto_xy (0, line_index + win->first_row);
+ terminal_clear_to_eol ();
+ entry->inverse = 0;
+ entry->text[0] = '\0';
+ entry->textlen = 0;
+ }
+
+ /* Find the offset where these lines differ. */
+ for (i = 0; i < pl_index; i++)
+ if (printed_line[i] != entry->text[i])
+ break;
+
+ /* If the lines are not the same length, or if they differed
+ at all, we must do some redrawing. */
+ if ((i != pl_index) || (pl_index != entry->textlen))
+ {
+ /* Move to the proper point on the terminal. */
+ terminal_goto_xy (i, line_index + win->first_row);
+
+ /* If there is any text to print, print it. */
+ if (i != pl_index)
+ terminal_put_text (printed_line + i);
+
+ /* If the printed text didn't extend all the way to the edge
+ of the window, and text was appearing between here and the
+ edge of the window, clear from here to the end of the line. */
+ if ((pl_index < win->width && pl_index < entry->textlen) ||
+ (entry->inverse))
+ terminal_clear_to_eol ();
+
+ fflush (stdout);
+
+ /* Update the display text buffer. */
+ strcpy (entry->text + i, printed_line + i);
+ entry->textlen = pl_index;
+
+ /* Lines showing node text are not in inverse. Only modelines
+ have that distinction. */
+ entry->inverse = 0;
+ }
+
+ /* We have done at least one line. Increment our screen line
+ index, and check against the bottom of the window. */
+ if (++line_index == win->height)
+ break;
+
+ /* A line has been displayed, and the screen reflects that state.
+ If there is typeahead pending, then let that typeahead be read
+ now, instead of continuing with the display. */
+ if (info_any_buffered_input_p ())
+ {
+ free (printed_line);
+ display_was_interrupted_p = 1;
+ return;
+ }
+
+ /* Reset PL_INDEX to the start of the line. */
+ pl_index = 0;
+
+ /* If there are characters from REP left to print, stuff them
+ into the buffer now. */
+ if (rep_carried_over)
+ for (; rep[pl_index]; pl_index++)
+ printed_line[pl_index] = rep[pl_index];
+
+ /* If this window has chosen not to wrap lines, skip to the end
+ of the physical line in the buffer, and start a new line here. */
+ if (pl_index && (win->flags & W_NoWrap))
+ {
+ char *begin;
+
+ pl_index = 0;
+ printed_line[0] = '\0';
+
+ begin = nodetext;
+
+ while ((nodetext < last_node_char) && (*nodetext != '\n'))
+ nodetext++;
+ }
+ }
}
done_with_node_display:
@@ -313,13 +308,13 @@ display_update_one_window (win)
/* If this line has text on it then make it go away. */
if (entry && entry->textlen)
- {
- entry->textlen = 0;
- entry->text[0] = '\0';
+ {
+ entry->textlen = 0;
+ entry->text[0] = '\0';
- terminal_goto_xy (0, line_index + win->first_row);
- terminal_clear_to_eol ();
- }
+ terminal_goto_xy (0, line_index + win->first_row);
+ terminal_clear_to_eol ();
+ }
}
/* Finally, if this window has a modeline it might need to be redisplayed.
@@ -331,19 +326,19 @@ display_update_one_window (win)
line_index = win->first_row + win->height;
/* This display line must both be in inverse, and have the same
- contents. */
+ contents. */
if ((!display[line_index]->inverse) ||
- (strcmp (display[line_index]->text, win->modeline) != 0))
- {
- terminal_goto_xy (0, line_index);
- terminal_begin_inverse ();
- terminal_put_text (win->modeline);
- terminal_end_inverse ();
- strcpy (display[line_index]->text, win->modeline);
- display[line_index]->inverse = 1;
- display[line_index]->textlen = strlen (win->modeline);
- fflush (stdout);
- }
+ (strcmp (display[line_index]->text, win->modeline) != 0))
+ {
+ terminal_goto_xy (0, line_index);
+ terminal_begin_inverse ();
+ terminal_put_text (win->modeline);
+ terminal_end_inverse ();
+ strcpy (display[line_index]->text, win->modeline);
+ display[line_index]->inverse = 1;
+ display[line_index]->textlen = strlen (win->modeline);
+ fflush (stdout);
+ }
}
/* Okay, this window doesn't need updating anymore. */
@@ -387,40 +382,40 @@ display_scroll_display (start, end, amount)
/* Shift the lines to scroll right into place. */
for (i = 0; i < (end - start); i++)
- {
- temp = the_display[last - i];
- the_display[last - i] = the_display[end - i];
- the_display[end - i] = temp;
- }
+ {
+ temp = the_display[last - i];
+ the_display[last - i] = the_display[end - i];
+ the_display[end - i] = temp;
+ }
/* The lines have been shifted down in the buffer. Clear all of the
- lines that were vacated. */
+ lines that were vacated. */
for (i = start; i != (start + amount); i++)
- {
- the_display[i]->text[0] = '\0';
- the_display[i]->textlen = 0;
- the_display[i]->inverse = 0;
- }
+ {
+ the_display[i]->text[0] = '\0';
+ the_display[i]->textlen = 0;
+ the_display[i]->inverse = 0;
+ }
}
if (amount < 0)
{
last = start + amount;
for (i = 0; i < (end - start); i++)
- {
- temp = the_display[last + i];
- the_display[last + i] = the_display[start + i];
- the_display[start + i] = temp;
- }
+ {
+ temp = the_display[last + i];
+ the_display[last + i] = the_display[start + i];
+ the_display[start + i] = temp;
+ }
/* The lines have been shifted up in the buffer. Clear all of the
- lines that are left over. */
+ lines that are left over. */
for (i = end + amount; i != end; i++)
- {
- the_display[i]->text[0] = '\0';
- the_display[i]->textlen = 0;
- the_display[i]->inverse = 0;
- }
+ {
+ the_display[i]->text[0] = '\0';
+ the_display[i]->textlen = 0;
+ the_display[i]->inverse = 0;
+ }
}
}
@@ -434,9 +429,9 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count)
int old_pagetop, old_count;
char **old_starts;
{
- register int i, old, new; /* Indices into the line starts arrays. */
- int last_new, last_old; /* Index of the last visible line. */
- int old_first, new_first; /* Index of the first changed line. */
+ register int i, old, new; /* Indices into the line starts arrays. */
+ int last_new, last_old; /* Index of the last visible line. */
+ int old_first, new_first; /* Index of the first changed line. */
int unchanged_at_top = 0;
int already_scrolled = 0;
@@ -466,39 +461,39 @@ display_scroll_line_starts (window, old_pagetop, old_starts, old_count)
for (old = old_first + unchanged_at_top; old < last_old; old++)
{
for (new = new_first; new < last_new; new++)
- if (old_starts[old] == window->line_starts[new])
- {
- /* Find the extent of the matching lines. */
- for (i = 0; (old + i) < last_old; i++)
- if (old_starts[old + i] != window->line_starts[new + i])
- break;
-
- /* Scroll these lines if there are enough of them. */
- {
- int start, end, amount;
-
- start = (window->first_row
- + ((old + already_scrolled) - old_pagetop));
- amount = new - (old + already_scrolled);
- end = window->first_row + window->height;
-
- /* If we are shifting the block of lines down, then the last
- AMOUNT lines will become invisible. Thus, don't bother
- scrolling them. */
- if (amount > 0)
- end -= amount;
-
- if ((end - start) > 0)
- {
- display_scroll_display (start, end, amount);
-
- /* Some lines have been scrolled. Simulate the scrolling
- by offsetting the value of the old index. */
- old += i;
- already_scrolled += amount;
- }
- }
- }
+ if (old_starts[old] == window->line_starts[new])
+ {
+ /* Find the extent of the matching lines. */
+ for (i = 0; (old + i) < last_old; i++)
+ if (old_starts[old + i] != window->line_starts[new + i])
+ break;
+
+ /* Scroll these lines if there are enough of them. */
+ {
+ int start, end, amount;
+
+ start = (window->first_row
+ + ((old + already_scrolled) - old_pagetop));
+ amount = new - (old + already_scrolled);
+ end = window->first_row + window->height;
+
+ /* If we are shifting the block of lines down, then the last
+ AMOUNT lines will become invisible. Thus, don't bother
+ scrolling them. */
+ if (amount > 0)
+ end -= amount;
+
+ if ((end - start) > 0)
+ {
+ display_scroll_display (start, end, amount);
+
+ /* Some lines have been scrolled. Simulate the scrolling
+ by offsetting the value of the old index. */
+ old += i;
+ already_scrolled += amount;
+ }
+ }
+ }
}
}
@@ -512,12 +507,13 @@ display_cursor_at_point (window)
vpos = window_line_of_point (window) - window->pagetop + window->first_row;
hpos = window_get_cursor_column (window);
terminal_goto_xy (hpos, vpos);
+ fflush (stdout);
}
/* **************************************************************** */
-/* */
-/* Functions Static to this File */
-/* */
+/* */
+/* Functions Static to this File */
+/* */
/* **************************************************************** */
/* Make a DISPLAY_LINE ** with width and height. */
@@ -552,7 +548,7 @@ free_display (display)
if (!display)
return;
- for (i = 0; display_line = display[i]; i++)
+ for (i = 0; (display_line = display[i]); i++)
{
free (display_line->text);
free (display_line);
diff --git a/texinfo/info/display.h b/texinfo/info/display.h
index d8bd5a166fe..439813576e2 100644
--- a/texinfo/info/display.h
+++ b/texinfo/info/display.h
@@ -1,9 +1,10 @@
-/* display.h -- How the display in Info is done. */
+/* display.h -- How the display in Info is done.
+ $Id: display.h,v 1.2 1997/07/15 18:37:29 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_DISPLAY_H_)
-#define _DISPLAY_H_
+#ifndef INFO_DISPLAY_H
+#define INFO_DISPLAY_H
#include "info-utils.h"
#include "terminal.h"
@@ -73,4 +74,4 @@ extern void display_scroll_display ();
that appear in the OLD_STARTS array. */
extern void display_scroll_line_starts ();
-#endif /* !_DISPLAY_H_ */
+#endif /* not INFO_DISPLAY_H */
diff --git a/texinfo/info/doc.h b/texinfo/info/doc.h
index 8afc28f7446..423998e37c8 100644
--- a/texinfo/info/doc.h
+++ b/texinfo/info/doc.h
@@ -21,18 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_DOC_H_)
-#define _DOC_H_
+#if !defined (DOC_H)
+#define DOC_H
-#if !defined (NULL)
-# define NULL 0x0
-#endif /* !NULL */
-
-#if !defined (__FUNCTION_DEF)
-# define __FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-#endif /* _FUNCTION_DEF */
+#include "info.h" /* for NAMED_FUNCTIONS, VFunction, etc. */
typedef struct {
VFunction *func;
@@ -55,4 +47,4 @@ extern void dump_map_to_message_buffer ();
extern char *function_name ();
extern VFunction *named_function ();
#endif /* NAMED_FUNCTIONS */
-#endif /* !_DOC_H_ */
+#endif /* !DOC_H */
diff --git a/texinfo/info/dribble.c b/texinfo/info/dribble.c
index 8e16cea4e45..d1d58486560 100644
--- a/texinfo/info/dribble.c
+++ b/texinfo/info/dribble.c
@@ -21,7 +21,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
+#include "info.h"
#include "dribble.h"
/* When non-zero, it is a stream to write all input characters to for the
diff --git a/texinfo/info/filesys.c b/texinfo/info/filesys.c
index e684bf81f7b..24d1d75071b 100644
--- a/texinfo/info/filesys.c
+++ b/texinfo/info/filesys.c
@@ -1,9 +1,7 @@
-/* filesys.c -- File system specific functions for hacking this system. */
+/* filesys.c -- File system specific functions for hacking this system.
+ $Id: filesys.c,v 1.4 1997/07/24 21:23:07 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,49 +19,17 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if defined (HAVE_SYS_FILE_H)
-#include <sys/file.h>
-#endif /* HAVE_SYS_FILE_H */
-#include <sys/errno.h>
-#include "general.h"
+#include "info.h"
+
#include "tilde.h"
#include "filesys.h"
-#if !defined (O_RDONLY)
-#if defined (HAVE_SYS_FCNTL_H)
-#include <sys/fcntl.h>
-#else /* !HAVE_SYS_FCNTL_H */
-#include <fcntl.h>
-#endif /* !HAVE_SYS_FCNTL_H */
-#endif /* !O_RDONLY */
-
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
-/* Found in info-utils.c. */
-extern char *filename_non_directory ();
-
-#if !defined (BUILDING_LIBRARY)
-/* Found in session.c */
-extern int info_windows_initialized_p;
-
-/* Found in window.c. */
-extern void message_in_echo_area (), unmessage_in_echo_area ();
-#endif /* !BUILDING_LIBRARY */
-
/* Local to this file. */
static char *info_file_in_path (), *lookup_info_filename ();
static void remember_info_filename (), maybe_initialize_infopath ();
-#if !defined (NULL)
-# define NULL 0x0
-#endif /* !NULL */
-
-typedef struct {
+typedef struct
+{
char *suffix;
char *decompressor;
} COMPRESSION_ALIST;
@@ -114,58 +80,58 @@ info_find_fullpath (partial)
expansion = lookup_info_filename (partial);
if (expansion)
- return (expansion);
+ return (expansion);
/* If we have the full path to this file, we still may have to add
- various extensions to it. I guess we have to stat this file
- after all. */
+ various extensions to it. I guess we have to stat this file
+ after all. */
if (initial_character == '/')
- temp = info_file_in_path (partial + 1, "/");
+ temp = info_file_in_path (partial + 1, "/");
else if (initial_character == '~')
- {
- expansion = tilde_expand_word (partial);
- if (*expansion == '/')
- {
- temp = info_file_in_path (expansion + 1, "/");
- free (expansion);
- }
- else
- temp = expansion;
- }
+ {
+ expansion = tilde_expand_word (partial);
+ if (*expansion == '/')
+ {
+ temp = info_file_in_path (expansion + 1, "/");
+ free (expansion);
+ }
+ else
+ temp = expansion;
+ }
else if (initial_character == '.' &&
- (partial[1] == '/' || (partial[1] == '.' && partial[2] == '/')))
- {
- if (local_temp_filename_size < 1024)
- local_temp_filename = (char *)xrealloc
- (local_temp_filename, (local_temp_filename_size = 1024));
+ (partial[1] == '/' || (partial[1] == '.' && partial[2] == '/')))
+ {
+ if (local_temp_filename_size < 1024)
+ local_temp_filename = (char *)xrealloc
+ (local_temp_filename, (local_temp_filename_size = 1024));
#if defined (HAVE_GETCWD)
- if (!getcwd (local_temp_filename, local_temp_filename_size))
+ if (!getcwd (local_temp_filename, local_temp_filename_size))
#else /* !HAVE_GETCWD */
- if (!getwd (local_temp_filename))
+ if (!getwd (local_temp_filename))
#endif /* !HAVE_GETCWD */
- {
- filesys_error_number = errno;
- return (partial);
- }
-
- strcat (local_temp_filename, "/");
- strcat (local_temp_filename, partial);
- return (local_temp_filename);
- }
+ {
+ filesys_error_number = errno;
+ return (partial);
+ }
+
+ strcat (local_temp_filename, "/");
+ strcat (local_temp_filename, partial);
+ return (local_temp_filename);
+ }
else
- temp = info_file_in_path (partial, infopath);
+ temp = info_file_in_path (partial, infopath);
if (temp)
- {
- remember_info_filename (partial, temp);
- if (strlen (temp) > local_temp_filename_size)
- local_temp_filename = (char *) xrealloc
- (local_temp_filename,
- (local_temp_filename_size = (50 + strlen (temp))));
- strcpy (local_temp_filename, temp);
- free (temp);
- return (local_temp_filename);
- }
+ {
+ remember_info_filename (partial, temp);
+ if (strlen (temp) > local_temp_filename_size)
+ local_temp_filename = (char *) xrealloc
+ (local_temp_filename,
+ (local_temp_filename_size = (50 + strlen (temp))));
+ strcpy (local_temp_filename, temp);
+ free (temp);
+ return (local_temp_filename);
+ }
}
return (partial);
}
@@ -183,25 +149,25 @@ info_file_in_path (filename, path)
dirname_index = 0;
- while (temp_dirname = extract_colon_unit (path, &dirname_index))
+ while ((temp_dirname = extract_colon_unit (path, &dirname_index)))
{
register int i, pre_suffix_length;
char *temp;
/* Expand a leading tilde if one is present. */
if (*temp_dirname == '~')
- {
- char *expanded_dirname;
+ {
+ char *expanded_dirname;
- expanded_dirname = tilde_expand_word (temp_dirname);
- free (temp_dirname);
- temp_dirname = expanded_dirname;
- }
+ expanded_dirname = tilde_expand_word (temp_dirname);
+ free (temp_dirname);
+ temp_dirname = expanded_dirname;
+ }
temp = (char *)xmalloc (30 + strlen (temp_dirname) + strlen (filename));
strcpy (temp, temp_dirname);
if (temp[(strlen (temp)) - 1] != '/')
- strcat (temp, "/");
+ strcat (temp, "/");
strcat (temp, filename);
pre_suffix_length = strlen (temp);
@@ -209,54 +175,54 @@ info_file_in_path (filename, path)
free (temp_dirname);
for (i = 0; info_suffixes[i]; i++)
- {
- strcpy (temp + pre_suffix_length, info_suffixes[i]);
-
- statable = (stat (temp, &finfo) == 0);
-
- /* If we have found a regular file, then use that. Else, if we
- have found a directory, look in that directory for this file. */
- if (statable)
- {
- if (S_ISREG (finfo.st_mode))
- {
- return (temp);
- }
- else if (S_ISDIR (finfo.st_mode))
- {
- char *newpath, *filename_only, *newtemp;
-
- newpath = strdup (temp);
- filename_only = filename_non_directory (filename);
- newtemp = info_file_in_path (filename_only, newpath);
-
- free (newpath);
- if (newtemp)
- {
- free (temp);
- return (newtemp);
- }
- }
- }
- else
- {
- /* Add various compression suffixes to the name to see if
- the file is present in compressed format. */
- register int j, pre_compress_suffix_length;
-
- pre_compress_suffix_length = strlen (temp);
-
- for (j = 0; compress_suffixes[j].suffix; j++)
- {
- strcpy (temp + pre_compress_suffix_length,
- compress_suffixes[j].suffix);
-
- statable = (stat (temp, &finfo) == 0);
- if (statable && (S_ISREG (finfo.st_mode)))
- return (temp);
- }
- }
- }
+ {
+ strcpy (temp + pre_suffix_length, info_suffixes[i]);
+
+ statable = (stat (temp, &finfo) == 0);
+
+ /* If we have found a regular file, then use that. Else, if we
+ have found a directory, look in that directory for this file. */
+ if (statable)
+ {
+ if (S_ISREG (finfo.st_mode))
+ {
+ return (temp);
+ }
+ else if (S_ISDIR (finfo.st_mode))
+ {
+ char *newpath, *filename_only, *newtemp;
+
+ newpath = xstrdup (temp);
+ filename_only = filename_non_directory (filename);
+ newtemp = info_file_in_path (filename_only, newpath);
+
+ free (newpath);
+ if (newtemp)
+ {
+ free (temp);
+ return (newtemp);
+ }
+ }
+ }
+ else
+ {
+ /* Add various compression suffixes to the name to see if
+ the file is present in compressed format. */
+ register int j, pre_compress_suffix_length;
+
+ pre_compress_suffix_length = strlen (temp);
+
+ for (j = 0; compress_suffixes[j].suffix; j++)
+ {
+ strcpy (temp + pre_compress_suffix_length,
+ compress_suffixes[j].suffix);
+
+ statable = (stat (temp, &finfo) == 0);
+ if (statable && (S_ISREG (finfo.st_mode)))
+ return (temp);
+ }
+ }
+ }
free (temp);
}
return ((char *)NULL);
@@ -290,7 +256,7 @@ extract_colon_unit (string, idx)
strncpy (value, &string[start], (i - start));
value[i - start] = '\0';
if (string[i])
- ++i;
+ ++i;
*idx = i;
return (value);
}
@@ -317,10 +283,10 @@ lookup_info_filename (filename)
{
register int i;
for (i = 0; names_and_files[i]; i++)
- {
- if (strcmp (names_and_files[i]->filename, filename) == 0)
- return (names_and_files[i]->expansion);
- }
+ {
+ if (strcmp (names_and_files[i]->filename, filename) == 0)
+ return (names_and_files[i]->expansion);
+ }
}
return (char *)NULL;;
}
@@ -340,12 +306,12 @@ remember_info_filename (filename, expansion)
alloc_size = names_and_files_slots * sizeof (FILENAME_LIST *);
names_and_files =
- (FILENAME_LIST **) xrealloc (names_and_files, alloc_size);
+ (FILENAME_LIST **) xrealloc (names_and_files, alloc_size);
}
new = (FILENAME_LIST *)xmalloc (sizeof (FILENAME_LIST));
- new->filename = strdup (filename);
- new->expansion = expansion ? strdup (expansion) : (char *)NULL;
+ new->filename = xstrdup (filename);
+ new->expansion = expansion ? xstrdup (expansion) : (char *)NULL;
names_and_files[names_and_files_index++] = new;
names_and_files[names_and_files_index] = (FILENAME_LIST *)NULL;
@@ -357,7 +323,7 @@ maybe_initialize_infopath ()
if (!infopath_size)
{
infopath = (char *)
- xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH)));
+ xmalloc (infopath_size = (1 + strlen (DEFAULT_INFOPATH)));
strcpy (infopath, DEFAULT_INFOPATH);
}
@@ -392,7 +358,7 @@ info_add_path (path, where)
}
else if (where == INFOPATH_PREPEND)
{
- char *temp = strdup (infopath);
+ char *temp = xstrdup (infopath);
strcpy (infopath, path);
strcat (infopath, ":");
strcat (infopath, temp);
@@ -436,21 +402,21 @@ filesys_read_info_file (pathname, filesize, finfo)
/* If the file couldn't be opened, give up. */
if (descriptor < 0)
- {
- filesys_error_number = errno;
- return ((char *)NULL);
- }
+ {
+ filesys_error_number = errno;
+ return ((char *)NULL);
+ }
/* Try to read the contents of this file. */
st_size = (long) finfo->st_size;
contents = (char *)xmalloc (1 + st_size);
if ((read (descriptor, contents, st_size)) != st_size)
- {
- filesys_error_number = errno;
- close (descriptor);
- free (contents);
- return ((char *)NULL);
- }
+ {
+ filesys_error_number = errno;
+ close (descriptor);
+ free (contents);
+ return ((char *)NULL);
+ }
close (descriptor);
@@ -510,20 +476,20 @@ filesys_read_compressed (pathname, filesize, finfo)
chunk = (char *)xmalloc (FILESYS_PIPE_BUFFER_SIZE);
while (1)
- {
- int bytes_read;
+ {
+ int bytes_read;
- bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream);
+ bytes_read = fread (chunk, 1, FILESYS_PIPE_BUFFER_SIZE, stream);
- if (bytes_read + offset >= size)
- contents = (char *)xrealloc
- (contents, size += (2 * FILESYS_PIPE_BUFFER_SIZE));
+ if (bytes_read + offset >= size)
+ contents = (char *)xrealloc
+ (contents, size += (2 * FILESYS_PIPE_BUFFER_SIZE));
- memcpy (contents + offset, chunk, bytes_read);
- offset += bytes_read;
- if (bytes_read != FILESYS_PIPE_BUFFER_SIZE)
- break;
- }
+ memcpy (contents + offset, chunk, bytes_read);
+ offset += bytes_read;
+ if (bytes_read != FILESYS_PIPE_BUFFER_SIZE)
+ break;
+ }
free (chunk);
pclose (stream);
@@ -572,8 +538,8 @@ filesys_decompressor_for_file (filename)
for (i = strlen (filename) - 1; i > 0; i--)
if (filename[i] == '.')
{
- extension = filename + i;
- break;
+ extension = filename + i;
+ break;
}
if (!extension)
diff --git a/texinfo/info/filesys.h b/texinfo/info/filesys.h
index 130a52a6357..440eb9b281b 100644
--- a/texinfo/info/filesys.h
+++ b/texinfo/info/filesys.h
@@ -1,9 +1,10 @@
-/* filesys.h -- External declarations of functions and vars in filesys.c. */
+/* filesys.h -- External declarations of functions and vars in filesys.c.
+ $Id: filesys.h,v 1.3 1997/07/15 18:39:08 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_FILESYS_H_)
-#define _FILESYS_H_
+#ifndef INFO_FILESYS_H
+#define INFO_FILESYS_H
/* The path on which we look for info files. You can initialize this
from the environment variable INFOPATH if there is one, or you can
@@ -70,7 +71,7 @@ extern char *extract_colon_unit ();
/* The default value of INFOPATH. */
#if !defined (DEFAULT_INFOPATH)
-! # define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:."
+# define DEFAULT_INFOPATH "/usr/local/info:/usr/info:/usr/local/lib/info:/usr/lib/info:/usr/local/gnu/info:/usr/local/gnu/lib/info:/usr/gnu/info:/usr/gnu/lib/info:/opt/gnu/info:/usr/share/info:/usr/share/lib/info:/usr/local/share/info:/usr/local/share/lib/info:/usr/gnu/lib/emacs/info:/usr/local/gnu/lib/emacs/info:/usr/local/lib/emacs/info:/usr/local/emacs/info:."
#endif /* !DEFAULT_INFOPATH */
#if !defined (S_ISREG) && defined (S_IFREG)
@@ -81,4 +82,4 @@ extern char *extract_colon_unit ();
# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#endif /* !S_ISDIR && S_IFDIR */
-#endif /* !_FILESYS_H_ */
+#endif /* not INFO_FILESYS_H */
diff --git a/texinfo/info/footnotes.c b/texinfo/info/footnotes.c
index 35a0f352de8..b6467431b64 100644
--- a/texinfo/info/footnotes.c
+++ b/texinfo/info/footnotes.c
@@ -1,9 +1,7 @@
-/* footnotes.c -- Some functions for manipulating footnotes. */
+/* footnotes.c -- Some functions for manipulating footnotes.
+ $Id: footnotes.c,v 1.4 1997/07/24 21:23:33 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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
@@ -40,7 +38,7 @@ find_footnotes_window ()
/* Try to find an existing window first. */
for (win = windows; win; win = win->next)
if (internal_info_node_p (win->node) &&
- (strcmp (win->node->nodename, footnote_nodename) == 0))
+ (strcmp (win->node->nodename, footnote_nodename) == 0))
break;
return (win);
@@ -72,37 +70,37 @@ make_footnotes_node (node)
refs = info_xrefs_of_node (node);
if (refs)
- {
- register int i;
- char *refname;
+ {
+ register int i;
+ char *refname;
- refname = (char *)xmalloc
- (1 + strlen ("-Footnotes") + strlen (node->nodename));
+ refname = (char *)xmalloc
+ (1 + strlen ("-Footnotes") + strlen (node->nodename));
- strcpy (refname, node->nodename);
- strcat (refname, "-Footnotes");
+ strcpy (refname, node->nodename);
+ strcat (refname, "-Footnotes");
- for (i = 0; refs[i]; i++)
- if ((refs[i]->nodename != (char *)NULL) &&
- (strcmp (refs[i]->nodename, refname) == 0))
- {
- char *filename;
+ for (i = 0; refs[i]; i++)
+ if ((refs[i]->nodename != (char *)NULL) &&
+ (strcmp (refs[i]->nodename, refname) == 0))
+ {
+ char *filename;
- filename = node->parent;
- if (!filename)
- filename = node->filename;
+ filename = node->parent;
+ if (!filename)
+ filename = node->filename;
- fn_node = info_get_node (filename, refname);
+ fn_node = info_get_node (filename, refname);
- if (fn_node)
- fn_start = 0;
+ if (fn_node)
+ fn_start = 0;
- break;
- }
+ break;
+ }
- free (refname);
- info_free_references (refs);
- }
+ free (refname);
+ info_free_references (refs);
+ }
}
/* If we never found the start of a footnotes area, quit now. */
@@ -126,7 +124,7 @@ make_footnotes_node (node)
This effectively skips either "---- footno...", or "File: foo...". */
while (text_start < fn_node->nodelen)
if (fn_node->contents[text_start++] == '\n')
- break;
+ break;
result->nodelen = strlen (header) + fn_node->nodelen - text_start;
@@ -134,7 +132,7 @@ make_footnotes_node (node)
result->contents = (char *)xmalloc (1 + result->nodelen);
sprintf (result->contents, "%s", header);
memcpy (result->contents + strlen (header),
- fn_node->contents + text_start, fn_node->nodelen - text_start);
+ fn_node->contents + text_start, fn_node->nodelen - text_start);
name_internal_node (result, footnote_nodename);
free (header);
@@ -176,7 +174,7 @@ info_get_or_remove_footnotes (window)
if (fn_win && !new_footnotes)
{
if (windows->next)
- info_delete_window_internal (fn_win);
+ info_delete_window_internal (fn_win);
}
/* If there are footnotes for this window's node, but no window around
@@ -187,27 +185,27 @@ info_get_or_remove_footnotes (window)
WINDOW *last, *win;
/* Always make this window be the last one appearing in the list. Find
- the last window in the chain. */
+ the last window in the chain. */
for (win = windows, last = windows; win; last = win, win = win->next);
/* Try to split this window, and make the split window the one to
- contain the footnotes. */
+ contain the footnotes. */
old_active = active_window;
active_window = last;
fn_win = window_make_window (new_footnotes);
active_window = old_active;
if (!fn_win)
- {
- free (new_footnotes->contents);
- free (new_footnotes);
-
- /* 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");
- return (FN_UNABLE);
- }
+ {
+ free (new_footnotes->contents);
+ free (new_footnotes);
+
+ /* 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"));
+ return (FN_UNABLE);
+ }
}
/* If there are footnotes, and there is a window to display them,
@@ -217,7 +215,7 @@ info_get_or_remove_footnotes (window)
window_set_node_of_window (fn_win, new_footnotes);
window_change_window_height
- (fn_win, fn_win->line_count - fn_win->height);
+ (fn_win, fn_win->line_count - fn_win->height);
remember_window_and_node (fn_win, new_footnotes);
add_gcable_pointer (new_footnotes->contents);
@@ -231,19 +229,17 @@ info_get_or_remove_footnotes (window)
/* Show the footnotes associated with this node in another window. */
DECLARE_INFO_COMMAND (info_show_footnotes,
- "Show the footnotes associated with this node in another window")
+ _("Show the footnotes associated with this node in another window"))
{
- int result;
-
/* A negative argument means just make the window go away. */
if (count < 0)
{
WINDOW *fn_win = find_footnotes_window ();
/* If there is an old footnotes window, and it isn't the only window
- on the screen, delete it. */
+ on the screen, delete it. */
if (fn_win && windows->next)
- info_delete_window_internal (fn_win);
+ info_delete_window_internal (fn_win);
}
else
{
@@ -252,14 +248,14 @@ DECLARE_INFO_COMMAND (info_show_footnotes,
result = info_get_or_remove_footnotes (window);
switch (result)
- {
- case FN_UNFOUND:
- info_error (NO_FOOT_NODE);
- break;
-
- case FN_UNABLE:
- info_error (WIN_TOO_SMALL);
- break;
- }
+ {
+ case FN_UNFOUND:
+ info_error (NO_FOOT_NODE);
+ break;
+
+ case FN_UNABLE:
+ info_error (WIN_TOO_SMALL);
+ break;
+ }
}
}
diff --git a/texinfo/info/footnotes.h b/texinfo/info/footnotes.h
index 89b1b3578e6..3406bcb67be 100644
--- a/texinfo/info/footnotes.h
+++ b/texinfo/info/footnotes.h
@@ -1,9 +1,10 @@
-/* footnotes.h -- Some functions for manipulating footnotes. */
+/* footnotes.h -- Some functions for manipulating footnotes.
+ $Id: footnotes.h,v 1.3 1997/07/15 18:40:27 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,11 +22,11 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_FOOTNOTES_H_)
-#define _FOOTNOTES_H_
+#ifndef INFO_FOOTNOTES_H
+#define INFO_FOOTNOTES_H
/* Magic string which indicates following text is footnotes. */
-#define FOOTNOTE_LABEL "---------- Footnotes ----------"
+#define FOOTNOTE_LABEL _("---------- Footnotes ----------")
#define FN_FOUND 0
#define FN_UNFOUND 1
@@ -42,5 +43,4 @@ extern int info_get_or_remove_footnotes ();
/* Non-zero means attempt to show footnotes when displaying a new window. */
extern int auto_footnotes_p;
-#endif /* !_FOOTNOTES_H_ */
-
+#endif /* not INFO_FOOTNOTES_H */
diff --git a/texinfo/info/gc.c b/texinfo/info/gc.c
index 3b9b0907f51..1c868ba3284 100644
--- a/texinfo/info/gc.c
+++ b/texinfo/info/gc.c
@@ -56,7 +56,7 @@ gc_pointers ()
if (!info_windows || !gcable_pointers_index)
return;
- for (i = 0; iw = info_windows[i]; i++)
+ for (i = 0; (iw = info_windows[i]); i++)
{
for (j = 0; j < iw->nodes_index; j++)
{
diff --git a/texinfo/info/gc.h b/texinfo/info/gc.h
index 876062ad249..b4d993af4f8 100644
--- a/texinfo/info/gc.h
+++ b/texinfo/info/gc.h
@@ -1,9 +1,10 @@
-/* gc.h -- Functions for garbage collecting unused node contents. */
+/* gc.h -- Functions for garbage collecting unused node contents.
+ $Id: gc.h,v 1.2 1997/07/15 18:41:53 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_GC_H_)
-#define _GC_H_
+#ifndef INFO_GC_H
+#define INFO_GC_H
/* Add POINTER to the list of garbage collectible pointers. A pointer
is not actually garbage collected until no info window contains a node
@@ -33,4 +34,4 @@ extern void add_gcable_pointer ();
node->contents which are collectible, and free them. */
extern void gc_pointers ();
-#endif /* !_GC_H_ */
+#endif /* not INFO_GC_H */
diff --git a/texinfo/info/indices.c b/texinfo/info/indices.c
index 6848884288b..37e9b037762 100644
--- a/texinfo/info/indices.c
+++ b/texinfo/info/indices.c
@@ -1,9 +1,7 @@
-/* indices.c -- Commands for dealing with an Info file Index. */
+/* indices.c -- Commands for dealing with an Info file Index.
+ $Id: indices.c,v 1.6 1997/07/24 21:25:53 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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
@@ -43,9 +41,9 @@ static char *initial_index_nodename = (char *)NULL;
/* A structure associating index names with index offset ranges. */
typedef struct {
- char *name; /* The nodename of this index. */
- int first; /* The index in our list of the first entry. */
- int last; /* The index in our list of the last entry. */
+ char *name; /* The nodename of this index. */
+ int first; /* The index in our list of the first entry. */
+ int last; /* The index in our list of the last entry. */
} INDEX_NAME_ASSOC;
/* An array associating index nodenames with index offset ranges. */
@@ -65,7 +63,7 @@ add_index_to_index_nodenames (array, node)
for (last = 0; array[last]; last++);
assoc = (INDEX_NAME_ASSOC *)xmalloc (sizeof (INDEX_NAME_ASSOC));
- assoc->name = strdup (node->nodename);
+ assoc->name = xstrdup (node->nodename);
if (!index_nodenames_index)
{
@@ -119,10 +117,10 @@ info_indices_of_file_buffer (file_buffer)
if (index_nodenames)
{
for (i = 0; index_nodenames[i]; i++)
- {
- free (index_nodenames[i]->name);
- free (index_nodenames[i]);
- }
+ {
+ free (index_nodenames[i]->name);
+ free (index_nodenames[i]);
+ }
index_nodenames_index = 0;
index_nodenames[0] = (INDEX_NAME_ASSOC *)NULL;
@@ -133,48 +131,59 @@ info_indices_of_file_buffer (file_buffer)
{
TAG *tag;
- for (i = 0; tag = file_buffer->tags[i]; i++)
- {
- if (string_in_line ("Index", tag->nodename) != -1)
- {
- NODE *node;
- REFERENCE **menu;
-
- /* Found one. Get its menu. */
- node = info_get_node (tag->filename, tag->nodename);
- if (!node)
- continue;
-
- /* Remember the filename and nodename of this index. */
- initial_index_filename = strdup (file_buffer->filename);
- initial_index_nodename = strdup (tag->nodename);
-
- menu = info_menu_of_node (node);
-
- /* If we have a menu, add this index's nodename and range
- to our list of index_nodenames. */
- if (menu)
- {
- add_index_to_index_nodenames (menu, node);
-
- /* Concatenate the references found so far. */
- result = info_concatenate_references (result, menu);
- }
- free (node);
- }
- }
+ for (i = 0; (tag = file_buffer->tags[i]); i++)
+ {
+ if (string_in_line ("Index", tag->nodename) != -1)
+ {
+ NODE *node;
+ REFERENCE **menu;
+
+ /* Found one. Get its menu. */
+ node = info_get_node (tag->filename, tag->nodename);
+ if (!node)
+ continue;
+
+ /* Remember the filename and nodename of this index. */
+ initial_index_filename = xstrdup (file_buffer->filename);
+ initial_index_nodename = xstrdup (tag->nodename);
+
+ menu = info_menu_of_node (node);
+
+ /* If we have a menu, add this index's nodename and range
+ to our list of index_nodenames. */
+ if (menu)
+ {
+ add_index_to_index_nodenames (menu, node);
+
+ /* Concatenate the references found so far. */
+ result = info_concatenate_references (result, menu);
+ }
+ free (node);
+ }
+ }
}
/* If there is a result, clean it up so that every entry has a filename. */
for (i = 0; result && result[i]; i++)
if (!result[i]->filename)
- result[i]->filename = strdup (file_buffer->filename);
+ result[i]->filename = xstrdup (file_buffer->filename);
return (result);
}
DECLARE_INFO_COMMAND (info_index_search,
- "Look up a string in the index for this file")
+ _("Look up a string in the index for this file"))
+{
+ do_info_index_search (window, count, 0);
+}
+
+/* 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;
{
FILE_BUFFER *fb;
char *line;
@@ -193,47 +202,52 @@ DECLARE_INFO_COMMAND (info_index_search,
(strcmp (initial_index_filename, fb->filename) != 0))
{
info_free_references (index_index);
- window_message_in_echo_area ("Finding index entries...");
+ window_message_in_echo_area (_("Finding index entries..."));
index_index = info_indices_of_file_buffer (fb);
}
/* If there is no index, quit now. */
if (!index_index)
{
- info_error ("No indices found.");
- return;
- }
-
- /* Okay, there is an index. Let the user select one of the members of it. */
- line =
- info_read_maybe_completing (window, "Index entry: ", index_index);
-
- window = active_window;
-
- /* User aborted? */
- if (!line)
- {
- info_abort_key (active_window, 1, 0);
+ info_error (_("No indices found."));
return;
}
- /* Empty line means move to the Index node. */
- if (!*line)
+ /* Okay, there is an index. Look for SEARCH_STRING, or, if it is
+ empty, prompt for one. */
+ if (search_string && *search_string)
+ line = xstrdup (search_string);
+ else
{
- free (line);
-
- if (initial_index_filename && initial_index_nodename)
- {
- NODE *node;
-
- node =
- info_get_node (initial_index_filename, initial_index_nodename);
- set_remembered_pagetop_and_point (window);
- window_set_node_of_window (window, node);
- remember_window_and_node (window, node);
- window_clear_echo_area ();
- return;
- }
+ line = info_read_maybe_completing (window, _("Index entry: "),
+ index_index);
+ window = active_window;
+
+ /* User aborted? */
+ if (!line)
+ {
+ info_abort_key (active_window, 1, 0);
+ return;
+ }
+
+ /* Empty line means move to the Index node. */
+ if (!*line)
+ {
+ free (line);
+
+ if (initial_index_filename && initial_index_nodename)
+ {
+ NODE *node;
+
+ node = info_get_node (initial_index_filename,
+ initial_index_nodename);
+ set_remembered_pagetop_and_point (window);
+ window_set_node_of_window (window, node);
+ remember_window_and_node (window, node);
+ window_clear_echo_area ();
+ return;
+ }
+ }
}
/* The user typed either a completed index label, or a partial string.
@@ -246,9 +260,9 @@ DECLARE_INFO_COMMAND (info_index_search,
/* Start the search right after/before this index. */
if (count < 0)
{
- register int i;
- for (i = 0; index_index[i]; i++);
- index_offset = i;
+ register int i;
+ for (i = 0; index_index[i]; i++);
+ index_offset = i;
}
else
index_offset = -1;
@@ -267,8 +281,55 @@ DECLARE_INFO_COMMAND (info_index_search,
}
}
+int
+index_entry_exists (window, string)
+ WINDOW *window;
+ char *string;
+{
+ register int i;
+ FILE_BUFFER *fb;
+
+ /* If there is no previous search string, the user hasn't built an index
+ yet. */
+ if (!string)
+ return 0;
+
+ fb = file_buffer_of_window (window);
+ if (!initial_index_filename
+ || (strcmp (initial_index_filename, fb->filename) != 0))
+ {
+ info_free_references (index_index);
+ index_index = info_indices_of_file_buffer (fb);
+ }
+
+ /* If there is no index, that is an error. */
+ if (!index_index)
+ return 0;
+
+ for (i = 0; (i > -1) && (index_index[i]); i++)
+ if (strcmp (string, index_index[i]->label) == 0)
+ break;
+
+ /* If that failed, look for the next substring match. */
+ if ((i < 0) || (!index_index[i]))
+ {
+ for (i = 0; (i > -1) && (index_index[i]); i++)
+ if (string_in_line (string, index_index[i]->label) != -1)
+ break;
+
+ if ((i > -1) && (index_index[i]))
+ string_in_line (string, index_index[i]->label);
+ }
+
+ /* If that failed, return 0. */
+ if ((i < 0) || (!index_index[i]))
+ return 0;
+
+ return 1;
+}
+
DECLARE_INFO_COMMAND (info_next_index_match,
- "Go to the next matching index item from the last `\\[index-search]' command")
+ _("Go to the next matching index item from the last `\\[index-search]' command"))
{
register int i;
int partial, dir;
@@ -278,14 +339,14 @@ DECLARE_INFO_COMMAND (info_next_index_match,
yet. */
if (!index_search)
{
- info_error ("No previous index search string.");
+ info_error (_("No previous index search string."));
return;
}
/* If there is no index, that is an error. */
if (!index_index)
{
- info_error ("No index entries.");
+ info_error (_("No index entries."));
return;
}
@@ -308,18 +369,18 @@ DECLARE_INFO_COMMAND (info_next_index_match,
if ((i < 0) || (!index_index[i]))
{
for (i = index_offset + dir; (i > -1) && (index_index[i]); i += dir)
- if (string_in_line (index_search, index_index[i]->label) != -1)
- break;
+ if (string_in_line (index_search, index_index[i]->label) != -1)
+ break;
if ((i > -1) && (index_index[i]))
- partial = string_in_line (index_search, index_index[i]->label);
+ partial = string_in_line (index_search, index_index[i]->label);
}
/* 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 (_("No %sindex entries containing \"%s\"."),
+ index_offset > 0 ? _("more ") : "", index_search);
return;
}
@@ -329,43 +390,43 @@ 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";
+ char *name = _("CAN'T SEE THIS");
char *match;
for (j = 0; index_nodenames[j]; j++)
{
- if ((i >= index_nodenames[j]->first) &&
- (i <= index_nodenames[j]->last))
- {
- name = index_nodenames[j]->name;
- break;
- }
+ if ((i >= index_nodenames[j]->first) &&
+ (i <= index_nodenames[j]->last))
+ {
+ name = index_nodenames[j]->name;
+ break;
+ }
}
/* If we had a partial match, indicate to the user which part of the
string matched. */
- match = strdup (index_index[i]->label);
+ match = xstrdup (index_index[i]->label);
if (partial && show_index_match)
{
- int j, ls, start, upper;
+ int j, ls, start, upper;
- ls = strlen (index_search);
- start = partial - ls;
- upper = isupper (match[start]) ? 1 : 0;
+ ls = strlen (index_search);
+ start = partial - ls;
+ upper = isupper (match[start]) ? 1 : 0;
- for (j = 0; j < ls; j++)
- if (upper)
- match[j + start] = info_tolower (match[j + start]);
- else
- match[j + start] = info_toupper (match[j + start]);
+ for (j = 0; j < ls; j++)
+ if (upper)
+ match[j + start] = info_tolower (match[j + start]);
+ else
+ match[j + start] = info_toupper (match[j + start]);
}
{
char *format;
format = replace_in_documentation
- ("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)");
+ (_("Found \"%s\" in %s. (`\\[next-index-match]' tries to find next.)"));
window_message_in_echo_area (format, match, name);
}
@@ -379,7 +440,7 @@ DECLARE_INFO_COMMAND (info_next_index_match,
if (!node)
{
info_error (CANT_FILE_NODE,
- index_index[i]->filename, index_index[i]->nodename);
+ index_index[i]->filename, index_index[i]->nodename);
return;
}
@@ -397,16 +458,16 @@ DECLARE_INFO_COMMAND (info_next_index_match,
if (loc != -1)
{
- window->point = loc;
- window_adjust_pagetop (window);
+ window->point = loc;
+ window_adjust_pagetop (window);
}
}
}
/* **************************************************************** */
-/* */
-/* Info APROPOS: Search every known index. */
-/* */
+/* */
+/* Info APROPOS: Search every known index. */
+/* */
/* **************************************************************** */
/* For every menu item in DIR, search the indices of that file for
@@ -420,14 +481,13 @@ apropos_in_all_indices (search_string, inform)
REFERENCE **all_indices = (REFERENCE **)NULL;
REFERENCE **dir_menu = (REFERENCE **)NULL;
NODE *dir_node;
- int printed = 0;
dir_node = info_get_node ("dir", "Top");
if (dir_node)
dir_menu = info_menu_of_node (dir_node);
if (!dir_menu)
- return;
+ return NULL;
/* For every menu item in DIR, get the associated node's file buffer and
read the indices of that file buffer. Gather all of the indices into
@@ -441,54 +501,54 @@ apropos_in_all_indices (search_string, inform)
this_item = dir_menu[dir_index];
if (!this_item->filename)
- {
- if (dir_node->parent)
- this_item->filename = strdup (dir_node->parent);
- else
- this_item->filename = strdup (dir_node->filename);
- }
+ {
+ if (dir_node->parent)
+ this_item->filename = xstrdup (dir_node->parent);
+ else
+ this_item->filename = xstrdup (dir_node->filename);
+ }
/* Find this node. If we cannot find it, try using the label of the
- entry as a file (i.e., "(LABEL)Top"). */
+ entry as a file (i.e., "(LABEL)Top"). */
this_node = info_get_node (this_item->filename, this_item->nodename);
if (!this_node && this_item->nodename &&
- (strcmp (this_item->label, this_item->nodename) == 0))
- this_node = info_get_node (this_item->label, "Top");
+ (strcmp (this_item->label, this_item->nodename) == 0))
+ this_node = info_get_node (this_item->label, "Top");
if (!this_node)
- continue;
+ continue;
/* Get the file buffer associated with this node. */
{
- char *files_name;
+ char *files_name;
- files_name = this_node->parent;
- if (!files_name)
- files_name = this_node->filename;
+ files_name = this_node->parent;
+ if (!files_name)
+ files_name = this_node->filename;
- this_fb = info_find_file (files_name);
+ this_fb = info_find_file (files_name);
- if (this_fb && inform)
- message_in_echo_area ("Scanning indices of \"%s\"...", files_name);
+ if (this_fb && inform)
+ message_in_echo_area (_("Scanning indices of \"%s\"..."), files_name);
- this_index = info_indices_of_file_buffer (this_fb);
- free (this_node);
+ this_index = info_indices_of_file_buffer (this_fb);
+ free (this_node);
- if (this_fb && inform)
- unmessage_in_echo_area ();
+ if (this_fb && inform)
+ unmessage_in_echo_area ();
}
if (this_index)
- {
- /* Remember the filename which contains this set of references. */
- for (i = 0; this_index && this_index[i]; i++)
- if (!this_index[i]->filename)
- this_index[i]->filename = strdup (this_fb->filename);
-
- /* Concatenate with the other indices. */
- all_indices = info_concatenate_references (all_indices, this_index);
- }
+ {
+ /* Remember the filename which contains this set of references. */
+ for (i = 0; this_index && this_index[i]; i++)
+ if (!this_index[i]->filename)
+ this_index[i]->filename = xstrdup (this_fb->filename);
+
+ /* Concatenate with the other indices. */
+ all_indices = info_concatenate_references (all_indices, this_index);
+ }
}
info_free_references (dir_menu);
@@ -501,21 +561,21 @@ apropos_in_all_indices (search_string, inform)
int apropos_list_slots = 0;
for (i = 0; (entry = all_indices[i]); i++)
- {
- if (string_in_line (search_string, entry->label) != -1)
- {
- add_pointer_to_array
- (entry, apropos_list_index, apropos_list, apropos_list_slots,
- 100, REFERENCE *);
- }
- else
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
- free (entry);
- }
- }
+ {
+ if (string_in_line (search_string, entry->label) != -1)
+ {
+ add_pointer_to_array
+ (entry, apropos_list_index, apropos_list, apropos_list_slots,
+ 100, REFERENCE *);
+ }
+ else
+ {
+ maybe_free (entry->label);
+ maybe_free (entry->filename);
+ maybe_free (entry->nodename);
+ free (entry);
+ }
+ }
free (all_indices);
all_indices = apropos_list;
@@ -524,7 +584,7 @@ apropos_in_all_indices (search_string, inform)
}
#define APROPOS_NONE \
- "No available info files reference \"%s\" in their indices."
+ _("No available info files reference \"%s\" in their indices.")
void
info_apropos (string)
@@ -544,8 +604,8 @@ info_apropos (string)
REFERENCE *entry;
for (i = 0; (entry = apropos_list[i]); i++)
- fprintf (stderr, "\"(%s)%s\" -- %s\n",
- entry->filename, entry->nodename, entry->label);
+ fprintf (stderr, "\"(%s)%s\" -- %s\n",
+ entry->filename, entry->nodename, entry->label);
}
info_free_references (apropos_list);
}
@@ -553,11 +613,11 @@ info_apropos (string)
static char *apropos_list_nodename = "*Apropos*";
DECLARE_INFO_COMMAND (info_index_apropos,
- "Grovel all known info file's indices for a string and build a menu")
+ _("Grovel all known info file's indices for a string and build a menu"))
{
char *line;
- line = info_read_in_echo_area (window, "Index apropos: ");
+ line = info_read_in_echo_area (window, _("Index apropos: "));
window = active_window;
@@ -577,85 +637,85 @@ DECLARE_INFO_COMMAND (info_index_apropos,
apropos_list = apropos_in_all_indices (line, 1);
if (!apropos_list)
- {
- info_error (APROPOS_NONE, line);
- }
+ {
+ info_error (APROPOS_NONE, line);
+ }
else
- {
- register int i;
- char *line_buffer;
-
- initialize_message_buffer ();
- printf_to_message_buffer
- ("\n* Menu: Nodes whoses indices contain \"%s\":\n", line);
- line_buffer = (char *)xmalloc (500);
-
- for (i = 0; apropos_list[i]; i++)
- {
- int len;
- sprintf (line_buffer, "* (%s)%s::",
- apropos_list[i]->filename, apropos_list[i]->nodename);
- len = pad_to (36, line_buffer);
- sprintf (line_buffer + len, "%s", apropos_list[i]->label);
- printf_to_message_buffer ("%s\n", line_buffer);
- }
- free (line_buffer);
- }
+ {
+ register int i;
+ char *line_buffer;
+
+ initialize_message_buffer ();
+ printf_to_message_buffer
+ (_("\n* Menu: Nodes whoses indices contain \"%s\":\n"), line);
+ line_buffer = (char *)xmalloc (500);
+
+ for (i = 0; apropos_list[i]; i++)
+ {
+ int len;
+ sprintf (line_buffer, "* (%s)%s::",
+ apropos_list[i]->filename, apropos_list[i]->nodename);
+ len = pad_to (36, line_buffer);
+ sprintf (line_buffer + len, "%s", apropos_list[i]->label);
+ printf_to_message_buffer ("%s\n", line_buffer);
+ }
+ free (line_buffer);
+ }
apropos_node = message_buffer_to_node ();
add_gcable_pointer (apropos_node->contents);
name_internal_node (apropos_node, apropos_list_nodename);
/* Even though this is an internal node, we don't want the window
- system to treat it specially. So we turn off the internalness
- of it here. */
+ system to treat it specially. So we turn off the internalness
+ of it here. */
apropos_node->flags &= ~N_IsInternal;
/* Find/Create a window to contain this node. */
{
- WINDOW *new;
- NODE *node;
-
- set_remembered_pagetop_and_point (window);
-
- /* If a window is visible and showing an apropos list already,
- re-use it. */
- for (new = windows; new; new = new->next)
- {
- node = new->node;
-
- if (internal_info_node_p (node) &&
- (strcmp (node->nodename, apropos_list_nodename) == 0))
- break;
- }
-
- /* If we couldn't find an existing window, try to use the next window
- in the chain. */
- if (!new && window->next)
- new = window->next;
-
- /* If we still don't have a window, make a new one to contain
- the list. */
- if (!new)
- {
- WINDOW *old_active;
-
- old_active = active_window;
- active_window = window;
- new = window_make_window ((NODE *)NULL);
- active_window = old_active;
- }
-
- /* If we couldn't make a new window, use this one. */
- if (!new)
- new = window;
-
- /* Lines do not wrap in this window. */
- new->flags |= W_NoWrap;
-
- window_set_node_of_window (new, apropos_node);
- remember_window_and_node (new, apropos_node);
- active_window = new;
+ WINDOW *new;
+ NODE *node;
+
+ set_remembered_pagetop_and_point (window);
+
+ /* If a window is visible and showing an apropos list already,
+ re-use it. */
+ for (new = windows; new; new = new->next)
+ {
+ node = new->node;
+
+ if (internal_info_node_p (node) &&
+ (strcmp (node->nodename, apropos_list_nodename) == 0))
+ break;
+ }
+
+ /* If we couldn't find an existing window, try to use the next window
+ in the chain. */
+ if (!new && window->next)
+ new = window->next;
+
+ /* If we still don't have a window, make a new one to contain
+ the list. */
+ if (!new)
+ {
+ WINDOW *old_active;
+
+ old_active = active_window;
+ active_window = window;
+ new = window_make_window ((NODE *)NULL);
+ active_window = old_active;
+ }
+
+ /* If we couldn't make a new window, use this one. */
+ if (!new)
+ new = window;
+
+ /* Lines do not wrap in this window. */
+ new->flags |= W_NoWrap;
+
+ window_set_node_of_window (new, apropos_node);
+ remember_window_and_node (new, apropos_node);
+ active_window = new;
}
info_free_references (apropos_list);
}
diff --git a/texinfo/info/indices.h b/texinfo/info/indices.h
index 265b1472ba8..8b8a7070c0b 100644
--- a/texinfo/info/indices.h
+++ b/texinfo/info/indices.h
@@ -1,9 +1,10 @@
-/* indices.h -- Functions defined in indices.c. */
+/* indices.h -- Functions defined in indices.c.
+ $Id: indices.h,v 1.2 1997/07/06 20:50:29 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_INDICES_H_)
-#define _INDICES_H_
+#ifndef INFO_INDICES_H
+#define INFO_INDICES_H
/* User-visible variable controls the output of info-index-next. */
extern int show_index_match;
@@ -35,5 +36,7 @@ REFERENCE **apropos_in_all_indices ();
/* 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 ();
-#endif /* !_INDICES_H_ */
+#endif /* not INFO_INDICES_H */
diff --git a/texinfo/info/info-utils.c b/texinfo/info/info-utils.c
index 6af3dd0e2ca..d9ab9a0634b 100644
--- a/texinfo/info/info-utils.c
+++ b/texinfo/info/info-utils.c
@@ -21,15 +21,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h> /* For "NULL". Yechhh! */
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if defined (HAVE_STRING_H)
-# include <string.h>
-#endif /* HAVE_STRING_H */
+#include "info.h"
#include "info-utils.h"
-
#if defined (HANDLE_MAN_PAGES)
# include "man.h"
#endif /* HANDLE_MAN_PAGES */
@@ -84,7 +77,7 @@ info_parse_node (string, newlines_okay)
/* Find the closing paren. */
while (string[i] && string[i] != ')')
- i++;
+ i++;
/* Remember parsed filename. */
saven_filename (string, i);
@@ -93,7 +86,7 @@ info_parse_node (string, newlines_okay)
string += i;
if (*string)
- string++;
+ string++;
}
/* Parse out nodename. */
@@ -136,9 +129,9 @@ info_parse_label (label, node)
}
/* **************************************************************** */
-/* */
-/* Finding and Building Menus */
-/* */
+/* */
+/* Finding and Building Menus */
+/* */
/* **************************************************************** */
/* Return a NULL terminated array of REFERENCE * which represents the menu
@@ -246,23 +239,23 @@ info_references_internal (label, binding)
offset = string_in_line (":", refdef);
/* When searching for menu items, if no colon, there is no
- menu item on this line. */
+ menu item on this line. */
if (offset == -1)
- {
- if (searching_for_menu_items)
- continue;
- else
- {
- int temp;
-
- temp = skip_line (refdef);
- offset = string_in_line (":", refdef + temp);
- if (offset == -1)
- continue; /* Give up? */
- else
- offset += temp;
- }
- }
+ {
+ if (searching_for_menu_items)
+ continue;
+ else
+ {
+ int temp;
+
+ temp = skip_line (refdef);
+ offset = string_in_line (":", refdef + temp);
+ if (offset == -1)
+ continue; /* Give up? */
+ else
+ offset += temp;
+ }
+ }
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
entry->filename = (char *)NULL;
@@ -277,32 +270,32 @@ info_references_internal (label, binding)
entry->end = refdef - binding->buffer;
/* If this reference entry continues with another ':' then the
- nodename is the same as the label. */
+ nodename is the same as the label. */
if (*refdef == ':')
- {
- entry->nodename = strdup (entry->label);
- }
+ {
+ entry->nodename = xstrdup (entry->label);
+ }
else
- {
- /* This entry continues with a specific nodename. Parse the
- nodename from the specification. */
+ {
+ /* This entry continues with a specific nodename. Parse the
+ nodename from the specification. */
- refdef += skip_whitespace_and_newlines (refdef);
+ refdef += skip_whitespace_and_newlines (refdef);
- if (searching_for_menu_items)
- info_parse_node (refdef, DONT_SKIP_NEWLINES);
- else
- info_parse_node (refdef, SKIP_NEWLINES);
+ if (searching_for_menu_items)
+ info_parse_node (refdef, DONT_SKIP_NEWLINES);
+ else
+ info_parse_node (refdef, SKIP_NEWLINES);
- if (info_parsed_filename)
- entry->filename = strdup (info_parsed_filename);
+ if (info_parsed_filename)
+ entry->filename = xstrdup (info_parsed_filename);
- if (info_parsed_nodename)
- entry->nodename = strdup (info_parsed_nodename);
- }
+ if (info_parsed_nodename)
+ entry->nodename = xstrdup (info_parsed_nodename);
+ }
add_pointer_to_array
- (entry, refs_index, refs, refs_slots, 50, REFERENCE *);
+ (entry, refs_index, refs, refs_slots, 50, REFERENCE *);
}
return (refs);
}
@@ -320,7 +313,7 @@ info_get_labeled_reference (label, references)
for (i = 0; references && (entry = references[i]); i++)
{
if (strcmp (label, entry->label) == 0)
- return (entry);
+ return (entry);
}
return ((REFERENCE *)NULL);
}
@@ -375,13 +368,13 @@ info_free_references (references)
if (references)
{
for (i = 0; references && (entry = references[i]); i++)
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
+ {
+ maybe_free (entry->label);
+ maybe_free (entry->filename);
+ maybe_free (entry->nodename);
- free (entry);
- }
+ free (entry);
+ }
free (references);
}
@@ -411,24 +404,24 @@ canonicalize_whitespace (string)
for (i = 0, j = 0; string[i]; i++)
{
if (whitespace_or_newline (string[i]))
- {
- whitespace_found++;
- whitespace_loc = i;
- continue;
- }
+ {
+ whitespace_found++;
+ whitespace_loc = i;
+ continue;
+ }
else
- {
- if (whitespace_found && whitespace_loc)
- {
- whitespace_found = 0;
-
- /* Suppress whitespace at start of string. */
- if (j)
- temp[j++] = ' ';
- }
-
- temp[j++] = string[i];
- }
+ {
+ if (whitespace_found && whitespace_loc)
+ {
+ whitespace_found = 0;
+
+ /* Suppress whitespace at start of string. */
+ if (j)
+ temp[j++] = ' ';
+ }
+
+ temp[j++] = string[i];
+ }
}
/* Kill trailing whitespace. */
@@ -466,26 +459,26 @@ printed_representation (character, hpos)
else if (iscntrl (character))
{
switch (character)
- {
- case '\r':
- case '\n':
- the_rep[i++] = character;
- break;
-
- case '\t':
- {
- int tw;
-
- tw = ((hpos + 8) & 0xf8) - hpos;
- while (i < tw)
- the_rep[i++] = ' ';
- }
- break;
-
- default:
- the_rep[i++] = '^';
- the_rep[i++] = (character | 0x40);
- }
+ {
+ case '\r':
+ case '\n':
+ the_rep[i++] = character;
+ break;
+
+ case '\t':
+ {
+ int tw;
+
+ tw = ((hpos + 8) & 0xf8) - hpos;
+ while (i < tw)
+ the_rep[i++] = ' ';
+ }
+ break;
+
+ default:
+ the_rep[i++] = '^';
+ the_rep[i++] = (character | 0x40);
+ }
}
else if (character > printable_limit)
{
@@ -502,9 +495,9 @@ printed_representation (character, hpos)
/* **************************************************************** */
-/* */
-/* Functions Static To This File */
-/* */
+/* */
+/* Functions Static To This File */
+/* */
/* **************************************************************** */
/* Amount of space allocated to INFO_PARSED_FILENAME via xmalloc (). */
@@ -531,7 +524,7 @@ saven_filename (filename, len)
int len;
{
saven_string (filename, len,
- &info_parsed_filename, &parsed_filename_size);
+ &info_parsed_filename, &parsed_filename_size);
}
/* Remember NODENAME in PARSED_NODENAME. An empty NODENAME is translated
@@ -550,7 +543,7 @@ saven_nodename (nodename, len)
int len;
{
saven_string (nodename, len,
- &info_parsed_nodename, &parsed_nodename_size);
+ &info_parsed_nodename, &parsed_nodename_size);
}
/* Remember STRING in STRING_P. STRING_P should currently have STRING_SIZE_P
@@ -565,7 +558,7 @@ save_string (string, string_p, string_size_p)
if (!string || !*string)
{
if (*string_p)
- free (*string_p);
+ free (*string_p);
*string_p = (char *)NULL;
*string_size_p = 0;
@@ -573,8 +566,8 @@ save_string (string, string_p, string_size_p)
else
{
if (strlen (string) >= *string_size_p)
- *string_p = (char *)xrealloc
- (*string_p, (*string_size_p = 1 + strlen (string)));
+ *string_p = (char *)xrealloc
+ (*string_p, (*string_size_p = 1 + strlen (string)));
strcpy (*string_p, string);
}
@@ -591,7 +584,7 @@ saven_string (string, len, string_p, string_size_p)
if (!string)
{
if (*string_p)
- free (*string_p);
+ free (*string_p);
*string_p = (char *)NULL;
*string_size_p = 0;
@@ -599,7 +592,7 @@ saven_string (string, len, string_p, string_size_p)
else
{
if (len >= *string_size_p)
- *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len));
+ *string_p = (char *)xrealloc (*string_p, (*string_size_p = 1 + len));
strncpy (*string_p, string, len);
(*string_p)[len] = '\0';
@@ -665,7 +658,7 @@ get_internal_info_window (name)
for (win = windows; win; win = win->next)
if (internal_info_node_p (win->node) &&
- (strcmp (win->node->nodename, name) == 0))
+ (strcmp (win->node->nodename, name) == 0))
break;
return (win);
diff --git a/texinfo/info/info-utils.h b/texinfo/info/info-utils.h
index 9f17a39f88b..879587c4844 100644
--- a/texinfo/info/info-utils.h
+++ b/texinfo/info/info-utils.h
@@ -1,5 +1,5 @@
/* info-utils.h -- Exported functions and variables from info-util.c.
- $Id: info-utils.h,v 1.1 1997/08/21 22:58:02 jason Exp $
+ $Id: info-utils.h,v 1.3 1997/07/15 18:42:20 karl Exp $
This file is part of GNU Info, a program for reading online documentation
stored in Info format.
@@ -22,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_INFO_UTILS_H_)
-#define _INFO_UTILS_H_
+#ifndef INFO_UTILS_H
+#define INFO_UTILS_H
#if !defined (HAVE_STRCHR)
# undef strchr
@@ -40,10 +40,10 @@
cross reference. Arrays of such references can be built by calling
info_menus_of_node () or info_xrefs_of_node (). */
typedef struct {
- char *label; /* User Label. */
- 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. */
+ char *label; /* User Label. */
+ 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. */
} REFERENCE;
/* When non-zero, various display and input functions handle ISO Latin
@@ -137,4 +137,4 @@ extern void info_parse_label (/* label, node */);
info_parse_label (INFO_ALTPREV_LABEL, n); \
} while (0)
-#endif /* !_INFO_UTILS_H_ */
+#endif /* not INFO_UTILS_H */
diff --git a/texinfo/info/info.c b/texinfo/info/info.c
index 223df55acb2..9b46edfcfc0 100644
--- a/texinfo/info/info.c
+++ b/texinfo/info/info.c
@@ -1,9 +1,7 @@
-/* info.c -- Display nodes of Info files in multiple windows. */
+/* info.c -- Display nodes of Info files in multiple windows.
+ $Id: info.c,v 1.10 1997/07/30 15:21:44 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 96 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97 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 +20,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
+#include "indices.h"
#include "dribble.h"
#include "getopt.h"
#if defined (HANDLE_MAN_PAGES)
@@ -30,7 +29,7 @@
/* The version numbers of this version of Info. */
int info_major_version = 2;
-int info_minor_version = 16;
+int info_minor_version = 17;
int info_patch_level = 0;
/* Non-zero means search all indices for APROPOS_SEARCH_STRING. */
@@ -39,6 +38,14 @@ static int apropos_p = 0;
/* Variable containing the string to search for when apropos_p is non-zero. */
static char *apropos_search_string = (char *)NULL;
+/* Non-zero means search all indices for INDEX_SEARCH_STRING. Unlike
+ apropos, this puts the user at the node, running info. */
+static int index_search_p = 0;
+
+/* Variable containing the string to search for when index_search_p is
+ non-zero. */
+static char *index_search_string = (char *)NULL;
+
/* Non-zero means print version info only. */
static int print_version_p = 0;
@@ -70,6 +77,7 @@ int dump_subnodes = 0;
#define APROPOS_OPTION 1
#define DRIBBLE_OPTION 2
#define RESTORE_OPTION 3
+#define IDXSRCH_OPTION 4
static struct option long_options[] = {
{ "apropos", 1, 0, APROPOS_OPTION },
{ "directory", 1, 0, 'd' },
@@ -81,6 +89,7 @@ static struct option long_options[] = {
{ "version", 0, &print_version_p, 1 },
{ "dribble", 1, 0, DRIBBLE_OPTION },
{ "restore", 1, 0, RESTORE_OPTION },
+ { "index-search", 1, 0, IDXSRCH_OPTION },
{NULL, 0, NULL, 0}
};
@@ -95,9 +104,9 @@ static void usage (), info_short_help (), remember_info_program_name ();
/* **************************************************************** */
-/* */
-/* Main Entry Point to the Info Program */
-/* */
+/* */
+/* Main Entry Point to the Info Program */
+/* */
/* **************************************************************** */
int
@@ -105,85 +114,101 @@ main (argc, argv)
int argc;
char **argv;
{
- int getopt_long_index; /* Index returned by getopt_long (). */
- NODE *initial_node; /* First node loaded by Info. */
+ int getopt_long_index; /* Index returned by getopt_long (). */
+ NODE *initial_node; /* First node loaded by Info. */
remember_info_program_name (argv[0]);
+#ifdef HAVE_SETLOCALE
+ /* Set locale via LC_ALL. */
+ setlocale (LC_ALL, "");
+#endif
+
+ /* Set the text message domain. */
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
while (1)
{
int option_character;
option_character = getopt_long
- (argc, argv, short_options, long_options, &getopt_long_index);
+ (argc, argv, short_options, long_options, &getopt_long_index);
/* getopt_long () returns EOF when there are no more long options. */
if (option_character == EOF)
- break;
+ break;
/* If this is a long option, then get the short version of it. */
if (option_character == 0 && long_options[getopt_long_index].flag == 0)
- option_character = long_options[getopt_long_index].val;
+ option_character = long_options[getopt_long_index].val;
/* Case on the option that we have received. */
switch (option_character)
- {
- case 0:
- break;
-
- /* User wants to add a directory. */
- case 'd':
- info_add_path (optarg, INFOPATH_PREPEND);
- break;
-
- /* User is specifying a particular node. */
- case 'n':
- add_pointer_to_array (optarg, user_nodenames_index, user_nodenames,
- user_nodenames_slots, 10, char *);
- break;
-
- /* User is specifying a particular Info file. */
- case 'f':
- if (user_filename)
- free (user_filename);
-
- user_filename = strdup (optarg);
- break;
-
- /* User is specifying the name of a file to output to. */
- case 'o':
- if (user_output_filename)
- free (user_output_filename);
- user_output_filename = strdup (optarg);
- break;
-
- /* User is specifying that she wishes to dump the subnodes of
- the node that she is dumping. */
- case 's':
- dump_subnodes = 1;
- break;
-
- /* User has specified a string to search all indices for. */
- case APROPOS_OPTION:
- apropos_p = 1;
- maybe_free (apropos_search_string);
- apropos_search_string = strdup (optarg);
- break;
-
- /* User has specified a dribble file to receive keystrokes. */
- case DRIBBLE_OPTION:
- close_dribble_file ();
- open_dribble_file (optarg);
- break;
-
- /* User has specified an alternate input stream. */
- case RESTORE_OPTION:
- info_set_input_from_file (optarg);
- break;
-
- default:
- usage ();
- }
+ {
+ case 0:
+ break;
+
+ /* User wants to add a directory. */
+ case 'd':
+ info_add_path (optarg, INFOPATH_PREPEND);
+ break;
+
+ /* User is specifying a particular node. */
+ case 'n':
+ add_pointer_to_array (optarg, user_nodenames_index, user_nodenames,
+ user_nodenames_slots, 10, char *);
+ break;
+
+ /* User is specifying a particular Info file. */
+ case 'f':
+ if (user_filename)
+ free (user_filename);
+
+ user_filename = xstrdup (optarg);
+ break;
+
+ /* User is specifying the name of a file to output to. */
+ case 'o':
+ if (user_output_filename)
+ free (user_output_filename);
+ user_output_filename = xstrdup (optarg);
+ break;
+
+ /* User is specifying that she wishes to dump the subnodes of
+ the node that she is dumping. */
+ case 's':
+ dump_subnodes = 1;
+ break;
+
+ /* User has specified a string to search all indices for. */
+ case APROPOS_OPTION:
+ apropos_p = 1;
+ maybe_free (apropos_search_string);
+ apropos_search_string = xstrdup (optarg);
+ break;
+
+ /* User has specified a dribble file to receive keystrokes. */
+ case DRIBBLE_OPTION:
+ close_dribble_file ();
+ open_dribble_file (optarg);
+ break;
+
+ /* User has specified an alternate input stream. */
+ case RESTORE_OPTION:
+ info_set_input_from_file (optarg);
+ break;
+
+ /* User has specified a string to search all indices for. */
+ case IDXSRCH_OPTION:
+ index_search_p = 1;
+ maybe_free (index_search_string);
+ index_search_string = xstrdup (optarg);
+ break;
+
+ default:
+ usage ();
+ }
}
/* If the output device is not a terminal, and no output filename has been
@@ -191,15 +216,15 @@ main (argc, argv)
to stdout, and turn on the dumping of subnodes. */
if ((!isatty (fileno (stdout))) && (user_output_filename == (char *)NULL))
{
- user_output_filename = strdup ("-");
+ user_output_filename = xstrdup ("-");
dump_subnodes = 1;
}
/* If the user specified --version, then show the version and exit. */
if (print_version_p)
{
- printf ("GNU Info (Texinfo 3.9) %s\n", version_string ());
- puts ("Copyright (C) 1996 Free Software Foundation, Inc.\n\
+ printf ("info (GNU %s %s) %s\n", PACKAGE, VERSION, version_string ());
+ puts ("Copyright (C) 1997 Free Software Foundation, Inc.\n\
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.");
@@ -213,34 +238,38 @@ For more information about these matters, see the files named COPYING.");
exit (0);
}
- /* If the user hasn't specified a path for Info files, default that path
- now. */
+ /* If the user hasn't specified a path for Info files, default it. */
if (!infopath)
{
- char *path_from_env, *getenv ();
-
- path_from_env = getenv ("INFOPATH");
+ char *path_from_env = getenv ("INFOPATH");
if (path_from_env)
- info_add_path (path_from_env, INFOPATH_PREPEND);
+ {
+ unsigned len = strlen (path_from_env);
+ /* Trailing : on INFOPATH means insert the default path. */
+ if (len && path_from_env[len - 1] == ':')
+ {
+ path_from_env[len - 1] = 0;
+ info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+ }
+ info_add_path (path_from_env, INFOPATH_PREPEND);
+ }
else
- info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+ info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
}
/* If the user specified a particular filename, add the path of that
file to the contents of INFOPATH. */
if (user_filename)
{
- char *directory_name, *temp;
-
- directory_name = strdup (user_filename);
- temp = filename_non_directory (directory_name);
+ char *directory_name = xstrdup (user_filename);
+ char *temp = filename_non_directory (directory_name);
if (temp != directory_name)
- {
- *temp = 0;
- info_add_path (directory_name, INFOPATH_PREPEND);
- }
+ {
+ *temp = 0;
+ info_add_path (directory_name, INFOPATH_PREPEND);
+ }
free (directory_name);
}
@@ -255,39 +284,74 @@ For more information about these matters, see the files named COPYING.");
/* Get the initial Info node. It is either "(dir)Top", or what the user
specifed with values in user_filename and user_nodenames. */
- if (user_nodenames)
- initial_node = info_get_node (user_filename, user_nodenames[0]);
- else
- initial_node = info_get_node (user_filename, (char *)NULL);
+ initial_node = info_get_node (user_filename,
+ user_nodenames ? user_nodenames[0] : NULL);
/* If we couldn't get the initial node, this user is in trouble. */
if (!initial_node)
{
if (info_recent_file_error)
- info_error (info_recent_file_error);
+ info_error (info_recent_file_error);
else
- info_error
- (CANT_FIND_NODE, user_nodenames ? user_nodenames[0] : "Top");
+ info_error
+ (CANT_FIND_NODE, user_nodenames ? user_nodenames[0] : "Top");
exit (1);
}
- /* Special cases for when the user specifies multiple nodes. If we are
- dumping to an output file, dump all of the nodes specified. Otherwise,
- attempt to create enough windows to handle the nodes that this user wants
- displayed. */
+ /* Special cases for when the user specifies multiple nodes. If we
+ are dumping to an output file, dump all of the nodes specified.
+ Otherwise, attempt to create enough windows to handle the nodes
+ that this user wants displayed. */
if (user_nodenames_index > 1)
{
free (initial_node);
if (user_output_filename)
- dump_nodes_to_file
- (user_filename, user_nodenames, user_output_filename, dump_subnodes);
+ dump_nodes_to_file
+ (user_filename, user_nodenames, user_output_filename, dump_subnodes);
else
- begin_multiple_window_info_session (user_filename, user_nodenames);
+ begin_multiple_window_info_session (user_filename, user_nodenames);
exit (0);
}
+ /* If the user specified `--index-search=STRING', start the info
+ session in the node corresponding to the first match. */
+ if (index_search_p)
+ {
+ int status = 0;
+
+ initialize_info_session (initial_node, 0);
+
+ if (index_entry_exists (windows, index_search_string))
+ {
+ terminal_clear_screen ();
+ terminal_prep_terminal ();
+ display_update_display (windows);
+ info_last_executed_command = (VFunction *)NULL;
+
+ do_info_index_search (windows, 0, index_search_string);
+
+ info_read_and_dispatch ();
+
+ terminal_unprep_terminal ();
+
+ /* On program exit, leave the cursor at the bottom of the
+ window, and restore the terminal IO. */
+ terminal_goto_xy (0, screenheight - 1);
+ terminal_clear_to_eol ();
+ fflush (stdout);
+ }
+ else
+ {
+ fputs (_("no entries found\n"), stderr);
+ status = 2;
+ }
+
+ close_dribble_file ();
+ exit (status);
+ }
+
/* If there are arguments remaining, they are the names of menu items
in sequential info files starting from the first one loaded. That
file name is either "dir", or the contents of user_filename if one
@@ -303,134 +367,134 @@ For more information about these matters, see the files named COPYING.");
/* Remember the name of the menu entry we want. */
arg = argv[optind++];
- if (first_arg == (char *)NULL)
- first_arg = arg;
+ if (!first_arg)
+ first_arg = arg;
/* Build and return a list of the menu items in this node. */
menu = info_menu_of_node (initial_node);
/* If there wasn't a menu item in this node, stop here, but let
- the user continue to use Info. Perhaps they wanted this node
- and didn't realize it. */
+ the user continue to use Info. Perhaps they wanted this node
+ and didn't realize it. */
if (!menu)
- {
+ {
#if defined (HANDLE_MAN_PAGES)
- if (first_arg == arg)
- {
- node = make_manpage_node (first_arg);
- if (node)
- goto maybe_got_node;
- }
+ if (first_arg == arg)
+ {
+ node = make_manpage_node (first_arg);
+ if (node)
+ goto maybe_got_node;
+ }
#endif /* HANDLE_MAN_PAGES */
- begin_info_session_with_error
- (initial_node, "There is no menu in this node.");
- exit (0);
- }
+ begin_info_session_with_error
+ (initial_node, _("There is no menu in this node."));
+ exit (0);
+ }
/* Find the specified menu item. */
entry = info_get_labeled_reference (arg, menu);
/* If the item wasn't found, search the list sloppily. Perhaps this
- user typed "buffer" when they really meant "Buffers". */
+ user typed "buffer" when they really meant "Buffers". */
if (!entry)
- {
- register int i;
- int best_guess = -1;
-
- for (i = 0; entry = menu[i]; i++)
- {
- if (strcasecmp (entry->label, arg) == 0)
- break;
- else
- if (strncasecmp (entry->label, arg, strlen (arg)) == 0)
- best_guess = i;
- }
-
- if (!entry && best_guess != -1)
- entry = menu[best_guess];
- }
+ {
+ register int i;
+ int best_guess = -1;
+
+ for (i = 0; (entry = menu[i]); i++)
+ {
+ if (strcasecmp (entry->label, arg) == 0)
+ break;
+ else
+ if (strncasecmp (entry->label, arg, strlen (arg)) == 0)
+ best_guess = i;
+ }
+
+ if (!entry && best_guess != -1)
+ entry = menu[best_guess];
+ }
/* If we failed to find the reference, start Info with the current
- node anyway. It is probably a misspelling. */
+ node anyway. It is probably a misspelling. */
if (!entry)
- {
- char *error_message = "There is no menu item \"%s\" in this node.";
+ {
+ char *error_message = _("There is no menu item \"%s\" in this node.");
#if defined (HANDLE_MAN_PAGES)
- if (first_arg == arg)
- {
- node = make_manpage_node (first_arg);
- if (node)
- goto maybe_got_node;
- }
+ if (first_arg == arg)
+ {
+ node = make_manpage_node (first_arg);
+ if (node)
+ goto maybe_got_node;
+ }
#endif /* HANDLE_MAN_PAGES */
- info_free_references (menu);
+ info_free_references (menu);
- /* If we were supposed to dump this node, complain. */
- if (user_output_filename)
- info_error (error_message, arg);
- else
- begin_info_session_with_error (initial_node, error_message, arg);
+ /* If we were supposed to dump this node, complain. */
+ if (user_output_filename)
+ info_error (error_message, arg);
+ else
+ begin_info_session_with_error (initial_node, error_message, arg);
- exit (0);
- }
+ exit (0);
+ }
/* We have found the reference that the user specified. Clean it
- up a little bit. */
+ up a little bit. */
if (!entry->filename)
- {
- if (initial_node->parent)
- entry->filename = strdup (initial_node->parent);
- else
- entry->filename = strdup (initial_node->filename);
- }
+ {
+ if (initial_node->parent)
+ entry->filename = xstrdup (initial_node->parent);
+ else
+ entry->filename = xstrdup (initial_node->filename);
+ }
/* Find this node. If we can find it, then turn the initial_node
- into this one. If we cannot find it, try using the label of the
- entry as a file (i.e., "(LABEL)Top"). Otherwise the Info file is
- malformed in some way, and we will just use the current value of
- initial node. */
+ into this one. If we cannot find it, try using the label of the
+ entry as a file (i.e., "(LABEL)Top"). Otherwise the Info file is
+ malformed in some way, and we will just use the current value of
+ initial node. */
node = info_get_node (entry->filename, entry->nodename);
#if defined (HANDLE_MAN_PAGES)
- if ((first_arg == arg) && !node)
- {
- node = make_manpage_node (first_arg);
- if (node)
- goto maybe_got_node;
- }
+ if ((first_arg == arg) && !node)
+ {
+ node = make_manpage_node (first_arg);
+ if (node)
+ goto maybe_got_node;
+ }
#endif /* HANDLE_MAN_PAGES */
if (!node && entry->nodename &&
- (strcmp (entry->label, entry->nodename) == 0))
- node = info_get_node (entry->label, "Top");
+ (strcmp (entry->label, entry->nodename) == 0))
+ node = info_get_node (entry->label, "Top");
maybe_got_node:
if (node)
- {
- free (initial_node);
- initial_node = node;
- info_free_references (menu);
- }
+ {
+ free (initial_node);
+ initial_node = node;
+ info_free_references (menu);
+ }
else
- {
- char *temp = strdup (entry->label);
- char *error_message;
+ {
+ char *temp = xstrdup (entry->label);
+ char *error_message;
- error_message = "Unable to find the node referenced by \"%s\".";
+ error_message = _("Unable to find the node referenced by \"%s\".");
- info_free_references (menu);
+ info_free_references (menu);
- /* If we were trying to dump the node, then give up. Otherwise,
- start the session with an error message. */
- if (user_output_filename)
- info_error (error_message, temp);
- else
- begin_info_session_with_error (initial_node, error_message, temp);
+ /* If we were trying to dump the node, then give up. Otherwise,
+ start the session with an error message. */
+ if (user_output_filename)
+ info_error (error_message, temp);
+ else
+ begin_info_session_with_error (initial_node, error_message, temp);
- exit (0);
- }
+ exit (0);
+ }
}
/* If the user specified that this node should be output, then do that
@@ -454,15 +518,15 @@ version_string ()
vstring = (char *)xmalloc (50);
sprintf (vstring, "%d.%d", info_major_version, info_minor_version);
if (info_patch_level)
- sprintf (vstring + strlen (vstring), "-p%d", info_patch_level);
+ sprintf (vstring + strlen (vstring), "-p%d", info_patch_level);
}
return (vstring);
}
/* **************************************************************** */
-/* */
-/* Error Handling for Info */
-/* */
+/* */
+/* Error Handling for Info */
+/* */
/* **************************************************************** */
static char *program_name = (char *)NULL;
@@ -474,7 +538,7 @@ remember_info_program_name (fullpath)
char *filename;
filename = filename_non_directory (fullpath);
- program_name = strdup (filename);
+ program_name = xstrdup (filename);
}
/* Non-zero if an error has been signalled. */
@@ -503,22 +567,22 @@ info_error (format, arg1, arg2)
else
{
if (!echo_area_is_active)
- {
- if (info_error_rings_bell_p)
- terminal_ring_bell ();
- window_message_in_echo_area (format, arg1, arg2);
- }
+ {
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ window_message_in_echo_area (format, arg1, arg2);
+ }
else
- {
- NODE *temp;
-
- temp = build_message_node (format, arg1, arg2);
- if (info_error_rings_bell_p)
- terminal_ring_bell ();
- inform_in_echo_area (temp->contents);
- free (temp->contents);
- free (temp);
- }
+ {
+ NODE *temp;
+
+ temp = build_message_node (format, arg1, arg2);
+ if (info_error_rings_bell_p)
+ terminal_ring_bell ();
+ inform_in_echo_area (temp->contents);
+ free (temp->contents);
+ free (temp);
+ }
}
}
@@ -528,11 +592,11 @@ static void
usage ()
{
fprintf (stderr,"%s\n%s\n%s\n%s\n%s\n",
-"Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]...",
-" [--directory dir-path] [--file info-file] [--node node-name]...",
-" [--help] [--output output-file] [--subnodes] [--version]",
-" [--dribble dribble-file] [--restore from-file]",
-" [menu-selection ...]");
+_("Usage: info [-d dir-path] [-f info-file] [-o output-file] [-n node-name]..."),
+_(" [--directory dir-path] [--file info-file] [--node node-name]..."),
+_(" [--help] [--output output-file] [--subnodes] [--version]"),
+_(" [--dribble dribble-file] [--restore from-file]"),
+_(" [menu-selection ...]"));
exit (1);
}
@@ -540,26 +604,26 @@ usage ()
static void
info_short_help ()
{
- puts ("\
+ puts (_("\
Here is a quick description of Info's options. For a more complete\n\
description of how to use Info, type `info info options'.\n\
\n\
- --directory DIR Add DIR to INFOPATH.\n\
- --dribble FILENAME Remember user keystrokes in FILENAME.\n\
- --file FILENAME Specify Info file to visit.\n\
- --node NODENAME Specify nodes in first visited Info file.\n\
- --output FILENAME Output selected nodes to FILENAME.\n\
- --restore FILENAME Read initial keystrokes from FILENAME.\n\
- --subnodes Recursively output menu items.\n\
- --help Get this help message.\n\
- --version Display Info's version information.\n\
+ --directory DIR Add DIR to INFOPATH.\n\
+ --dribble FILENAME Remember user keystrokes in FILENAME.\n\
+ --file FILENAME Specify Info file to visit.\n\
+ --node NODENAME Specify nodes in first visited Info file.\n\
+ --output FILENAME Output selected nodes to FILENAME.\n\
+ --restore FILENAME Read initial keystrokes from FILENAME.\n\
+ --subnodes Recursively output menu items.\n\
+ --help Get this help message.\n\
+ --version Display Info's version information.\n\
\n\
Remaining arguments to Info are treated as the names of menu\n\
items in the initial node visited. You can easily move to the\n\
node of your choice by specifying the menu names which describe\n\
the path to that node. For example, `info emacs buffers'.\n\
\n\
-Email bug reports to bug-texinfo@prep.ai.mit.edu.");
+Email bug reports to bug-texinfo@prep.ai.mit.edu."));
exit (0);
}
diff --git a/texinfo/info/info.h b/texinfo/info/info.h
index a8759227758..e8be98ed42f 100644
--- a/texinfo/info/info.h
+++ b/texinfo/info/info.h
@@ -1,9 +1,10 @@
-/* info.h -- Header file which includes all of the other headers. */
+/* info.h -- Header file which includes all of the other headers.
+ $Id: info.h,v 1.6 1997/07/15 18:34:15 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,33 +22,86 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_INFO_H_)
-#define _INFO_H_
+#if !defined (INFO_H)
+#define INFO_H
+
+/* We always want these, so why clutter up the compile command? */
+#define HANDLE_MAN_PAGES
+#define NAMED_FUNCTIONS
+
+/* System dependencies. */
+#include "system.h"
+
+/* Some of our other include files use these. */
+typedef int Function ();
+typedef void VFunction ();
+typedef char *CFunction ();
+
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#if defined (HAVE_STRING_H)
-#include <string.h>
-#endif /* HAVE_STRING_H */
#include "filesys.h"
#include "display.h"
#include "session.h"
-#include "echo_area.h"
+#include "echo-area.h"
#include "doc.h"
#include "footnotes.h"
#include "gc.h"
+#define info_toupper(x) (islower (x) ? toupper (x) : x)
+#define info_tolower(x) (isupper (x) ? tolower (x) : x)
+
+#if !defined (whitespace)
+# define whitespace(c) ((c == ' ') || (c == '\t'))
+#endif /* !whitespace */
+
+#if !defined (whitespace_or_newline)
+# define whitespace_or_newline(c) (whitespace (c) || (c == '\n'))
+#endif /* !whitespace_or_newline */
+
+/* Add POINTER to the list of pointers found in ARRAY. SLOTS is the number
+ of slots that have already been allocated. INDEX is the index into the
+ array where POINTER should be added. GROW is the number of slots to grow
+ ARRAY by, in the case that it needs growing. TYPE is a cast of the type
+ of object stored in ARRAY (e.g., NODE_ENTRY *. */
+#define add_pointer_to_array(pointer, idx, array, slots, grow, type) \
+ do { \
+ if (idx + 2 >= slots) \
+ array = (type *)(xrealloc (array, (slots += grow) * sizeof (type))); \
+ array[idx++] = (type)pointer; \
+ array[idx] = (type)NULL; \
+ } while (0)
+
+#define maybe_free(x) do { if (x) free (x); } while (0)
+
+#if !defined (zero_mem) && defined (HAVE_MEMSET)
+# define zero_mem(mem, length) memset (mem, 0, length)
+#endif /* !zero_mem && HAVE_MEMSET */
+
+#if !defined (zero_mem) && defined (HAVE_BZERO)
+# define zero_mem(mem, length) bzero (mem, length)
+#endif /* !zero_mem && HAVE_BZERO */
+
+#if !defined (zero_mem)
+# define zero_mem(mem, length) \
+ do { \
+ register int zi; \
+ register unsigned char *place; \
+ \
+ place = (unsigned char *)mem; \
+ for (zi = 0; zi < length; zi++) \
+ place[zi] = 0; \
+ } while (0)
+#endif /* !zero_mem */
+
+
/* A structure associating the nodes visited in a particular window. */
typedef struct {
- WINDOW *window; /* The window that this list is attached to. */
- NODE **nodes; /* Array of nodes visited in this window. */
- int *pagetops; /* For each node in NODES, the pagetop. */
- long *points; /* For each node in NODES, the point. */
- int current; /* Index in NODES of the current node. */
- int nodes_index; /* Index where to add the next node. */
- int nodes_slots; /* Number of slots allocated to NODES. */
+ WINDOW *window; /* The window that this list is attached to. */
+ NODE **nodes; /* Array of nodes visited in this window. */
+ int *pagetops; /* For each node in NODES, the pagetop. */
+ long *points; /* For each node in NODES, the point. */
+ int current; /* Index in NODES of the current node. */
+ int nodes_index; /* Index where to add the next node. */
+ int nodes_slots; /* Number of slots allocated to NODES. */
} INFO_WINDOW;
/* Array of structures describing for each window which nodes have been
@@ -78,23 +132,34 @@ extern int info_major_version, info_minor_version, info_patch_level;
extern char *version_string ();
/* Error message defines. */
-#define CANT_FIND_NODE "Cannot find the node \"%s\"."
-#define CANT_FILE_NODE "Cannot find the node \"(%s)%s\"."
-#define CANT_FIND_WIND "Cannot find a window!"
-#define CANT_FIND_POINT "Point doesn't appear within this window's node!"
-#define CANT_KILL_LAST "Cannot delete the last window."
-#define NO_MENU_NODE "No menu in this node."
-#define NO_FOOT_NODE "No footnotes in this node."
-#define NO_XREF_NODE "No cross references in this node."
-#define NO_POINTER "No \"%s\" pointer for this node."
-#define UNKNOWN_COMMAND "Unknown Info command `%c'. `?' for help."
-#define TERM_TOO_DUMB "Terminal type \"%s\" is not smart enough to run Info."
-#define AT_NODE_BOTTOM "You are already at the last page of this node."
-#define AT_NODE_TOP "You are already at the first page of this node."
-#define ONE_WINDOW "Only one window."
-#define WIN_TOO_SMALL "Resulting window would be too small."
-#define CANT_MAKE_HELP \
-"There isn't enough room to make a help window. Please delete a window."
-
-#endif /* !_INFO_H_ */
+#define CANT_FIND_NODE _("Cannot find the node \"%s\".")
+#define CANT_FILE_NODE _("Cannot find the node \"(%s)%s\".")
+#define CANT_FIND_WIND _("Cannot find a window!")
+#define CANT_FIND_POINT _("Point doesn't appear within this window's node!")
+#define CANT_KILL_LAST _("Cannot delete the last window.")
+#define NO_MENU_NODE _("No menu in this node.")
+#define NO_FOOT_NODE _("No footnotes in this node.")
+#define NO_XREF_NODE _("No cross references in this node.")
+#define NO_POINTER _("No \"%s\" pointer for this node.")
+#define UNKNOWN_COMMAND _("Unknown Info command `%c'. `?' for help.")
+#define TERM_TOO_DUMB _("Terminal type \"%s\" is not smart enough to run Info.")
+#define AT_NODE_BOTTOM _("You are already at the last page of this node.")
+#define AT_NODE_TOP _("You are already at the first page of this node.")
+#define ONE_WINDOW _("Only one window.")
+#define WIN_TOO_SMALL _("Resulting window would be too small.")
+#define CANT_MAKE_HELP \
+_("There isn't enough room to make a help window. Please delete a window.")
+
+
+/* Found in info-utils.c. */
+extern char *filename_non_directory ();
+
+#if !defined (BUILDING_LIBRARY)
+/* Found in session.c */
+extern int info_windows_initialized_p;
+
+/* Found in window.c. */
+extern void message_in_echo_area (), unmessage_in_echo_area ();
+#endif /* !BUILDING_LIBRARY */
+#endif /* !INFO_H */
diff --git a/texinfo/info/infodoc.c b/texinfo/info/infodoc.c
index 35675095e70..4fc0419c5f9 100644
--- a/texinfo/info/infodoc.c
+++ b/texinfo/info/infodoc.c
@@ -1,9 +1,7 @@
-/* infodoc.c -- Functions which build documentation nodes. */
+/* infodoc.c -- Functions which build documentation nodes.
+ $Id: infodoc.c,v 1.4 1997/07/25 21:08:40 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,9 +31,9 @@
/* #define HELP_NODE_GETS_REGENERATED 1 */
/* **************************************************************** */
-/* */
-/* Info Help Windows */
-/* */
+/* */
+/* Info Help Windows */
+/* */
/* **************************************************************** */
/* The name of the node used in the help window. */
@@ -49,10 +47,12 @@ static char *internal_info_help_node_contents = (char *)NULL;
/* The static text which appears in the internal info help node. */
static char *info_internal_help_text[] = {
- "Basic Commands in Info Windows",
+ N_ ("Basic Commands in Info Windows"),
"******************************",
"",
- " h Invoke the Info tutorial.",
+ " h Invoke the Info tutorial.",
+ " CTRL-x 0 Quit this help.",
+ " q Quit Info altogether.",
"",
"Selecting other nodes:",
"----------------------",
@@ -72,9 +72,8 @@ static char *info_internal_help_text[] = {
" b Go to the beginning of this node.",
" e Go to the end of this node.",
"",
- "\"Advanced\" commands:",
+ "Other commands:",
"--------------------",
- " q Quit Info.",
" 1 Pick first item in node's menu.",
" 2-9 Pick second ... ninth item in node's menu.",
" 0 Pick last item in node's menu.",
@@ -82,7 +81,7 @@ static char *info_internal_help_text[] = {
" You may include a filename as well, as in (FILENAME)NODENAME.",
" s Search through this Info file for a specified string,",
" and select the node in which the next occurrence is found.",
- (char *)NULL
+ NULL
};
static char *where_is (), *where_is_internal ();
@@ -97,70 +96,70 @@ dump_map_to_message_buffer (prefix, map)
for (i = 0; i < 256; i++)
{
if (map[i].type == ISKMAP)
- {
- char *new_prefix, *keyname;
+ {
+ char *new_prefix, *keyname;
- keyname = pretty_keyname (i);
- new_prefix = (char *)
- xmalloc (3 + strlen (prefix) + strlen (keyname));
- sprintf (new_prefix, "%s%s%s ", prefix, *prefix ? " " : "", keyname);
+ keyname = pretty_keyname (i);
+ new_prefix = (char *)
+ xmalloc (3 + strlen (prefix) + strlen (keyname));
+ sprintf (new_prefix, "%s%s%s ", prefix, *prefix ? " " : "", keyname);
- dump_map_to_message_buffer (new_prefix, (Keymap)map[i].function);
- free (new_prefix);
- }
+ dump_map_to_message_buffer (new_prefix, (Keymap)map[i].function);
+ free (new_prefix);
+ }
else if (map[i].function)
- {
- register int last;
- char *doc, *name;
-
- doc = function_documentation (map[i].function);
- name = function_name (map[i].function);
-
- if (!*doc)
- continue;
-
- /* Find out if there is a series of identical functions, as in
- ea_insert (). */
- for (last = i + 1; last < 256; last++)
- if ((map[last].type != ISFUNC) ||
- (map[last].function != map[i].function))
- break;
-
- if (last - 1 != i)
- {
- printf_to_message_buffer
- ("%s%s .. ", prefix, pretty_keyname (i));
- printf_to_message_buffer
- ("%s%s\t", prefix, pretty_keyname (last - 1));
- i = last - 1;
- }
- else
- printf_to_message_buffer ("%s%s\t", prefix, pretty_keyname (i));
+ {
+ register int last;
+ char *doc, *name;
+
+ doc = function_documentation (map[i].function);
+ name = function_name (map[i].function);
+
+ if (!*doc)
+ continue;
+
+ /* Find out if there is a series of identical functions, as in
+ ea_insert (). */
+ for (last = i + 1; last < 256; last++)
+ if ((map[last].type != ISFUNC) ||
+ (map[last].function != map[i].function))
+ break;
+
+ if (last - 1 != i)
+ {
+ printf_to_message_buffer
+ ("%s%s .. ", prefix, pretty_keyname (i));
+ printf_to_message_buffer
+ ("%s%s\t", prefix, pretty_keyname (last - 1));
+ i = last - 1;
+ }
+ else
+ printf_to_message_buffer ("%s%s\t", prefix, pretty_keyname (i));
#if defined (NAMED_FUNCTIONS)
- /* Print the name of the function, and some padding before the
- documentation string is printed. */
- {
- int length_so_far;
- int desired_doc_start = 40; /* Must be multiple of 8. */
-
- printf_to_message_buffer ("(%s)", name);
- length_so_far = message_buffer_length_this_line ();
-
- if ((desired_doc_start + strlen (doc)) >= the_screen->width)
- printf_to_message_buffer ("\n ");
- else
- {
- while (length_so_far < desired_doc_start)
- {
- printf_to_message_buffer ("\t");
- length_so_far += character_width ('\t', length_so_far);
- }
- }
- }
+ /* Print the name of the function, and some padding before the
+ documentation string is printed. */
+ {
+ int length_so_far;
+ int desired_doc_start = 40; /* Must be multiple of 8. */
+
+ printf_to_message_buffer ("(%s)", name);
+ length_so_far = message_buffer_length_this_line ();
+
+ if ((desired_doc_start + strlen (doc)) >= the_screen->width)
+ printf_to_message_buffer ("\n ");
+ else
+ {
+ while (length_so_far < desired_doc_start)
+ {
+ printf_to_message_buffer ("\t");
+ 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);
+ }
}
}
@@ -184,7 +183,7 @@ create_internal_info_help_node ()
initialize_message_buffer ();
for (i = 0; info_internal_help_text[i]; i++)
- printf_to_message_buffer ("%s\n", info_internal_help_text[i]);
+ printf_to_message_buffer ("%s\n", info_internal_help_text[i]);
printf_to_message_buffer ("---------------------\n\n");
printf_to_message_buffer ("The current search path is:\n");
@@ -199,34 +198,34 @@ create_internal_info_help_node ()
#if defined (NAMED_FUNCTIONS)
/* Get a list of the M-x commands which have no keystroke equivs. */
for (i = 0; function_doc_array[i].func; i++)
- {
- VFunction *func = function_doc_array[i].func;
-
- if ((!where_is_internal (info_keymap, func)) &&
- (!where_is_internal (echo_area_keymap, func)))
- {
- if (!printed_one_mx)
- {
- printf_to_message_buffer ("---------------------\n\n");
- printf_to_message_buffer
- ("The following commands can only be invoked via M-x:\n\n");
- printed_one_mx = 1;
- }
-
- printf_to_message_buffer
- ("M-x %s\n %s\n",
- function_doc_array[i].func_name,
- replace_in_documentation (function_doc_array[i].doc));
- }
- }
+ {
+ VFunction *func = function_doc_array[i].func;
+
+ if ((!where_is_internal (info_keymap, func)) &&
+ (!where_is_internal (echo_area_keymap, func)))
+ {
+ if (!printed_one_mx)
+ {
+ printf_to_message_buffer ("---------------------\n\n");
+ printf_to_message_buffer
+ (_("The following commands can only be invoked via M-x:\n\n"));
+ printed_one_mx = 1;
+ }
+
+ printf_to_message_buffer
+ ("M-x %s\n %s\n",
+ function_doc_array[i].func_name,
+ replace_in_documentation (function_doc_array[i].doc));
+ }
+ }
if (printed_one_mx)
- printf_to_message_buffer ("\n");
+ printf_to_message_buffer ("\n");
#endif /* NAMED_FUNCTIONS */
printf_to_message_buffer
- ("%s", replace_in_documentation
- ("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n"));
+ ("%s", replace_in_documentation
+ (_("--- Use `\\[history-node]' or `\\[kill-node]' to exit ---\n")));
node = message_buffer_to_node ();
internal_info_help_node_contents = node->contents;
}
@@ -273,16 +272,16 @@ info_find_or_create_help_window ()
int max = 0;
for (window = windows; window; window = window->next)
- {
- if (window->height > max)
- {
- max = window->height;
- eligible = window;
- }
- }
+ {
+ if (window->height > max)
+ {
+ max = window->height;
+ eligible = window;
+ }
+ }
if (!eligible)
- return ((WINDOW *)NULL);
+ return ((WINDOW *)NULL);
}
#if !defined (HELP_NODE_GETS_REGENERATED)
else
@@ -297,28 +296,28 @@ info_find_or_create_help_window ()
if (!help_window)
{
/* Split the largest window into 2 windows, and show the help text
- in that window. */
+ in that window. */
if (eligible->height > 30)
- {
- active_window = eligible;
- help_window = window_make_window (internal_info_help_node);
- }
+ {
+ active_window = eligible;
+ help_window = window_make_window (internal_info_help_node);
+ }
else
- {
- set_remembered_pagetop_and_point (active_window);
- window_set_node_of_window (active_window, internal_info_help_node);
- help_window = active_window;
- }
+ {
+ set_remembered_pagetop_and_point (active_window);
+ window_set_node_of_window (active_window, internal_info_help_node);
+ help_window = active_window;
+ }
}
else
{
/* Case where help node always gets regenerated, and we have an
- existing window in which to place the node. */
+ existing window in which to place the node. */
if (active_window != help_window)
- {
- set_remembered_pagetop_and_point (active_window);
- active_window = help_window;
- }
+ {
+ set_remembered_pagetop_and_point (active_window);
+ active_window = help_window;
+ }
window_set_node_of_window (active_window, internal_info_help_node);
}
remember_window_and_node (help_window, help_window->node);
@@ -326,7 +325,7 @@ info_find_or_create_help_window ()
}
/* Create or move to the help window. */
-DECLARE_INFO_COMMAND (info_get_help_window, "Display help message")
+DECLARE_INFO_COMMAND (info_get_help_window, _("Display help message"))
{
WINDOW *help_window;
@@ -344,7 +343,7 @@ DECLARE_INFO_COMMAND (info_get_help_window, "Display help message")
/* Show the Info help node. This means that the "info" file is installed
where it can easily be found on your system. */
-DECLARE_INFO_COMMAND (info_get_info_help_node, "Visit Info node `(info)Help'")
+DECLARE_INFO_COMMAND (info_get_info_help_node, _("Visit Info node `(info)Help'"))
{
NODE *node;
char *nodename;
@@ -356,15 +355,15 @@ DECLARE_INFO_COMMAND (info_get_info_help_node, "Visit Info node `(info)Help'")
for (win = windows; win; win = win->next)
{
- if (win->node && win->node->filename &&
- (strcasecmp
- (filename_non_directory (win->node->filename), "info") == 0) &&
- ((strcmp (win->node->nodename, "Help") == 0) ||
- (strcmp (win->node->nodename, "Help-Small-Screen") == 0)))
- {
- active_window = win;
- return;
- }
+ if (win->node && win->node->filename &&
+ (strcasecmp
+ (filename_non_directory (win->node->filename), "info") == 0) &&
+ ((strcmp (win->node->nodename, "Help") == 0) ||
+ (strcmp (win->node->nodename, "Help-Small-Screen") == 0)))
+ {
+ active_window = win;
+ return;
+ }
}
}
@@ -380,32 +379,32 @@ 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);
else
- info_error (CANT_FILE_NODE, "Info", nodename);
+ info_error (CANT_FILE_NODE, "Info", nodename);
}
else
{
/* If the current window is very large (greater than 45 lines),
- then split it and show the help node in another window.
- Otherwise, use the current window. */
+ then split it and show the help node in another window.
+ Otherwise, use the current window. */
if (active_window->height > 45)
- active_window = window_make_window (node);
+ active_window = window_make_window (node);
else
- {
- set_remembered_pagetop_and_point (active_window);
- window_set_node_of_window (active_window, node);
- }
+ {
+ set_remembered_pagetop_and_point (active_window);
+ window_set_node_of_window (active_window, node);
+ }
remember_window_and_node (active_window, node);
}
}
/* **************************************************************** */
-/* */
-/* Groveling Info Keymaps and Docs */
-/* */
+/* */
+/* Groveling Info Keymaps and Docs */
+/* */
/* **************************************************************** */
/* Return the documentation associated with the Info command FUNCTION. */
@@ -468,7 +467,7 @@ key_documentation (key, map)
return ((char *)NULL);
}
-DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY")
+DECLARE_INFO_COMMAND (describe_key, _("Print documentation for KEY"))
{
char keyname[50];
int keyname_index = 0;
@@ -481,24 +480,24 @@ DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY")
while (1)
{
- message_in_echo_area ("Describe key: %s", keyname);
+ message_in_echo_area (_("Describe key: %s"), keyname);
keystroke = info_get_input_char ();
unmessage_in_echo_area ();
if (Meta_p (keystroke) && (!ISO_Latin_p || key < 160))
- {
- if (map[ESC].type != ISKMAP)
- {
- window_message_in_echo_area
- ("ESC %s is undefined.", pretty_keyname (UnMeta (keystroke)));
- return;
- }
-
- strcpy (keyname + keyname_index, "ESC ");
- keyname_index = strlen (keyname);
- keystroke = UnMeta (keystroke);
- map = (Keymap)map[ESC].function;
- }
+ {
+ if (map[ESC].type != ISKMAP)
+ {
+ window_message_in_echo_area
+ (_("ESC %s is undefined."), pretty_keyname (UnMeta (keystroke)));
+ return;
+ }
+
+ strcpy (keyname + keyname_index, "ESC ");
+ keyname_index = strlen (keyname);
+ keystroke = UnMeta (keystroke);
+ map = (Keymap)map[ESC].function;
+ }
/* Add the printed representation of KEYSTROKE to our keyname. */
rep = pretty_keyname (keystroke);
@@ -506,40 +505,40 @@ DECLARE_INFO_COMMAND (describe_key, "Print documentation for KEY")
keyname_index = strlen (keyname);
if (map[keystroke].function == (VFunction *)NULL)
- {
- message_in_echo_area ("%s is undefined.", keyname);
- return;
- }
+ {
+ message_in_echo_area (_("%s is undefined."), keyname);
+ return;
+ }
else if (map[keystroke].type == ISKMAP)
- {
- map = (Keymap)map[keystroke].function;
- strcat (keyname, " ");
- keyname_index = strlen (keyname);
- continue;
- }
+ {
+ map = (Keymap)map[keystroke].function;
+ strcat (keyname, " ");
+ keyname_index = strlen (keyname);
+ continue;
+ }
else
- {
- char *message, *fundoc, *funname = "";
+ {
+ char *message, *fundoc, *funname = "";
#if defined (NAMED_FUNCTIONS)
- funname = function_name (map[keystroke].function);
+ funname = function_name (map[keystroke].function);
#endif /* NAMED_FUNCTIONS */
- fundoc = function_documentation (map[keystroke].function);
+ fundoc = function_documentation (map[keystroke].function);
- message = (char *)xmalloc
- (10 + strlen (keyname) + strlen (fundoc) + strlen (funname));
+ message = (char *)xmalloc
+ (10 + strlen (keyname) + strlen (fundoc) + strlen (funname));
#if defined (NAMED_FUNCTIONS)
- sprintf (message, "%s (%s): %s.", keyname, funname, fundoc);
+ sprintf (message, "%s (%s): %s.", keyname, funname, fundoc);
#else
- sprintf (message, "%s is defined to %s.", keyname, fundoc);
+ sprintf (message, _("%s is defined to %s."), keyname, fundoc);
#endif /* !NAMED_FUNCTIONS */
- window_message_in_echo_area ("%s", message);
- free (message);
- break;
- }
+ window_message_in_echo_area ("%s", message);
+ free (message);
+ break;
+ }
}
}
@@ -565,28 +564,28 @@ pretty_keyname (key)
else if (Control_p (key))
{
switch (key)
- {
- case '\n': rep = "LFD"; break;
- case '\t': rep = "TAB"; break;
- case '\r': rep = "RET"; break;
- case ESC: rep = "ESC"; break;
-
- default:
- sprintf (rep_buffer, "C-%c", UnControl (key));
- rep = rep_buffer;
- }
+ {
+ case '\n': rep = "LFD"; break;
+ case '\t': rep = "TAB"; break;
+ case '\r': rep = "RET"; break;
+ case ESC: rep = "ESC"; break;
+
+ default:
+ sprintf (rep_buffer, "C-%c", UnControl (key));
+ rep = rep_buffer;
+ }
}
else
{
switch (key)
- {
- case ' ': rep = "SPC"; break;
- case DEL: rep = "DEL"; break;
- default:
- rep_buffer[0] = key;
- rep_buffer[1] = '\0';
- rep = rep_buffer;
- }
+ {
+ case ' ': rep = "SPC"; break;
+ case DEL: rep = "DEL"; break;
+ default:
+ rep_buffer[0] = key;
+ rep_buffer[1] = '\0';
+ rep = rep_buffer;
+ }
}
return (rep);
}
@@ -609,39 +608,39 @@ replace_in_documentation (string)
{
/* Is this the start of a replaceable function name? */
if (string[i] == '\\' && string[i + 1] == '[')
- {
- char *fun_name, *rep;
- VFunction *function;
-
- /* Copy in the old text. */
- strncpy (result + next, string + start, i - start);
- next += (i - start);
- start = i + 2;
-
- /* Move to the end of the function name. */
- for (i = start; string[i] && (string[i] != ']'); i++);
-
- fun_name = (char *)xmalloc (1 + i - start);
- strncpy (fun_name, string + start, i - start);
- fun_name[i - start] = '\0';
-
- /* Find a key which invokes this function in the info_keymap. */
- function = named_function (fun_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 (!function)
- abort ();
-
- rep = where_is (info_keymap, function);
- strcpy (result + next, rep);
- next = strlen (result);
-
- start = i;
- if (string[i])
- start++;
- }
+ {
+ char *fun_name, *rep;
+ VFunction *function;
+
+ /* Copy in the old text. */
+ strncpy (result + next, string + start, i - start);
+ next += (i - start);
+ start = i + 2;
+
+ /* Move to the end of the function name. */
+ for (i = start; string[i] && (string[i] != ']'); i++);
+
+ fun_name = (char *)xmalloc (1 + i - start);
+ strncpy (fun_name, string + start, i - start);
+ fun_name[i - start] = '\0';
+
+ /* Find a key which invokes this function in the info_keymap. */
+ function = named_function (fun_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 (!function)
+ abort ();
+
+ rep = where_is (info_keymap, function);
+ strcpy (result + next, rep);
+ next = strlen (result);
+
+ start = i;
+ if (string[i])
+ start++;
+ }
}
strcpy (result + next, string + start);
return (result);
@@ -674,7 +673,7 @@ where_is (map, function)
name = function_name (function);
if (name)
- sprintf (where_is_rep, "M-x %s", name);
+ sprintf (where_is_rep, "M-x %s", name);
rep = where_is_rep;
}
@@ -694,29 +693,29 @@ where_is_internal (map, function)
for (i = 0; i < 256; i++)
if ((map[i].type == ISFUNC) && map[i].function == function)
{
- sprintf (where_is_rep + where_is_rep_index, "%s", pretty_keyname (i));
- return (where_is_rep);
+ sprintf (where_is_rep + where_is_rep_index, "%s", pretty_keyname (i));
+ return (where_is_rep);
}
/* Okay, search subsequent maps for this function. */
for (i = 0; i < 256; i++)
{
if (map[i].type == ISKMAP)
- {
- int saved_index = where_is_rep_index;
- char *rep;
+ {
+ int saved_index = where_is_rep_index;
+ char *rep;
- sprintf (where_is_rep + where_is_rep_index, "%s ",
- pretty_keyname (i));
+ sprintf (where_is_rep + where_is_rep_index, "%s ",
+ pretty_keyname (i));
- where_is_rep_index = strlen (where_is_rep);
- rep = where_is_internal ((Keymap)map[i].function, function);
+ where_is_rep_index = strlen (where_is_rep);
+ rep = where_is_internal ((Keymap)map[i].function, function);
- if (rep)
- return (where_is_rep);
+ if (rep)
+ return (where_is_rep);
- where_is_rep_index = saved_index;
- }
+ where_is_rep_index = saved_index;
+ }
}
return ((char *)NULL);
@@ -729,7 +728,7 @@ DECLARE_INFO_COMMAND (info_where_is,
{
char *command_name;
- command_name = read_function_name ("Where is command: ", window);
+ command_name = read_function_name (_("Where is command: "), window);
if (!command_name)
{
@@ -744,27 +743,27 @@ DECLARE_INFO_COMMAND (info_where_is,
function = named_function (command_name);
if (function)
- {
- char *location;
-
- location = where_is (active_window->keymap, function);
-
- if (!location)
- {
- info_error ("`%s' is not on any keys", command_name);
- }
- else
- {
- if (strncmp (location, "M-x ", 4) == 0)
- window_message_in_echo_area
- ("%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 *location;
+
+ location = where_is (active_window->keymap, function);
+
+ if (!location)
+ {
+ info_error (_("`%s' is not on any keys"), command_name);
+ }
+ else
+ {
+ if (strncmp (location, "M-x ", 4) == 0)
+ window_message_in_echo_area
+ (_("%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);
+ }
+ }
else
- info_error ("There is no function named `%s'", command_name);
+ info_error (_("There is no function named `%s'"), command_name);
}
free (command_name);
diff --git a/texinfo/info/infomap.c b/texinfo/info/infomap.c
index 3f24f1f55d5..7591283dc59 100644
--- a/texinfo/info/infomap.c
+++ b/texinfo/info/infomap.c
@@ -1,9 +1,7 @@
-/* infomap.c -- Keymaps for Info. */
+/* infomap.c -- Keymaps for Info.
+ $Id: infomap.c,v 1.7 1997/07/31 20:37:32 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,10 +19,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include "stdio.h"
-#include "ctype.h"
+#include "info.h"
#include "infomap.h"
#include "funs.h"
+#include "terminal.h"
/* Return a new keymap which has all the uppercase letters mapped to run
the function info_do_lowercase_version (). */
@@ -82,16 +80,63 @@ keymap_discard_keymap (map)
for (i = 0; i < 256; i++)
{
switch (map[i].type)
- {
- case ISFUNC:
- break;
+ {
+ case ISFUNC:
+ break;
- case ISKMAP:
- keymap_discard_keymap ((Keymap)map[i].function);
- break;
+ case ISKMAP:
+ keymap_discard_keymap ((Keymap)map[i].function);
+ break;
- }
+ }
+ }
+}
+
+/* Conditionally bind key sequence. */
+int
+keymap_bind_keyseq (map, keyseq, keyentry)
+ Keymap map;
+ const unsigned char *keyseq;
+ KEYMAP_ENTRY *keyentry;
+{
+ register Keymap m = map;
+ register const unsigned char *s = keyseq;
+ register int c;
+
+ if (s == NULL || *s == '\0') return 0;
+
+ while ((c = *s++) != '\0')
+ {
+ switch (m[c].type)
+ {
+ case ISFUNC:
+ if (!(m[c].function == NULL ||
+ (m != map && m[c].function == info_do_lowercase_version)))
+ return 0;
+
+ if (*s != '\0')
+ {
+ m[c].type = ISKMAP;
+ m[c].function = (VFunction *)keymap_make_keymap ();
+ }
+ break;
+
+ case ISKMAP:
+ if (*s == '\0')
+ return 0;
+ break;
+ }
+ if (*s != '\0')
+ {
+ m = (Keymap)m[c].function;
+ }
+ else
+ {
+ m[c] = *keyentry;
+ }
}
+
+ return 1;
}
/* Initialize the standard info keymaps. */
@@ -117,15 +162,15 @@ initialize_info_keymaps ()
echo_area_keymap[ESC].function = (VFunction *)keymap_make_keymap ();
echo_area_keymap[Control ('x')].type = ISKMAP;
echo_area_keymap[Control ('x')].function =
- (VFunction *)keymap_make_keymap ();
+ (VFunction *)keymap_make_keymap ();
}
/* Bind numeric arg functions for both echo area and info window maps. */
for (i = '0'; i < '9' + 1; i++)
{
((Keymap) info_keymap[ESC].function)[i].function =
- ((Keymap) echo_area_keymap[ESC].function)[i].function =
- info_add_digit_to_numeric_arg;
+ ((Keymap) echo_area_keymap[ESC].function)[i].function =
+ info_add_digit_to_numeric_arg;
}
((Keymap) info_keymap[ESC].function)['-'].function =
((Keymap) echo_area_keymap[ESC].function)['-'].function =
@@ -182,6 +227,31 @@ initialize_info_keymaps ()
map['o'].function = info_next_window;
map[DEL].function = ea_backward_kill_line;
+ /* Arrow key bindings for echo area keymaps. It seems that some
+ terminals do not match their termcap entries, so it's best to just
+ define everything with both of the usual prefixes. */
+ map = echo_area_keymap;
+ keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */
+ keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]);
+ keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]);
+ keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */
+ keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]);
+ keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]);
+ keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */
+ keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]);
+ keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]);
+ keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
+ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
+ keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+
+ map = (Keymap)echo_area_keymap[ESC].function;
+ keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
+ keymap_bind_keyseq (map, "\033OA", &map['b']);
+ keymap_bind_keyseq (map, "\033[A", &map['b']);
+ keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
+ keymap_bind_keyseq (map, "\033OB", &map['f']);
+ keymap_bind_keyseq (map, "\033[B", &map['f']);
+
/* Bind commands for Info window keymaps. */
map = info_keymap;
map[TAB].function = info_move_to_next_xref;
@@ -264,11 +334,35 @@ initialize_info_keymaps ()
map['o'].function = info_next_window;
map['t'].function = info_tile_windows;
map['w'].function = info_toggle_wrap;
-}
-/* Strings which represent the sequence of characters that the arrow keys
- produce. If these keys begin with ESC, and the second character of the
- sequence does not conflict with an existing binding in the Meta keymap,
- then bind the keys to do what C-p, C-n, C-f, and C-b do. */
-extern char *term_ku, *term_kd, *term_kr, *term_kl;
+ /* Arrow key bindings for Info windows keymap. */
+ map = info_keymap;
+ keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
+ keymap_bind_keyseq (map, term_ku, &map[Control ('p')]); /* up */
+ keymap_bind_keyseq (map, "\033OA", &map[Control ('p')]);
+ keymap_bind_keyseq (map, "\033[A", &map[Control ('p')]);
+ keymap_bind_keyseq (map, term_kd, &map[Control ('n')]); /* down */
+ keymap_bind_keyseq (map, "\033OB", &map[Control ('n')]);
+ keymap_bind_keyseq (map, "\033[B", &map[Control ('n')]);
+ keymap_bind_keyseq (map, term_kr, &map[Control ('f')]); /* right */
+ keymap_bind_keyseq (map, "\033OC", &map[Control ('f')]);
+ keymap_bind_keyseq (map, "\033[C", &map[Control ('f')]);
+ keymap_bind_keyseq (map, term_kl, &map[Control ('b')]); /* left */
+ keymap_bind_keyseq (map, "\033OD", &map[Control ('b')]);
+ keymap_bind_keyseq (map, "\033[D", &map[Control ('b')]);
+ map = (Keymap)info_keymap[ESC].function;
+ keymap_bind_keyseq (map, term_kl, &map['b']); /* left */
+ keymap_bind_keyseq (map, "\033OA", &map['b']);
+ keymap_bind_keyseq (map, "\033[A", &map['b']);
+ keymap_bind_keyseq (map, term_kr, &map['f']); /* right */
+ keymap_bind_keyseq (map, "\033OB", &map['f']);
+ keymap_bind_keyseq (map, "\033[B", &map['f']);
+ keymap_bind_keyseq (map, term_kN, &map[Control ('v')]); /* pagedown */
+
+ /* The alternative to this definition of a `main map' key in the
+ `ESC map' section, is something like:
+ keymap_bind_keyseq (map, term_kP, &((KeyMap)map[ESC].function).map['v']);
+ */
+ keymap_bind_keyseq (info_keymap/*sic*/, term_kP, &map['v']); /* pageup */
+}
diff --git a/texinfo/info/infomap.h b/texinfo/info/infomap.h
index faf93884fd5..65968cbdff4 100644
--- a/texinfo/info/infomap.h
+++ b/texinfo/info/infomap.h
@@ -21,14 +21,14 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_INFOMAP_H_)
-#define _INFOMAP_H_
+#ifndef INFOMAP_H
+#define INFOMAP_H
-#include "general.h"
+#include "info.h"
#define ESC '\033'
#define DEL '\177'
-#define TAB '\011'
+#define TAB '\011'
#define RET '\r'
#define LFD '\n'
#define SPC ' '
@@ -79,4 +79,4 @@ extern void keymap_discard_keymap ();
/* Initialize the info keymaps. */
extern void initialize_info_keymaps ();
-#endif /* !_INFOMAP_H_ */
+#endif /* not INFOMAP_H */
diff --git a/texinfo/info/m-x.c b/texinfo/info/m-x.c
index 03ac1a52232..28b8e80e730 100644
--- a/texinfo/info/m-x.c
+++ b/texinfo/info/m-x.c
@@ -1,9 +1,7 @@
-/* m-x.c -- Meta-X minibuffer reader. */
+/* m-x.c -- Meta-X minibuffer reader.
+ $Id: m-x.c,v 1.5 1997/07/24 21:28:00 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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
@@ -24,9 +22,9 @@
#include "info.h"
/* **************************************************************** */
-/* */
-/* Reading Named Commands */
-/* */
+/* */
+/* Reading Named Commands */
+/* */
/* **************************************************************** */
/* Read the name of an Info function in the echo area and return the
@@ -49,12 +47,12 @@ read_function_name (prompt, window)
REFERENCE *entry;
entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->label = strdup (function_doc_array[i].func_name);
+ entry->label = xstrdup (function_doc_array[i].func_name);
entry->nodename = (char *)NULL;
entry->filename = (char *)NULL;
add_pointer_to_array
- (entry, array_index, array, array_slots, 200, REFERENCE *);
+ (entry, array_index, array, array_slots, 200, REFERENCE *);
}
line = info_read_completing_in_echo_area (window, prompt, array);
@@ -68,11 +66,11 @@ read_function_name (prompt, window)
}
DECLARE_INFO_COMMAND (describe_command,
- "Read the name of an Info command and describe it")
+ _("Read the name of an Info command and describe it"))
{
char *line;
- line = read_function_name ("Describe command: ", window);
+ line = read_function_name (_("Describe command: "), window);
if (!line)
{
@@ -83,22 +81,19 @@ DECLARE_INFO_COMMAND (describe_command,
/* Describe the function named in "LINE". */
if (*line)
{
- char *fundoc;
- VFunction *fun;
-
- fun = named_function (line);
+ VFunction *fun = named_function (line);
if (!fun)
- return;
+ return;
window_message_in_echo_area ("%s: %s.",
- line, function_documentation (fun));
+ line, function_documentation (fun));
}
free (line);
}
DECLARE_INFO_COMMAND (info_execute_command,
- "Read a command name in the echo area and execute it")
+ _("Read a command name in the echo area and execute it"))
{
char *line;
@@ -133,11 +128,11 @@ DECLARE_INFO_COMMAND (info_execute_command,
VFunction *function;
if ((active_window != the_echo_area) &&
- (strncmp (line, "echo-area-", 10) == 0))
+ (strncmp (line, "echo-area-", 10) == 0))
{
- free (line);
- info_error ("Cannot execute an `echo-area' command here.");
- return;
+ free (line);
+ info_error (_("Cannot execute an `echo-area' command here."));
+ return;
}
function = named_function (line);
@@ -152,7 +147,7 @@ DECLARE_INFO_COMMAND (info_execute_command,
/* Okay, now that we have M-x, let the user set the screen height. */
DECLARE_INFO_COMMAND (set_screen_height,
- "Set the height of the displayed window")
+ _("Set the height of the displayed window"))
{
int new_height;
@@ -165,24 +160,24 @@ DECLARE_INFO_COMMAND (set_screen_height,
new_height = screenheight;
- sprintf (prompt, "Set screen height to (%d): ", new_height);
+ sprintf (prompt, _("Set screen height to (%d): "), new_height);
line = info_read_in_echo_area (window, prompt);
/* If the user aborted, do that now. */
if (!line)
- {
- info_abort_key (active_window, count, 0);
- return;
- }
+ {
+ info_abort_key (active_window, count, 0);
+ return;
+ }
/* Find out what the new height is supposed to be. */
if (*line)
- new_height = atoi (line);
+ new_height = atoi (line);
/* Clear the echo area if it isn't active. */
if (!echo_area_is_active)
- window_clear_echo_area ();
+ window_clear_echo_area ();
free (line);
}
diff --git a/texinfo/info/makedoc.c b/texinfo/info/makedoc.c
index c0c4587ff18..c88663fcddf 100644
--- a/texinfo/info/makedoc.c
+++ b/texinfo/info/makedoc.c
@@ -1,9 +1,10 @@
-/* makedoc.c -- Make DOC.C and FUNS.H from input files. */
+/* makedoc.c -- Make doc.c and funs.h from input files.
+ $Id: makedoc.c,v 1.4 1997/07/15 18:35:59 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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
@@ -26,24 +27,8 @@
a header file which describes the contents. This only does the functions
declared with DECLARE_INFO_COMMAND. */
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#if defined (HAVE_SYS_FILE_H)
-#include <sys/file.h>
-#endif /* HAVE_SYS_FILE_H */
-#include <sys/stat.h>
-#include "general.h"
-
-#if !defined (O_RDONLY)
-#if defined (HAVE_SYS_FCNTL_H)
-#include <sys/fcntl.h>
-#else /* !HAVE_SYS_FCNTL_H */
-#include <fcntl.h>
-#endif /* !HAVE_SYS_FCNTL_H */
-#endif /* !O_RDONLY */
-
-extern void *xmalloc (), *xrealloc ();
+#include "info.h"
+
static void fatal_file_error ();
/* Name of the header file which receives the declarations of functions. */
@@ -79,15 +64,15 @@ static char *doc_header_1[] = {
/* How to remember the locations of the functions found so that Emacs
can use the information in a tag table. */
typedef struct {
- char *name; /* Name of the tag. */
- int line; /* Line number at which it appears. */
- long char_offset; /* Character offset at which it appears. */
+ char *name; /* Name of the tag. */
+ int line; /* Line number at which it appears. */
+ long char_offset; /* Character offset at which it appears. */
} EMACS_TAG;
typedef struct {
- char *filename; /* Name of the file containing entries. */
- long entrylen; /* Total number of characters in tag block. */
- EMACS_TAG **entries; /* Entries found in FILENAME. */
+ char *filename; /* Name of the file containing entries. */
+ long entrylen; /* Total number of characters in tag block. */
+ EMACS_TAG **entries; /* Entries found in FILENAME. */
int entries_index;
int entries_slots;
} EMACS_TAG_BLOCK;
@@ -114,8 +99,8 @@ main (argc, argv)
for (i = 1; i < argc; i++)
if (strcmp (argv[i], "-tags") == 0)
{
- tags_only++;
- break;
+ tags_only++;
+ break;
}
if (tags_only)
@@ -128,8 +113,8 @@ main (argc, argv)
doc_stream = must_fopen (doc_filename, "w");
fprintf (funs_stream,
- "/* %s -- Generated declarations for Info commands. */\n",
- funs_filename);
+ "/* %s -- Generated declarations for Info commands. */\n",
+ funs_filename);
for (i = 0; doc_header[i]; i++)
{
@@ -138,7 +123,7 @@ main (argc, argv)
}
fprintf (doc_stream,
- " Source files groveled to make this file include:\n\n");
+ _(" Source files groveled to make this file include:\n\n"));
for (i = 1; i < argc; i++)
fprintf (doc_stream, "\t%s\n", argv[i]);
@@ -155,17 +140,17 @@ main (argc, argv)
curfile = argv[i];
if (*curfile == '-')
- continue;
+ continue;
fprintf (doc_stream, "/* Commands found in \"%s\". */\n", curfile);
fprintf (funs_stream, "\n/* Functions declared in \"%s\". */\n",
- curfile);
+ curfile);
process_one_file (curfile, doc_stream, funs_stream);
}
fprintf (doc_stream,
- " { (VFunction *)NULL, (char *)NULL, (char *)NULL }\n};\n");
+ " { (VFunction *)NULL, (char *)NULL, (char *)NULL }\n};\n");
fclose (funs_stream);
fclose (doc_stream);
@@ -195,25 +180,25 @@ maybe_dump_tags (stream)
/* Calculate the length of the dumped block first. */
for (j = 0; j < block->entries_index; j++)
- {
- char digits[30];
- etag = block->entries[j];
- block_len += 3 + strlen (etag->name);
- sprintf (digits, "%d,%d", etag->line, etag->char_offset);
- block_len += strlen (digits);
- }
+ {
+ char digits[30];
+ etag = block->entries[j];
+ block_len += 3 + strlen (etag->name);
+ sprintf (digits, "%d,%ld", etag->line, etag->char_offset);
+ block_len += strlen (digits);
+ }
/* Print out the defining line. */
- fprintf (stream, "\f\n%s,%d\n", block->filename, block_len);
+ fprintf (stream, "\f\n%s,%ld\n", block->filename, block_len);
/* Print out the individual tags. */
for (j = 0; j < block->entries_index; j++)
- {
- etag = block->entries[j];
+ {
+ etag = block->entries[j];
- fprintf (stream, "%s,\177%d,%d\n",
- etag->name, etag->line, etag->char_offset);
- }
+ fprintf (stream, "%s,\177%d,%ld\n",
+ etag->name, etag->line, etag->char_offset);
+ }
}
}
@@ -226,7 +211,7 @@ make_emacs_tag_block (filename)
EMACS_TAG_BLOCK *block;
block = (EMACS_TAG_BLOCK *)xmalloc (sizeof (EMACS_TAG_BLOCK));
- block->filename = strdup (filename);
+ block->filename = xstrdup (filename);
block->entrylen = 0;
block->entries = (EMACS_TAG **)NULL;
block->entries_index = 0;
@@ -248,7 +233,7 @@ add_tag_to_block (block, name, line, char_offset)
tag->line = line;
tag->char_offset = char_offset;
add_pointer_to_array (tag, block->entries_index, block->entries,
- block->entries_slots, 50, EMACS_TAG *);
+ block->entries_slots, 50, EMACS_TAG *);
}
/* Read the file represented by FILENAME into core, and search it for Info
@@ -297,51 +282,51 @@ process_one_file (filename, doc_stream, funs_stream)
#endif /* NAMED_FUNCTIONS */
for (; offset < (file_size - decl_len); offset++)
- {
- if (buffer[offset] == '\n')
- {
- line_number++;
- line_start = offset + 1;
- }
-
- if (strncmp (buffer + offset, decl_str, decl_len) == 0)
- {
- offset += decl_len;
- point = offset;
- break;
- }
- }
+ {
+ if (buffer[offset] == '\n')
+ {
+ line_number++;
+ line_start = offset + 1;
+ }
+
+ if (strncmp (buffer + offset, decl_str, decl_len) == 0)
+ {
+ offset += decl_len;
+ point = offset;
+ break;
+ }
+ }
if (!point)
- break;
+ break;
/* Skip forward until we find the open paren. */
while (point < file_size)
- {
- if (buffer[point] == '\n')
- {
- line_number++;
- line_start = point + 1;
- }
- else if (buffer[point] == '(')
- break;
-
- point++;
- }
+ {
+ if (buffer[point] == '\n')
+ {
+ line_number++;
+ line_start = point + 1;
+ }
+ else if (buffer[point] == '(')
+ break;
+
+ point++;
+ }
while (point++ < file_size)
- {
- if (!whitespace_or_newline (buffer[point]))
- break;
- else if (buffer[point] == '\n')
- {
- line_number++;
- line_start = point + 1;
- }
- }
+ {
+ if (!whitespace_or_newline (buffer[point]))
+ break;
+ else if (buffer[point] == '\n')
+ {
+ line_number++;
+ line_start = point + 1;
+ }
+ }
if (point >= file_size)
- break;
+ break;
/* Now looking at name of function. Get it. */
for (offset = point; buffer[offset] != ','; offset++);
@@ -351,42 +336,42 @@ process_one_file (filename, doc_stream, funs_stream)
/* Remember this tag in the current block. */
{
- char *tag_name;
+ char *tag_name;
- tag_name = (char *)xmalloc (1 + (offset - line_start));
- strncpy (tag_name, buffer + line_start, offset - line_start);
- tag_name[offset - line_start] = '\0';
- add_tag_to_block (block, tag_name, line_number, point);
+ tag_name = (char *)xmalloc (1 + (offset - line_start));
+ strncpy (tag_name, buffer + line_start, offset - line_start);
+ tag_name[offset - line_start] = '\0';
+ add_tag_to_block (block, tag_name, line_number, point);
}
#if defined (NAMED_FUNCTIONS)
/* Generate the user-visible function name from the function's name. */
{
- register int i;
- char *name_start;
+ register int i;
+ char *name_start;
- name_start = func;
+ name_start = func;
- if (strncmp (name_start, "info_", 5) == 0)
- name_start += 5;
+ if (strncmp (name_start, "info_", 5) == 0)
+ name_start += 5;
- func_name = strdup (name_start);
+ func_name = xstrdup (name_start);
- /* Fix up "ea" commands. */
- if (strncmp (func_name, "ea_", 3) == 0)
- {
- char *temp_func_name;
+ /* Fix up "ea" commands. */
+ if (strncmp (func_name, "ea_", 3) == 0)
+ {
+ char *temp_func_name;
- temp_func_name = (char *)xmalloc (10 + strlen (func_name));
- strcpy (temp_func_name, "echo_area_");
- strcat (temp_func_name, func_name + 3);
- free (func_name);
- func_name = temp_func_name;
- }
+ temp_func_name = (char *)xmalloc (10 + strlen (func_name));
+ strcpy (temp_func_name, "echo_area_");
+ strcat (temp_func_name, func_name + 3);
+ free (func_name);
+ func_name = temp_func_name;
+ }
- for (i = 0; func_name[i]; i++)
- if (func_name[i] == '_')
- func_name[i] = '-';
+ for (i = 0; func_name[i]; i++)
+ if (func_name[i] == '_')
+ func_name[i] = '-';
}
#endif /* NAMED_FUNCTIONS */
@@ -394,40 +379,40 @@ process_one_file (filename, doc_stream, funs_stream)
point = offset + 1;
while (point < file_size)
- {
- if (buffer[point] == '\n')
- {
- line_number++;
- line_start = point + 1;
- }
-
- if (buffer[point] == '"')
- break;
- else
- point++;
- }
+ {
+ if (buffer[point] == '\n')
+ {
+ line_number++;
+ line_start = point + 1;
+ }
+
+ if (buffer[point] == '"')
+ break;
+ else
+ point++;
+ }
offset = point + 1;
while (offset < file_size)
- {
- if (buffer[offset] == '\n')
- {
- line_number++;
- line_start = offset + 1;
- }
-
- if (buffer[offset] == '\\')
- offset += 2;
- else if (buffer[offset] == '"')
- break;
- else
- offset++;
- }
+ {
+ if (buffer[offset] == '\n')
+ {
+ line_number++;
+ line_start = offset + 1;
+ }
+
+ if (buffer[offset] == '\\')
+ offset += 2;
+ else if (buffer[offset] == '"')
+ break;
+ else
+ offset++;
+ }
offset++;
if (offset >= file_size)
- break;
+ break;
doc = (char *)xmalloc (1 + (offset - point));
strncpy (doc, buffer + point, offset - point);
@@ -450,7 +435,7 @@ process_one_file (filename, doc_stream, funs_stream)
free the memory already allocated to it. */
if (block->entries)
add_pointer_to_array (block, emacs_tags_index, emacs_tags,
- emacs_tags_slots, 10, EMACS_TAG_BLOCK *);
+ emacs_tags_slots, 10, EMACS_TAG_BLOCK *);
else
{
free (block->filename);
@@ -462,7 +447,7 @@ static void
fatal_file_error (filename)
char *filename;
{
- fprintf (stderr, "Couldn't manipulate the file %s.\n", filename);
+ fprintf (stderr, _("Couldn't manipulate the file %s.\n"), filename);
exit (2);
}
diff --git a/texinfo/info/man.h b/texinfo/info/man.h
index 1584e260687..3cf4b162a50 100644
--- a/texinfo/info/man.h
+++ b/texinfo/info/man.h
@@ -1,9 +1,10 @@
-/* man.h: Defines and external function declarations for man.c */
+/* man.h: Defines and external function declarations for man.c.
+ $Id: man.h,v 1.2 1997/07/15 18:42:56 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Author: Brian J. Fox (bfox@ai.mit.edu) Sat May 6 16:19:13 1995. */
-#if !defined (_MAN_H_)
-#define _MAN_H_
+#ifndef INFO_MAN_H
+#define INFO_MAN_H
#define MANPAGE_FILE_BUFFER_NAME "*manpages*"
@@ -33,4 +34,4 @@ 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 */);
-#endif /* !_MAN_H_ */
+#endif /* INFO_MAN_H */
diff --git a/texinfo/info/nodemenu.c b/texinfo/info/nodemenu.c
index 33044157bd2..26326574742 100644
--- a/texinfo/info/nodemenu.c
+++ b/texinfo/info/nodemenu.c
@@ -1,9 +1,7 @@
-/* nodemenu.c -- Produce a menu of all visited nodes. */
+/* nodemenu.c -- Produce a menu of all visited nodes.
+ $Id: nodemenu.c,v 1.7 1997/07/24 21:30:30 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,10 +25,10 @@
static char *
nodemenu_format_info ()
{
- return ("\n\
+ return (_("\n\
* Menu:\n\
(File)Node Lines Size Containing File\n\
- ---------- ----- ---- ---------------");
+ ---------- ----- ---- ---------------"));
}
/* Produce a formatted line of information about NODE. Here is what we want
@@ -41,7 +39,7 @@ nodemenu_format_info ()
---------- ----- ---- ---------------
* (emacs)Buffers:: 48 2230 /usr/gnu/info/emacs/emacs-1
* (autoconf)Writing configure.in:: 123 58789 /usr/gnu/info/autoconf/autoconf-1
-* (dir)Top:: 40 589 /usr/gnu/info/dir
+* (dir)Top:: 40 589 /usr/gnu/info/dir
*/
static char *
format_node_info (node)
@@ -58,7 +56,7 @@ format_node_info (node)
{
parent = filename_non_directory (node->parent);
if (!parent)
- parent = node->parent;
+ parent = node->parent;
}
else
parent = (char *)NULL;
@@ -72,15 +70,15 @@ format_node_info (node)
char *file = (char *)NULL;
if (parent)
- file = parent;
+ file = parent;
else
- file = filename_non_directory (containing_file);
+ file = filename_non_directory (containing_file);
if (!file)
- file = containing_file;
+ file = containing_file;
if (!*file)
- file = "dir";
+ file = "dir";
sprintf (line_buffer, "* (%s)%s::", file, node->nodename);
}
@@ -92,13 +90,13 @@ format_node_info (node)
for (i = 0; i < node->nodelen; i++)
if (node->contents[i] == '\n')
- lines++;
+ lines++;
sprintf (line_buffer + len, "%d", lines);
}
len = pad_to (44, line_buffer);
- sprintf (line_buffer + len, "%d", node->nodelen);
+ sprintf (line_buffer + len, "%ld", node->nodelen);
if (node->filename && *(node->filename))
{
@@ -106,7 +104,7 @@ format_node_info (node)
sprintf (line_buffer + len, node->filename);
}
- return (strdup (line_buffer));
+ return xstrdup (line_buffer);
}
/* Little string comparison routine for qsort (). */
@@ -137,26 +135,26 @@ get_visited_nodes (filter_func)
if (!info_windows)
return ((NODE *)NULL);
- for (iw_index = 0; info_win = info_windows[iw_index]; iw_index++)
+ for (iw_index = 0; (info_win = info_windows[iw_index]); iw_index++)
{
for (i = 0; i < info_win->nodes_index; i++)
- {
- node = info_win->nodes[i];
-
- /* We skip mentioning "*Node Menu*" nodes. */
- if (internal_info_node_p (node) &&
- (strcmp (node->nodename, nodemenu_nodename) == 0))
- continue;
-
- if (node && (!filter_func || (*filter_func) (node)))
- {
- char *line;
-
- line = format_node_info (node);
- add_pointer_to_array
- (line, lines_index, lines, lines_slots, 20, char *);
- }
- }
+ {
+ node = info_win->nodes[i];
+
+ /* We skip mentioning "*Node Menu*" nodes. */
+ if (internal_info_node_p (node) &&
+ (strcmp (node->nodename, nodemenu_nodename) == 0))
+ continue;
+
+ if (node && (!filter_func || (*filter_func) (node)))
+ {
+ char *line;
+
+ line = format_node_info (node);
+ add_pointer_to_array
+ (line, lines_index, lines, lines_slots, 20, char *);
+ }
+ }
}
/* Sort the array of information lines, if there are any. */
@@ -169,22 +167,22 @@ get_visited_nodes (filter_func)
/* Delete duplicates. */
for (i = 0, newlen = 1; i < lines_index - 1; i++)
- {
- if (strcmp (lines[i], lines[i + 1]) == 0)
- {
- free (lines[i]);
- lines[i] = (char *)NULL;
- }
- else
- newlen++;
- }
+ {
+ if (strcmp (lines[i], lines[i + 1]) == 0)
+ {
+ free (lines[i]);
+ lines[i] = (char *)NULL;
+ }
+ else
+ newlen++;
+ }
/* We have free ()'d and marked all of the duplicate slots.
- Copy the live slots rather than pruning the dead slots. */
+ Copy the live slots rather than pruning the dead slots. */
temp = (char **)xmalloc ((1 + newlen) * sizeof (char *));
for (i = 0, j = 0; i < lines_index; i++)
- if (lines[i])
- temp[j++] = lines[i];
+ if (lines[i])
+ temp[j++] = lines[i];
temp[j] = (char *)NULL;
free (lines);
@@ -196,8 +194,8 @@ 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"));
+ (_("Here is the menu of nodes you have recently visited.\n\
+Select one from this menu, or use `\\[history-node]' in another window.\n")));
printf_to_message_buffer ("%s\n", nodemenu_format_info ());
@@ -216,7 +214,7 @@ Select one from this menu, or use `\\[history-node]' in another window.\n"));
}
DECLARE_INFO_COMMAND (list_visited_nodes,
- "Make a window containing a menu of all of the currently visited nodes")
+ _("Make a window containing a menu of all of the currently visited nodes"))
{
WINDOW *new;
NODE *node;
@@ -229,14 +227,20 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
node = new->node;
if (internal_info_node_p (node) &&
- (strcmp (node->nodename, nodemenu_nodename) == 0))
- break;
+ (strcmp (node->nodename, nodemenu_nodename) == 0))
+ break;
}
/* If we couldn't find an existing window, try to use the next window
in the chain. */
- if (!new && window->next)
- new = window->next;
+ if (!new)
+ {
+ if (window->next)
+ new = window->next;
+ /* If there is more than one window, wrap around. */
+ else if (window != windows)
+ new = windows;
+ }
/* If we still don't have a window, make a new one to contain the list. */
if (!new)
@@ -258,10 +262,16 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
node = get_visited_nodes ((Function *)NULL);
name_internal_node (node, nodemenu_nodename);
+#if 0
/* Even if this is an internal node, we don't want the window
system to treat it specially. So we turn off the internalness
of it here. */
+ /* Why? We depend on internal_info_node_p returning true, so we must
+ not remove the flag. Otherwise, the *Node Menu* nodes themselves
+ appear in the node menu. --Andreas Schwab
+ <schwab@issan.informatik.uni-dortmund.de>. */
node->flags &= ~N_IsInternal;
+#endif
/* If this window is already showing a node menu, reuse the existing node
slot. */
@@ -270,7 +280,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
#if defined (NOTDEF)
if (internal_info_node_p (new->node) &&
- (strcmp (new->node->nodename, nodemenu_nodename) == 0))
+ (strcmp (new->node->nodename, nodemenu_nodename) == 0))
remember_me = 0;
#endif /* NOTDEF */
@@ -284,7 +294,7 @@ DECLARE_INFO_COMMAND (list_visited_nodes,
}
DECLARE_INFO_COMMAND (select_visited_node,
- "Select a node which has been previously visited in a visible window")
+ _("Select a node which has been previously visited in a visible window"))
{
char *line;
NODE *node;
@@ -296,7 +306,7 @@ 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, _("Select visited node: "), menu);
window = active_window;
@@ -316,9 +326,9 @@ DECLARE_INFO_COMMAND (select_visited_node,
entry = info_get_labeled_reference (line, menu);
if (!entry)
- info_error ("The reference disappeared! (%s).", line);
+ info_error (_("The reference disappeared! (%s)."), line);
else
- info_select_reference (window, entry);
+ info_select_reference (window, entry);
}
free (line);
diff --git a/texinfo/info/nodes.c b/texinfo/info/nodes.c
index 8995c78195f..f2737e7b354 100644
--- a/texinfo/info/nodes.c
+++ b/texinfo/info/nodes.c
@@ -21,17 +21,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#if defined (HAVE_SYS_FILE_H)
-#include <sys/file.h>
-#endif /* HAVE_SYS_FILE_H */
-#include <sys/errno.h>
-#include <sys/stat.h>
-#if defined (HAVE_STRING_H)
-#include <string.h>
-#endif /* HAVE_STRING_H */
+#include "info.h"
+
#include "nodes.h"
#include "search.h"
#include "filesys.h"
@@ -41,22 +32,10 @@
# include "man.h"
#endif /* HANDLE_MAN_PAGES */
-#if !defined (O_RDONLY)
-#if defined (HAVE_SYS_FCNTL_H)
-#include <sys/fcntl.h>
-#else /* !HAVE_SYS_FCNTL_H */
-#include <fcntl.h>
-#endif /* !HAVE_SYS_FCNTL_H */
-#endif /* !O_RDONLY */
-
-#if !defined (errno)
-extern int errno;
-#endif /* !errno */
-
/* **************************************************************** */
-/* */
-/* Functions Static to this File */
-/* */
+/* */
+/* Functions Static to this File */
+/* */
/* **************************************************************** */
static void forget_info_file (), remember_info_file ();
@@ -81,9 +60,9 @@ static long get_node_length ();
#define INFO_GET_TAGS 1
/* **************************************************************** */
-/* */
-/* Global Variables */
-/* */
+/* */
+/* Global Variables */
+/* */
/* **************************************************************** */
/* When non-zero, this is a string describing the recent file error. */
@@ -96,9 +75,9 @@ FILE_BUFFER **info_loaded_files = (FILE_BUFFER **)NULL;
int info_loaded_files_slots = 0;
/* **************************************************************** */
-/* */
-/* Public Functions for Node Manipulation */
-/* */
+/* */
+/* Public Functions for Node Manipulation */
+/* */
/* **************************************************************** */
/* Used to build "dir" menu from "localdir" files found in INFOPATH. */
@@ -142,8 +121,8 @@ info_get_node (filename, nodename)
if (!file_buffer)
{
if (filesys_error_number)
- info_recent_file_error =
- filesys_error_string (filename, filesys_error_number);
+ info_recent_file_error =
+ filesys_error_string (filename, filesys_error_number);
return ((NODE *)NULL);
}
@@ -154,9 +133,9 @@ info_get_node (filename, nodename)
{
node = info_get_node_of_file_buffer ("Top", file_buffer);
if (!node)
- node = info_get_node_of_file_buffer ("top", file_buffer);
+ node = info_get_node_of_file_buffer ("top", file_buffer);
if (!node)
- node = info_get_node_of_file_buffer ("TOP", file_buffer);
+ node = info_get_node_of_file_buffer ("TOP", file_buffer);
}
return (node);
}
@@ -193,7 +172,7 @@ info_get_node_of_file_buffer (nodename, file_buffer)
node = (NODE *)xmalloc (sizeof (NODE));
node->filename = file_buffer->fullpath;
node->parent = (char *)NULL;
- node->nodename = strdup ("*");
+ node->nodename = xstrdup ("*");
node->contents = file_buffer->contents;
node->nodelen = file_buffer->filesize;
node->flags = 0;
@@ -203,7 +182,7 @@ info_get_node_of_file_buffer (nodename, file_buffer)
the manpage node finding function instead. */
else if (file_buffer->flags & N_IsManPage)
{
- node = get_manpage_node (file_buffer, nodename);
+ node = get_manpage_node (file_buffer, nodename);
}
#endif /* HANDLE_MAN_PAGES */
/* If this is the "main" info file, it might contain a tags table. Search
@@ -242,9 +221,9 @@ info_load_file (filename)
/* **************************************************************** */
-/* */
-/* Private Functions Implementation */
-/* */
+/* */
+/* Private Functions Implementation */
+/* */
/* **************************************************************** */
/* The workhorse for info_find_file (). Non-zero 2nd argument says to
@@ -263,58 +242,58 @@ info_find_file_internal (filename, get_tags)
/* First try to find the file in our list of already loaded files. */
if (info_loaded_files)
{
- for (i = 0; file_buffer = info_loaded_files[i]; i++)
- if ((strcmp (filename, file_buffer->filename) == 0) ||
- (strcmp (filename, file_buffer->fullpath) == 0) ||
- ((*filename != '/') &&
- strcmp (filename,
- filename_non_directory (file_buffer->fullpath)) == 0))
- {
- struct stat new_info, *old_info;
-
- /* This file is loaded. If the filename that we want is
- specifically "dir", then simply return the file buffer. */
- if (strcasecmp (filename_non_directory (filename), "dir") == 0)
- return (file_buffer);
+ for (i = 0; (file_buffer = info_loaded_files[i]); i++)
+ if ((strcmp (filename, file_buffer->filename) == 0) ||
+ (strcmp (filename, file_buffer->fullpath) == 0) ||
+ ((*filename != '/') &&
+ strcmp (filename,
+ filename_non_directory (file_buffer->fullpath)) == 0))
+ {
+ struct stat new_info, *old_info;
+
+ /* This file is loaded. If the filename that we want is
+ specifically "dir", then simply return the file buffer. */
+ if (strcasecmp (filename_non_directory (filename), "dir") == 0)
+ return (file_buffer);
#if defined (HANDLE_MAN_PAGES)
- /* Do the same for the magic MANPAGE file. */
- if (file_buffer->flags & N_IsManPage)
- return (file_buffer);
+ /* Do the same for the magic MANPAGE file. */
+ if (file_buffer->flags & N_IsManPage)
+ return (file_buffer);
#endif /* HANDLE_MAN_PAGES */
- /* The file appears to be already loaded, and it is not "dir".
- Check to see if it has changed since the last time it was
- loaded. */
- if (stat (file_buffer->fullpath, &new_info) == -1)
- {
- filesys_error_number = errno;
- return ((FILE_BUFFER *)NULL);
- }
-
- old_info = &file_buffer->finfo;
-
- if ((new_info.st_size != old_info->st_size) ||
- (new_info.st_mtime != old_info->st_mtime))
- {
- /* The file has changed. Forget that we ever had loaded it
- in the first place. */
- forget_info_file (filename);
- break;
- }
- else
- {
- /* The info file exists, and has not changed since the last
- time it was loaded. If the caller requested a nodes list
- for this file, and there isn't one here, build the nodes
- for this file_buffer. In any case, return the file_buffer
- object. */
- if (get_tags && !file_buffer->tags)
- build_tags_and_nodes (file_buffer);
-
- return (file_buffer);
- }
- }
+ /* The file appears to be already loaded, and it is not "dir".
+ Check to see if it has changed since the last time it was
+ loaded. */
+ if (stat (file_buffer->fullpath, &new_info) == -1)
+ {
+ filesys_error_number = errno;
+ return ((FILE_BUFFER *)NULL);
+ }
+
+ old_info = &file_buffer->finfo;
+
+ if ((new_info.st_size != old_info->st_size) ||
+ (new_info.st_mtime != old_info->st_mtime))
+ {
+ /* The file has changed. Forget that we ever had loaded it
+ in the first place. */
+ forget_info_file (filename);
+ break;
+ }
+ else
+ {
+ /* The info file exists, and has not changed since the last
+ time it was loaded. If the caller requested a nodes list
+ for this file, and there isn't one here, build the nodes
+ for this file_buffer. In any case, return the file_buffer
+ object. */
+ if (get_tags && !file_buffer->tags)
+ build_tags_and_nodes (file_buffer);
+
+ return (file_buffer);
+ }
+ }
}
/* The file wasn't loaded. Try to load it now. */
@@ -364,21 +343,21 @@ info_load_file_internal (filename, get_tags)
char *lowered_name;
char *basename;
- lowered_name = strdup (filename);
+ lowered_name = xstrdup (filename);
basename = (char *) strrchr (lowered_name, '/');
if (basename)
- basename++;
+ basename++;
else
- basename = lowered_name;
+ basename = lowered_name;
while (*basename)
- {
- if (isupper (*basename))
- *basename = tolower (*basename);
+ {
+ if (isupper (*basename))
+ *basename = tolower (*basename);
- basename++;
- }
+ basename++;
+ }
fullpath = info_find_fullpath (lowered_name);
free (lowered_name);
@@ -402,8 +381,8 @@ info_load_file_internal (filename, get_tags)
/* The file was found, and can be read. Allocate FILE_BUFFER and fill
in the various members. */
file_buffer = make_file_buffer ();
- file_buffer->filename = strdup (filename);
- file_buffer->fullpath = strdup (fullpath);
+ file_buffer->filename = xstrdup (filename);
+ file_buffer->fullpath = xstrdup (fullpath);
file_buffer->finfo = finfo;
file_buffer->filesize = filesize;
file_buffer->contents = contents;
@@ -444,81 +423,81 @@ build_tags_and_nodes (file_buffer)
if (position != -1)
while (1)
{
- long tags_table_begin, tags_table_end;
-
- binding.end = position;
- binding.start = binding.end - 5 - strlen (TAGS_TABLE_END_LABEL);
- if (binding.start < 0)
- binding.start = 0;
-
- position = find_node_separator (&binding);
-
- /* For this test, (and all others here) failure indicates a bogus
- tags table. Grovel the file. */
- if (position == -1)
- break;
-
- /* Remember the end of the tags table. */
- binding.start = position;
- tags_table_end = binding.start;
- binding.end = 0;
-
- /* Locate the start of the tags table. */
- position = search_backward (TAGS_TABLE_BEG_LABEL, &binding);
-
- if (position == -1)
- break;
-
- binding.end = position;
- binding.start = binding.end - 5 - strlen (TAGS_TABLE_BEG_LABEL);
- position = find_node_separator (&binding);
-
- if (position == -1)
- break;
-
- /* The file contains a valid tags table. Fill the FILE_BUFFER's
- tags member. */
- file_buffer->flags |= N_HasTagsTable;
- tags_table_begin = position;
-
- /* If this isn't an indirect tags table, just remember the nodes
- described locally in this tags table. Note that binding.end
- is pointing to just after the beginning label. */
- binding.start = binding.end;
- binding.end = file_buffer->filesize;
-
- if (!looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, &binding))
- {
- binding.start = tags_table_begin;
- binding.end = tags_table_end;
- get_nodes_of_tags_table (file_buffer, &binding);
- return;
- }
- else
- {
- /* This is an indirect tags table. Build TAGS member. */
- SEARCH_BINDING indirect;
-
- indirect.start = tags_table_begin;
- indirect.end = 0;
- indirect.buffer = binding.buffer;
- indirect.flags = S_FoldCase;
-
- position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect);
-
- if (position == -1)
- {
- /* This file is malformed. Give up. */
- return;
- }
-
- indirect.start = position;
- indirect.end = tags_table_begin;
- binding.start = tags_table_begin;
- binding.end = tags_table_end;
- get_tags_of_indirect_tags_table (file_buffer, &indirect, &binding);
- return;
- }
+ long tags_table_begin, tags_table_end;
+
+ binding.end = position;
+ binding.start = binding.end - 5 - strlen (TAGS_TABLE_END_LABEL);
+ if (binding.start < 0)
+ binding.start = 0;
+
+ position = find_node_separator (&binding);
+
+ /* For this test, (and all others here) failure indicates a bogus
+ tags table. Grovel the file. */
+ if (position == -1)
+ break;
+
+ /* Remember the end of the tags table. */
+ binding.start = position;
+ tags_table_end = binding.start;
+ binding.end = 0;
+
+ /* Locate the start of the tags table. */
+ position = search_backward (TAGS_TABLE_BEG_LABEL, &binding);
+
+ if (position == -1)
+ break;
+
+ binding.end = position;
+ binding.start = binding.end - 5 - strlen (TAGS_TABLE_BEG_LABEL);
+ position = find_node_separator (&binding);
+
+ if (position == -1)
+ break;
+
+ /* The file contains a valid tags table. Fill the FILE_BUFFER's
+ tags member. */
+ file_buffer->flags |= N_HasTagsTable;
+ tags_table_begin = position;
+
+ /* If this isn't an indirect tags table, just remember the nodes
+ described locally in this tags table. Note that binding.end
+ is pointing to just after the beginning label. */
+ binding.start = binding.end;
+ binding.end = file_buffer->filesize;
+
+ if (!looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, &binding))
+ {
+ binding.start = tags_table_begin;
+ binding.end = tags_table_end;
+ get_nodes_of_tags_table (file_buffer, &binding);
+ return;
+ }
+ else
+ {
+ /* This is an indirect tags table. Build TAGS member. */
+ SEARCH_BINDING indirect;
+
+ indirect.start = tags_table_begin;
+ indirect.end = 0;
+ indirect.buffer = binding.buffer;
+ indirect.flags = S_FoldCase;
+
+ position = search_backward (INDIRECT_TAGS_TABLE_LABEL, &indirect);
+
+ if (position == -1)
+ {
+ /* This file is malformed. Give up. */
+ return;
+ }
+
+ indirect.start = position;
+ indirect.end = tags_table_begin;
+ binding.start = tags_table_begin;
+ binding.end = tags_table_end;
+ get_tags_of_indirect_tags_table (file_buffer, &indirect, &binding);
+ return;
+ }
}
/* This file doesn't contain any kind of tags table. Grovel the
@@ -561,37 +540,37 @@ get_nodes_of_info_file (file_buffer)
/* If not there, this is not the start of a node. */
if (start == -1)
- continue;
+ continue;
/* Find the start of the nodename. */
start += skip_whitespace (nodeline + start);
/* Find the end of the nodename. */
end = start +
- skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES);
+ skip_node_characters (nodeline + start, DONT_SKIP_NEWLINES);
/* Okay, we have isolated the node name, and we know where the
- node starts. Remember this information in a NODE structure. */
+ node starts. Remember this information in a NODE structure. */
entry = (TAG *)xmalloc (sizeof (TAG));
entry->nodename = (char *)xmalloc (1 + (end - start));
strncpy (entry->nodename, nodeline + start, end - start);
entry->nodename[end - start] = '\0';
entry->nodestart = nodestart;
{
- SEARCH_BINDING node_body;
+ SEARCH_BINDING node_body;
- node_body.buffer = binding.buffer + binding.start;
- node_body.start = 0;
- node_body.end = binding.end - binding.start;
- node_body.flags = S_FoldCase;
- entry->nodelen = get_node_length (&node_body);
+ node_body.buffer = binding.buffer + binding.start;
+ node_body.start = 0;
+ node_body.end = binding.end - binding.start;
+ node_body.flags = S_FoldCase;
+ entry->nodelen = get_node_length (&node_body);
}
entry->filename = file_buffer->fullpath;
/* Add this tag to the array of tag structures in this FILE_BUFFER. */
add_pointer_to_array (entry, tags_index, file_buffer->tags,
- file_buffer->tags_slots, 100, TAG *);
+ file_buffer->tags_slots, 100, TAG *);
}
}
@@ -608,7 +587,7 @@ get_node_length (binding)
for (i = binding->start, body = binding->buffer; i < binding->end; i++)
{
if (body[i] == INFO_FF || body[i] == INFO_COOKIE)
- break;
+ break;
}
return ((long) i - binding->start);
}
@@ -652,16 +631,16 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
/* Skip past informative "(Indirect)" tags table line. */
if (!tags_index && looking_at (TAGS_TABLE_IS_INDIRECT_LABEL, search))
- continue;
+ continue;
/* Find the label preceding the node name. */
offset =
- string_in_line (INFO_NODE_LABEL, search->buffer + search->start);
+ string_in_line (INFO_NODE_LABEL, search->buffer + search->start);
/* If not there, not a defining line, so we must be out of the
- tags table. */
+ tags table. */
if (offset == -1)
- break;
+ break;
/* Point to the beginning of the node definition. */
search->start += offset;
@@ -670,11 +649,11 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
/* Move past the node's name. */
for (offset = 0;
- (nodedef[offset]) && (nodedef[offset] != INFO_TAGSEP);
- offset++);
+ (nodedef[offset]) && (nodedef[offset] != INFO_TAGSEP);
+ offset++);
if (nodedef[offset] != INFO_TAGSEP)
- continue;
+ continue;
entry = (TAG *)xmalloc (sizeof (TAG));
entry->nodename = (char *)xmalloc (1 + offset);
@@ -687,13 +666,13 @@ get_nodes_of_tags_table (file_buffer, buffer_binding)
entry->nodelen = -1;
/* The filename of this node is currently known as the same as the
- name of this file. */
+ name of this file. */
entry->filename = file_buffer->fullpath;
/* Add this node structure to the array of node structures in this
- FILE_BUFFER. */
+ FILE_BUFFER. */
add_pointer_to_array (entry, tags_index, file_buffer->tags,
- file_buffer->tags_slots, 100, TAG *);
+ file_buffer->tags_slots, 100, TAG *);
}
free (search);
}
@@ -734,23 +713,23 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
while (line < end)
{
- int colon;
+ int colon;
- colon = string_in_line (":", line);
+ colon = string_in_line (":", line);
- if (colon == -1)
- break;
+ if (colon == -1)
+ break;
- subfile = (SUBFILE *)xmalloc (sizeof (SUBFILE));
- subfile->filename = (char *)xmalloc (colon);
- strncpy (subfile->filename, line, colon - 1);
- subfile->filename[colon - 1] = '\0';
- subfile->first_byte = (long) atol (line + colon);
+ subfile = (SUBFILE *)xmalloc (sizeof (SUBFILE));
+ subfile->filename = (char *)xmalloc (colon);
+ strncpy (subfile->filename, line, colon - 1);
+ subfile->filename[colon - 1] = '\0';
+ subfile->first_byte = (long) atol (line + colon);
- add_pointer_to_array
- (subfile, subfiles_index, subfiles, subfiles_slots, 10, SUBFILE *);
+ add_pointer_to_array
+ (subfile, subfiles_index, subfiles, subfiles_slots, 10, SUBFILE *);
- while (*line++ != '\n');
+ while (*line++ != '\n');
}
}
@@ -768,10 +747,10 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
SEARCH_BINDING binding;
/* Find the length of the header of the file containing the indirect
- tags table. This header appears at the start of every file. We
- want the absolute position of each node within each subfile, so
- we subtract the start of the containing subfile from the logical
- position of the node, and then add the length of the header in. */
+ tags table. This header appears at the start of every file. We
+ want the absolute position of each node within each subfile, so
+ we subtract the start of the containing subfile from the logical
+ position of the node, and then add the length of the header in. */
binding.buffer = file_buffer->contents;
binding.start = 0;
binding.end = file_buffer->filesize;
@@ -779,81 +758,80 @@ get_tags_of_indirect_tags_table (file_buffer, indirect_binding, tags_binding)
header_length = find_node_separator (&binding);
if (header_length == -1)
- header_length = 0;
+ header_length = 0;
/* Build the file buffer's list of subfiles. */
{
- char *containing_dir, *temp;
- int len_containing_dir;
+ char *containing_dir, *temp;
+ int len_containing_dir;
- containing_dir = strdup (file_buffer->fullpath);
- temp = (char *) strrchr (containing_dir, '/');
+ containing_dir = xstrdup (file_buffer->fullpath);
+ temp = (char *) strrchr (containing_dir, '/');
- if (temp)
- *temp = '\0';
+ if (temp)
+ *temp = '\0';
- len_containing_dir = strlen (containing_dir);
+ len_containing_dir = strlen (containing_dir);
- for (i = 0; subfiles[i]; i++);
+ for (i = 0; subfiles[i]; i++);
- file_buffer->subfiles = (char **) xmalloc ((1 + i) * sizeof (char *));
+ file_buffer->subfiles = (char **) xmalloc ((1 + i) * sizeof (char *));
- for (i = 0; subfiles[i]; i++)
- {
- char *fullpath;
+ for (i = 0; subfiles[i]; i++)
+ {
+ char *fullpath;
- fullpath = (char *) xmalloc
- (2 + strlen (subfiles[i]->filename) + len_containing_dir);
+ fullpath = (char *) xmalloc
+ (2 + strlen (subfiles[i]->filename) + len_containing_dir);
- sprintf (fullpath, "%s/%s",
- containing_dir, subfiles[i]->filename);
+ sprintf (fullpath, "%s/%s",
+ containing_dir, subfiles[i]->filename);
- file_buffer->subfiles[i] = fullpath;
- }
- file_buffer->subfiles[i] = (char *)NULL;
- free (containing_dir);
+ file_buffer->subfiles[i] = fullpath;
+ }
+ file_buffer->subfiles[i] = (char *)NULL;
+ free (containing_dir);
}
/* For each node in the file's tags table, remember the starting
- position. */
- for (tags_index = 0;
- entry = file_buffer->tags[tags_index];
- tags_index++)
- {
- for (i = 0;
- subfiles[i] && entry->nodestart >= subfiles[i]->first_byte;
- i++);
-
- /* If the Info file containing the indirect tags table is
- malformed, then give up. */
- if (!i)
- {
- /* The Info file containing the indirect tags table is
- malformed. Give up. */
- for (i = 0; subfiles[i]; i++)
- {
- free (subfiles[i]->filename);
- free (subfiles[i]);
- free (file_buffer->subfiles[i]);
- }
- file_buffer->subfiles = (char **)NULL;
- free_file_buffer_tags (file_buffer);
- return;
- }
-
- /* SUBFILES[i] is the index of the first subfile whose logical
- first byte is greater than the logical offset of this node's
- starting position. This means that the subfile directly
- preceding this one is the one containing the node. */
-
- entry->filename = file_buffer->subfiles[i - 1];
- entry->nodestart -= subfiles[i -1]->first_byte;
- entry->nodestart += header_length;
- entry->nodelen = -1;
- }
+ position. */
+ for (tags_index = 0; (entry = file_buffer->tags[tags_index]);
+ tags_index++)
+ {
+ for (i = 0;
+ subfiles[i] && entry->nodestart >= subfiles[i]->first_byte;
+ i++);
+
+ /* If the Info file containing the indirect tags table is
+ malformed, then give up. */
+ if (!i)
+ {
+ /* The Info file containing the indirect tags table is
+ malformed. Give up. */
+ for (i = 0; subfiles[i]; i++)
+ {
+ free (subfiles[i]->filename);
+ free (subfiles[i]);
+ free (file_buffer->subfiles[i]);
+ }
+ file_buffer->subfiles = (char **)NULL;
+ free_file_buffer_tags (file_buffer);
+ return;
+ }
+
+ /* SUBFILES[i] is the index of the first subfile whose logical
+ first byte is greater than the logical offset of this node's
+ starting position. This means that the subfile directly
+ preceding this one is the one containing the node. */
+
+ entry->filename = file_buffer->subfiles[i - 1];
+ entry->nodestart -= subfiles[i -1]->first_byte;
+ entry->nodestart += header_length;
+ entry->nodelen = -1;
+ }
/* We have successfully built the tags table. Remember that it
- was indirect. */
+ was indirect. */
file_buffer->flags |= N_TagsIndirect;
}
@@ -878,105 +856,105 @@ info_node_of_file_buffer_tags (file_buffer, nodename)
register int i;
TAG *tag;
- for (i = 0; tag = file_buffer->tags[i]; i++)
+ for (i = 0; (tag = file_buffer->tags[i]); i++)
if (strcmp (nodename, tag->nodename) == 0)
{
- FILE_BUFFER *subfile;
-
- subfile = info_find_file_internal (tag->filename, INFO_NO_TAGS);
-
- if (!subfile)
- return ((NODE *)NULL);
-
- if (!subfile->contents)
- {
- info_reload_file_buffer_contents (subfile);
-
- if (!subfile->contents)
- return ((NODE *)NULL);
- }
-
- /* If we were able to find this file and load it, then return
- the node within it. */
- {
- NODE *node;
-
- node = (NODE *)xmalloc (sizeof (NODE));
- node->filename = (subfile->fullpath);
- node->nodename = tag->nodename;
- node->contents = subfile->contents + tag->nodestart;
- node->flags = 0;
- node->parent = (char *)NULL;
-
- if (file_buffer->flags & N_HasTagsTable)
- {
- node->flags |= N_HasTagsTable;
-
- if (file_buffer->flags & N_TagsIndirect)
- {
- node->flags |= N_TagsIndirect;
- node->parent = file_buffer->fullpath;
- }
- }
-
- if (subfile->flags & N_IsCompressed)
- node->flags |= N_IsCompressed;
-
- /* If TAG->nodelen hasn't been calculated yet, then we aren't
- in a position to trust the entry pointer. Adjust things so
- that ENTRY->nodestart gets the exact address of the start of
- the node separator which starts this node, and NODE->contents
- gets the address of the line defining this node. If we cannot
- do that, the node isn't really here. */
- if (tag->nodelen == -1)
- {
- int min, max;
- char *node_sep;
- SEARCH_BINDING node_body;
- char *buff_end;
-
- min = max = DEFAULT_INFO_FUDGE;
-
- if (tag->nodestart < DEFAULT_INFO_FUDGE)
- min = tag->nodestart;
-
- if (DEFAULT_INFO_FUDGE >
- (subfile->filesize - tag->nodestart))
- max = subfile->filesize - tag->nodestart;
-
- /* NODE_SEP gets the address of the separator which defines
- this node, or (char *)NULL if the node wasn't found.
- NODE->contents is side-effected to point to right after
- the separator. */
- node_sep = adjust_nodestart (node, min, max);
- if (node_sep == (char *)NULL)
- {
- free (node);
- return ((NODE *)NULL);
- }
- /* Readjust tag->nodestart. */
- tag->nodestart = node_sep - subfile->contents;
-
- /* Calculate the length of the current node. */
- buff_end = subfile->contents + subfile->filesize;
-
- node_body.buffer = node->contents;
- node_body.start = 0;
- node_body.end = buff_end - node_body.buffer;
- node_body.flags = 0;
- tag->nodelen = get_node_length (&node_body);
- }
- else
- {
- /* Since we know the length of this node, we have already
- adjusted tag->nodestart to point to the exact start of
- it. Simply skip the node separator. */
- node->contents += skip_node_separator (node->contents);
- }
-
- node->nodelen = tag->nodelen;
- return (node);
- }
+ FILE_BUFFER *subfile;
+
+ subfile = info_find_file_internal (tag->filename, INFO_NO_TAGS);
+
+ if (!subfile)
+ return ((NODE *)NULL);
+
+ if (!subfile->contents)
+ {
+ info_reload_file_buffer_contents (subfile);
+
+ if (!subfile->contents)
+ return ((NODE *)NULL);
+ }
+
+ /* If we were able to find this file and load it, then return
+ the node within it. */
+ {
+ NODE *node;
+
+ node = (NODE *)xmalloc (sizeof (NODE));
+ node->filename = (subfile->fullpath);
+ node->nodename = tag->nodename;
+ node->contents = subfile->contents + tag->nodestart;
+ node->flags = 0;
+ node->parent = (char *)NULL;
+
+ if (file_buffer->flags & N_HasTagsTable)
+ {
+ node->flags |= N_HasTagsTable;
+
+ if (file_buffer->flags & N_TagsIndirect)
+ {
+ node->flags |= N_TagsIndirect;
+ node->parent = file_buffer->fullpath;
+ }
+ }
+
+ if (subfile->flags & N_IsCompressed)
+ node->flags |= N_IsCompressed;
+
+ /* If TAG->nodelen hasn't been calculated yet, then we aren't
+ in a position to trust the entry pointer. Adjust things so
+ that ENTRY->nodestart gets the exact address of the start of
+ the node separator which starts this node, and NODE->contents
+ gets the address of the line defining this node. If we cannot
+ do that, the node isn't really here. */
+ if (tag->nodelen == -1)
+ {
+ int min, max;
+ char *node_sep;
+ SEARCH_BINDING node_body;
+ char *buff_end;
+
+ min = max = DEFAULT_INFO_FUDGE;
+
+ if (tag->nodestart < DEFAULT_INFO_FUDGE)
+ min = tag->nodestart;
+
+ if (DEFAULT_INFO_FUDGE >
+ (subfile->filesize - tag->nodestart))
+ max = subfile->filesize - tag->nodestart;
+
+ /* NODE_SEP gets the address of the separator which defines
+ this node, or (char *)NULL if the node wasn't found.
+ NODE->contents is side-effected to point to right after
+ the separator. */
+ node_sep = adjust_nodestart (node, min, max);
+ if (node_sep == (char *)NULL)
+ {
+ free (node);
+ return ((NODE *)NULL);
+ }
+ /* Readjust tag->nodestart. */
+ tag->nodestart = node_sep - subfile->contents;
+
+ /* Calculate the length of the current node. */
+ buff_end = subfile->contents + subfile->filesize;
+
+ node_body.buffer = node->contents;
+ node_body.start = 0;
+ node_body.end = buff_end - node_body.buffer;
+ node_body.flags = 0;
+ tag->nodelen = get_node_length (&node_body);
+ }
+ else
+ {
+ /* Since we know the length of this node, we have already
+ adjusted tag->nodestart to point to the exact start of
+ it. Simply skip the node separator. */
+ node->contents += skip_node_separator (node->contents);
+ }
+
+ node->nodelen = tag->nodelen;
+ return (node);
+ }
}
/* There was a tag table for this file, and the node wasn't found.
@@ -985,9 +963,9 @@ info_node_of_file_buffer_tags (file_buffer, nodename)
}
/* **************************************************************** */
-/* */
-/* Managing file_buffers, nodes, and tags. */
-/* */
+/* */
+/* Managing file_buffers, nodes, and tags. */
+/* */
/* **************************************************************** */
/* Create a new, empty file buffer. */
@@ -1018,7 +996,7 @@ remember_info_file (file_buffer)
;
add_pointer_to_array (file_buffer, i, info_loaded_files,
- info_loaded_files_slots, 10, FILE_BUFFER *);
+ info_loaded_files_slots, 10, FILE_BUFFER *);
}
/* Forget the contents, tags table, nodes list, and names of FILENAME. */
@@ -1032,25 +1010,25 @@ forget_info_file (filename)
if (!info_loaded_files)
return;
- for (i = 0; file_buffer = info_loaded_files[i]; i++)
+ for (i = 0; (file_buffer = info_loaded_files[i]); i++)
if ((strcmp (filename, file_buffer->filename) == 0) ||
- (strcmp (filename, file_buffer->fullpath) == 0))
+ (strcmp (filename, file_buffer->fullpath) == 0))
{
- free (file_buffer->filename);
- free (file_buffer->fullpath);
+ free (file_buffer->filename);
+ free (file_buffer->fullpath);
- if (file_buffer->contents)
- free (file_buffer->contents);
-
- /* Note that free_file_buffer_tags () also kills the subfiles
- list, since the subfiles list is only of use in conjunction
- with tags. */
- free_file_buffer_tags (file_buffer);
+ if (file_buffer->contents)
+ free (file_buffer->contents);
+
+ /* Note that free_file_buffer_tags () also kills the subfiles
+ list, since the subfiles list is only of use in conjunction
+ with tags. */
+ free_file_buffer_tags (file_buffer);
- while (info_loaded_files[i] = info_loaded_files[++i])
- ;
+ while ((info_loaded_files[i] = info_loaded_files[++i]))
+ ;
- break;
+ break;
}
}
@@ -1065,8 +1043,8 @@ free_file_buffer_tags (file_buffer)
{
register TAG *tag;
- for (i = 0; tag = file_buffer->tags[i]; i++)
- free_info_tag (tag);
+ for (i = 0; (tag = file_buffer->tags[i]); i++)
+ free_info_tag (tag);
free (file_buffer->tags);
file_buffer->tags = (TAG **)NULL;
@@ -1076,7 +1054,7 @@ free_file_buffer_tags (file_buffer)
if (file_buffer->subfiles)
{
for (i = 0; file_buffer->subfiles[i]; i++)
- free (file_buffer->subfiles[i]);
+ free (file_buffer->subfiles[i]);
free (file_buffer->subfiles);
file_buffer->subfiles = (char **)NULL;
@@ -1160,29 +1138,29 @@ adjust_nodestart (node, min, max)
sep_len = skip_node_separator (node->contents);
/* If we managed to skip a node separator, then check for this node
- being the right one. */
+ being the right one. */
if (sep_len != 0)
- {
- char *nodedef, *nodestart;
- int offset;
-
- nodestart = node_body.buffer + position + sep_len;
- nodedef = nodestart;
- offset = string_in_line (INFO_NODE_LABEL, nodedef);
-
- if (offset != -1)
- {
- nodedef += offset;
- nodedef += skip_whitespace (nodedef);
- offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES);
- if ((offset == strlen (node->nodename)) &&
- (strncmp (node->nodename, nodedef, offset) == 0))
- {
- node->contents = nodestart;
- return (node_body.buffer + position);
- }
- }
- }
+ {
+ char *nodedef, *nodestart;
+ int offset;
+
+ nodestart = node_body.buffer + position + sep_len;
+ nodedef = nodestart;
+ offset = string_in_line (INFO_NODE_LABEL, nodedef);
+
+ if (offset != -1)
+ {
+ nodedef += offset;
+ nodedef += skip_whitespace (nodedef);
+ offset = skip_node_characters (nodedef, DONT_SKIP_NEWLINES);
+ if ((offset == strlen (node->nodename)) &&
+ (strncmp (node->nodename, nodedef, offset) == 0))
+ {
+ node->contents = nodestart;
+ return (node_body.buffer + position);
+ }
+ }
+ }
}
/* Oh well, I guess we have to try to find it in a larger area. */
diff --git a/texinfo/info/nodes.h b/texinfo/info/nodes.h
index 7ddea17ddda..a96c07c8a6e 100644
--- a/texinfo/info/nodes.h
+++ b/texinfo/info/nodes.h
@@ -1,9 +1,10 @@
-/* nodes.h -- How we represent nodes internally. */
+/* nodes.h -- How we represent nodes internally.
+ $Id: nodes.h,v 1.5 1997/07/18 14:33:44 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,15 +22,15 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_NODES_H_)
-#define _NODES_H_
+#if !defined (NODES_H)
+#define NODES_H
-#include "general.h"
+#include "info.h"
/* **************************************************************** */
-/* */
-/* User Code Interface */
-/* */
+/* */
+/* User Code Interface */
+/* */
/* **************************************************************** */
/* Callers generally only want the node itself. This structure is used
@@ -41,45 +42,45 @@
paths, so you might have: node->filename = "/usr/gnu/info/emacs-1",
with node->parent = "/usr/gnu/info/emacs". */
typedef struct {
- char *filename; /* The physical file containing this node. */
- char *parent; /* Non-null is the logical file name. */
- char *nodename; /* The name of this node. */
- char *contents; /* Characters appearing in this node. */
- long nodelen; /* The length of the CONTENTS member. */
- int flags; /* See immediately below. */
+ char *filename; /* The physical file containing this node. */
+ char *parent; /* Non-null is the logical file name. */
+ char *nodename; /* The name of this node. */
+ char *contents; /* Characters appearing in this node. */
+ long nodelen; /* The length of the CONTENTS member. */
+ int flags; /* See immediately below. */
} NODE;
/* Defines that can appear in NODE->flags. All informative. */
-#define N_HasTagsTable 0x01 /* This node was found through a tags table. */
-#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */
-#define N_UpdateTags 0x04 /* The tags table is out of date. */
-#define N_IsCompressed 0x08 /* The file is compressed on disk. */
-#define N_IsInternal 0x10 /* This node was made by Info. */
-#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */
-#define N_IsManPage 0x40 /* This node is a Un*x manpage. */
+#define N_HasTagsTable 0x01 /* This node was found through a tags table. */
+#define N_TagsIndirect 0x02 /* The tags table was an indirect one. */
+#define N_UpdateTags 0x04 /* The tags table is out of date. */
+#define N_IsCompressed 0x08 /* The file is compressed on disk. */
+#define N_IsInternal 0x10 /* This node was made by Info. */
+#define N_CannotGC 0x20 /* File buffer cannot be gc'ed. */
+#define N_IsManPage 0x40 /* This node is a Un*x manpage. */
/* **************************************************************** */
-/* */
-/* Internal Data Structures */
-/* */
+/* */
+/* Internal Data Structures */
+/* */
/* **************************************************************** */
/* Some defines describing details about Info file contents. */
/* String Constants. */
-#define INFO_FILE_LABEL "File:"
-#define INFO_NODE_LABEL "Node:"
-#define INFO_PREV_LABEL "Prev:"
-#define INFO_ALTPREV_LABEL "Previous:"
-#define INFO_NEXT_LABEL "Next:"
-#define INFO_UP_LABEL "Up:"
-#define INFO_MENU_LABEL "\n* Menu:"
-#define INFO_MENU_ENTRY_LABEL "\n* "
-#define INFO_XREF_LABEL "*Note"
-#define TAGS_TABLE_END_LABEL "\nEnd Tag Table"
-#define TAGS_TABLE_BEG_LABEL "Tag Table:\n"
-#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n"
-#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)"
+#define INFO_FILE_LABEL "File:"
+#define INFO_NODE_LABEL "Node:"
+#define INFO_PREV_LABEL "Prev:"
+#define INFO_ALTPREV_LABEL "Previous:"
+#define INFO_NEXT_LABEL "Next:"
+#define INFO_UP_LABEL "Up:"
+#define INFO_MENU_LABEL "\n* Menu:"
+#define INFO_MENU_ENTRY_LABEL "\n* "
+#define INFO_XREF_LABEL "*Note"
+#define TAGS_TABLE_END_LABEL "\nEnd Tag Table"
+#define TAGS_TABLE_BEG_LABEL "Tag Table:\n"
+#define INDIRECT_TAGS_TABLE_LABEL "Indirect:\n"
+#define TAGS_TABLE_IS_INDIRECT_LABEL "(Indirect)"
/* Character Constants. */
#define INFO_COOKIE '\037'
@@ -94,10 +95,10 @@ typedef struct {
member in the structure below simply contains the name of the current
file. The following structure describes a single node within a file. */
typedef struct {
- char *filename; /* The file where this node can be found. */
- char *nodename; /* The node pointed to by this tag. */
- long nodestart; /* The offset of the start of this node. */
- long nodelen; /* The length of this node. */
+ char *filename; /* The file where this node can be found. */
+ char *nodename; /* The node pointed to by this tag. */
+ long nodestart; /* The offset of the start of this node. */
+ long nodelen; /* The length of this node. */
} TAG;
/* The following structure is used to remember information about the contents
@@ -108,21 +109,21 @@ typedef struct {
corresponding SLOTS member which says how many slots have been allocated
(with malloc ()) for this array. */
typedef struct {
- char *filename; /* The filename used to find this file. */
- char *fullpath; /* The full pathname of this info file. */
- struct stat finfo; /* Information about this file. */
- char *contents; /* The contents of this particular file. */
- long filesize; /* The number of bytes this file expands to. */
- char **subfiles; /* If non-null, the list of subfiles. */
- TAG **tags; /* If non-null, the indirect tags table. */
- int tags_slots; /* Number of slots allocated for TAGS. */
- int flags; /* Various flags. Mimics of N_* flags. */
+ char *filename; /* The filename used to find this file. */
+ char *fullpath; /* The full pathname of this info file. */
+ struct stat finfo; /* Information about this file. */
+ char *contents; /* The contents of this particular file. */
+ long filesize; /* The number of bytes this file expands to. */
+ char **subfiles; /* If non-null, the list of subfiles. */
+ TAG **tags; /* If non-null, the indirect tags table. */
+ int tags_slots; /* Number of slots allocated for TAGS. */
+ int flags; /* Various flags. Mimics of N_* flags. */
} FILE_BUFFER;
/* **************************************************************** */
-/* */
-/* Externally Visible Functions */
-/* */
+/* */
+/* Externally Visible Functions */
+/* */
/* **************************************************************** */
/* Array of FILE_BUFFER * which represents the currently loaded info files. */
@@ -165,4 +166,4 @@ extern char *info_recent_file_error;
/* Create a new, empty file buffer. */
extern FILE_BUFFER *make_file_buffer ();
-#endif /* !_NODES_H_ */
+#endif /* !NODES_H */
diff --git a/texinfo/info/search.c b/texinfo/info/search.c
index c5fd47794b0..0e8e619256a 100644
--- a/texinfo/info/search.c
+++ b/texinfo/info/search.c
@@ -3,7 +3,7 @@
/* This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,17 +21,11 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include "general.h"
+#include "info.h"
+
#include "search.h"
#include "nodes.h"
-#if !defined (NULL)
-# define NULL 0x0
-#endif /* !NULL */
-
/* The search functions take two arguments:
1) a string to search for, and
@@ -73,9 +67,9 @@ copy_binding (binding)
/* **************************************************************** */
-/* */
-/* The Actual Searching Functions */
-/* */
+/* */
+/* The Actual Searching Functions */
+/* */
/* **************************************************************** */
/* Search forwards or backwards for the text delimited by BINDING.
@@ -115,15 +109,15 @@ search_forward (string, binding)
if (binding->flags & S_FoldCase)
{
- alternate = strdup (string);
+ alternate = xstrdup (string);
for (i = 0; i < len; i++)
- {
- if (islower (alternate[i]))
- alternate[i] = toupper (alternate[i]);
- else if (isupper (alternate[i]))
- alternate[i] = tolower (alternate[i]);
- }
+ {
+ if (islower (alternate[i]))
+ alternate[i] = toupper (alternate[i]);
+ else if (isupper (alternate[i]))
+ alternate[i] = tolower (alternate[i]);
+ }
}
buff = binding->buffer + binding->start;
@@ -132,21 +126,21 @@ search_forward (string, binding)
while (buff < (end - len))
{
for (i = 0; i < len; i++)
- {
- c = buff[i];
+ {
+ c = buff[i];
- if ((c != string[i]) && (!alternate || c != alternate[i]))
- break;
- }
+ if ((c != string[i]) && (!alternate || c != alternate[i]))
+ break;
+ }
if (!string[i])
- {
- if (alternate)
- free (alternate);
- if (binding->flags & S_SkipDest)
- buff += len;
- return ((long) (buff - binding->buffer));
- }
+ {
+ if (alternate)
+ free (alternate);
+ if (binding->flags & S_SkipDest)
+ buff += len;
+ return ((long) (buff - binding->buffer));
+ }
buff++;
}
@@ -184,15 +178,15 @@ search_backward (input_string, binding)
if (binding->flags & S_FoldCase)
{
- alternate = strdup (string);
+ alternate = xstrdup (string);
for (i = 0; i < len; i++)
- {
- if (islower (alternate[i]))
- alternate[i] = toupper (alternate[i]);
- else if (isupper (alternate[i]))
- alternate[i] = tolower (alternate[i]);
- }
+ {
+ if (islower (alternate[i]))
+ alternate[i] = toupper (alternate[i]);
+ else if (isupper (alternate[i]))
+ alternate[i] = tolower (alternate[i]);
+ }
}
buff = binding->buffer + binding->start - 1;
@@ -201,23 +195,23 @@ search_backward (input_string, binding)
while (buff > (end + len))
{
for (i = 0; i < len; i++)
- {
- c = *(buff - i);
+ {
+ c = *(buff - i);
- if (c != string[i] && (alternate && c != alternate[i]))
- break;
- }
+ if (c != string[i] && (alternate && c != alternate[i]))
+ break;
+ }
if (!string[i])
- {
- free (string);
- if (alternate)
- free (alternate);
+ {
+ free (string);
+ if (alternate)
+ free (alternate);
- if (binding->flags & S_SkipDest)
- buff -= len;
- return ((long) (1 + (buff - binding->buffer)));
- }
+ if (binding->flags & S_SkipDest)
+ buff -= len;
+ return ((long) (1 + (buff - binding->buffer)));
+ }
buff--;
}
@@ -268,9 +262,9 @@ looking_at (string, binding)
}
/* **************************************************************** */
-/* */
-/* Small String Searches */
-/* */
+/* */
+/* Small String Searches */
+/* */
/* **************************************************************** */
/* Function names that start with "skip" are passed a string, and return
@@ -346,37 +340,43 @@ skip_node_characters (string, newlines_okay)
for (; string && (c = string[i]); i++)
{
if (paren)
- {
- if (c == '(')
- paren++;
- else if (c == ')')
- paren--;
-
- continue;
- }
+ {
+ if (c == '(')
+ paren++;
+ else if (c == ')')
+ paren--;
+
+ continue;
+ }
/* If the character following the close paren is a space or period,
- then this node name has no more characters associated with it. */
+ then this node name has no more characters associated with it. */
if (c == '\t' ||
- c == ',' ||
- c == INFO_TAGSEP ||
- ((!newlines_okay) && (c == '\n')) ||
- ((paren_seen && string[i - 1] == ')') &&
- (c == ' ' || c == '.')) ||
- (c == '.' &&
- ((!string[i + 1]) ||
- (whitespace_or_newline (string[i + 1])) ||
- (string[i + 1] == ')'))))
- break;
+ c == ',' ||
+ c == INFO_TAGSEP ||
+ ((!newlines_okay) && (c == '\n')) ||
+ ((paren_seen && string[i - 1] == ')') &&
+ (c == ' ' || c == '.')) ||
+ (c == '.' &&
+ (
+#if 0
+/* This test causes a node name ending in a period, like `This.', not to
+ be found. The trailing . is stripped. This occurs in the jargon
+ file (`I see no X here.' is a node name). */
+ (!string[i + 1]) ||
+#endif
+ (whitespace_or_newline (string[i + 1])) ||
+ (string[i + 1] == ')'))))
+ break;
}
return (i);
}
/* **************************************************************** */
-/* */
-/* Searching FILE_BUFFER's */
-/* */
+/* */
+/* Searching FILE_BUFFER's */
+/* */
/* **************************************************************** */
/* Return the absolute position of the first occurence of a node separator in
@@ -397,11 +397,11 @@ find_node_separator (binding)
table (if present) and the indirect tags table (if present). */
for (i = binding->start; i < binding->end - 1; i++)
if (((body[i] == INFO_FF && body[i + 1] == INFO_COOKIE) &&
- (body[i + 2] == '\n' ||
- (body[i + 2] == INFO_FF && body[i + 3] == '\n'))) ||
- ((body[i] == INFO_COOKIE) &&
- (body[i + 1] == '\n' ||
- (body[i + 1] == INFO_FF && body[i + 2] == '\n'))))
+ (body[i + 2] == '\n' ||
+ (body[i + 2] == INFO_FF && body[i + 3] == '\n'))) ||
+ ((body[i] == INFO_COOKIE) &&
+ (body[i + 1] == '\n' ||
+ (body[i + 1] == INFO_FF && body[i + 2] == '\n'))))
return (i);
return (-1);
}
@@ -467,7 +467,7 @@ find_tags_table (binding)
search.start += skip_node_separator (search.buffer + search.start);
if (looking_at (TAGS_TABLE_BEG_LABEL, &search))
- return (position);
+ return (position);
}
return (-1);
}
@@ -482,8 +482,8 @@ find_node_in_binding (nodename, binding)
char *nodename;
SEARCH_BINDING *binding;
{
- register long position;
- register int offset, namelen;
+ long position;
+ int offset, namelen;
SEARCH_BINDING search;
namelen = strlen (nodename);
@@ -501,19 +501,19 @@ find_node_in_binding (nodename, binding)
offset = string_in_line (INFO_NODE_LABEL, search.buffer + search.start);
if (offset == -1)
- continue;
+ continue;
search.start += offset;
search.start += skip_whitespace (search.buffer + search.start);
offset = skip_node_characters
- (search.buffer + search.start, DONT_SKIP_NEWLINES);
+ (search.buffer + search.start, DONT_SKIP_NEWLINES);
/* Notice that this is an exact match. You cannot grovel through
- the buffer with this function looking for random nodes. */
+ the buffer with this function looking for random nodes. */
if ((offset == namelen) &&
- (search.buffer[search.start] == nodename[0]) &&
- (strncmp (search.buffer + search.start, nodename, offset) == 0))
- return (position);
+ (search.buffer[search.start] == nodename[0]) &&
+ (strncmp (search.buffer + search.start, nodename, offset) == 0))
+ return (position);
}
return (-1);
}
diff --git a/texinfo/info/search.h b/texinfo/info/search.h
index 72695c3f0b6..6425536f172 100644
--- a/texinfo/info/search.h
+++ b/texinfo/info/search.h
@@ -1,9 +1,10 @@
-/* search.h -- Structure used to search large bodies of text, with bounds. */
+/* search.h -- Structure used to search large bodies of text, with bounds.
+ $Id: search.h,v 1.3 1997/07/15 18:43:49 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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
@@ -31,18 +32,18 @@
They return a long, which is the offset from the start of the buffer
at which the match was found. An offset of -1 indicates failure. */
-#if !defined (_SEARCH_H_)
-#define _SEARCH_H_
+#ifndef INFO_SEARCH_H
+#define INFO_SEARCH_H
typedef struct {
- char *buffer; /* The buffer of text to search. */
- long start; /* Offset of the start of the search. */
- long end; /* Offset of the end of the searh. */
- int flags; /* Flags controlling the type of search. */
+ char *buffer; /* The buffer of text to search. */
+ long start; /* Offset of the start of the search. */
+ long end; /* Offset of the end of the searh. */
+ int flags; /* Flags controlling the type of search. */
} SEARCH_BINDING;
-#define S_FoldCase 0x01 /* Set means fold case in searches. */
-#define S_SkipDest 0x02 /* Set means return pointing after the dest. */
+#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 ();
@@ -71,5 +72,4 @@ extern int skip_node_characters (), skip_node_separator ();
extern long find_node_separator (), find_tags_table ();
extern long find_node_in_binding ();
-#endif /* !_SEARCH_H_ */
-
+#endif /* not INFO_SEARCH_H */
diff --git a/texinfo/info/session.c b/texinfo/info/session.c
index be3076c9ac1..a30bbfe6d74 100644
--- a/texinfo/info/session.c
+++ b/texinfo/info/session.c
@@ -1,9 +1,7 @@
-/* session.c -- The user windowing interface to Info. */
+/* session.c -- The user windowing interface to Info.
+ $Id: session.c,v 1.12 1997/07/24 21:34:00 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1993, 96 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97 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,11 +20,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
#include "info.h"
-#if defined (HAVE_SYS_FILE_H)
-#include <sys/file.h>
-#endif /* HAVE_SYS_FILE_H */
#include <sys/ioctl.h>
-#include <fcntl.h>
#if defined (HAVE_SYS_TIME_H)
# include <sys/time.h>
@@ -41,28 +35,28 @@ static void info_clear_pending_input (), info_set_pending_input ();
static void info_handle_pointer ();
/* **************************************************************** */
-/* */
-/* Running an Info Session */
-/* */
+/* */
+/* Running an Info Session */
+/* */
/* **************************************************************** */
/* The place that we are reading input from. */
-static FILE *info_input_stream = (FILE *)NULL;
+static FILE *info_input_stream = NULL;
/* The last executed command. */
-VFunction *info_last_executed_command = (VFunction *)NULL;
+VFunction *info_last_executed_command = NULL;
/* Becomes non-zero when 'q' is typed to an Info window. */
int quit_info_immediately = 0;
/* Array of structures describing for each window which nodes have been
visited in that window. */
-INFO_WINDOW **info_windows = (INFO_WINDOW **)NULL;
+INFO_WINDOW **info_windows = NULL;
/* Where to add the next window, if we need to add one. */
static int info_windows_index = 0;
-/* Number of slots allocated to INFO_WINDOWS. */
+/* Number of slots allocated to `info_windows'. */
static int info_windows_slots = 0;
void remember_window_and_node (), forget_window_and_nodes ();
@@ -87,52 +81,52 @@ begin_multiple_window_info_session (filename, nodenames)
node = info_get_node (filename, nodenames[i]);
if (!node)
- break;
+ break;
/* If this is the first node, initialize the info session. */
if (!window)
- {
- initialize_info_session (node);
- window = active_window;
- }
+ {
+ initialize_info_session (node, 1);
+ window = active_window;
+ }
else
- {
- /* Find the largest window in WINDOWS, and make that be the active
- one. Then split it and add our window and node to the list
- of remembered windows and nodes. Then tile the windows. */
- register WINDOW *win, *largest = (WINDOW *)NULL;
- int max_height = 0;
-
- for (win = windows; win; win = win->next)
- if (win->height > max_height)
- {
- max_height = win->height;
- largest = win;
- }
-
- if (!largest)
- {
- display_update_display (windows);
- info_error (CANT_FIND_WIND);
- info_session ();
- exit (0);
- }
-
- active_window = largest;
- window = window_make_window (node);
- if (window)
- {
- window_tile_windows (TILE_INTERNALS);
- remember_window_and_node (window, node);
- }
- else
- {
- display_update_display (windows);
- info_error (WIN_TOO_SMALL);
- info_session ();
- exit (0);
- }
- }
+ {
+ /* Find the largest window in WINDOWS, and make that be the active
+ one. Then split it and add our window and node to the list
+ of remembered windows and nodes. Then tile the windows. */
+ register WINDOW *win, *largest = (WINDOW *)NULL;
+ int max_height = 0;
+
+ for (win = windows; win; win = win->next)
+ if (win->height > max_height)
+ {
+ max_height = win->height;
+ largest = win;
+ }
+
+ if (!largest)
+ {
+ display_update_display (windows);
+ info_error (CANT_FIND_WIND);
+ info_session ();
+ exit (0);
+ }
+
+ active_window = largest;
+ window = window_make_window (node);
+ if (window)
+ {
+ window_tile_windows (TILE_INTERNALS);
+ remember_window_and_node (window, node);
+ }
+ else
+ {
+ display_update_display (windows);
+ info_error (WIN_TOO_SMALL);
+ info_session ();
+ exit (0);
+ }
+ }
}
display_startup_message_and_start ();
}
@@ -145,7 +139,7 @@ begin_info_session_with_error (initial_node, format, arg)
char *format;
void *arg;
{
- initialize_info_session (initial_node);
+ initialize_info_session (initial_node, 1);
info_error (format, arg, (void *)NULL);
info_session ();
}
@@ -155,7 +149,7 @@ void
begin_info_session (initial_node)
NODE *initial_node;
{
- initialize_info_session (initial_node);
+ initialize_info_session (initial_node, 1);
display_startup_message_and_start ();
}
@@ -165,7 +159,7 @@ display_startup_message_and_start ()
char *format;
format = replace_in_documentation
- ("Welcome to Info version %s. \"\\[get-help-window]\" for help, \"\\[menu-item]\" for menu item.");
+ (_("Welcome to Info version %s. \"\\[get-help-window]\" for help, \"\\[menu-item]\" for menu item."));
window_message_in_echo_area (format, version_string ());
info_session ();
@@ -175,9 +169,8 @@ display_startup_message_and_start ()
void
info_session ()
{
- terminal_prep_terminal ();
display_update_display (windows);
- info_last_executed_command = (VFunction *)NULL;
+ info_last_executed_command = NULL;
info_read_and_dispatch ();
/* On program exit, leave the cursor at the bottom of the window, and
restore the terminal I/O. */
@@ -202,19 +195,19 @@ info_read_and_dispatch ()
int lk;
/* If we haven't just gone up or down a line, there is no
- goal column for this window. */
+ goal column for this window. */
if ((info_last_executed_command != info_next_line) &&
- (info_last_executed_command != info_prev_line))
- active_window->goal_column = -1;
+ (info_last_executed_command != info_prev_line))
+ active_window->goal_column = -1;
if (echo_area_is_active)
- {
- lk = echo_area_last_command_was_kill;
- echo_area_prep_read ();
- }
+ {
+ lk = echo_area_last_command_was_kill;
+ echo_area_prep_read ();
+ }
if (!info_any_buffered_input_p ())
- display_update_display (windows);
+ display_update_display (windows);
display_cursor_at_point (active_window);
info_initialize_numeric_arg ();
@@ -223,9 +216,9 @@ info_read_and_dispatch ()
key = info_get_input_char ();
/* No errors yet. We just read a character, that's all. Only clear
- the echo_area if it is not currently active. */
+ the echo_area if it is not currently active. */
if (!echo_area_is_active)
- window_clear_echo_area ();
+ window_clear_echo_area ();
info_error_was_printed = 0;
@@ -233,26 +226,26 @@ info_read_and_dispatch ()
info_dispatch_on_key (key, active_window->keymap);
if (echo_area_is_active)
- {
- /* Echo area commands that do killing increment the value of
- ECHO_AREA_LAST_COMMAND_WAS_KILL. Thus, if there is no
- change in the value of this variable, the last command
- executed was not a kill command. */
- if (lk == echo_area_last_command_was_kill)
- echo_area_last_command_was_kill = 0;
-
- if (ea_last_executed_command == ea_newline ||
- info_aborted_echo_area)
- {
- ea_last_executed_command = (VFunction *)NULL;
- done = 1;
- }
-
- if (info_last_executed_command == info_quit)
- quit_info_immediately = 1;
- }
+ {
+ /* Echo area commands that do killing increment the value of
+ ECHO_AREA_LAST_COMMAND_WAS_KILL. Thus, if there is no
+ change in the value of this variable, the last command
+ executed was not a kill command. */
+ if (lk == echo_area_last_command_was_kill)
+ echo_area_last_command_was_kill = 0;
+
+ if (ea_last_executed_command == ea_newline ||
+ info_aborted_echo_area)
+ {
+ ea_last_executed_command = (VFunction *)NULL;
+ done = 1;
+ }
+
+ if (info_last_executed_command == info_quit)
+ quit_info_immediately = 1;
+ }
else if (info_last_executed_command == info_quit)
- done = 1;
+ done = 1;
}
}
@@ -260,26 +253,30 @@ info_read_and_dispatch ()
extern void initialize_info_signal_handler ();
/* Initialize the first info session by starting the terminal, window,
- and display systems. */
+ and display systems. If CLEAR_SCREEN is 0, don't clear the screen. */
void
-initialize_info_session (node)
+initialize_info_session (node, clear_screen)
NODE *node;
+ int clear_screen;
{
- char *getenv (), *term_name;
-
- term_name = getenv ("TERM");
+ char *term_name = getenv ("TERM");
terminal_initialize_terminal (term_name);
if (terminal_is_dumb_p)
{
if (!term_name)
- term_name = "dumb";
+ term_name = "dumb";
info_error (TERM_TOO_DUMB, term_name);
exit (1);
}
- terminal_clear_screen ();
+ if (clear_screen)
+ {
+ terminal_prep_terminal ();
+ terminal_clear_screen ();
+ }
+
initialize_info_keymaps ();
window_initialize_windows (screenwidth, screenheight);
initialize_info_signal_handler ();
@@ -290,9 +287,13 @@ initialize_info_session (node)
asynchronously deleted (e.g., user resizes window very small). */
window_deletion_notifier = forget_window_and_nodes;
- /* If input has not been redirected yet, make it come from STDIN. */
+ /* If input has not been redirected yet, make it come from unbuffered
+ standard input. */
if (!info_input_stream)
- info_input_stream = stdin;
+ {
+ setbuf(stdin, NULL);
+ info_input_stream = stdin;
+ }
info_windows_initialized_p = 1;
}
@@ -361,10 +362,8 @@ remember_window_and_node (window, node)
WINDOW *window;
NODE *node;
{
- INFO_WINDOW *info_win;
-
/* See if we already have this window in our list. */
- info_win = get_info_window_of_window (window);
+ INFO_WINDOW *info_win = get_info_window_of_window (window);
/* If the window wasn't already on our list, then make a new entry. */
if (!info_win)
@@ -379,21 +378,19 @@ remember_window_and_node (window, node)
info_win->nodes_slots = 0;
add_pointer_to_array (info_win, info_windows_index, info_windows,
- info_windows_slots, 10, INFO_WINDOW *);
+ info_windows_slots, 10, INFO_WINDOW *);
}
/* If this node, the current pagetop, and the current point are the
- same as the last saved node and pagetop, don't really add this to
- the list of history nodes. */
- {
- int ni = info_win->nodes_index - 1;
-
- if ((ni != -1) &&
- (info_win->nodes[ni]->contents == node->contents) &&
- (info_win->pagetops[ni] == window->pagetop) &&
- (info_win->points[ni] == window->point))
- return;
- }
+ same as the current saved node and pagetop, don't really add this to
+ the list of history nodes. This may happen only at the very
+ beginning of the program, I'm not sure. --karl */
+ if (info_win->nodes
+ && info_win->current >= 0
+ && info_win->nodes[info_win->current]->contents == node->contents
+ && info_win->pagetops[info_win->current] == window->pagetop
+ && info_win->points[info_win->current] == window->point)
+ return;
/* Remember this node, the currently displayed pagetop, and the current
location of point in this window. Because we are updating pagetops
@@ -401,22 +398,20 @@ remember_window_and_node (window, node)
add_pointer_to_array macro here. */
if (info_win->nodes_index + 2 >= info_win->nodes_slots)
{
- info_win->nodes = (NODE **)
- xrealloc (info_win->nodes,
- (info_win->nodes_slots += 20) * sizeof (NODE *));
-
- info_win->pagetops = (int *)
- xrealloc (info_win->pagetops, info_win->nodes_slots * sizeof (int));
-
- info_win->points = (long *)
- xrealloc (info_win->points, info_win->nodes_slots * sizeof (long));
+ info_win->nodes_slots += 20;
+ info_win->nodes = (NODE **) xrealloc (info_win->nodes,
+ info_win->nodes_slots * sizeof (NODE *));
+ info_win->pagetops = (int *) xrealloc (info_win->pagetops,
+ info_win->nodes_slots * sizeof (int));
+ info_win->points = (long *) xrealloc (info_win->points,
+ info_win->nodes_slots * sizeof (long));
}
info_win->nodes[info_win->nodes_index] = node;
info_win->pagetops[info_win->nodes_index] = window->pagetop;
info_win->points[info_win->nodes_index] = window->point;
info_win->current = info_win->nodes_index++;
- info_win->nodes[info_win->nodes_index] = (NODE *)NULL;
+ info_win->nodes[info_win->nodes_index] = NULL;
info_win->pagetops[info_win->nodes_index] = 0;
info_win->points[info_win->nodes_index] = 0;
}
@@ -427,18 +422,17 @@ static void
consistency_check_info_windows ()
{
register int i;
- INFO_WINDOW *info_win;
for (i = 0; i < info_windows_index; i++)
{
WINDOW *win;
for (win = windows; win; win = win->next)
- if (win == info_windows[i]->window)
- break;
+ if (win == info_windows[i]->window)
+ break;
if (!win)
- abort ();
+ abort ();
}
}
#endif /* DEBUG_FORGET_WINDOW_AND_NODES */
@@ -459,27 +453,27 @@ forget_window_and_nodes (window)
if (info_win)
{
while (i < info_windows_index)
- {
- info_windows[i] = info_windows[i + 1];
- i++;
- }
+ {
+ info_windows[i] = info_windows[i + 1];
+ i++;
+ }
info_windows_index--;
info_windows[info_windows_index] = (INFO_WINDOW *)NULL;
if (info_win->nodes)
- {
- /* Free the node structures which held onto internal node contents
- here. This doesn't free the contents; we have a garbage collector
- which does that. */
- for (i = 0; info_win->nodes[i]; i++)
- if (internal_info_node_p (info_win->nodes[i]))
- free (info_win->nodes[i]);
- free (info_win->nodes);
-
- maybe_free (info_win->pagetops);
- maybe_free (info_win->points);
- }
+ {
+ /* Free the node structures which held onto internal node contents
+ here. This doesn't free the contents; we have a garbage collector
+ which does that. */
+ for (i = 0; info_win->nodes[i]; i++)
+ if (internal_info_node_p (info_win->nodes[i]))
+ free (info_win->nodes[i]);
+ free (info_win->nodes);
+
+ maybe_free (info_win->pagetops);
+ maybe_free (info_win->points);
+ }
free (info_win);
}
@@ -510,9 +504,9 @@ info_set_node_of_window (window, node)
/* **************************************************************** */
-/* */
-/* Info Movement Commands */
-/* */
+/* */
+/* Info Movement Commands */
+/* */
/* **************************************************************** */
/* Change the pagetop of WINDOW to DESIRED_TOP, perhaps scrolling the screen
@@ -556,8 +550,8 @@ set_window_pagetop (window, desired_top)
amount = desired_top - old_pagetop;
if ((amount >= window->height) ||
- (((window->height - amount) * 10) < window->height))
- return;
+ (((window->height - amount) * 10) < window->height))
+ return;
start = amount + window->first_row;
end = window->height + window->first_row;
@@ -571,8 +565,8 @@ set_window_pagetop (window, desired_top)
amount = old_pagetop - desired_top;
if ((amount >= window->height) ||
- (((window->height - amount) * 10) < window->height))
- return;
+ (((window->height - amount) * 10) < window->height))
+ return;
start = window->first_row;
end = (window->first_row + window->height) - amount;
@@ -620,7 +614,7 @@ move_to_new_line (old, new, window)
int goal;
if (new >= window->line_count || new < 0)
- return;
+ return;
goal = window_get_goal_column (window);
window->goal_column = goal;
@@ -632,7 +626,7 @@ move_to_new_line (old, new, window)
}
/* Move WINDOW's point down to the next line if possible. */
-DECLARE_INFO_COMMAND (info_next_line, "Move down to the next line")
+DECLARE_INFO_COMMAND (info_next_line, _("Move down to the next line"))
{
int old_line, new_line;
@@ -647,7 +641,7 @@ DECLARE_INFO_COMMAND (info_next_line, "Move down to the next line")
}
/* Move WINDOW's point up to the previous line if possible. */
-DECLARE_INFO_COMMAND (info_prev_line, "Move up to the previous line")
+DECLARE_INFO_COMMAND (info_prev_line, _("Move up to the previous line"))
{
int old_line, new_line;
@@ -662,7 +656,7 @@ DECLARE_INFO_COMMAND (info_prev_line, "Move up to the previous line")
}
/* Move WINDOW's point to the end of the true line. */
-DECLARE_INFO_COMMAND (info_end_of_line, "Move to the end of the line")
+DECLARE_INFO_COMMAND (info_end_of_line, _("Move to the end of the line"))
{
register int point, len;
register char *buffer;
@@ -682,7 +676,7 @@ DECLARE_INFO_COMMAND (info_end_of_line, "Move to the end of the line")
}
/* Move WINDOW's point to the beginning of the true line. */
-DECLARE_INFO_COMMAND (info_beginning_of_line, "Move to the start of the line")
+DECLARE_INFO_COMMAND (info_beginning_of_line, _("Move to the start of the line"))
{
register int point;
register char *buffer;
@@ -701,7 +695,7 @@ DECLARE_INFO_COMMAND (info_beginning_of_line, "Move to the start of the line")
}
/* Move point forward in the node. */
-DECLARE_INFO_COMMAND (info_forward_char, "Move forward a character")
+DECLARE_INFO_COMMAND (info_forward_char, _("Move forward a character"))
{
if (count < 0)
info_backward_char (window, -count, key);
@@ -710,14 +704,14 @@ DECLARE_INFO_COMMAND (info_forward_char, "Move forward a character")
window->point += count;
if (window->point >= window->node->nodelen)
- window->point = window->node->nodelen - 1;
+ window->point = window->node->nodelen - 1;
info_show_point (window);
}
}
/* Move point backward in the node. */
-DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character")
+DECLARE_INFO_COMMAND (info_backward_char, _("Move backward a character"))
{
if (count < 0)
info_forward_char (window, -count, key);
@@ -726,7 +720,7 @@ DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character")
window->point -= count;
if (window->point < 0)
- window->point = 0;
+ window->point = 0;
info_show_point (window);
}
@@ -735,7 +729,7 @@ DECLARE_INFO_COMMAND (info_backward_char, "Move backward a character")
#define alphabetic(c) (islower (c) || isupper (c) || isdigit (c))
/* Move forward a word in this node. */
-DECLARE_INFO_COMMAND (info_forward_word, "Move forward a word")
+DECLARE_INFO_COMMAND (info_forward_word, _("Move forward a word"))
{
long point;
char *buffer;
@@ -754,37 +748,37 @@ DECLARE_INFO_COMMAND (info_forward_word, "Move forward a word")
while (count)
{
if (point + 1 >= end)
- return;
+ return;
/* If we are not in a word, move forward until we are in one.
- Then, move forward until we hit a non-alphabetic character. */
+ Then, move forward until we hit a non-alphabetic character. */
c = buffer[point];
if (!alphabetic (c))
- {
- while (++point < end)
- {
- c = buffer[point];
- if (alphabetic (c))
- break;
- }
- }
+ {
+ while (++point < end)
+ {
+ c = buffer[point];
+ if (alphabetic (c))
+ break;
+ }
+ }
if (point >= end) return;
while (++point < end)
- {
- c = buffer[point];
- if (!alphabetic (c))
- break;
- }
+ {
+ c = buffer[point];
+ if (!alphabetic (c))
+ break;
+ }
--count;
}
window->point = point;
info_show_point (window);
}
-DECLARE_INFO_COMMAND (info_backward_word, "Move backward a word")
+DECLARE_INFO_COMMAND (info_backward_word, _("Move backward a word"))
{
long point;
char *buffer;
@@ -802,31 +796,31 @@ DECLARE_INFO_COMMAND (info_backward_word, "Move backward a word")
while (count)
{
if (point == 0)
- break;
+ break;
/* Like info_forward_word (), except that we look at the
- characters just before point. */
+ characters just before point. */
c = buffer[point - 1];
if (!alphabetic (c))
- {
- while (--point)
- {
- c = buffer[point - 1];
- if (alphabetic (c))
- break;
- }
- }
+ {
+ while (--point)
+ {
+ c = buffer[point - 1];
+ if (alphabetic (c))
+ break;
+ }
+ }
while (point)
- {
- c = buffer[point - 1];
- if (!alphabetic (c))
- break;
- else
- --point;
- }
+ {
+ c = buffer[point - 1];
+ if (!alphabetic (c))
+ break;
+ else
+ --point;
+ }
--count;
}
window->point = point;
@@ -858,9 +852,9 @@ times_description (count)
break;
if (counter_names[i])
- sprintf (td_buffer, "%s%s", counter_names[i], count > 2 ? " times" : "");
+ sprintf (td_buffer, "%s%s", counter_names[i], count > 2 ? _(" times") : "");
else
- sprintf (td_buffer, "%d times", count);
+ sprintf (td_buffer, _("%d times"), count);
return (td_buffer);
}
@@ -869,11 +863,11 @@ times_description (count)
already at the bottom of a node. Possible values are defined in session.h.
The meanings are:
- IS_Continuous Try to get first menu item, or failing that, the
- "Next:" pointer, or failing that, the "Up:" and
- "Next:" of the up.
- IS_NextOnly Try to get "Next:" menu item.
- IS_PageOnly Simply give up at the bottom of a node. */
+ IS_Continuous Try to get first menu item, or failing that, the
+ "Next:" pointer, or failing that, the "Up:" and
+ "Next:" of the up.
+ IS_NextOnly Try to get "Next:" menu item.
+ IS_PageOnly Simply give up at the bottom of a node. */
int info_scroll_behaviour = IS_Continuous;
@@ -898,136 +892,136 @@ forward_move_node_structure (window, behaviour)
case IS_NextOnly:
info_next_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
- info_error ("No \"Next\" pointer for this node.");
+ info_error (_("No \"Next\" pointer for this node."));
else
- {
- window_message_in_echo_area ("Following \"Next\" node...");
- info_handle_pointer ("Next", window);
- }
+ {
+ window_message_in_echo_area (_("Following \"Next\" node..."));
+ info_handle_pointer (_("Next"), window);
+ }
break;
case IS_Continuous:
{
- /* First things first. If this node contains a menu, move down
- into the menu. */
- {
- REFERENCE **menu;
-
- menu = info_menu_of_node (window->node);
-
- if (menu)
- {
- info_free_references (menu);
- window_message_in_echo_area ("Selecting first menu item...");
- info_menu_digit (window, 1, '1');
- return;
- }
- }
-
- /* Okay, this node does not contain a menu. If it contains a
- "Next:" pointer, use that. */
- info_next_label_of_node (window->node);
- if (info_label_was_found)
- {
- window_message_in_echo_area ("Selecting \"Next\" node...");
- info_handle_pointer ("Next", window);
- return;
- }
-
- /* Okay, there wasn't a "Next:" for this node. Move "Up:" until we
- can move "Next:". If that isn't possible, complain that there
- are no more nodes. */
- {
- int up_counter, old_current;
- INFO_WINDOW *info_win;
-
- /* Remember the current node and location. */
- info_win = get_info_window_of_window (window);
- old_current = info_win->current;
-
- /* Back up through the "Up:" pointers until we have found a "Next:"
- that isn't the same as the first menu item found in that node. */
- up_counter = 0;
- while (!info_error_was_printed)
- {
- info_up_label_of_node (window->node);
- if (info_label_was_found)
- {
- info_handle_pointer ("Up", window);
- if (info_error_was_printed)
- continue;
-
- up_counter++;
-
- info_next_label_of_node (window->node);
-
- /* If no "Next" pointer, keep backing up. */
- if (!info_label_was_found)
- continue;
-
- /* If this node's first menu item is the same as this node's
- Next pointer, keep backing up. */
- if (!info_parsed_filename)
- {
- REFERENCE **menu;
- char *next_nodename;
-
- /* Remember the name of the Next node, since reading
- the menu can overwrite the contents of the
- info_parsed_xxx strings. */
- next_nodename = strdup (info_parsed_nodename);
-
- menu = info_menu_of_node (window->node);
- if (menu &&
- (strcmp
- (menu[0]->nodename, next_nodename) == 0))
- {
- info_free_references (menu);
- free (next_nodename);
- continue;
- }
- else
- {
- /* Restore the world to where it was before
- reading the menu contents. */
- info_free_references (menu);
- free (next_nodename);
- info_next_label_of_node (window->node);
- }
- }
-
- /* 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\" %s, then \"Next\".",
- times_description (up_counter));
-
- info_handle_pointer ("Next", window);
- return;
- }
- else
- {
- /* No more "Up" pointers. Print an error, and call it
- quits. */
- register int i;
-
- for (i = 0; i < up_counter; i++)
- {
- info_win->nodes_index--;
- free (info_win->nodes[info_win->nodes_index]);
- info_win->nodes[info_win->nodes_index] = (NODE *)NULL;
- }
- info_win->current = old_current;
- window->node = info_win->nodes[old_current];
- window->pagetop = info_win->pagetops[old_current];
- window->point = info_win->points[old_current];
- recalculate_line_starts (window);
- window->flags |= W_UpdateWindow;
- info_error ("No more nodes.");
- }
- }
- }
- break;
+ /* First things first. If this node contains a menu, move down
+ into the menu. */
+ {
+ REFERENCE **menu;
+
+ menu = info_menu_of_node (window->node);
+
+ if (menu)
+ {
+ info_free_references (menu);
+ window_message_in_echo_area (_("Selecting first menu item..."));
+ info_menu_digit (window, 1, '1');
+ return;
+ }
+ }
+
+ /* Okay, this node does not contain a menu. If it contains a
+ "Next:" pointer, use that. */
+ info_next_label_of_node (window->node);
+ if (info_label_was_found)
+ {
+ window_message_in_echo_area (_("Selecting \"Next\" node..."));
+ info_handle_pointer (_("Next"), window);
+ return;
+ }
+
+ /* Okay, there wasn't a "Next:" for this node. Move "Up:" until we
+ can move "Next:". If that isn't possible, complain that there
+ are no more nodes. */
+ {
+ int up_counter, old_current;
+ INFO_WINDOW *info_win;
+
+ /* Remember the current node and location. */
+ info_win = get_info_window_of_window (window);
+ old_current = info_win->current;
+
+ /* Back up through the "Up:" pointers until we have found a "Next:"
+ that isn't the same as the first menu item found in that node. */
+ up_counter = 0;
+ while (!info_error_was_printed)
+ {
+ info_up_label_of_node (window->node);
+ if (info_label_was_found)
+ {
+ info_handle_pointer (_("Up"), window);
+ if (info_error_was_printed)
+ continue;
+
+ up_counter++;
+
+ info_next_label_of_node (window->node);
+
+ /* If no "Next" pointer, keep backing up. */
+ if (!info_label_was_found)
+ continue;
+
+ /* If this node's first menu item is the same as this node's
+ Next pointer, keep backing up. */
+ if (!info_parsed_filename)
+ {
+ REFERENCE **menu;
+ char *next_nodename;
+
+ /* Remember the name of the Next node, since reading
+ the menu can overwrite the contents of the
+ info_parsed_xxx strings. */
+ next_nodename = xstrdup (info_parsed_nodename);
+
+ menu = info_menu_of_node (window->node);
+ if (menu &&
+ (strcmp
+ (menu[0]->nodename, next_nodename) == 0))
+ {
+ info_free_references (menu);
+ free (next_nodename);
+ continue;
+ }
+ else
+ {
+ /* Restore the world to where it was before
+ reading the menu contents. */
+ info_free_references (menu);
+ free (next_nodename);
+ info_next_label_of_node (window->node);
+ }
+ }
+
+ /* 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\" %s, then \"Next\".",
+ times_description (up_counter));
+
+ info_handle_pointer (_("Next"), window);
+ return;
+ }
+ else
+ {
+ /* No more "Up" pointers. Print an error, and call it
+ quits. */
+ register int i;
+
+ for (i = 0; i < up_counter; i++)
+ {
+ info_win->nodes_index--;
+ free (info_win->nodes[info_win->nodes_index]);
+ info_win->nodes[info_win->nodes_index] = (NODE *)NULL;
+ }
+ info_win->current = old_current;
+ window->node = info_win->nodes[old_current];
+ window->pagetop = info_win->pagetops[old_current];
+ window->point = info_win->points[old_current];
+ recalculate_line_starts (window);
+ window->flags |= W_UpdateWindow;
+ info_error (_("No more nodes."));
+ }
+ }
+ }
+ break;
}
}
}
@@ -1047,115 +1041,115 @@ backward_move_node_structure (window, behaviour)
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 (_("No \"Prev\" for this node."));
else
- {
- window_message_in_echo_area ("Moving \"Prev\" in this window.");
- info_handle_pointer ("Prev", window);
- }
+ {
+ window_message_in_echo_area (_("Moving \"Prev\" in this window."));
+ info_handle_pointer (_("Prev"), window);
+ }
break;
case IS_Continuous:
info_prev_label_of_node (window->node);
if (!info_parsed_nodename && !info_parsed_filename)
- {
- info_up_label_of_node (window->node);
- if (!info_parsed_nodename && !info_parsed_filename)
- info_error ("No \"Prev\" or \"Up\" for this node.");
- else
- {
- window_message_in_echo_area ("Moving \"Up\" in this window.");
- info_handle_pointer ("Up", window);
- }
- }
+ {
+ info_up_label_of_node (window->node);
+ if (!info_parsed_nodename && !info_parsed_filename)
+ info_error (_("No \"Prev\" or \"Up\" for this node."));
+ else
+ {
+ window_message_in_echo_area (_("Moving \"Up\" in this window."));
+ info_handle_pointer (_("Up"), window);
+ }
+ }
else
- {
- REFERENCE **menu;
- int inhibit_menu_traversing = 0;
-
- /* Watch out! If this node's Prev is the same as the Up, then
- move Up. Otherwise, we could move Prev, and then to the last
- menu item in the Prev. This would cause the user to loop
- through a subsection of the info file. */
- if (!info_parsed_filename && info_parsed_nodename)
- {
- char *pnode;
-
- pnode = strdup (info_parsed_nodename);
- info_up_label_of_node (window->node);
-
- if (!info_parsed_filename && info_parsed_nodename &&
- strcmp (info_parsed_nodename, pnode) == 0)
- {
- /* The nodes are the same. Inhibit moving to the last
- menu item. */
- free (pnode);
- inhibit_menu_traversing = 1;
- }
- else
- {
- free (pnode);
- info_prev_label_of_node (window->node);
- }
- }
-
- /* 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.");
- info_handle_pointer ("Prev", window);
-
- if (!inhibit_menu_traversing)
- {
- while (!info_error_was_printed &&
- (menu = info_menu_of_node (window->node)))
- {
- info_free_references (menu);
- window_message_in_echo_area
- ("Moving to \"Prev\"'s last menu item.");
- info_menu_digit (window, 1, '0');
- }
- }
- }
+ {
+ REFERENCE **menu;
+ int inhibit_menu_traversing = 0;
+
+ /* Watch out! If this node's Prev is the same as the Up, then
+ move Up. Otherwise, we could move Prev, and then to the last
+ menu item in the Prev. This would cause the user to loop
+ through a subsection of the info file. */
+ if (!info_parsed_filename && info_parsed_nodename)
+ {
+ char *pnode;
+
+ pnode = xstrdup (info_parsed_nodename);
+ info_up_label_of_node (window->node);
+
+ if (!info_parsed_filename && info_parsed_nodename &&
+ strcmp (info_parsed_nodename, pnode) == 0)
+ {
+ /* The nodes are the same. Inhibit moving to the last
+ menu item. */
+ free (pnode);
+ inhibit_menu_traversing = 1;
+ }
+ else
+ {
+ free (pnode);
+ info_prev_label_of_node (window->node);
+ }
+ }
+
+ /* 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."));
+ info_handle_pointer (_("Prev"), window);
+
+ if (!inhibit_menu_traversing)
+ {
+ while (!info_error_was_printed &&
+ (menu = info_menu_of_node (window->node)))
+ {
+ info_free_references (menu);
+ window_message_in_echo_area
+ (_("Moving to \"Prev\"'s last menu item."));
+ info_menu_digit (window, 1, '0');
+ }
+ }
+ }
break;
}
}
/* Move continuously forward through the node structure of this info file. */
DECLARE_INFO_COMMAND (info_global_next_node,
- "Move forwards or down through node structure")
+ _("Move forwards or down through node structure"))
{
if (count < 0)
info_global_prev_node (window, -count, key);
else
{
while (count && !info_error_was_printed)
- {
- forward_move_node_structure (window, IS_Continuous);
- count--;
- }
+ {
+ forward_move_node_structure (window, IS_Continuous);
+ count--;
+ }
}
}
/* Move continuously backward through the node structure of this info file. */
DECLARE_INFO_COMMAND (info_global_prev_node,
- "Move backwards or up through node structure")
+ _("Move backwards or up through node structure"))
{
if (count < 0)
info_global_next_node (window, -count, key);
else
{
while (count && !info_error_was_printed)
- {
- backward_move_node_structure (window, IS_Continuous);
- count--;
- }
+ {
+ backward_move_node_structure (window, IS_Continuous);
+ count--;
+ }
}
}
/* Show the next screen of WINDOW's node. */
-DECLARE_INFO_COMMAND (info_scroll_forward, "Scroll forward in this window")
+DECLARE_INFO_COMMAND (info_scroll_forward, _("Scroll forward in this window"))
{
if (count < 0)
info_scroll_backward (window, -count, key);
@@ -1164,43 +1158,43 @@ DECLARE_INFO_COMMAND (info_scroll_forward, "Scroll forward in this window")
int desired_top;
/* Without an explicit numeric argument, scroll the bottom two
- lines to the top of this window, Or, if at bottom of window,
- and the user wishes to scroll through nodes get the "Next" node
- for this window. */
+ lines to the top of this window, Or, if at bottom of window,
+ and the user wishes to scroll through nodes get the "Next" node
+ for this window. */
if (!info_explicit_arg && count == 1)
- {
- desired_top = window->pagetop + (window->height - 2);
-
- /* If there are no more lines to scroll here, error, or get
- another node, depending on INFO_SCROLL_BEHAVIOUR. */
- if (desired_top > window->line_count)
- {
- int behaviour = info_scroll_behaviour;
-
- /* Here is a hack. If the key being used is not SPC, do the
- PageOnly behaviour. */
- if (key != SPC && key != DEL)
- behaviour = IS_PageOnly;
-
- forward_move_node_structure (window, behaviour);
- return;
- }
- }
+ {
+ desired_top = window->pagetop + (window->height - 2);
+
+ /* If there are no more lines to scroll here, error, or get
+ another node, depending on INFO_SCROLL_BEHAVIOUR. */
+ if (desired_top > window->line_count)
+ {
+ int behaviour = info_scroll_behaviour;
+
+ /* Here is a hack. If the key being used is not SPC, do the
+ PageOnly behaviour. */
+ if (key != SPC && key != DEL)
+ behaviour = IS_PageOnly;
+
+ forward_move_node_structure (window, behaviour);
+ return;
+ }
+ }
else
- desired_top = window->pagetop + count;
+ desired_top = window->pagetop + count;
if (desired_top >= window->line_count)
- desired_top = window->line_count - 2;
+ desired_top = window->line_count - 2;
if (window->pagetop > desired_top)
- return;
+ return;
else
- set_window_pagetop (window, desired_top);
+ set_window_pagetop (window, desired_top);
}
}
/* Show the previous screen of WINDOW's node. */
-DECLARE_INFO_COMMAND (info_scroll_backward, "Scroll backward in this window")
+DECLARE_INFO_COMMAND (info_scroll_backward, _("Scroll backward in this window"))
{
if (count < 0)
info_scroll_forward (window, -count, key);
@@ -1209,58 +1203,58 @@ DECLARE_INFO_COMMAND (info_scroll_backward, "Scroll backward in this window")
int desired_top;
/* Without an explicit numeric argument, scroll the top two lines
- to the bottom of this window, or move to the previous, or Up'th
- node. */
+ to the bottom of this window, or move to the previous, or Up'th
+ node. */
if (!info_explicit_arg && count == 1)
- {
- desired_top = window->pagetop - (window->height - 2);
-
- if ((desired_top < 0) && (window->pagetop == 0))
- {
- int behaviour = info_scroll_behaviour;
-
- /* Same kind of hack as in info_scroll_forward. If the key
- used to invoke this command is not DEL, do only the PageOnly
- behaviour. */
- if (key != DEL && key != SPC)
- behaviour = IS_PageOnly;
-
- backward_move_node_structure (window, behaviour);
- return;
- }
- }
+ {
+ desired_top = window->pagetop - (window->height - 2);
+
+ if ((desired_top < 0) && (window->pagetop == 0))
+ {
+ int behaviour = info_scroll_behaviour;
+
+ /* Same kind of hack as in info_scroll_forward. If the key
+ used to invoke this command is not DEL, do only the PageOnly
+ behaviour. */
+ if (key != DEL && key != SPC)
+ behaviour = IS_PageOnly;
+
+ backward_move_node_structure (window, behaviour);
+ return;
+ }
+ }
else
- desired_top = window->pagetop - count;
+ desired_top = window->pagetop - count;
if (desired_top < 0)
- desired_top = 0;
+ desired_top = 0;
set_window_pagetop (window, desired_top);
}
}
/* Move to the beginning of the node. */
-DECLARE_INFO_COMMAND (info_beginning_of_node, "Move to the start of this node")
+DECLARE_INFO_COMMAND (info_beginning_of_node, _("Move to the start of this node"))
{
window->pagetop = window->point = 0;
window->flags |= W_UpdateWindow;
}
/* Move to the end of the node. */
-DECLARE_INFO_COMMAND (info_end_of_node, "Move to the end of this node")
+DECLARE_INFO_COMMAND (info_end_of_node, _("Move to the end of this node"))
{
window->point = window->node->nodelen - 1;
info_show_point (window);
}
/* **************************************************************** */
-/* */
-/* Commands for Manipulating Windows */
-/* */
+/* */
+/* Commands for Manipulating Windows */
+/* */
/* **************************************************************** */
/* Make the next window in the chain be the active window. */
-DECLARE_INFO_COMMAND (info_next_window, "Select the next window")
+DECLARE_INFO_COMMAND (info_next_window, _("Select the next window"))
{
if (count < 0)
{
@@ -1278,20 +1272,20 @@ DECLARE_INFO_COMMAND (info_next_window, "Select the next window")
while (count--)
{
if (window->next)
- window = window->next;
+ window = window->next;
else
- {
- if (window == the_echo_area || !echo_area_is_active)
- window = windows;
- else
- window = the_echo_area;
- }
+ {
+ if (window == the_echo_area || !echo_area_is_active)
+ window = windows;
+ else
+ window = the_echo_area;
+ }
}
if (active_window != window)
{
if (auto_footnotes_p)
- info_get_or_remove_footnotes (window);
+ info_get_or_remove_footnotes (window);
window->flags |= W_UpdateWindow;
active_window = window;
@@ -1299,7 +1293,7 @@ DECLARE_INFO_COMMAND (info_next_window, "Select the next window")
}
/* Make the previous window in the chain be the active window. */
-DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window")
+DECLARE_INFO_COMMAND (info_prev_window, _("Select the previous window"))
{
if (count < 0)
{
@@ -1318,30 +1312,30 @@ DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window")
while (count--)
{
/* If we are in the echo area, or if the echo area isn't active and we
- are in the first window, find the last window in the chain. */
+ are in the first window, find the last window in the chain. */
if (window == the_echo_area ||
- (window == windows && !echo_area_is_active))
- {
- register WINDOW *win, *last;
+ (window == windows && !echo_area_is_active))
+ {
+ register WINDOW *win, *last;
- for (win = windows; win; win = win->next)
- last = win;
+ for (win = windows; win; win = win->next)
+ last = win;
- window = last;
- }
+ window = last;
+ }
else
- {
- if (window == windows)
- window = the_echo_area;
- else
- window = window->prev;
- }
+ {
+ if (window == windows)
+ window = the_echo_area;
+ else
+ window = window->prev;
+ }
}
if (active_window != window)
{
if (auto_footnotes_p)
- info_get_or_remove_footnotes (window);
+ info_get_or_remove_footnotes (window);
window->flags |= W_UpdateWindow;
active_window = window;
@@ -1350,7 +1344,7 @@ DECLARE_INFO_COMMAND (info_prev_window, "Select the previous window")
/* Split WINDOW into two windows, both showing the same node. If we
are automatically tiling windows, re-tile after the split. */
-DECLARE_INFO_COMMAND (info_split_window, "Split the current window")
+DECLARE_INFO_COMMAND (info_split_window, _("Split the current window"))
{
WINDOW *split, *old_active;
int pagetop;
@@ -1374,54 +1368,54 @@ DECLARE_INFO_COMMAND (info_split_window, "Split the current window")
#if defined (SPLIT_BEFORE_ACTIVE)
/* Try to scroll the old window into its new postion. */
if (pagetop == window->pagetop)
- {
- int start, end, amount;
-
- start = split->first_row;
- end = start + window->height;
- amount = split->height + 1;
- display_scroll_display (start, end, amount);
- }
+ {
+ int start, end, amount;
+
+ start = split->first_row;
+ end = start + window->height;
+ amount = split->height + 1;
+ display_scroll_display (start, end, amount);
+ }
#else /* !SPLIT_BEFORE_ACTIVE */
/* Make sure point still appears in the active window. */
info_show_point (window);
#endif /* !SPLIT_BEFORE_ACTIVE */
/* If the window just split was one internal to Info, try to display
- something else in it. */
+ something else in it. */
if (internal_info_node_p (split->node))
- {
- register int i, j;
- INFO_WINDOW *iw;
- NODE *node = (NODE *)NULL;
- char *filename;
-
- for (i = 0; iw = info_windows[i]; i++)
- {
- for (j = 0; j < iw->nodes_index; j++)
- if (!internal_info_node_p (iw->nodes[j]))
- {
- if (iw->nodes[j]->parent)
- filename = iw->nodes[j]->parent;
- else
- filename = iw->nodes[j]->filename;
-
- node = info_get_node (filename, iw->nodes[j]->nodename);
- if (node)
- {
- window_set_node_of_window (split, node);
- i = info_windows_index - 1;
- break;
- }
- }
- }
- }
+ {
+ register int i, j;
+ INFO_WINDOW *iw;
+ NODE *node = (NODE *)NULL;
+ char *filename;
+
+ for (i = 0; (iw = info_windows[i]); i++)
+ {
+ for (j = 0; j < iw->nodes_index; j++)
+ if (!internal_info_node_p (iw->nodes[j]))
+ {
+ if (iw->nodes[j]->parent)
+ filename = iw->nodes[j]->parent;
+ else
+ filename = iw->nodes[j]->filename;
+
+ node = info_get_node (filename, iw->nodes[j]->nodename);
+ if (node)
+ {
+ window_set_node_of_window (split, node);
+ i = info_windows_index - 1;
+ break;
+ }
+ }
+ }
+ }
split->pagetop = window->pagetop;
if (auto_tiling_p)
- window_tile_windows (DONT_TILE_INTERNALS);
+ window_tile_windows (DONT_TILE_INTERNALS);
else
- window_adjust_pagetop (split);
+ window_adjust_pagetop (split);
remember_window_and_node (split, split->node);
}
@@ -1431,7 +1425,7 @@ DECLARE_INFO_COMMAND (info_split_window, "Split the current window")
automatically displaying footnotes, show or remove the footnotes
window. If we are automatically tiling windows, re-tile after the
deletion. */
-DECLARE_INFO_COMMAND (info_delete_window, "Delete the current window")
+DECLARE_INFO_COMMAND (info_delete_window, _("Delete the current window"))
{
if (!windows->next)
{
@@ -1439,17 +1433,17 @@ DECLARE_INFO_COMMAND (info_delete_window, "Delete the current window")
}
else if (window->flags & W_WindowIsPerm)
{
- info_error ("Cannot delete a permanent window");
+ info_error (_("Cannot delete a permanent window"));
}
else
{
info_delete_window_internal (window);
if (auto_footnotes_p)
- info_get_or_remove_footnotes (active_window);
+ info_get_or_remove_footnotes (active_window);
if (auto_tiling_p)
- window_tile_windows (DONT_TILE_INTERNALS);
+ window_tile_windows (DONT_TILE_INTERNALS);
}
}
@@ -1462,19 +1456,19 @@ info_delete_window_internal (window)
if (windows->next && ((window->flags & W_WindowIsPerm) == 0))
{
/* We not only delete the window from the display, we forget it from
- our list of remembered windows. */
+ our list of remembered windows. */
forget_window_and_nodes (window);
window_delete_window (window);
if (echo_area_is_active)
- echo_area_inform_of_deleted_window (window);
+ echo_area_inform_of_deleted_window (window);
}
}
/* Just keep WINDOW, deleting all others. */
-DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows")
+DECLARE_INFO_COMMAND (info_keep_one_window, _("Delete all other windows"))
{
- int num_deleted; /* The number of windows we deleted. */
+ int num_deleted; /* The number of windows we deleted. */
int pagetop, start, end;
/* Remember a few things about this window. We may be able to speed up
@@ -1490,14 +1484,14 @@ DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows")
WINDOW *win;
/* Find an eligible window and delete it. If no eligible windows
- are found, we are done. A window is eligible for deletion if
- is it not permanent, and it is not WINDOW. */
+ are found, we are done. A window is eligible for deletion if
+ is it not permanent, and it is not WINDOW. */
for (win = windows; win; win = win->next)
- if (win != window && ((win->flags & W_WindowIsPerm) == 0))
- break;
+ if (win != window && ((win->flags & W_WindowIsPerm) == 0))
+ break;
if (!win)
- break;
+ break;
info_delete_window_internal (win);
num_deleted++;
@@ -1518,7 +1512,7 @@ DECLARE_INFO_COMMAND (info_keep_one_window, "Delete all other windows")
}
/* Scroll the "other" window of WINDOW. */
-DECLARE_INFO_COMMAND (info_scroll_other_window, "Scroll the other window")
+DECLARE_INFO_COMMAND (info_scroll_other_window, _("Scroll the other window"))
{
WINDOW *other;
@@ -1538,7 +1532,7 @@ DECLARE_INFO_COMMAND (info_scroll_other_window, "Scroll the other window")
}
/* Change the size of WINDOW by AMOUNT. */
-DECLARE_INFO_COMMAND (info_grow_window, "Grow (or shrink) this window")
+DECLARE_INFO_COMMAND (info_grow_window, _("Grow (or shrink) this window"))
{
window_change_window_height (window, count);
}
@@ -1549,22 +1543,22 @@ int auto_tiling_p = 0;
/* Tile all of the visible windows. */
DECLARE_INFO_COMMAND (info_tile_windows,
- "Divide the available screen space among the visible windows")
+ _("Divide the available screen space among the visible windows"))
{
window_tile_windows (TILE_INTERNALS);
}
/* Toggle the state of this window's wrapping of lines. */
DECLARE_INFO_COMMAND (info_toggle_wrap,
- "Toggle the state of line wrapping in the current window")
+ _("Toggle the state of line wrapping in the current window"))
{
window_toggle_wrap (window);
}
/* **************************************************************** */
-/* */
-/* Info Node Commands */
-/* */
+/* */
+/* Info Node Commands */
+/* */
/* **************************************************************** */
/* Using WINDOW for various defaults, select the node referenced by ENTRY
@@ -1586,12 +1580,12 @@ info_select_reference (window, entry)
filename = window->node->filename;
if (filename)
- filename = strdup (filename);
+ filename = xstrdup (filename);
if (entry->nodename)
- nodename = strdup (entry->nodename);
+ nodename = xstrdup (entry->nodename);
else
- nodename = strdup ("Top");
+ nodename = xstrdup ("Top");
node = info_get_node (filename, nodename);
@@ -1601,25 +1595,25 @@ info_select_reference (window, entry)
if (!node)
{
if (info_recent_file_error)
- file_system_error = strdup (info_recent_file_error);
+ file_system_error = xstrdup (info_recent_file_error);
if (entry->nodename && (strcmp (entry->nodename, entry->label) == 0))
- {
- node = info_get_node (entry->label, "Top");
- if (!node && info_recent_file_error)
- {
- maybe_free (file_system_error);
- file_system_error = strdup (info_recent_file_error);
- }
- }
+ {
+ node = info_get_node (entry->label, "Top");
+ if (!node && info_recent_file_error)
+ {
+ maybe_free (file_system_error);
+ file_system_error = xstrdup (info_recent_file_error);
+ }
+ }
}
if (!node)
{
if (file_system_error)
- info_error (file_system_error);
+ info_error (file_system_error);
else
- info_error (CANT_FIND_NODE, nodename);
+ info_error (CANT_FIND_NODE, nodename);
}
maybe_free (file_system_error);
@@ -1669,42 +1663,42 @@ info_handle_pointer (label, window)
filename = nodename = (char *)NULL;
if (info_parsed_filename)
- filename = strdup (info_parsed_filename);
+ filename = xstrdup (info_parsed_filename);
else
- {
- if (window->node->parent)
- filename = strdup (window->node->parent);
- else if (window->node->filename)
- filename = strdup (window->node->filename);
- }
+ {
+ if (window->node->parent)
+ filename = xstrdup (window->node->parent);
+ else if (window->node->filename)
+ filename = xstrdup (window->node->filename);
+ }
if (info_parsed_nodename)
- nodename = strdup (info_parsed_nodename);
+ nodename = xstrdup (info_parsed_nodename);
else
- nodename = strdup ("Top");
+ nodename = xstrdup ("Top");
node = info_get_node (filename, nodename);
if (node)
- {
- INFO_WINDOW *info_win;
-
- info_win = get_info_window_of_window (window);
- if (info_win)
- {
- info_win->pagetops[info_win->current] = window->pagetop;
- info_win->points[info_win->current] = window->point;
- }
- set_remembered_pagetop_and_point (window);
- info_set_node_of_window (window, node);
- }
+ {
+ INFO_WINDOW *info_win;
+
+ info_win = get_info_window_of_window (window);
+ if (info_win)
+ {
+ info_win->pagetops[info_win->current] = window->pagetop;
+ info_win->points[info_win->current] = window->point;
+ }
+ set_remembered_pagetop_and_point (window);
+ info_set_node_of_window (window, node);
+ }
else
- {
- if (info_recent_file_error)
- info_error (info_recent_file_error);
- else
- info_error (CANT_FILE_NODE, filename, nodename);
- }
+ {
+ if (info_recent_file_error)
+ info_error (info_recent_file_error);
+ else
+ info_error (CANT_FILE_NODE, filename, nodename);
+ }
free (filename);
free (nodename);
@@ -1717,30 +1711,30 @@ info_handle_pointer (label, window)
/* Make WINDOW display the "Next:" node of the node currently being
displayed. */
-DECLARE_INFO_COMMAND (info_next_node, "Select the `Next' node")
+DECLARE_INFO_COMMAND (info_next_node, _("Select the `Next' node"))
{
info_next_label_of_node (window->node);
- info_handle_pointer ("Next", window);
+ info_handle_pointer (_("Next"), window);
}
/* Make WINDOW display the "Prev:" node of the node currently being
displayed. */
-DECLARE_INFO_COMMAND (info_prev_node, "Select the `Prev' node")
+DECLARE_INFO_COMMAND (info_prev_node, _("Select the `Prev' node"))
{
info_prev_label_of_node (window->node);
- info_handle_pointer ("Prev", window);
+ info_handle_pointer (_("Prev"), window);
}
/* Make WINDOW display the "Up:" node of the node currently being
displayed. */
-DECLARE_INFO_COMMAND (info_up_node, "Select the `Up' node")
+DECLARE_INFO_COMMAND (info_up_node, _("Select the `Up' node"))
{
info_up_label_of_node (window->node);
- info_handle_pointer ("Up", window);
+ info_handle_pointer (_("Up"), window);
}
/* Make WINDOW display the last node of this info file. */
-DECLARE_INFO_COMMAND (info_last_node, "Select the last node in this file")
+DECLARE_INFO_COMMAND (info_last_node, _("Select the last node in this file"))
{
register int i;
FILE_BUFFER *fb = file_buffer_of_window (window);
@@ -1753,7 +1747,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 (_("This window has no additional nodes"));
else
{
set_remembered_pagetop_and_point (window);
@@ -1762,7 +1756,7 @@ DECLARE_INFO_COMMAND (info_last_node, "Select the last node in this file")
}
/* Make WINDOW display the first node of this info file. */
-DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file")
+DECLARE_INFO_COMMAND (info_first_node, _("Select the first node in this file"))
{
FILE_BUFFER *fb = file_buffer_of_window (window);
NODE *node = (NODE *)NULL;
@@ -1771,7 +1765,7 @@ DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file")
node = info_get_node (fb->filename, fb->tags[0]->nodename);
if (!node)
- info_error ("This window has no additional nodes");
+ info_error (_("This window has no additional nodes"));
else
{
set_remembered_pagetop_and_point (window);
@@ -1779,55 +1773,15 @@ DECLARE_INFO_COMMAND (info_first_node, "Select the first node in this file")
}
}
-/* Make WINDOW display the previous node displayed in this window. */
-DECLARE_INFO_COMMAND (info_history_node,
- "Select the most recently selected node")
-{
- INFO_WINDOW *info_win;
-
- /* Find the INFO_WINDOW which contains WINDOW. */
- info_win = get_info_window_of_window (window);
-
- if (!info_win)
- {
- info_error ("Requested window is not present!");
- return;
- }
-
- set_remembered_pagetop_and_point (window);
- if (!info_win->current)
- {
- if (info_win->nodes_index > 1)
- {
- window_message_in_echo_area
- ("Now wrapped around to beginning of history.");
- info_win->current = info_win->nodes_index;
- }
- else
- {
- info_error ("No earlier nodes in this window.");
- return;
- }
- }
-
- info_win->current--;
- window_set_node_of_window (window, info_win->nodes[info_win->current]);
- window->pagetop = info_win->pagetops[info_win->current];
- window->point = info_win->points[info_win->current];
- window->flags |= W_UpdateWindow;
- if (auto_footnotes_p)
- info_get_or_remove_footnotes (window);
-}
-
/* Select the last menu item in WINDOW->node. */
DECLARE_INFO_COMMAND (info_last_menu_item,
- "Select the last item in this node's menu")
+ _("Select the last item in this node's menu"))
{
info_menu_digit (window, 1, '0');
}
/* Use KEY (a digit) to select the Nth menu item in WINDOW->node. */
-DECLARE_INFO_COMMAND (info_menu_digit, "Select this menu item")
+DECLARE_INFO_COMMAND (info_menu_digit, _("Select this menu item"))
{
register int i, item;
register REFERENCE *entry, **menu;
@@ -1848,15 +1802,15 @@ 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++)
- if (i == item - 1)
- break;
+ for (i = 0; (entry = menu[i]); i++)
+ if (i == item - 1)
+ break;
}
if (menu[i])
info_select_reference (window, menu[i]);
else
- info_error ("There aren't %d items in this menu.", item);
+ info_error (_("There aren't %d items in this menu."), item);
info_free_references (menu);
return;
@@ -1883,9 +1837,9 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
if (!menu)
{
if (builder == info_menu_of_node)
- info_error (NO_MENU_NODE);
+ info_error (NO_MENU_NODE);
else
- info_error (NO_XREF_NODE);
+ info_error (NO_XREF_NODE);
return;
}
@@ -1899,77 +1853,77 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
if (point_line != -1)
{
- SEARCH_BINDING binding;
-
- binding.buffer = window->node->contents;
- binding.start = window->line_starts[point_line] - binding.buffer;
- if (window->line_starts[point_line + 1])
- binding.end = window->line_starts[point_line + 1] - binding.buffer;
- else
- binding.end = window->node->nodelen;
- binding.flags = 0;
-
- if (builder == info_menu_of_node)
- {
- if (point_line)
- {
- binding.start--;
- refs = info_menu_items (&binding);
- }
- }
- else
- {
+ SEARCH_BINDING binding;
+
+ binding.buffer = window->node->contents;
+ binding.start = window->line_starts[point_line] - binding.buffer;
+ if (window->line_starts[point_line + 1])
+ binding.end = window->line_starts[point_line + 1] - binding.buffer;
+ else
+ binding.end = window->node->nodelen;
+ binding.flags = 0;
+
+ if (builder == info_menu_of_node)
+ {
+ if (point_line)
+ {
+ binding.start--;
+ refs = info_menu_items (&binding);
+ }
+ }
+ else
+ {
#if defined (HANDLE_MAN_PAGES)
- if (window->node->flags & N_IsManPage)
- refs = manpage_xrefs_in_binding (window->node, &binding);
- else
+ if (window->node->flags & N_IsManPage)
+ refs = manpage_xrefs_in_binding (window->node, &binding);
+ else
#endif /* HANDLE_MAN_PAGES */
- refs = info_xrefs (&binding);
- }
-
- if (refs)
- {
- 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)
- {
- int closest = -1;
-
- for (; refs[which]; which++)
- {
- if ((window->point >= refs[which]->start) &&
- (window->point <= refs[which]->end))
- {
- closest = which;
- break;
- }
- else if (window->point < refs[which]->start)
- {
- break;
- }
- }
- if (closest == -1)
- which--;
- else
- which = closest;
- }
-
- defentry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- defentry->label = strdup (refs[which]->label);
- defentry->filename = refs[which]->filename;
- defentry->nodename = refs[which]->nodename;
-
- if (defentry->filename)
- defentry->filename = strdup (defentry->filename);
- if (defentry->nodename)
- defentry->nodename = strdup (defentry->nodename);
- }
- info_free_references (refs);
- }
+ refs = info_xrefs (&binding);
+ }
+
+ if (refs)
+ {
+ 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)
+ {
+ int closest = -1;
+
+ for (; refs[which]; which++)
+ {
+ if ((window->point >= refs[which]->start) &&
+ (window->point <= refs[which]->end))
+ {
+ closest = which;
+ break;
+ }
+ else if (window->point < refs[which]->start)
+ {
+ break;
+ }
+ }
+ if (closest == -1)
+ which--;
+ else
+ which = closest;
+ }
+
+ defentry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ defentry->label = xstrdup (refs[which]->label);
+ defentry->filename = refs[which]->filename;
+ defentry->nodename = refs[which]->nodename;
+
+ if (defentry->filename)
+ defentry->filename = xstrdup (defentry->filename);
+ if (defentry->nodename)
+ defentry->nodename = xstrdup (defentry->nodename);
+ }
+ info_free_references (refs);
+ }
}
}
@@ -1980,24 +1934,24 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
/* Build the prompt string. */
if (defentry)
- prompt = (char *)xmalloc (20 + strlen (defentry->label));
+ prompt = (char *)xmalloc (20 + strlen (defentry->label));
else
- prompt = (char *)xmalloc (20);
+ prompt = (char *)xmalloc (20);
if (builder == info_menu_of_node)
- {
- if (defentry)
- sprintf (prompt, "Menu item (%s): ", defentry->label);
- else
- sprintf (prompt, "Menu item: ");
- }
+ {
+ if (defentry)
+ sprintf (prompt, _("Menu item (%s): "), defentry->label);
+ else
+ sprintf (prompt, _("Menu item: "));
+ }
else
- {
- if (defentry)
- sprintf (prompt, "Follow xref (%s): ", defentry->label);
- else
- sprintf (prompt, "Follow xref: ");
- }
+ {
+ if (defentry)
+ sprintf (prompt, _("Follow xref (%s): "), defentry->label);
+ else
+ sprintf (prompt, _("Follow xref: "));
+ }
line = info_read_completing_in_echo_area (window, prompt, menu);
free (prompt);
@@ -2006,31 +1960,31 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
/* User aborts, just quit. */
if (!line)
- {
- maybe_free (defentry);
- info_free_references (menu);
- info_abort_key (window, 0, 0);
- return;
- }
+ {
+ maybe_free (defentry);
+ info_free_references (menu);
+ info_abort_key (window, 0, 0);
+ return;
+ }
/* If we had a default and the user accepted it, use that. */
if (!*line)
- {
- free (line);
- if (defentry)
- line = strdup (defentry->label);
- else
- line = (char *)NULL;
- }
+ {
+ free (line);
+ if (defentry)
+ line = xstrdup (defentry->label);
+ else
+ line = (char *)NULL;
+ }
}
else
{
/* Not going to ask any questions. If we have a default entry, use
- that, otherwise return. */
+ that, otherwise return. */
if (!defentry)
- return;
+ return;
else
- line = strdup (defentry->label);
+ line = xstrdup (defentry->label);
}
if (line)
@@ -2039,42 +1993,42 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
entry = info_get_labeled_reference (line, menu);
if (!entry && defentry)
- info_error ("The reference disappeared! (%s).", line);
+ info_error (_("The reference disappeared! (%s)."), line);
else
- {
- NODE *orig;
-
- orig = window->node;
- info_select_reference (window, entry);
- if ((builder == info_xrefs_of_node) && (window->node != orig))
- {
- long offset;
- long start;
-
- if (window->line_count > 0)
- start = window->line_starts[1] - window->node->contents;
- else
- start = 0;
-
- offset =
- info_target_search_node (window->node, entry->label, start);
-
- if (offset != -1)
- {
- window->point = offset;
- window_adjust_pagetop (window);
- }
- }
- }
+ {
+ NODE *orig;
+
+ orig = window->node;
+ info_select_reference (window, entry);
+ if ((builder == info_xrefs_of_node) && (window->node != orig))
+ {
+ long offset;
+ long start;
+
+ if (window->line_count > 0)
+ start = window->line_starts[1] - window->node->contents;
+ else
+ start = 0;
+
+ offset =
+ info_target_search_node (window->node, entry->label, start);
+
+ if (offset != -1)
+ {
+ window->point = offset;
+ window_adjust_pagetop (window);
+ }
+ }
+ }
free (line);
if (defentry)
- {
- free (defentry->label);
- maybe_free (defentry->filename);
- maybe_free (defentry->nodename);
- free (defentry);
- }
+ {
+ free (defentry->label);
+ maybe_free (defentry->filename);
+ maybe_free (defentry->nodename);
+ free (defentry);
+ }
}
info_free_references (menu);
@@ -2085,7 +2039,7 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
/* Read a line (with completion) which is the name of a menu item,
and select that item. */
-DECLARE_INFO_COMMAND (info_menu_item, "Read a menu item and select its node")
+DECLARE_INFO_COMMAND (info_menu_item, _("Read a menu item and select its node"))
{
info_menu_or_ref_item (window, count, key, info_menu_of_node, 1);
}
@@ -2093,13 +2047,13 @@ DECLARE_INFO_COMMAND (info_menu_item, "Read a menu item and select its node")
/* Read a line (with completion) which is the name of a reference to
follow, and select the node. */
DECLARE_INFO_COMMAND
- (info_xref_item, "Read a footnote or cross reference and select its node")
+ (info_xref_item, _("Read a footnote or cross reference and select its node"))
{
info_menu_or_ref_item (window, count, key, info_xrefs_of_node, 1);
}
/* Position the cursor at the start of this node's menu. */
-DECLARE_INFO_COMMAND (info_find_menu, "Move to the start of this node's menu")
+DECLARE_INFO_COMMAND (info_find_menu, _("Move to the start of this node's menu"))
{
SEARCH_BINDING binding;
long position;
@@ -2123,7 +2077,7 @@ DECLARE_INFO_COMMAND (info_find_menu, "Move to the start of this node's menu")
/* Visit as many menu items as is possible, each in a separate window. */
DECLARE_INFO_COMMAND (info_visit_menu,
- "Visit as many menu items at once as possible")
+ _("Visit as many menu items at once as possible"))
{
register int i;
REFERENCE *entry, **menu;
@@ -2141,20 +2095,19 @@ DECLARE_INFO_COMMAND (info_visit_menu,
window_tile_windows (TILE_INTERNALS);
if (!new)
- info_error (WIN_TOO_SMALL);
+ info_error (WIN_TOO_SMALL);
else
- {
- active_window = new;
- info_select_reference (new, entry);
- }
+ {
+ active_window = new;
+ info_select_reference (new, entry);
+ }
}
}
/* Read a line of input which is a node name, and go to that node. */
-DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it")
+DECLARE_INFO_COMMAND (info_goto_node, _("Read a node name and select it"))
{
char *line;
- NODE *node;
#define GOTO_COMPLETES
#if defined (GOTO_COMPLETES)
@@ -2170,54 +2123,54 @@ DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it")
for (fbi = 0; info_loaded_files && info_loaded_files[fbi]; fbi++)
{
- FILE_BUFFER *fb;
- REFERENCE *entry;
- int this_is_the_current_fb;
-
- fb = info_loaded_files[fbi];
- this_is_the_current_fb = (current == fb);
-
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->filename = entry->nodename = (char *)NULL;
- entry->label = (char *)xmalloc (4 + strlen (fb->filename));
- sprintf (entry->label, "(%s)*", fb->filename);
-
- add_pointer_to_array
- (entry, items_index, items, items_slots, 10, REFERENCE *);
-
- if (fb->tags)
- {
- for (i = 0; fb->tags[i]; i++)
- {
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->filename = entry->nodename = (char *)NULL;
- entry->label = (char *) xmalloc
- (4 + strlen (fb->filename) + strlen (fb->tags[i]->nodename));
- sprintf (entry->label, "(%s)%s",
- fb->filename, fb->tags[i]->nodename);
-
- add_pointer_to_array
- (entry, items_index, items, items_slots, 100, REFERENCE *);
- }
-
- if (this_is_the_current_fb)
- {
- for (i = 0; fb->tags[i]; i++)
- {
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->filename = entry->nodename = (char *)NULL;
- entry->label = strdup (fb->tags[i]->nodename);
- add_pointer_to_array (entry, items_index, items,
- items_slots, 100, REFERENCE *);
- }
- }
- }
+ FILE_BUFFER *fb;
+ REFERENCE *entry;
+ int this_is_the_current_fb;
+
+ fb = info_loaded_files[fbi];
+ this_is_the_current_fb = (current == fb);
+
+ entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->filename = entry->nodename = (char *)NULL;
+ entry->label = (char *)xmalloc (4 + strlen (fb->filename));
+ sprintf (entry->label, "(%s)*", fb->filename);
+
+ add_pointer_to_array
+ (entry, items_index, items, items_slots, 10, REFERENCE *);
+
+ if (fb->tags)
+ {
+ for (i = 0; fb->tags[i]; i++)
+ {
+ entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->filename = entry->nodename = (char *)NULL;
+ entry->label = (char *) xmalloc
+ (4 + strlen (fb->filename) + strlen (fb->tags[i]->nodename));
+ sprintf (entry->label, "(%s)%s",
+ fb->filename, fb->tags[i]->nodename);
+
+ add_pointer_to_array
+ (entry, items_index, items, items_slots, 100, REFERENCE *);
+ }
+
+ if (this_is_the_current_fb)
+ {
+ for (i = 0; fb->tags[i]; i++)
+ {
+ entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->filename = entry->nodename = (char *)NULL;
+ entry->label = xstrdup (fb->tags[i]->nodename);
+ add_pointer_to_array (entry, items_index, items,
+ items_slots, 100, REFERENCE *);
+ }
+ }
+ }
}
- line = info_read_maybe_completing (window, "Goto Node: ", items);
+ line = info_read_maybe_completing (window, _("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, _("Goto Node: "));
#endif /* !GOTO_COMPLETES */
/* If the user aborted, quit now. */
@@ -2238,12 +2191,11 @@ DECLARE_INFO_COMMAND (info_goto_node, "Read a node name and select it")
}
#if defined (HANDLE_MAN_PAGES)
-DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it")
+DECLARE_INFO_COMMAND (info_man, _("Read a manpage reference and select it"))
{
char *line;
- NODE *node;
- line = info_read_in_echo_area (window, "Get Manpage: ");
+ line = info_read_in_echo_area (window, _("Get Manpage: "));
if (!line)
{
@@ -2258,7 +2210,7 @@ DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it")
char *goto_command;
goto_command = (char *)xmalloc
- (4 + strlen (MANPAGE_FILE_BUFFER_NAME) + strlen (line));
+ (4 + strlen (MANPAGE_FILE_BUFFER_NAME) + strlen (line));
sprintf (goto_command, "(%s)%s", MANPAGE_FILE_BUFFER_NAME, line);
@@ -2273,61 +2225,70 @@ DECLARE_INFO_COMMAND (info_man, "Read a manpage reference and select it")
#endif /* HANDLE_MAN_PAGES */
/* Move to the "Top" node in this file. */
-DECLARE_INFO_COMMAND (info_top_node, "Select the node `Top' in this file")
+DECLARE_INFO_COMMAND (info_top_node, _("Select the node `Top' in this file"))
{
- info_parse_and_select ("Top", window);
+ info_parse_and_select (_("Top"), window);
}
/* Move to the node "(dir)Top". */
-DECLARE_INFO_COMMAND (info_dir_node, "Select the node `(dir)'")
+DECLARE_INFO_COMMAND (info_dir_node, _("Select the node `(dir)'"))
{
info_parse_and_select ("(dir)Top", window);
}
-/* Try to delete the current node appearing in this window, showing the most
- recently selected node in this window. */
-DECLARE_INFO_COMMAND (info_kill_node, "Kill this node")
+
+/* 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;
{
- register int iw, i;
- register INFO_WINDOW *info_win;
- char *nodename = (char *)NULL;
- NODE *temp = (NODE *)NULL;
+ int iw;
+ char *nodename;
+ INFO_WINDOW *info_win;
+ 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));
- /* Read the name of a node to kill. The list of available nodes comes
- from the nodes appearing in the current window configuration. */
- {
- REFERENCE **menu = (REFERENCE **)NULL;
- int menu_index = 0, menu_slots = 0;
- char *default_nodename, *prompt;
+ sprintf (prompt, _("Kill node (%s): "), default_nodename);
- for (iw = 0; info_win = info_windows[iw]; iw++)
- {
- REFERENCE *entry;
+ for (iw = 0; (info_win = info_windows[iw]); iw++)
+ {
+ REFERENCE *entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->label = xstrdup (info_win->window->node->nodename);
+ entry->filename = entry->nodename = (char *)NULL;
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->label = strdup (info_win->window->node->nodename);
- entry->filename = entry->nodename = (char *)NULL;
+ add_pointer_to_array (entry, menu_index, menu, menu_slots, 10,
+ REFERENCE *);
+ }
- add_pointer_to_array
- (entry, menu_index, menu, menu_slots, 10, REFERENCE *);
- }
+ nodename = info_read_completing_in_echo_area (window, prompt, menu);
+ free (prompt);
+ info_free_references (menu);
+ if (nodename && !*nodename)
+ {
+ free (nodename);
+ nodename = default_nodename;
+ }
+ else
+ free (default_nodename);
- default_nodename = strdup (active_window->node->nodename);
- prompt = (char *)xmalloc (40 + strlen (default_nodename));
- sprintf (prompt, "Kill node (%s): ", default_nodename);
+ return nodename;
+}
- nodename = info_read_completing_in_echo_area (window, prompt, menu);
- free (prompt);
- info_free_references (menu);
- if (nodename && !*nodename)
- {
- free (nodename);
- nodename = default_nodename;
- }
- else
- free (default_nodename);
- }
+/* Delete NODENAME from this window, showing the most
+ recently selected node in this window. */
+static void
+kill_node (window, nodename)
+ WINDOW *window;
+ char *nodename;
+{
+ int iw, i;
+ INFO_WINDOW *info_win;
+ NODE *temp;
+
/* If there is no nodename to kill, quit now. */
if (!nodename)
{
@@ -2336,16 +2297,16 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node")
}
/* If there is a nodename, find it in our window list. */
- for (iw = 0; info_win = info_windows[iw]; iw++)
+ for (iw = 0; (info_win = info_windows[iw]); iw++)
if (strcmp (nodename, info_win->nodes[info_win->current]->nodename) == 0)
break;
if (!info_win)
{
if (*nodename)
- info_error ("Cannot kill the node `%s'", nodename);
+ info_error (_("Cannot kill node `%s'"), nodename);
else
- window_clear_echo_area ();
+ window_clear_echo_area ();
return;
}
@@ -2353,13 +2314,12 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node")
/* 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 (_("Cannot kill the last node"));
return;
}
- /* INFO_WIN contains the node that the user wants to stop viewing.
- Delete this node from the list of nodes previously shown in this
- window. */
+ /* INFO_WIN contains the node that the user wants to stop viewing. Delete
+ this node from the list of nodes previously shown in this window. */
for (i = info_win->current; i < info_win->nodes_index; i++)
info_win->nodes[i] = info_win->nodes[i++];
@@ -2378,41 +2338,40 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node")
long point;
if (info_windows[iw + 1])
- stealer = info_windows[iw + 1];
+ stealer = info_windows[iw + 1];
else
- stealer = info_windows[0];
+ stealer = info_windows[0];
/* If the node being displayed in the next window is not the most
- recently loaded one, get the most recently loaded one. */
+ recently loaded one, get the most recently loaded one. */
if ((stealer->nodes_index - 1) != stealer->current)
- which = stealer->nodes_index - 1;
+ which = stealer->nodes_index - 1;
/* Else, if there is another node behind the stealers current node,
- use that one. */
+ use that one. */
else if (stealer->current > 0)
- which = stealer->current - 1;
+ which = stealer->current - 1;
/* Else, just use the node appearing in STEALER's window. */
else
- which = stealer->current;
+ which = stealer->current;
/* Copy this node. */
{
- NODE *copy;
-
- temp = stealer->nodes[which];
- point = stealer->points[which];
- pagetop = stealer->pagetops[which];
-
- copy = (NODE *)xmalloc (sizeof (NODE));
- copy->filename = temp->filename;
- copy->parent = temp->parent;
- copy->nodename = temp->nodename;
- copy->contents = temp->contents;
- copy->nodelen = temp->nodelen;
- copy->flags = temp->flags;
-
- temp = copy;
+ NODE *copy = xmalloc (sizeof (NODE));
+
+ temp = stealer->nodes[which];
+ point = stealer->points[which];
+ pagetop = stealer->pagetops[which];
+
+ copy->filename = temp->filename;
+ copy->parent = temp->parent;
+ copy->nodename = temp->nodename;
+ copy->contents = temp->contents;
+ copy->nodelen = temp->nodelen;
+ copy->flags = temp->flags;
+
+ temp = copy;
}
window_set_node_of_window (info_win->window, temp);
@@ -2425,16 +2384,39 @@ DECLARE_INFO_COMMAND (info_kill_node, "Kill this node")
temp = info_win->nodes[info_win->current];
window_set_node_of_window (info_win->window, temp);
}
+
if (!info_error_was_printed)
window_clear_echo_area ();
+
+ if (auto_footnotes_p)
+ info_get_or_remove_footnotes (window);
+}
+
+/* Kill current node, thus going back one in the node history. I (karl)
+ do not think this is completely correct yet, because of the
+ window-changing stuff in kill_node, but it's a lot better than the
+ previous implementation, which did not account for nodes being
+ visited twice at all. */
+DECLARE_INFO_COMMAND (info_history_node,
+ _("Select the most recently selected node"))
+{
+ kill_node (window, active_window->node->nodename);
+}
+
+/* Kill named node. */
+DECLARE_INFO_COMMAND (info_kill_node, _("Kill this node"))
+{
+ char *nodename = read_nodename_to_kill (window);
+ kill_node (window, nodename);
}
+
/* Read the name of a file and select the entire file. */
-DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it")
+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, _("Find file: "));
if (!line)
{
info_abort_key (active_window, 1, 0);
@@ -2447,17 +2429,17 @@ DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it")
node = info_get_node (line, "*");
if (!node)
- {
- if (info_recent_file_error)
- info_error (info_recent_file_error);
- else
- info_error ("Cannot find \"%s\".", line);
- }
+ {
+ if (info_recent_file_error)
+ info_error (info_recent_file_error);
+ else
+ info_error (_("Cannot find \"%s\"."), line);
+ }
else
- {
- set_remembered_pagetop_and_point (active_window);
- info_set_node_of_window (window, node);
- }
+ {
+ set_remembered_pagetop_and_point (active_window);
+ info_set_node_of_window (window, node);
+ }
free (line);
}
@@ -2466,9 +2448,9 @@ DECLARE_INFO_COMMAND (info_view_file, "Read the name of a file and select it")
}
/* **************************************************************** */
-/* */
-/* Dumping and Printing Nodes */
-/* */
+/* */
+/* Dumping and Printing Nodes */
+/* */
/* **************************************************************** */
#define VERBOSE_NODE_DUMPING
@@ -2498,7 +2480,7 @@ 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 (_("Could not create output file \"%s\"."), output_filename);
return;
}
@@ -2511,7 +2493,7 @@ dump_nodes_to_file (filename, nodenames, output_filename, dump_subnodes)
fclose (output_stream);
#if defined (VERBOSE_NODE_DUMPING)
- info_error ("Done.");
+ info_error (_("Done."));
#endif /* VERBOSE_NODE_DUMPING */
}
@@ -2543,15 +2525,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);
else
- {
- if (filename && *nodename != '(')
- info_error
- (CANT_FILE_NODE, filename_non_directory (filename), nodename);
- else
- info_error (CANT_FIND_NODE, nodename);
- }
+ {
+ if (filename && *nodename != '(')
+ info_error
+ (CANT_FILE_NODE, filename_non_directory (filename), nodename);
+ else
+ info_error (CANT_FIND_NODE, nodename);
+ }
return;
}
@@ -2559,19 +2541,19 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes)
for (i = 0; i < dumped_already_index; i++)
if (strcmp (node->nodename, dumped_already[i]) == 0)
{
- free (node);
- return;
+ free (node);
+ return;
}
add_pointer_to_array (node->nodename, dumped_already_index, dumped_already,
- dumped_already_slots, 50, char *);
+ dumped_already_slots, 50, char *);
#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
if (node->filename)
- info_error ("Writing node \"(%s)%s\"...",
- filename_non_directory (node->filename), node->nodename);
+ info_error (_("Writing node \"(%s)%s\"..."),
+ filename_non_directory (node->filename), node->nodename);
else
- info_error ("Writing node \"%s\"...", node->nodename);
+ info_error (_("Writing node \"%s\"..."), node->nodename);
#endif /* VERBOSE_NODE_DUMPING */
write_node_to_stream (node, stream);
@@ -2584,20 +2566,20 @@ dump_node_to_stream (filename, nodename, stream, dump_subnodes)
/* If this node is an Index, do not dump the menu references. */
if (string_in_line ("Index", node->nodename) == -1)
- menu = info_menu_of_node (node);
+ menu = info_menu_of_node (node);
if (menu)
- {
- for (i = 0; menu[i]; i++)
- {
- /* We don't dump Info files which are different than the
- current one. */
- if (!menu[i]->filename)
- dump_node_to_stream
- (filename, menu[i]->nodename, stream, dump_subnodes);
- }
- info_free_references (menu);
- }
+ {
+ for (i = 0; menu[i]; i++)
+ {
+ /* We don't dump Info files which are different than the
+ current one. */
+ if (!menu[i]->filename)
+ dump_node_to_stream
+ (filename, menu[i]->nodename, stream, dump_subnodes);
+ }
+ info_free_references (menu);
+ }
}
free (node);
@@ -2623,7 +2605,7 @@ dump_node_to_file (node, filename, dump_subnodes)
if (!output_stream)
{
- info_error ("Could not create output file \"%s\".", filename);
+ info_error (_("Could not create output file \"%s\"."), filename);
return;
}
@@ -2640,7 +2622,7 @@ dump_node_to_file (node, filename, dump_subnodes)
fclose (output_stream);
#if defined (VERBOSE_NODE_DUMPING)
- info_error ("Done.");
+ info_error (_("Done."));
#endif /* VERBOSE_NODE_DUMPING */
}
@@ -2649,7 +2631,7 @@ dump_node_to_file (node, filename, dump_subnodes)
#endif /* !DEFAULT_INFO_PRINT_COMMAND */
DECLARE_INFO_COMMAND (info_print_node,
- "Pipe the contents of this node through INFO_PRINT_COMMAND")
+ _("Pipe the contents of this node through INFO_PRINT_COMMAND"))
{
print_node (window->node);
}
@@ -2659,10 +2641,8 @@ void
print_node (node)
NODE *node;
{
- char *print_command, *getenv ();
FILE *printer_pipe;
-
- print_command = getenv ("INFO_PRINT_COMMAND");
+ char *print_command = getenv ("INFO_PRINT_COMMAND");
if (!print_command || !*print_command)
print_command = DEFAULT_INFO_PRINT_COMMAND;
@@ -2671,24 +2651,24 @@ print_node (node)
if (!printer_pipe)
{
- info_error ("Cannot open pipe to \"%s\".", print_command);
+ info_error (_("Cannot open pipe to \"%s\"."), print_command);
return;
}
#if defined (VERBOSE_NODE_DUMPING)
/* Maybe we should print some information about the node being output. */
if (node->filename)
- info_error ("Printing node \"(%s)%s\"...",
- filename_non_directory (node->filename), node->nodename);
+ info_error (_("Printing node \"(%s)%s\"..."),
+ filename_non_directory (node->filename), node->nodename);
else
- info_error ("Printing node \"%s\"...", node->nodename);
+ info_error (_("Printing node \"%s\"..."), node->nodename);
#endif /* VERBOSE_NODE_DUMPING */
write_node_to_stream (node, printer_pipe);
pclose (printer_pipe);
#if defined (VERBOSE_NODE_DUMPING)
- info_error ("Done.");
+ info_error (_("Done."));
#endif /* VERBOSE_NODE_DUMPING */
}
@@ -2701,9 +2681,9 @@ write_node_to_stream (node, stream)
}
/* **************************************************************** */
-/* */
-/* Info Searching Commands */
-/* */
+/* */
+/* Info Searching Commands */
+/* */
/* **************************************************************** */
/* Variable controlling the garbage collection of files briefly visited
@@ -2778,7 +2758,7 @@ info_search_in_node (string, node, start, window, dir)
{
set_remembered_pagetop_and_point (window);
if (window->node != node)
- window_set_node_of_window (window, node);
+ window_set_node_of_window (window, node);
window->point = offset;
window_adjust_pagetop (window);
}
@@ -2798,7 +2778,7 @@ info_target_search_node (node, string, start)
long offset;
char *target;
- target = strdup (string);
+ target = xstrdup (string);
i = strlen (target);
/* Try repeatedly searching for this string while removing words from
@@ -2809,7 +2789,7 @@ info_target_search_node (node, string, start)
offset = info_search_in_node (target, node, start, (WINDOW *)NULL, 1);
if (offset != -1)
- break;
+ break;
/* Delete the last word from TARGET. */
for (; i && (!whitespace (target[i]) && (target[i] != ',')); i--);
@@ -2843,22 +2823,22 @@ info_search_internal (string, window, dir)
(strcmp (last_searched_for_string, string) == 0))
{
ret = info_search_in_node
- (string, window->node, window->point + dir, window, dir);
+ (string, window->node, window->point + dir, window, dir);
}
else
{
ret = info_search_in_node
- (string, window->node, window->point, window, dir);
+ (string, window->node, window->point, window, dir);
}
maybe_free (last_searched_for_string);
- last_searched_for_string = strdup (string);
+ last_searched_for_string = xstrdup (string);
if (ret != -1)
{
/* We won! */
if (!echo_area_is_active && !isearch_is_active)
- window_clear_echo_area ();
+ window_clear_echo_area ();
return (0);
}
@@ -2879,91 +2859,91 @@ info_search_internal (string, window, dir)
/* Find number of tags and current tag. */
last_subfile = (char *)NULL;
for (i = 0; file_buffer->tags[i]; i++)
- if (strcmp (initial_nodename, file_buffer->tags[i]->nodename) == 0)
- {
- current_tag = i;
- last_subfile = file_buffer->tags[i]->filename;
- }
+ if (strcmp (initial_nodename, file_buffer->tags[i]->nodename) == 0)
+ {
+ current_tag = i;
+ last_subfile = file_buffer->tags[i]->filename;
+ }
number_of_tags = i;
/* If there is no last_subfile, our tag wasn't found. */
if (!last_subfile)
- return (-1);
+ return (-1);
/* Search through subsequent nodes, wrapping around to the top
- of the info file until we find the string or return to this
- window's node and point. */
+ of the info file until we find the string or return to this
+ window's node and point. */
while (1)
- {
- NODE *node;
-
- /* Allow C-g to quit the search, failing it if pressed. */
- return_if_control_g (-1);
-
- current_tag += dir;
-
- if (current_tag < 0)
- current_tag = number_of_tags - 1;
- else if (current_tag == number_of_tags)
- current_tag = 0;
-
- tag = file_buffer->tags[current_tag];
-
- if (!echo_area_is_active && (last_subfile != tag->filename))
- {
- window_message_in_echo_area
- ("Searching subfile \"%s\"...",
- filename_non_directory (tag->filename));
-
- last_subfile = tag->filename;
- }
-
- node = info_get_node (file_buffer->filename, tag->nodename);
-
- if (!node)
- {
- /* If not doing i-search... */
- if (!echo_area_is_active)
- {
- if (info_recent_file_error)
- info_error (info_recent_file_error);
- else
- info_error (CANT_FILE_NODE,
- filename_non_directory (file_buffer->filename),
- tag->nodename);
- }
- return (-1);
- }
-
- if (dir < 0)
- start = tag->nodelen;
-
- ret =
- info_search_in_node (string, node, start, window, dir);
-
- /* Did we find the string in this node? */
- if (ret != -1)
- {
- /* Yes! We win. */
- remember_window_and_node (window, node);
- if (!echo_area_is_active)
- window_clear_echo_area ();
- return (0);
- }
-
- /* No. Free this node, and make sure that we haven't passed
- our starting point. */
- free (node);
-
- if (strcmp (initial_nodename, tag->nodename) == 0)
- return (-1);
- }
+ {
+ NODE *node;
+
+ /* Allow C-g to quit the search, failing it if pressed. */
+ return_if_control_g (-1);
+
+ current_tag += dir;
+
+ if (current_tag < 0)
+ current_tag = number_of_tags - 1;
+ else if (current_tag == number_of_tags)
+ current_tag = 0;
+
+ tag = file_buffer->tags[current_tag];
+
+ if (!echo_area_is_active && (last_subfile != tag->filename))
+ {
+ window_message_in_echo_area
+ (_("Searching subfile \"%s\"..."),
+ filename_non_directory (tag->filename));
+
+ last_subfile = tag->filename;
+ }
+
+ node = info_get_node (file_buffer->filename, tag->nodename);
+
+ if (!node)
+ {
+ /* If not doing i-search... */
+ if (!echo_area_is_active)
+ {
+ if (info_recent_file_error)
+ info_error (info_recent_file_error);
+ else
+ info_error (CANT_FILE_NODE,
+ filename_non_directory (file_buffer->filename),
+ tag->nodename);
+ }
+ return (-1);
+ }
+
+ if (dir < 0)
+ start = tag->nodelen;
+
+ ret =
+ info_search_in_node (string, node, start, window, dir);
+
+ /* Did we find the string in this node? */
+ if (ret != -1)
+ {
+ /* Yes! We win. */
+ remember_window_and_node (window, node);
+ if (!echo_area_is_active)
+ window_clear_echo_area ();
+ return (0);
+ }
+
+ /* No. Free this node, and make sure that we haven't passed
+ our starting point. */
+ free (node);
+
+ if (strcmp (initial_nodename, tag->nodename) == 0)
+ return (-1);
+ }
}
return (-1);
}
-DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
+DECLARE_INFO_COMMAND (info_search, _("Read a string and search for it"))
{
char *line, *prompt;
int result, old_pagetop;
@@ -2983,9 +2963,9 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
prompt = (char *)xmalloc (50 + strlen (search_string));
- sprintf (prompt, "%s for string [%s]: ",
- direction < 0 ? "Search backward" : "Search",
- search_string);
+ sprintf (prompt, _("%s for string [%s]: "),
+ direction < 0 ? _("Search backward") : _("Search"),
+ search_string);
line = info_read_in_echo_area (window, prompt);
free (prompt);
@@ -2999,8 +2979,8 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
if (*line)
{
if (strlen (line) + 1 > search_string_size)
- search_string = (char *)
- xrealloc (search_string, (search_string_size += 50 + strlen (line)));
+ search_string = (char *)
+ xrealloc (search_string, (search_string_size += 50 + strlen (line)));
strcpy (search_string, line);
search_string_index = strlen (line);
@@ -3011,7 +2991,7 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
result = info_search_internal (search_string, active_window, direction);
if (result != 0 && !info_error_was_printed)
- info_error ("Search failed.");
+ info_error (_("Search failed."));
else if (old_pagetop != active_window->pagetop)
{
int new_pagetop;
@@ -3020,7 +3000,7 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
active_window->pagetop = old_pagetop;
set_window_pagetop (active_window, new_pagetop);
if (auto_footnotes_p)
- info_get_or_remove_footnotes (active_window);
+ info_get_or_remove_footnotes (active_window);
}
/* Perhaps free the unreferenced file buffers that were searched, but
@@ -3029,21 +3009,21 @@ DECLARE_INFO_COMMAND (info_search, "Read a string and search for it")
}
/* **************************************************************** */
-/* */
-/* Incremental Searching */
-/* */
+/* */
+/* Incremental Searching */
+/* */
/* **************************************************************** */
static void incremental_search ();
DECLARE_INFO_COMMAND (isearch_forward,
- "Search interactively for a string as you type it")
+ _("Search interactively for a string as you type it"))
{
incremental_search (window, count, key);
}
DECLARE_INFO_COMMAND (isearch_backward,
- "Search interactively for a string as you type it")
+ _("Search interactively for a string as you type it"))
{
incremental_search (window, -count, key);
}
@@ -3060,10 +3040,10 @@ 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. */
+ 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. */
@@ -3086,7 +3066,7 @@ push_isearch (window, search_index, direction, failing)
state->failing = failing;
add_pointer_to_array (state, isearch_states_index, isearch_states,
- isearch_states_slots, 20, SEARCH_STATE *);
+ isearch_states_slots, 20, SEARCH_STATE *);
}
/* Pop the state of this search to WINDOW, SEARCH_INDEX, and DIRECTION. */
@@ -3137,9 +3117,9 @@ show_isearch_prompt (dir, string, failing_p)
int prompt_len, p_rep_index, p_rep_size;
if (dir < 0)
- prefix = "I-search backward: ";
+ prefix = _("I-search backward: ");
else
- prefix = "I-search: ";
+ prefix = _("I-search: ");
p_rep_index = p_rep_size = 0;
p_rep = (char *)NULL;
@@ -3148,15 +3128,15 @@ show_isearch_prompt (dir, string, failing_p)
char *rep;
switch (string[i])
- {
- case ' ': rep = " "; break;
- case LFD: rep = "\\n"; break;
- case TAB: rep = "\\t"; break;
- default:
- rep = pretty_keyname (string[i]);
- }
+ {
+ case ' ': rep = " "; break;
+ case LFD: rep = "\\n"; break;
+ case TAB: rep = "\\t"; break;
+ default:
+ rep = pretty_keyname (string[i]);
+ }
if ((p_rep_index + strlen (rep) + 1) >= p_rep_size)
- p_rep = (char *)xrealloc (p_rep, p_rep_size += 100);
+ p_rep = (char *)xrealloc (p_rep, p_rep_size += 100);
strcpy (p_rep + p_rep_index, rep);
p_rep_index += strlen (rep);
@@ -3164,8 +3144,8 @@ show_isearch_prompt (dir, string, failing_p)
prompt_len = strlen (prefix) + p_rep_index + 20;
prompt = (char *)xmalloc (prompt_len);
- sprintf (prompt, "%s%s%s", failing_p ? "Failing " : "", prefix,
- p_rep ? p_rep : "");
+ sprintf (prompt, "%s%s%s", failing_p ? _("Failing ") : "", prefix,
+ p_rep ? p_rep : "");
window_message_in_echo_area ("%s", prompt);
maybe_free (p_rep);
@@ -3208,202 +3188,202 @@ incremental_search (window, count, ignore)
int quoted = 0;
/* If a recent display was interrupted, then do the redisplay now if
- it is convenient. */
+ it is convenient. */
if (!info_any_buffered_input_p () && display_was_interrupted_p)
- {
- display_update_one_window (window);
- display_cursor_at_point (active_window);
- }
+ {
+ display_update_one_window (window);
+ display_cursor_at_point (active_window);
+ }
/* Read a character and dispatch on it. */
key = info_get_input_char ();
window_get_state (window, &mystate);
if (key == DEL)
- {
- /* User wants to delete one level of search? */
- if (!isearch_states_index)
- {
- terminal_ring_bell ();
- continue;
- }
- else
- {
- pop_isearch
- (window, &isearch_string_index, &dir, &search_result);
- isearch_string[isearch_string_index] = '\0';
- show_isearch_prompt (dir, isearch_string, search_result);
- goto after_search;
- }
- }
+ {
+ /* User wants to delete one level of search? */
+ if (!isearch_states_index)
+ {
+ terminal_ring_bell ();
+ continue;
+ }
+ else
+ {
+ pop_isearch
+ (window, &isearch_string_index, &dir, &search_result);
+ isearch_string[isearch_string_index] = '\0';
+ show_isearch_prompt (dir, isearch_string, search_result);
+ goto after_search;
+ }
+ }
else if (key == Control ('q'))
- {
- key = info_get_input_char ();
- quoted = 1;
- }
+ {
+ key = info_get_input_char ();
+ quoted = 1;
+ }
/* We are about to search again, or quit. Save the current search. */
push_isearch (window, isearch_string_index, dir, search_result);
if (quoted)
- goto insert_and_search;
+ goto insert_and_search;
if (!Meta_p (key) || (ISO_Latin_p && key < 160))
- {
- func = window->keymap[key].function;
-
- /* 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 || func == isearch_backward)
- {
- if ((func == isearch_forward && dir > 0) ||
- (func == isearch_backward && dir < 0))
- {
- /* If the user has typed no characters, then insert the
- last successful search into the current search string. */
- if (isearch_string_index == 0)
- {
- /* Of course, there must be something to insert. */
- if (last_isearch_accepted)
- {
- if (strlen (last_isearch_accepted) + 1 >=
- isearch_string_size)
- isearch_string = (char *)
- xrealloc (isearch_string,
- isearch_string_size += 10 +
- strlen (last_isearch_accepted));
- strcpy (isearch_string, last_isearch_accepted);
- isearch_string_index = strlen (isearch_string);
- goto search_now;
- }
- else
- continue;
- }
- else
- {
- /* Search again in the same direction. This means start
- from a new place if the last search was successful. */
- if (search_result == 0)
- window->point += dir;
- }
- }
- else
- {
- /* Reverse the direction of the search. */
- dir = -dir;
- }
- }
- else if (isprint (key) || func == (VFunction *)NULL)
- {
- insert_and_search:
-
- if (isearch_string_index + 2 >= isearch_string_size)
- isearch_string = (char *)xrealloc
- (isearch_string, isearch_string_size += 100);
-
- isearch_string[isearch_string_index++] = key;
- isearch_string[isearch_string_index] = '\0';
- goto search_now;
- }
- else if (func == info_abort_key)
- {
- /* If C-g pressed, and the search is failing, pop the search
- stack back to the last unfailed search. */
- if (isearch_states_index && (search_result != 0))
- {
- terminal_ring_bell ();
- while (isearch_states_index && (search_result != 0))
- pop_isearch
- (window, &isearch_string_index, &dir, &search_result);
- isearch_string[isearch_string_index] = '\0';
- show_isearch_prompt (dir, isearch_string, search_result);
- continue;
- }
- else
- goto exit_search;
- }
- else
- goto exit_search;
- }
+ {
+ func = window->keymap[key].function;
+
+ /* 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 || func == isearch_backward)
+ {
+ if ((func == isearch_forward && dir > 0) ||
+ (func == isearch_backward && dir < 0))
+ {
+ /* If the user has typed no characters, then insert the
+ last successful search into the current search string. */
+ if (isearch_string_index == 0)
+ {
+ /* Of course, there must be something to insert. */
+ if (last_isearch_accepted)
+ {
+ if (strlen (last_isearch_accepted) + 1 >=
+ isearch_string_size)
+ isearch_string = (char *)
+ xrealloc (isearch_string,
+ isearch_string_size += 10 +
+ strlen (last_isearch_accepted));
+ strcpy (isearch_string, last_isearch_accepted);
+ isearch_string_index = strlen (isearch_string);
+ goto search_now;
+ }
+ else
+ continue;
+ }
+ else
+ {
+ /* Search again in the same direction. This means start
+ from a new place if the last search was successful. */
+ if (search_result == 0)
+ window->point += dir;
+ }
+ }
+ else
+ {
+ /* Reverse the direction of the search. */
+ dir = -dir;
+ }
+ }
+ else if (isprint (key) || func == (VFunction *)NULL)
+ {
+ insert_and_search:
+
+ if (isearch_string_index + 2 >= isearch_string_size)
+ isearch_string = (char *)xrealloc
+ (isearch_string, isearch_string_size += 100);
+
+ isearch_string[isearch_string_index++] = key;
+ isearch_string[isearch_string_index] = '\0';
+ goto search_now;
+ }
+ else if (func == info_abort_key)
+ {
+ /* If C-g pressed, and the search is failing, pop the search
+ stack back to the last unfailed search. */
+ if (isearch_states_index && (search_result != 0))
+ {
+ terminal_ring_bell ();
+ while (isearch_states_index && (search_result != 0))
+ pop_isearch
+ (window, &isearch_string_index, &dir, &search_result);
+ isearch_string[isearch_string_index] = '\0';
+ show_isearch_prompt (dir, isearch_string, search_result);
+ continue;
+ }
+ else
+ goto exit_search;
+ }
+ else
+ goto exit_search;
+ }
else
- {
- exit_search:
- /* The character is not printable, or it has a function which is
- 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)
- {
- maybe_free (last_isearch_accepted);
- last_isearch_accepted = strdup (isearch_string);
- }
-
- if (key != isearch_terminate_search_key)
- info_set_pending_input (key);
-
- if (func == info_abort_key)
- {
- if (isearch_states_index)
- window_set_state (window, &orig_state);
- }
-
- if (!echo_area_is_active)
- window_clear_echo_area ();
-
- if (auto_footnotes_p)
- info_get_or_remove_footnotes (active_window);
-
- isearch_is_active = 0;
- continue;
- }
+ {
+ exit_search:
+ /* The character is not printable, or it has a function which is
+ 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)
+ {
+ maybe_free (last_isearch_accepted);
+ last_isearch_accepted = xstrdup (isearch_string);
+ }
+
+ if (key != isearch_terminate_search_key)
+ info_set_pending_input (key);
+
+ if (func == info_abort_key)
+ {
+ if (isearch_states_index)
+ window_set_state (window, &orig_state);
+ }
+
+ if (!echo_area_is_active)
+ window_clear_echo_area ();
+
+ if (auto_footnotes_p)
+ info_get_or_remove_footnotes (active_window);
+
+ isearch_is_active = 0;
+ continue;
+ }
/* Search for the contents of isearch_string. */
search_now:
show_isearch_prompt (dir, isearch_string, search_result);
if (search_result == 0)
- {
- /* Check to see if the current search string is right here. If
- we are looking at it, then don't bother calling the search
- function. */
- if (((dir < 0) &&
- (strncasecmp (window->node->contents + window->point,
- isearch_string, isearch_string_index) == 0)) ||
- ((dir > 0) &&
- ((window->point - isearch_string_index) >= 0) &&
- (strncasecmp (window->node->contents +
- (window->point - (isearch_string_index - 1)),
- isearch_string, isearch_string_index) == 0)))
- {
- if (dir > 0)
- window->point++;
- }
- else
- search_result = info_search_internal (isearch_string, window, dir);
- }
+ {
+ /* Check to see if the current search string is right here. If
+ we are looking at it, then don't bother calling the search
+ function. */
+ if (((dir < 0) &&
+ (strncasecmp (window->node->contents + window->point,
+ isearch_string, isearch_string_index) == 0)) ||
+ ((dir > 0) &&
+ ((window->point - isearch_string_index) >= 0) &&
+ (strncasecmp (window->node->contents +
+ (window->point - (isearch_string_index - 1)),
+ isearch_string, isearch_string_index) == 0)))
+ {
+ if (dir > 0)
+ window->point++;
+ }
+ else
+ search_result = info_search_internal (isearch_string, window, dir);
+ }
/* If this search failed, and we didn't already have a failed search,
- then ring the terminal bell. */
+ then ring the terminal bell. */
if (search_result != 0 && last_search_result == 0)
- terminal_ring_bell ();
+ terminal_ring_bell ();
after_search:
show_isearch_prompt (dir, isearch_string, search_result);
if (search_result == 0)
- {
- if ((mystate.node == window->node) &&
- (mystate.pagetop != window->pagetop))
- {
- int newtop = window->pagetop;
- window->pagetop = mystate.pagetop;
- set_window_pagetop (window, newtop);
- }
- display_update_one_window (window);
- display_cursor_at_point (window);
- }
+ {
+ if ((mystate.node == window->node) &&
+ (mystate.pagetop != window->pagetop))
+ {
+ int newtop = window->pagetop;
+ window->pagetop = mystate.pagetop;
+ set_window_pagetop (window, newtop);
+ }
+ display_update_one_window (window);
+ display_cursor_at_point (window);
+ }
last_search_result = search_result;
}
@@ -3433,52 +3413,52 @@ info_gc_file_buffers ()
if (!info_loaded_files)
return;
- for (fb_index = 0; fb = info_loaded_files[fb_index]; fb_index++)
+ for (fb_index = 0; (fb = info_loaded_files[fb_index]); fb_index++)
{
int fb_referenced_p = 0;
/* If already gc-ed, do nothing. */
if (!fb->contents)
- continue;
+ continue;
/* If this file had to be uncompressed, check to see if we should
- gc it. This means that the user-variable "gc-compressed-files"
- is non-zero. */
+ gc it. This means that the user-variable "gc-compressed-files"
+ is non-zero. */
if ((fb->flags & N_IsCompressed) && !gc_compressed_files)
- continue;
+ continue;
/* If this file's contents are not gc-able, move on. */
if (fb->flags & N_CannotGC)
- continue;
+ continue;
/* Check each INFO_WINDOW to see if it has any nodes which reference
- this file. */
- for (iw_index = 0; iw = info_windows[iw_index]; iw_index++)
- {
- for (i = 0; iw->nodes && iw->nodes[i]; i++)
- {
- if ((strcmp (fb->fullpath, iw->nodes[i]->filename) == 0) ||
- (strcmp (fb->filename, iw->nodes[i]->filename) == 0))
- {
- fb_referenced_p = 1;
- break;
- }
- }
- }
+ this file. */
+ for (iw_index = 0; (iw = info_windows[iw_index]); iw_index++)
+ {
+ for (i = 0; iw->nodes && iw->nodes[i]; i++)
+ {
+ if ((strcmp (fb->fullpath, iw->nodes[i]->filename) == 0) ||
+ (strcmp (fb->filename, iw->nodes[i]->filename) == 0))
+ {
+ fb_referenced_p = 1;
+ break;
+ }
+ }
+ }
/* If this file buffer wasn't referenced, free its contents. */
if (!fb_referenced_p)
- {
- free (fb->contents);
- fb->contents = (char *)NULL;
- }
+ {
+ free (fb->contents);
+ fb->contents = (char *)NULL;
+ }
}
}
/* **************************************************************** */
-/* */
-/* Traversing and Selecting References */
-/* */
+/* */
+/* Traversing and Selecting References */
+/* */
/* **************************************************************** */
/* Move to the next or previous cross reference in this node. */
@@ -3513,8 +3493,8 @@ info_move_to_xref (window, count, key, dir)
char *text = node->contents + firstmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- firstmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, (WINDOW *)NULL, dir);
+ firstmenu = info_search_in_node
+ (INFO_MENU_ENTRY_LABEL, node, firstmenu + dir, (WINDOW *)NULL, dir);
}
firstxref =
@@ -3529,7 +3509,7 @@ info_move_to_xref (window, count, key, dir)
if (firstmenu == -1 && firstxref == -1)
{
- info_error ("No cross references in this node.");
+ info_error (_("No cross references in this node."));
return;
}
@@ -3553,8 +3533,8 @@ info_move_to_xref (window, count, key, dir)
char *text = node->contents + nextmenu;
if (strncmp (text, INFO_MENU_LABEL, strlen (INFO_MENU_LABEL)) == 0)
- nextmenu = info_search_in_node
- (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, (WINDOW *)NULL, dir);
+ nextmenu = info_search_in_node
+ (INFO_MENU_ENTRY_LABEL, node, nextmenu + dir, (WINDOW *)NULL, dir);
}
/* If there is both a next menu entry, and a next xref entry, choose the
@@ -3563,10 +3543,10 @@ info_move_to_xref (window, count, key, dir)
if (nextmenu != -1 && nextxref != -1)
{
if (((dir == 1) && (nextmenu < nextxref)) ||
- ((dir == -1) && (nextmenu > nextxref)))
- placement = nextmenu + 1;
+ ((dir == -1) && (nextmenu > nextxref)))
+ placement = nextmenu + 1;
else
- placement = nextxref;
+ placement = nextxref;
}
else if (nextmenu != -1)
placement = nextmenu + 1;
@@ -3578,17 +3558,17 @@ info_move_to_xref (window, count, key, dir)
if (placement == -1)
{
if (firstmenu != -1 && firstxref != -1)
- {
- if (((dir == 1) && (firstmenu < firstxref)) ||
- ((dir == -1) && (firstmenu > firstxref)))
- placement = firstmenu + 1;
- else
- placement = firstxref;
- }
+ {
+ if (((dir == 1) && (firstmenu < firstxref)) ||
+ ((dir == -1) && (firstmenu > firstxref)))
+ placement = firstmenu + 1;
+ else
+ placement = firstxref;
+ }
else if (firstmenu != -1)
- placement = firstmenu + 1;
+ placement = firstmenu + 1;
else
- placement = firstxref;
+ placement = firstxref;
}
window->point = placement;
window_adjust_pagetop (window);
@@ -3596,7 +3576,7 @@ info_move_to_xref (window, count, key, dir)
}
DECLARE_INFO_COMMAND (info_move_to_prev_xref,
- "Move to the previous cross reference")
+ _("Move to the previous cross reference"))
{
if (count < 0)
info_move_to_prev_xref (window, -count, key);
@@ -3605,7 +3585,7 @@ DECLARE_INFO_COMMAND (info_move_to_prev_xref,
}
DECLARE_INFO_COMMAND (info_move_to_next_xref,
- "Move to the next cross reference")
+ _("Move to the next cross reference"))
{
if (count < 0)
info_move_to_next_xref (window, -count, key);
@@ -3615,7 +3595,7 @@ DECLARE_INFO_COMMAND (info_move_to_next_xref,
/* Select the menu item or reference that appears on this line. */
DECLARE_INFO_COMMAND (info_select_reference_this_line,
- "Select reference or menu item appearing on this line")
+ _("Select reference or menu item appearing on this line"))
{
char *line;
NODE *orig;
@@ -3631,20 +3611,20 @@ DECLARE_INFO_COMMAND (info_select_reference_this_line,
}
/* **************************************************************** */
-/* */
-/* Miscellaneous Info Commands */
-/* */
+/* */
+/* Miscellaneous Info Commands */
+/* */
/* **************************************************************** */
/* What to do when C-g is pressed in a window. */
-DECLARE_INFO_COMMAND (info_abort_key, "Cancel current operation")
+DECLARE_INFO_COMMAND (info_abort_key, _("Cancel current operation"))
{
/* If error printing doesn't oridinarily ring the bell, do it now,
since C-g always rings the bell. Otherwise, let the error printer
do it. */
if (!info_error_rings_bell_p)
terminal_ring_bell ();
- info_error ("Quit");
+ info_error (_("Quit"));
info_initialize_numeric_arg ();
info_clear_pending_input ();
@@ -3653,7 +3633,7 @@ DECLARE_INFO_COMMAND (info_abort_key, "Cancel current operation")
/* Move the cursor to the desired line of the window. */
DECLARE_INFO_COMMAND (info_move_to_window_line,
- "Move to the cursor to a specific line of the window")
+ _("Move to the cursor to a specific line of the window"))
{
int line;
@@ -3663,9 +3643,9 @@ DECLARE_INFO_COMMAND (info_move_to_window_line,
else
{
if (count < 0)
- line = (window->height + count) + window->pagetop;
+ line = (window->height + count) + window->pagetop;
else
- line = window->pagetop + count;
+ line = window->pagetop + count;
}
/* If the line doesn't appear in this window, make it do so. */
@@ -3685,7 +3665,7 @@ DECLARE_INFO_COMMAND (info_move_to_window_line,
/* Clear the screen and redraw its contents. Given a numeric argument,
move the line the cursor is on to the COUNT'th line of the window. */
-DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display")
+DECLARE_INFO_COMMAND (info_redraw_display, _("Redraw the display"))
{
if ((!info_explicit_arg && count == 1) || echo_area_is_active)
{
@@ -3702,18 +3682,18 @@ DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display")
point_line = window_line_of_point (window) - window->pagetop;
if (count < 0)
- desired_line = window->height + count;
+ desired_line = window->height + count;
else
- desired_line = count;
+ desired_line = count;
if (desired_line < 0)
- desired_line = 0;
+ desired_line = 0;
if (desired_line >= window->height)
- desired_line = window->height - 1;
+ desired_line = window->height - 1;
if (desired_line == point_line)
- return;
+ return;
new_pagetop = window->pagetop + (point_line - desired_line);
@@ -3722,14 +3702,14 @@ DECLARE_INFO_COMMAND (info_redraw_display, "Redraw the display")
}
/* This command does nothing. It is the fact that a key is bound to it
that has meaning. See the code at the top of info_session (). */
-DECLARE_INFO_COMMAND (info_quit, "Quit using Info")
+DECLARE_INFO_COMMAND (info_quit, _("Quit using Info"))
{}
/* **************************************************************** */
-/* */
-/* Reading Keys and Dispatching on Them */
-/* */
+/* */
+/* Reading Keys and Dispatching on Them */
+/* */
/* **************************************************************** */
/* Declaration only. Special cased in info_dispatch_on_key (). */
@@ -3745,14 +3725,14 @@ dispatch_error (keyseq)
rep = pretty_keyseq (keyseq);
if (!echo_area_is_active)
- info_error ("Unknown command (%s).", rep);
+ info_error (_("Unknown command (%s)."), rep);
else
{
char *temp;
- temp = (char *)xmalloc (1 + strlen (rep) + strlen ("\"\" is invalid"));
+ temp = (char *)xmalloc (1 + strlen (rep) + strlen (_("\"\" is invalid")));
- sprintf (temp, "\"%s\" is invalid", rep);
+ sprintf (temp, _("\"%s\" is invalid"), rep);
terminal_ring_bell ();
inform_in_echo_area (temp);
free (temp);
@@ -3798,8 +3778,8 @@ pretty_keyseq (keyseq)
for (i = 0; keyseq[i]; i++)
{
sprintf (keyseq_rep + strlen (keyseq_rep), "%s%s",
- strlen (keyseq_rep) ? " " : "",
- pretty_keyname (keyseq[i]));
+ strlen (keyseq_rep) ? " " : "",
+ pretty_keyname (keyseq[i]));
}
return (keyseq_rep);
@@ -3832,25 +3812,30 @@ display_info_keyseq (expecting_future_input)
unsigned char
info_get_another_input_char ()
{
- int ready = 0;
+ int ready = !info_keyseq_displayed_p; /* ready if new and pending key */
/* If there isn't any input currently available, then wait a
moment looking for input. If we don't get it fast enough,
prompt a little bit with the current key sequence. */
- if (!info_keyseq_displayed_p &&
- !info_any_buffered_input_p () &&
- !info_input_pending_p ())
+ if (!info_keyseq_displayed_p)
{
+ ready = 1;
+ if (!info_any_buffered_input_p () &&
+ !info_input_pending_p ())
+ {
#if defined (FD_SET)
- struct timeval timer;
- fd_set readfds;
-
- FD_ZERO (&readfds);
- FD_SET (fileno (info_input_stream), &readfds);
- timer.tv_sec = 1;
- timer.tv_usec = 750;
- ready = select (1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+ struct timeval timer;
+ fd_set readfds;
+
+ FD_ZERO (&readfds);
+ FD_SET (fileno (info_input_stream), &readfds);
+ timer.tv_sec = 1;
+ timer.tv_usec = 750;
+ ready = select (fileno(info_input_stream)+1, &readfds, (fd_set *)NULL, (fd_set *)NULL, &timer);
+#else
+ ready = 0;
#endif /* FD_SET */
+ }
}
if (!ready)
@@ -3869,16 +3854,16 @@ info_dispatch_on_key (key, map)
if (Meta_p (key) && (!ISO_Latin_p || map[key].function != ea_insert))
{
if (map[ESC].type == ISKMAP)
- {
- map = (Keymap)map[ESC].function;
- add_char_to_keyseq (ESC);
- key = UnMeta (key);
- info_dispatch_on_key (key, map);
- }
+ {
+ map = (Keymap)map[ESC].function;
+ add_char_to_keyseq (ESC);
+ key = UnMeta (key);
+ info_dispatch_on_key (key, map);
+ }
else
- {
- dispatch_error (info_keyseq);
- }
+ {
+ dispatch_error (info_keyseq);
+ }
return;
}
@@ -3886,74 +3871,74 @@ info_dispatch_on_key (key, map)
{
case ISFUNC:
{
- VFunction *func;
-
- func = map[key].function;
- if (func != (VFunction *)NULL)
- {
- /* Special case info_do_lowercase_version (). */
- if (func == info_do_lowercase_version)
- {
- info_dispatch_on_key (tolower (key), map);
- return;
- }
-
- add_char_to_keyseq (key);
-
- if (info_keyseq_displayed_p)
- display_info_keyseq (0);
-
- {
- WINDOW *where;
-
- where = active_window;
- (*map[key].function)
- (active_window, info_numeric_arg * info_numeric_arg_sign, key);
-
- /* If we have input pending, then the last command was a prefix
- command. Don't change the value of the last function vars.
- Otherwise, remember the last command executed in the var
- appropriate to the window in which it was executed. */
- if (!info_input_pending_p ())
- {
- if (where == the_echo_area)
- ea_last_executed_command = map[key].function;
- else
- info_last_executed_command = map[key].function;
- }
- }
- }
- else
- {
- add_char_to_keyseq (key);
- dispatch_error (info_keyseq);
- return;
- }
+ VFunction *func;
+
+ func = map[key].function;
+ if (func != (VFunction *)NULL)
+ {
+ /* Special case info_do_lowercase_version (). */
+ if (func == info_do_lowercase_version)
+ {
+ info_dispatch_on_key (tolower (key), map);
+ return;
+ }
+
+ add_char_to_keyseq (key);
+
+ if (info_keyseq_displayed_p)
+ display_info_keyseq (0);
+
+ {
+ WINDOW *where;
+
+ where = active_window;
+ (*map[key].function)
+ (active_window, info_numeric_arg * info_numeric_arg_sign, key);
+
+ /* If we have input pending, then the last command was a prefix
+ command. Don't change the value of the last function vars.
+ Otherwise, remember the last command executed in the var
+ appropriate to the window in which it was executed. */
+ if (!info_input_pending_p ())
+ {
+ if (where == the_echo_area)
+ ea_last_executed_command = map[key].function;
+ else
+ info_last_executed_command = map[key].function;
+ }
+ }
+ }
+ else
+ {
+ add_char_to_keyseq (key);
+ dispatch_error (info_keyseq);
+ return;
+ }
}
break;
case ISKMAP:
add_char_to_keyseq (key);
if (map[key].function != (VFunction *)NULL)
- {
- unsigned char newkey;
+ {
+ unsigned char newkey;
- newkey = info_get_another_input_char ();
- info_dispatch_on_key (newkey, (Keymap)map[key].function);
- }
+ newkey = info_get_another_input_char ();
+ info_dispatch_on_key (newkey, (Keymap)map[key].function);
+ }
else
- {
- dispatch_error (info_keyseq);
- return;
- }
+ {
+ dispatch_error (info_keyseq);
+ return;
+ }
break;
}
}
/* **************************************************************** */
-/* */
-/* Numeric Arguments */
-/* */
+/* */
+/* Numeric Arguments */
+/* */
/* **************************************************************** */
/* Handle C-u style numeric args, as well as M--, and M-digits. */
@@ -3970,7 +3955,7 @@ int info_numeric_arg = 1;
/* Add the current digit to the argument in progress. */
DECLARE_INFO_COMMAND (info_add_digit_to_numeric_arg,
- "Add this digit to the current numeric argument")
+ _("Add this digit to the current numeric argument"))
{
info_numeric_arg_digit_loop (window, 0, key);
}
@@ -3979,7 +3964,7 @@ DECLARE_INFO_COMMAND (info_add_digit_to_numeric_arg,
Read a key. If the key has nothing to do with arguments, then
dispatch on it. If the key is the abort character then abort. */
DECLARE_INFO_COMMAND (info_universal_argument,
- "Start (or multiply by 4) the current numeric argument")
+ _("Start (or multiply by 4) the current numeric argument"))
{
info_numeric_arg *= 4;
info_numeric_arg_digit_loop (window, 0, 0);
@@ -3994,7 +3979,7 @@ info_initialize_numeric_arg ()
}
DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
- "Internally used by \\[universal-argument]")
+ _("Internally used by \\[universal-argument]"))
{
unsigned char pure_key;
Keymap keymap = window->keymap;
@@ -4002,64 +3987,64 @@ DECLARE_INFO_COMMAND (info_numeric_arg_digit_loop,
while (1)
{
if (key)
- pure_key = key;
+ pure_key = key;
else
- {
- if (display_was_interrupted_p && !info_any_buffered_input_p ())
- display_update_display (windows);
+ {
+ if (display_was_interrupted_p && !info_any_buffered_input_p ())
+ display_update_display (windows);
- if (active_window != the_echo_area)
- display_cursor_at_point (active_window);
+ if (active_window != the_echo_area)
+ display_cursor_at_point (active_window);
- pure_key = key = info_get_another_input_char ();
+ pure_key = key = info_get_another_input_char ();
- if (Meta_p (key))
- add_char_to_keyseq (ESC);
+ if (Meta_p (key))
+ add_char_to_keyseq (ESC);
- add_char_to_keyseq (UnMeta (key));
- }
+ add_char_to_keyseq (UnMeta (key));
+ }
if (Meta_p (key))
- key = UnMeta (key);
+ key = UnMeta (key);
if (keymap[key].type == ISFUNC &&
- keymap[key].function == info_universal_argument)
- {
- info_numeric_arg *= 4;
- key = 0;
- continue;
- }
+ keymap[key].function == info_universal_argument)
+ {
+ info_numeric_arg *= 4;
+ key = 0;
+ continue;
+ }
if (isdigit (key))
- {
- if (info_explicit_arg)
- info_numeric_arg = (info_numeric_arg * 10) + (key - '0');
- else
- info_numeric_arg = (key - '0');
- info_explicit_arg = 1;
- }
+ {
+ if (info_explicit_arg)
+ info_numeric_arg = (info_numeric_arg * 10) + (key - '0');
+ else
+ info_numeric_arg = (key - '0');
+ info_explicit_arg = 1;
+ }
else
- {
- if (key == '-' && !info_explicit_arg)
- {
- info_numeric_arg_sign = -1;
- info_numeric_arg = 1;
- }
- else
- {
- info_keyseq_index--;
- info_dispatch_on_key (pure_key, keymap);
- return;
- }
- }
+ {
+ if (key == '-' && !info_explicit_arg)
+ {
+ info_numeric_arg_sign = -1;
+ info_numeric_arg = 1;
+ }
+ else
+ {
+ info_keyseq_index--;
+ info_dispatch_on_key (pure_key, keymap);
+ return;
+ }
+ }
key = 0;
}
}
/* **************************************************************** */
-/* */
-/* Input Character Buffering */
-/* */
+/* */
+/* Input Character Buffering */
+/* */
/* **************************************************************** */
/* Character waiting to be read next. */
@@ -4108,7 +4093,7 @@ info_push_typeahead (key)
{
info_input_buffer[push_index++] = key;
if (push_index >= sizeof (info_input_buffer))
- push_index = 0;
+ push_index = 0;
}
}
@@ -4147,23 +4132,6 @@ info_any_buffered_input_p ()
return (push_index != pop_index);
}
-/* Push KEY into the *front* of the input buffer. Returns non-zero if
- successful, zero if there is no space left in the buffer. */
-static int
-info_replace_key_to_typeahead (key)
- unsigned char key;
-{
- if (info_input_buffer_space_available ())
- {
- pop_index--;
- if (pop_index < 0)
- pop_index = sizeof (info_input_buffer) - 1;
- info_input_buffer[pop_index] = key;
- return (1);
- }
- return (0);
-}
-
/* If characters are available to be read, then read them and stuff them into
info_input_buffer. Otherwise, do nothing. */
void
@@ -4188,7 +4156,7 @@ info_gather_typeahead ()
chars_avail = space_avail;
if (chars_avail)
- read (tty, &input[0], chars_avail);
+ chars_avail = read (tty, &input[0], chars_avail);
}
#else /* !FIONREAD */
# if defined (O_NDELAY)
@@ -4230,34 +4198,42 @@ info_get_input_char ()
else if (info_get_key_from_typeahead (&keystroke) == 0)
{
int rawkey;
+ unsigned char c;
+ int tty = fileno (info_input_stream);
+
+ /* Using stream I/O causes FIONREAD etc to fail to work
+ so unless someone can find a portable way of finding
+ out how many characters are currently buffered, we
+ should stay with away from stream I/O.
+ --Egil Kvaleberg <egilk@sn.no>, January 1997. */
+ rawkey = (read (tty, &c, 1) == 1) ? c : EOF;
- rawkey = getc (info_input_stream);
keystroke = rawkey;
if (rawkey == EOF)
- {
- if (info_input_stream != stdin)
- {
- fclose (info_input_stream);
- info_input_stream = stdin;
- display_inhibited = 0;
- display_update_display (windows);
- display_cursor_at_point (active_window);
- rawkey = getc (info_input_stream);
- keystroke = rawkey;
- }
-
- if (rawkey == EOF)
- {
- terminal_unprep_terminal ();
- close_dribble_file ();
- exit (0);
- }
- }
+ {
+ if (info_input_stream != stdin)
+ {
+ fclose (info_input_stream);
+ info_input_stream = stdin;
+ display_inhibited = 0;
+ display_update_display (windows);
+ display_cursor_at_point (active_window);
+ rawkey = (read (tty, &c, 1) == 1) ? c : EOF;
+ keystroke = rawkey;
+ }
+
+ if (rawkey == EOF)
+ {
+ terminal_unprep_terminal ();
+ close_dribble_file ();
+ exit (0);
+ }
+ }
}
if (info_dribble_file)
dribble (keystroke);
- return (keystroke);
+ return keystroke;
}
diff --git a/texinfo/info/session.h b/texinfo/info/session.h
index 98b8ccf695f..f1e5b23be8a 100644
--- a/texinfo/info/session.h
+++ b/texinfo/info/session.h
@@ -21,10 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_SESSION_H_)
-#define _SESSION_H_
+#if !defined (SESSION_H)
+#define SESSION_H
-#include "general.h"
+#include "info.h"
#include "dribble.h"
/* All commands that can be invoked from within info_session () receive
@@ -55,11 +55,11 @@ extern int info_scroll_behaviour;
extern char *info_scroll_choices[];
/* Values for info_scroll_behaviour. */
-#define IS_Continuous 0 /* Try to get first menu item, or failing that, the
- "Next:" pointer, or failing that, the "Up:" and
- "Next:" of the up. */
+#define IS_Continuous 0 /* Try to get first menu item, or failing that, the
+ "Next:" pointer, or failing that, the "Up:" and
+ "Next:" of the up. */
#define IS_NextOnly 1 /* Try to get "Next:" menu item. */
-#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */
+#define IS_PageOnly 2 /* Simply give up at the bottom of a node. */
/* Utility functions found in session.c */
extern void info_dispatch_on_key ();
@@ -143,4 +143,4 @@ extern void info_print_node ();
/* Miscellaneous commands. */
extern void info_abort_key (), info_quit (), info_do_lowercase_version ();
-#endif /* _SESSION_H_ */
+#endif /* SESSION_H */
diff --git a/texinfo/info/signals.c b/texinfo/info/signals.c
index a60777fe597..b93a585f567 100644
--- a/texinfo/info/signals.c
+++ b/texinfo/info/signals.c
@@ -25,9 +25,9 @@
#include "signals.h"
/* **************************************************************** */
-/* */
-/* Pretending That We Have POSIX Signals */
-/* */
+/* */
+/* Pretending That We Have POSIX Signals */
+/* */
/* **************************************************************** */
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
@@ -57,33 +57,32 @@ sigprocmask (operation, newset, oldset)
#endif /* !HAVE_SIGPROCMASK && HAVE_SIGSETMASK */
/* **************************************************************** */
-/* */
-/* Signal Handling for Info */
-/* */
+/* */
+/* Signal Handling for Info */
+/* */
/* **************************************************************** */
-typedef void SigHandlerType;
-typedef SigHandlerType SigHandler ();
+typedef RETSIGTYPE signal_handler ();
-static SigHandlerType info_signal_handler ();
-static SigHandler *old_TSTP, *old_TTOU, *old_TTIN;
-static SigHandler *old_WINCH, *old_INT;
+static RETSIGTYPE info_signal_handler ();
+static signal_handler *old_TSTP, *old_TTOU, *old_TTIN;
+static signal_handler *old_WINCH, *old_INT;
void
initialize_info_signal_handler ()
{
#if defined (SIGTSTP)
- old_TSTP = (SigHandler *) signal (SIGTSTP, info_signal_handler);
- old_TTOU = (SigHandler *) signal (SIGTTOU, info_signal_handler);
- old_TTIN = (SigHandler *) signal (SIGTTIN, info_signal_handler);
+ old_TSTP = (signal_handler *) signal (SIGTSTP, info_signal_handler);
+ old_TTOU = (signal_handler *) signal (SIGTTOU, info_signal_handler);
+ old_TTIN = (signal_handler *) signal (SIGTTIN, info_signal_handler);
#endif /* SIGTSTP */
#if defined (SIGWINCH)
- old_WINCH = (SigHandler *) signal (SIGWINCH, info_signal_handler);
+ old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler);
#endif
#if defined (SIGINT)
- old_INT = (SigHandler *) signal (SIGINT, info_signal_handler);
+ old_INT = (signal_handler *) signal (SIGINT, info_signal_handler);
#endif
}
@@ -98,11 +97,11 @@ redisplay_after_signal ()
fflush (stdout);
}
-static SigHandlerType
+static RETSIGTYPE
info_signal_handler (sig)
int sig;
{
- SigHandler **old_signal_handler;
+ signal_handler **old_signal_handler;
switch (sig)
{
@@ -116,56 +115,56 @@ info_signal_handler (sig)
#endif
{
#if defined (SIGTSTP)
- if (sig == SIGTSTP)
- old_signal_handler = &old_TSTP;
- if (sig == SIGTTOU)
- old_signal_handler = &old_TTOU;
- if (sig == SIGTTIN)
- old_signal_handler = &old_TTIN;
+ if (sig == SIGTSTP)
+ old_signal_handler = &old_TSTP;
+ if (sig == SIGTTOU)
+ old_signal_handler = &old_TTOU;
+ if (sig == SIGTTIN)
+ old_signal_handler = &old_TTIN;
#endif /* SIGTSTP */
- if (sig == SIGINT)
- old_signal_handler = &old_INT;
-
- /* For stop signals, restore the terminal IO, leave the cursor
- at the bottom of the window, and stop us. */
- terminal_goto_xy (0, screenheight - 1);
- terminal_clear_to_eol ();
- fflush (stdout);
- terminal_unprep_terminal ();
- signal (sig, *old_signal_handler);
- UNBLOCK_SIGNAL (sig);
- kill (getpid (), sig);
-
- /* The program is returning now. Restore our signal handler,
- turn on terminal handling, redraw the screen, and place the
- cursor where it belongs. */
- terminal_prep_terminal ();
- *old_signal_handler = (SigHandler *) signal (sig, info_signal_handler);
- redisplay_after_signal ();
- fflush (stdout);
+ if (sig == SIGINT)
+ old_signal_handler = &old_INT;
+
+ /* For stop signals, restore the terminal IO, leave the cursor
+ at the bottom of the window, and stop us. */
+ terminal_goto_xy (0, screenheight - 1);
+ terminal_clear_to_eol ();
+ fflush (stdout);
+ terminal_unprep_terminal ();
+ signal (sig, *old_signal_handler);
+ UNBLOCK_SIGNAL (sig);
+ kill (getpid (), sig);
+
+ /* The program is returning now. Restore our signal handler,
+ turn on terminal handling, redraw the screen, and place the
+ cursor where it belongs. */
+ terminal_prep_terminal ();
+ *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
+ redisplay_after_signal ();
+ fflush (stdout);
}
break;
#if defined (SIGWINCH)
case SIGWINCH:
{
- /* Turn off terminal IO, tell our parent that the window has changed,
- then reinitialize the terminal and rebuild our windows. */
- old_signal_handler = &old_WINCH;
- terminal_goto_xy (0, 0);
- fflush (stdout);
- terminal_unprep_terminal ();
- signal (sig, *old_signal_handler);
- UNBLOCK_SIGNAL (sig);
- kill (getpid (), sig);
-
- /* After our old signal handler returns... */
- terminal_get_screen_size ();
- terminal_prep_terminal ();
- display_initialize_display (screenwidth, screenheight);
- window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL);
- *old_signal_handler = (SigHandler *) signal (sig, info_signal_handler);
- redisplay_after_signal ();
+ /* Turn off terminal IO, tell our parent that the window has changed,
+ then reinitialize the terminal and rebuild our windows. */
+ old_signal_handler = &old_WINCH;
+ terminal_goto_xy (0, 0);
+ fflush (stdout);
+ terminal_unprep_terminal ();
+ signal (sig, *old_signal_handler);
+ UNBLOCK_SIGNAL (sig);
+ kill (getpid (), sig);
+
+ /* After our old signal handler returns... */
+ terminal_get_screen_size ();
+ terminal_prep_terminal ();
+ display_initialize_display (screenwidth, screenheight);
+ window_new_screen_size (screenwidth, screenheight, (VFunction *)NULL);
+ *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
+ redisplay_after_signal ();
}
break;
#endif /* SIGWINCH */
diff --git a/texinfo/info/signals.h b/texinfo/info/signals.h
index ab87a3b5495..3a45925a183 100644
--- a/texinfo/info/signals.h
+++ b/texinfo/info/signals.h
@@ -1,9 +1,10 @@
-/* signals.h -- Header to include system dependent signal definitions. */
+/* signals.h -- Header to include system dependent signal definitions.
+ $Id: signals.h,v 1.3 1997/07/15 18:35:59 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1993, 94, 95, 97 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,11 +22,17 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_SIGNALS_H_)
-#define _SIGNALS_H_
+#ifndef INFO_SIGNALS_H
+#define INFO_SIGNALS_H
+#include <sys/types.h>
#include <signal.h>
+/* For sysV68 --phdm@info.ucl.ac.be. */
+#if !defined (SIGCHLD) && defined (SIGCLD)
+#define SIGCHLD SIGCLD
+#endif
+
#if !defined (HAVE_SIGPROCMASK) && !defined (sigmask)
# define sigmask(x) (1 << ((x)-1))
#endif /* !HAVE_SIGPROCMASK && !sigmask */
@@ -86,4 +93,4 @@
# define UNBLOCK_SIGNAL(sig)
#endif /* !HAVE_SIGPROCMASK && !HAVE_SIGSETMASK */
-#endif /* !_SIGNALS_H_ */
+#endif /* not INFO_SIGNALS_H */
diff --git a/texinfo/info/terminal.h b/texinfo/info/terminal.h
index 7cb115835c6..2e27268ea7f 100644
--- a/texinfo/info/terminal.h
+++ b/texinfo/info/terminal.h
@@ -3,7 +3,7 @@
/* This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993, 96 Free Software Foundation, Inc.
+ Copyright (C) 1993, 96, 97 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,15 +21,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_TERMINAL_H_)
-#define _TERMINAL_H_
+#if !defined (TERMINAL_H)
+#define TERMINAL_H
-/* We use the following data type to talk about pointers to functions. */
-#if !defined (__FUNCTION_DEF)
-# define __FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-#endif /* _FUNCTION_DEF */
+#include "info.h"
/* For almost every function externally visible from terminal.c, there is
a corresponding "hook" function which can be bound in order to replace
@@ -125,5 +120,6 @@ extern VFunction *terminal_ring_bell_hook;
/* The key sequences output by the arrow keys, if this terminal has any. */
extern char *term_ku, *term_kd, *term_kr, *term_kl;
+extern char *term_kP, *term_kN;
-#endif /* !_TERMINAL_H_ */
+#endif /* !TERMINAL_H */
diff --git a/texinfo/info/tilde.c b/texinfo/info/tilde.c
index 817f9092c30..fef953a04dc 100644
--- a/texinfo/info/tilde.c
+++ b/texinfo/info/tilde.c
@@ -1,5 +1,5 @@
/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo).
- $Id: tilde.c,v 1.1 1997/08/21 22:58:05 jason Exp $
+ $Id: tilde.c,v 1.8 1997/07/24 21:49:03 karl Exp $
This file is part of GNU Info, a program for reading online documentation
stored in Info format.
@@ -22,6 +22,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
+/* Include config.h before doing alloca. */
+#include "info.h"
+
+#ifndef alloca
#if defined (__GNUC__)
# define alloca __builtin_alloca
#else /* !__GNUC__ */
@@ -33,28 +37,10 @@
# endif /* HAVE_ALLOCA_H */
# endif /* !AIX */
#endif /* !__GNUC__ */
-
-#if defined (HAVE_STDLIB_H)
-#include <stdlib.h>
-#endif
-
-#include "tilde.h"
-#include <pwd.h>
-
-#if defined (HAVE_STRING_H)
-#include <string.h>
-#endif
-
-#include "clib.h"
-
-#if !defined (NULL)
-# define NULL 0x0
-#endif
+#endif /* ! defined alloca */
#if defined (TEST) || defined (STATIC_MALLOC)
static void *xmalloc (), *xrealloc ();
-#else
-extern void *xmalloc (), *xrealloc ();
#endif /* TEST || STATIC_MALLOC */
/* The default value of tilde_additional_prefixes. This is set to
@@ -105,16 +91,16 @@ tilde_find_prefix (string, len)
if (prefixes)
{
for (i = 0; i < string_len; i++)
- {
- for (j = 0; prefixes[j]; j++)
- {
- if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
- {
- *len = strlen (prefixes[j]) - 1;
- return (i + *len);
- }
- }
- }
+ {
+ for (j = 0; prefixes[j]; j++)
+ {
+ if (strncmp (string + i, prefixes[j], strlen (prefixes[j])) == 0)
+ {
+ *len = strlen (prefixes[j]) - 1;
+ return (i + *len);
+ }
+ }
+ }
}
return (string_len);
}
@@ -133,13 +119,13 @@ tilde_find_suffix (string)
for (i = 0; i < string_len; i++)
{
if (string[i] == '/' || !string[i])
- break;
+ break;
for (j = 0; suffixes && suffixes[j]; j++)
- {
- if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
- return (i);
- }
+ {
+ if (strncmp (string + i, suffixes[j], strlen (suffixes[j])) == 0)
+ return (i);
+ }
}
return (i);
}
@@ -167,7 +153,7 @@ tilde_expand (string)
/* Copy the skipped text into the result. */
if ((result_index + start + 1) > result_size)
- result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
+ result = (char *)xrealloc (result, 1 + (result_size += (start + 20)));
strncpy (result + result_index, string, start);
result_index += start;
@@ -176,12 +162,12 @@ tilde_expand (string)
string += start;
/* Make END be the index of one after the last character of the
- username. */
+ username. */
end = tilde_find_suffix (string);
/* If both START and END are zero, we are all done. */
if (!start && !end)
- break;
+ break;
/* Expand the entire tilde word, and copy it into RESULT. */
tilde_word = (char *)xmalloc (1 + end);
@@ -194,7 +180,7 @@ tilde_expand (string)
len = strlen (expansion);
if ((result_index + len + 1) > result_size)
- result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
+ result = (char *)xrealloc (result, 1 + (result_size += (len + 20)));
strcpy (result + result_index, expansion);
result_index += len;
@@ -214,88 +200,87 @@ tilde_expand_word (filename)
{
char *dirname;
- dirname = filename ? strdup (filename) : (char *)NULL;
+ dirname = filename ? xstrdup (filename) : (char *)NULL;
if (dirname && *dirname == '~')
{
char *temp_name;
if (!dirname[1] || dirname[1] == '/')
- {
- /* Prepend $HOME to the rest of the string. */
- extern char *getenv ();
- char *temp_home = getenv ("HOME");
-
- /* If there is no HOME variable, look up the directory in
- the password database. */
- if (!temp_home)
- {
- struct passwd *entry;
-
- entry = (struct passwd *) getpwuid (getuid ());
- if (entry)
- temp_home = entry->pw_dir;
- }
-
- temp_name = (char *)
- alloca (1 + strlen (&dirname[1])
- + (temp_home ? strlen (temp_home) : 0));
- temp_name[0] = '\0';
- if (temp_home)
- strcpy (temp_name, temp_home);
- strcat (temp_name, &dirname[1]);
- free (dirname);
- dirname = strdup (temp_name);
- }
+ {
+ /* Prepend $HOME to the rest of the string. */
+ char *temp_home = getenv ("HOME");
+
+ /* If there is no HOME variable, look up the directory in
+ the password database. */
+ if (!temp_home)
+ {
+ struct passwd *entry;
+
+ entry = (struct passwd *) getpwuid (getuid ());
+ if (entry)
+ temp_home = entry->pw_dir;
+ }
+
+ temp_name = (char *)
+ alloca (1 + strlen (&dirname[1])
+ + (temp_home ? strlen (temp_home) : 0));
+ temp_name[0] = '\0';
+ if (temp_home)
+ strcpy (temp_name, temp_home);
+ strcat (temp_name, &dirname[1]);
+ free (dirname);
+ dirname = xstrdup (temp_name);
+ }
else
- {
- struct passwd *user_entry;
- char *username = (char *)alloca (257);
- int i, c;
-
- for (i = 1; c = dirname[i]; i++)
- {
- if (c == '/')
- break;
- else
- username[i - 1] = c;
- }
- username[i - 1] = '\0';
-
- if (!(user_entry = (struct passwd *) getpwnam (username)))
- {
- /* If the calling program has a special syntax for
- expanding tildes, and we couldn't find a standard
- expansion, then let them try. */
- if (tilde_expansion_failure_hook)
- {
- char *expansion;
-
- expansion = (*tilde_expansion_failure_hook) (username);
-
- if (expansion)
- {
- temp_name = (char *)alloca
- (1 + strlen (expansion) + strlen (&dirname[i]));
- strcpy (temp_name, expansion);
- strcat (temp_name, &dirname[i]);
- free (expansion);
- goto return_name;
- }
- }
- /* We shouldn't report errors. */
- }
- else
- {
- temp_name = (char *)alloca
- (1 + strlen (user_entry->pw_dir) + strlen (&dirname[i]));
- strcpy (temp_name, user_entry->pw_dir);
- strcat (temp_name, &dirname[i]);
- return_name:
- free (dirname);
- dirname = strdup (temp_name);
- }
- endpwent ();
- }
+ {
+ struct passwd *user_entry;
+ char *username = (char *)alloca (257);
+ int i, c;
+
+ for (i = 1; (c = dirname[i]); i++)
+ {
+ if (c == '/')
+ break;
+ else
+ username[i - 1] = c;
+ }
+ username[i - 1] = '\0';
+
+ if (!(user_entry = (struct passwd *) getpwnam (username)))
+ {
+ /* If the calling program has a special syntax for
+ expanding tildes, and we couldn't find a standard
+ expansion, then let them try. */
+ if (tilde_expansion_failure_hook)
+ {
+ char *expansion;
+
+ expansion = (*tilde_expansion_failure_hook) (username);
+
+ if (expansion)
+ {
+ temp_name = (char *)alloca
+ (1 + strlen (expansion) + strlen (&dirname[i]));
+ strcpy (temp_name, expansion);
+ strcat (temp_name, &dirname[i]);
+ free (expansion);
+ goto return_name;
+ }
+ }
+ /* We shouldn't report errors. */
+ }
+ else
+ {
+ temp_name = (char *)alloca
+ (1 + strlen (user_entry->pw_dir) + strlen (&dirname[i]));
+ strcpy (temp_name, user_entry->pw_dir);
+ strcat (temp_name, &dirname[i]);
+ return_name:
+ free (dirname);
+ dirname = xstrdup (temp_name);
+ }
+ endpwent ();
+ }
}
return (dirname);
}
@@ -318,15 +303,15 @@ main (argc, argv)
fflush (stdout);
if (!gets (line))
- strcpy (line, "done");
+ strcpy (line, "done");
if ((strcmp (line, "done") == 0) ||
- (strcmp (line, "quit") == 0) ||
- (strcmp (line, "exit") == 0))
- {
- done = 1;
- break;
- }
+ (strcmp (line, "quit") == 0) ||
+ (strcmp (line, "exit") == 0))
+ {
+ done = 1;
+ break;
+ }
result = tilde_expand (line);
printf (" --> %s\n", result);
@@ -369,7 +354,7 @@ xrealloc (pointer, bytes)
static void
memory_error_and_abort ()
{
- fprintf (stderr, "readline: Out of virtual memory!\n");
+ fprintf (stderr, _("readline: Out of virtual memory!\n"));
abort ();
}
#endif /* TEST */
diff --git a/texinfo/info/tilde.h b/texinfo/info/tilde.h
index d66aee95015..83f534b2bac 100644
--- a/texinfo/info/tilde.h
+++ b/texinfo/info/tilde.h
@@ -25,13 +25,10 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-/* Function pointers can be declared as (Function *)foo. */
-#if !defined (__FUNCTION_DEF)
-# define __FUNCTION_DEF
-typedef int Function ();
-typedef void VFunction ();
-typedef char *CFunction ();
-#endif /* _FUNCTION_DEF */
+#ifndef TILDE_H
+#define TILDE_H
+
+#include "info.h"
/* If non-null, this contains the address of a function to call if the
standard meaning for expanding a tilde fails. The function is called
@@ -56,3 +53,4 @@ extern char *tilde_expand ();
tilde. If there is no expansion, call tilde_expansion_failure_hook. */
extern char *tilde_expand_word ();
+#endif /* not TILDE_H */
diff --git a/texinfo/info/variables.c b/texinfo/info/variables.c
index 7798701c124..248c8af6488 100644
--- a/texinfo/info/variables.c
+++ b/texinfo/info/variables.c
@@ -1,9 +1,10 @@
-/* variables.c -- How to manipulate user visible variables in Info. */
+/* variables.c -- How to manipulate user visible variables in Info.
+ $Id: variables.c,v 1.5 1997/07/18 14:34:23 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,9 @@
#include "variables.h"
/* **************************************************************** */
-/* */
-/* User Visible Variables in Info */
-/* */
+/* */
+/* User Visible Variables in Info */
+/* */
/* **************************************************************** */
/* Choices used by the completer when reading a zero/non-zero value for
@@ -36,73 +37,75 @@ static char *on_off_choices[] = { "Off", "On", (char *)NULL };
VARIABLE_ALIST info_variables[] = {
{ "automatic-footnotes",
- "When \"On\", footnotes appear and disappear automatically",
+ N_("When \"On\", footnotes appear and disappear automatically"),
&auto_footnotes_p, (char **)on_off_choices },
{ "automatic-tiling",
- "When \"On\", creating or deleting a window resizes other windows",
+ N_("When \"On\", creating or deleting a window resizes other windows"),
&auto_tiling_p, (char **)on_off_choices },
{ "visible-bell",
- "When \"On\", flash the screen instead of ringing the bell",
+ N_("When \"On\", flash the screen instead of ringing the bell"),
&terminal_use_visible_bell_p, (char **)on_off_choices },
{ "errors-ring-bell",
- "When \"On\", errors cause the bell to ring",
+ N_("When \"On\", errors cause the bell to ring"),
&info_error_rings_bell_p, (char **)on_off_choices },
{ "gc-compressed-files",
- "When \"On\", Info garbage collects files which had to be uncompressed",
+ N_("When \"On\", Info garbage collects files which had to be uncompressed"),
&gc_compressed_files, (char **)on_off_choices },
{ "show-index-match",
- "When \"On\", the portion of the matched search string is highlighted",
+ N_("When \"On\", the portion of the matched search string is highlighted"),
&show_index_match, (char **)on_off_choices },
{ "scroll-behaviour",
- "Controls what happens when scrolling is requested at the end of a node",
+ N_("Controls what happens when scrolling is requested at the end of a node"),
&info_scroll_behaviour, (char **)info_scroll_choices },
{ "scroll-step",
- "The number lines to scroll when the cursor moves out of the window",
+ N_("The number lines to scroll when the cursor moves out of the window"),
&window_scroll_step, (char **)NULL },
{ "ISO-Latin",
- "When \"On\", Info accepts and displays ISO Latin characters",
+ N_("When \"On\", Info accepts and displays ISO Latin characters"),
&ISO_Latin_p, (char **)on_off_choices },
{ (char *)NULL, (char *)NULL, (int *)NULL, (char **)NULL }
};
-DECLARE_INFO_COMMAND (describe_variable, "Explain the use of a variable")
+DECLARE_INFO_COMMAND (describe_variable, _("Explain the use of a variable"))
{
VARIABLE_ALIST *var;
char *description;
/* Get the variable's name. */
- var = read_variable_name ("Describe variable: ", window);
+ var = read_variable_name (_("Describe variable: "), window);
if (!var)
return;
- description = (char *)xmalloc (20 + strlen (var->name) + strlen (var->doc));
+ description = (char *)xmalloc (20 + strlen (var->name)
+ + strlen (_(var->doc)));
if (var->choices)
sprintf (description, "%s (%s): %s.",
- var->name, var->choices[*(var->value)], var->doc);
+ var->name, var->choices[*(var->value)], _(var->doc));
else
- sprintf (description, "%s (%d): %s.", var->name, *(var->value), var->doc);
+ sprintf (description, "%s (%d): %s.",
+ var->name, *(var->value), _(var->doc));
window_message_in_echo_area ("%s", description);
free (description);
}
-DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable")
+DECLARE_INFO_COMMAND (set_variable, _("Set the value of an Info variable"))
{
VARIABLE_ALIST *var;
char *line;
/* Get the variable's name and value. */
- var = read_variable_name ("Set variable: ", window);
+ var = read_variable_name (_("Set variable: "), window);
if (!var)
return;
@@ -113,86 +116,86 @@ DECLARE_INFO_COMMAND (set_variable, "Set the value of an Info variable")
if (!var->choices)
{
- int potential_value;
+ int potential_value;
- if (info_explicit_arg || count != 1)
- potential_value = count;
- else
- potential_value = *(var->value);
+ if (info_explicit_arg || count != 1)
+ potential_value = count;
+ else
+ potential_value = *(var->value);
- sprintf (prompt, "Set %s to value (%d): ",
- var->name, potential_value);
- line = info_read_in_echo_area (active_window, prompt);
+ sprintf (prompt, _("Set %s to value (%d): "),
+ var->name, potential_value);
+ line = info_read_in_echo_area (active_window, prompt);
- /* If no error was printed, clear the echo area. */
- if (!info_error_was_printed)
- window_clear_echo_area ();
+ /* If no error was printed, clear the echo area. */
+ if (!info_error_was_printed)
+ window_clear_echo_area ();
- /* User aborted? */
- if (!line)
- return;
+ /* User aborted? */
+ if (!line)
+ return;
- /* If the user specified a value, get that, otherwise, we are done. */
- canonicalize_whitespace (line);
- if (*line)
- *(var->value) = atoi (line);
- else
- *(var->value) = potential_value;
+ /* If the user specified a value, get that, otherwise, we are done. */
+ canonicalize_whitespace (line);
+ if (*line)
+ *(var->value) = atoi (line);
+ else
+ *(var->value) = potential_value;
- free (line);
+ free (line);
}
else
{
- register int i;
- REFERENCE **array = (REFERENCE **)NULL;
- int array_index = 0;
- int array_slots = 0;
-
- for (i = 0; var->choices[i]; i++)
- {
- REFERENCE *entry;
-
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->label = strdup (var->choices[i]);
- entry->nodename = (char *)NULL;
- entry->filename = (char *)NULL;
-
- add_pointer_to_array
- (entry, array_index, array, array_slots, 10, REFERENCE *);
- }
-
- sprintf (prompt, "Set %s to value (%s): ",
- var->name, var->choices[*(var->value)]);
-
- /* Ask the completer to read a variable value for us. */
- line = info_read_completing_in_echo_area (window, prompt, array);
-
- info_free_references (array);
-
- if (!echo_area_is_active)
- window_clear_echo_area ();
-
- /* User aborted? */
- if (!line)
- {
- info_abort_key (active_window, 0, 0);
- return;
- }
-
- /* User accepted default choice? If so, no change. */
- if (!*line)
- {
- free (line);
- return;
- }
-
- /* Find the choice in our list of choices. */
- for (i = 0; var->choices[i]; i++)
- if (strcmp (var->choices[i], line) == 0)
- break;
-
- if (var->choices[i])
- *(var->value) = i;
+ register int i;
+ REFERENCE **array = (REFERENCE **)NULL;
+ int array_index = 0;
+ int array_slots = 0;
+
+ for (i = 0; var->choices[i]; i++)
+ {
+ REFERENCE *entry;
+
+ entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->label = xstrdup (var->choices[i]);
+ entry->nodename = (char *)NULL;
+ entry->filename = (char *)NULL;
+
+ add_pointer_to_array
+ (entry, array_index, array, array_slots, 10, REFERENCE *);
+ }
+
+ sprintf (prompt, _("Set %s to value (%s): "),
+ var->name, var->choices[*(var->value)]);
+
+ /* Ask the completer to read a variable value for us. */
+ line = info_read_completing_in_echo_area (window, prompt, array);
+
+ info_free_references (array);
+
+ if (!echo_area_is_active)
+ window_clear_echo_area ();
+
+ /* User aborted? */
+ if (!line)
+ {
+ info_abort_key (active_window, 0, 0);
+ return;
+ }
+
+ /* User accepted default choice? If so, no change. */
+ if (!*line)
+ {
+ free (line);
+ return;
+ }
+
+ /* Find the choice in our list of choices. */
+ for (i = 0; var->choices[i]; i++)
+ if (strcmp (var->choices[i], line) == 0)
+ break;
+
+ if (var->choices[i])
+ *(var->value) = i;
}
}
}
@@ -259,13 +262,13 @@ make_variable_completions_array ()
{
REFERENCE *entry;
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->label = strdup (info_variables[i].name);
+ entry = (REFERENCE *) xmalloc (sizeof (REFERENCE));
+ entry->label = xstrdup (info_variables[i].name);
entry->nodename = (char *)NULL;
entry->filename = (char *)NULL;
add_pointer_to_array
- (entry, array_index, array, array_slots, 200, REFERENCE *);
+ (entry, array_index, array, array_slots, 200, REFERENCE *);
}
return (array);
diff --git a/texinfo/info/variables.h b/texinfo/info/variables.h
index 85bde27737b..1afcfb8d72d 100644
--- a/texinfo/info/variables.h
+++ b/texinfo/info/variables.h
@@ -1,9 +1,10 @@
-/* variables.h -- Description of user visible variables in Info. */
+/* variables.h -- Description of user visible variables in Info.
+ $Id: variables.h,v 1.3 1997/07/15 18:44:23 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_VARIABLES_H_)
-#define _VARIABLES_H_
+#ifndef INFO_VARIABLES_H
+#define INFO_VARIABLES_H
/* A variable (in the Info sense) is an integer value with a user-visible
name. You may supply an array of strings to complete over when the
@@ -32,10 +33,10 @@
/* Structure describing a user visible variable. */
typedef struct {
- char *name; /* Polite name. */
- char *doc; /* Documentation string. */
- int *value; /* Address of value. */
- char **choices; /* Array of strings or NULL if numeric only. */
+ char *name; /* Polite name. */
+ char *doc; /* Documentation string. */
+ int *value; /* Address of value. */
+ char **choices; /* Array of strings or NULL if numeric only. */
} VARIABLE_ALIST;
/* Read the name of an Info variable in the echo area and return the
@@ -61,4 +62,4 @@ extern int info_scroll_behaviour;
extern int window_scroll_step;
extern int ISO_Latin_p;
-#endif /* _VARIABLES_H_ */
+#endif /* not INFO_VARIABLES_H */
diff --git a/texinfo/info/window.c b/texinfo/info/window.c
index 304e89c0c75..56a310838e2 100644
--- a/texinfo/info/window.c
+++ b/texinfo/info/window.c
@@ -1,9 +1,10 @@
-/* window.c -- Windows in Info. */
+/* window.c -- Windows in Info.
+ $Id: window.c,v 1.4 1997/07/15 18:35:59 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,10 +22,7 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#include <stdio.h>
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+#include "info.h"
#include "nodes.h"
#include "window.h"
#include "display.h"
@@ -136,36 +134,36 @@ window_new_screen_size (width, height)
while ((height - echo_area_required) / numwins <= WINDOW_MIN_SIZE)
{
/* If only one window, make the size of it be zero, and return
- immediately. */
+ immediately. */
if (!windows->next)
- {
- windows->height = 0;
- maybe_free (windows->line_starts);
- windows->line_starts = (char **)NULL;
- windows->line_count = 0;
- break;
- }
+ {
+ windows->height = 0;
+ maybe_free (windows->line_starts);
+ windows->line_starts = (char **)NULL;
+ windows->line_count = 0;
+ break;
+ }
/* If we have some temporary windows, delete one of them. */
for (win = windows; win; win = win->next)
- if (win->flags & W_TempWindow)
- break;
+ if (win->flags & W_TempWindow)
+ break;
/* Otherwise, delete the first window, and try again. */
if (!win)
- win = windows;
+ win = windows;
if (window_deletion_notifier)
- (*window_deletion_notifier) (win);
+ (*window_deletion_notifier) (win);
window_delete_window (win);
numwins--;
}
/* The screen has changed height and width. */
- delta_height = height - the_screen->height; /* This is how much. */
- the_screen->height = height; /* This is the new height. */
- the_screen->width = width; /* This is the new width. */
+ delta_height = height - the_screen->height; /* This is how much. */
+ the_screen->height = height; /* This is the new height. */
+ the_screen->width = width; /* This is the new width. */
/* Set the start of the echo area. */
the_echo_area->first_row = height - the_echo_area->height;
@@ -186,34 +184,34 @@ window_new_screen_size (width, height)
for (win = windows; win; win = win->next)
{
if ((win->width != width) && ((win->flags & W_InhibitMode) == 0))
- {
- win->width = width;
- maybe_free (win->modeline);
- win->modeline = (char *)xmalloc (1 + width);
- }
+ {
+ win->width = width;
+ maybe_free (win->modeline);
+ win->modeline = (char *)xmalloc (1 + width);
+ }
win->height += delta_each;
/* If the previous height of this window was zero, it was the only
- window, and it was not visible. Thus we need to compensate for
- the echo_area. */
+ window, and it was not visible. Thus we need to compensate for
+ the echo_area. */
if (win->height == delta_each)
- win->height -= (1 + the_echo_area->height);
+ win->height -= (1 + the_echo_area->height);
/* If this is not the first window in the chain, then change the
- first row of it. We cannot just add delta_each to the first row,
- since this window's first row is the sum of the collective increases
- that have gone before it. So we just add one to the location of the
- previous window's modeline. */
+ first row of it. We cannot just add delta_each to the first row,
+ since this window's first row is the sum of the collective increases
+ that have gone before it. So we just add one to the location of the
+ previous window's modeline. */
if (win->prev)
- win->first_row = (win->prev->first_row + win->prev->height) + 1;
+ win->first_row = (win->prev->first_row + win->prev->height) + 1;
/* The last window in the chain gets the extra space (or shrinkage). */
if (!win->next)
- win->height += delta_leftover;
+ win->height += delta_leftover;
if (win->node)
- recalculate_line_starts (win);
+ recalculate_line_starts (win);
win->flags |= W_UpdateWindow;
}
@@ -232,32 +230,32 @@ window_new_screen_size (width, height)
win = windows;
while (win)
- {
- if ((win->height < WINDOW_MIN_HEIGHT) ||
- (win->height > avail))
- {
- WINDOW *lastwin;
-
- /* Split the space among the available windows. */
- delta_each = avail / numwins;
- delta_leftover = avail - (delta_each * numwins);
-
- for (win = windows; win; win = win->next)
- {
- lastwin = win;
- if (win->prev)
- win->first_row =
- (win->prev->first_row + win->prev->height) + 1;
- win->height = delta_each;
- }
-
- /* Give the leftover space (if any) to the last window. */
- lastwin->height += delta_leftover;
- break;
- }
- else
- win= win->next;
- }
+ {
+ if ((win->height < WINDOW_MIN_HEIGHT) ||
+ (win->height > avail))
+ {
+ WINDOW *lastwin;
+
+ /* Split the space among the available windows. */
+ delta_each = avail / numwins;
+ delta_leftover = avail - (delta_each * numwins);
+
+ for (win = windows; win; win = win->next)
+ {
+ lastwin = win;
+ if (win->prev)
+ win->first_row =
+ (win->prev->first_row + win->prev->height) + 1;
+ win->height = delta_each;
+ }
+
+ /* Give the leftover space (if any) to the last window. */
+ lastwin->height += delta_leftover;
+ break;
+ }
+ else
+ win= win->next;
+ }
}
}
@@ -412,25 +410,25 @@ window_change_window_height (window, amount)
/* WINDOW decreasing in size? */
if (amount < 0)
{
- int abs_amount = -amount; /* It is easier to deal with this way. */
+ int abs_amount = -amount; /* It is easier to deal with this way. */
/* If the resultant window would be too small, stop here. */
if ((window->height - abs_amount) < WINDOW_MIN_HEIGHT)
- return;
+ return;
/* If we have two neighboring windows, choose the smaller one to get
- larger. */
+ larger. */
if (next && prev)
- {
- if (prev->height < next->height)
- shrink_me_growing_prev (window, prev, abs_amount);
- else
- shrink_me_growing_next (window, next, abs_amount);
- }
+ {
+ if (prev->height < next->height)
+ shrink_me_growing_prev (window, prev, abs_amount);
+ else
+ shrink_me_growing_next (window, next, abs_amount);
+ }
else if (next)
- shrink_me_growing_next (window, next, abs_amount);
+ shrink_me_growing_next (window, next, abs_amount);
else
- shrink_me_growing_prev (window, prev, abs_amount);
+ shrink_me_growing_prev (window, prev, abs_amount);
}
/* WINDOW increasing in size? */
@@ -439,65 +437,65 @@ window_change_window_height (window, amount)
int total_avail, next_avail = 0, prev_avail = 0;
if (next)
- next_avail = next->height - WINDOW_MIN_SIZE;
+ next_avail = next->height - WINDOW_MIN_SIZE;
if (prev)
- prev_avail = prev->height - WINDOW_MIN_SIZE;
+ prev_avail = prev->height - WINDOW_MIN_SIZE;
total_avail = next_avail + prev_avail;
/* If there isn't enough space available to grow this window, give up. */
if (amount > total_avail)
- return;
+ return;
/* If there aren't two neighboring windows, or if one of the neighbors
- is larger than the other one by at least AMOUNT, grow that one. */
+ is larger than the other one by at least AMOUNT, grow that one. */
if ((next && !prev) || ((next_avail - amount) >= prev_avail))
- grow_me_shrinking_next (window, next, amount);
+ grow_me_shrinking_next (window, next, amount);
else if ((prev && !next) || ((prev_avail - amount) >= next_avail))
- grow_me_shrinking_prev (window, prev, amount);
+ grow_me_shrinking_prev (window, prev, amount);
else
- {
- int change;
-
- /* This window has two neighbors. They both must be shrunk in to
- make enough space for WINDOW to grow. Make them both the same
- size. */
- if (prev_avail > next_avail)
- {
- change = prev_avail - next_avail;
- grow_me_shrinking_prev (window, prev, change);
- amount -= change;
- }
- else
- {
- change = next_avail - prev_avail;
- grow_me_shrinking_next (window, next, change);
- amount -= change;
- }
-
- /* Both neighbors are the same size. Split the difference in
- AMOUNT between them. */
- while (amount)
- {
- window->height++;
- amount--;
-
- /* Odd numbers grow next, even grow prev. */
- if (amount & 1)
- {
- prev->height--;
- window->first_row--;
- }
- else
- {
- next->height--;
- next->first_row++;
- }
- }
- window_adjust_pagetop (prev);
- window_adjust_pagetop (next);
- }
+ {
+ int change;
+
+ /* This window has two neighbors. They both must be shrunk in to
+ make enough space for WINDOW to grow. Make them both the same
+ size. */
+ if (prev_avail > next_avail)
+ {
+ change = prev_avail - next_avail;
+ grow_me_shrinking_prev (window, prev, change);
+ amount -= change;
+ }
+ else
+ {
+ change = next_avail - prev_avail;
+ grow_me_shrinking_next (window, next, change);
+ amount -= change;
+ }
+
+ /* Both neighbors are the same size. Split the difference in
+ AMOUNT between them. */
+ while (amount)
+ {
+ window->height++;
+ amount--;
+
+ /* Odd numbers grow next, even grow prev. */
+ if (amount & 1)
+ {
+ prev->height--;
+ window->first_row--;
+ }
+ else
+ {
+ next->height--;
+ next->first_row++;
+ }
+ }
+ window_adjust_pagetop (prev);
+ window_adjust_pagetop (next);
+ }
}
if (prev)
prev->flags |= W_UpdateWindow;
@@ -526,10 +524,10 @@ window_tile_windows (style)
for (win = windows; win; win = win->next)
if (do_internals || !win->node ||
- (win->node->flags & N_IsInternal) == 0)
+ (win->node->flags & N_IsInternal) == 0)
{
- avail += win->height;
- numwins++;
+ avail += win->height;
+ numwins++;
}
if (numwins <= 1 || !the_screen->height)
@@ -544,11 +542,11 @@ window_tile_windows (style)
for (win = windows; win; win = win->next)
{
if (do_internals || !win->node ||
- (win->node->flags & N_IsInternal) == 0)
- {
- last_adjusted = win;
- win->height = per_win_height;
- }
+ (win->node->flags & N_IsInternal) == 0)
+ {
+ last_adjusted = win;
+ win->height = per_win_height;
+ }
}
if (last_adjusted)
@@ -558,7 +556,7 @@ window_tile_windows (style)
for (win = windows; win; win = win->next)
{
if (win->prev)
- win->first_row = win->prev->first_row + win->prev->height + 1;
+ win->first_row = win->prev->first_row + win->prev->height + 1;
window_adjust_pagetop (win);
win->flags |= W_UpdateWindow;
@@ -591,11 +589,11 @@ window_toggle_wrap (window)
window_adjust_pagetop (window);
/* If the pagetop hasn't changed maybe we can do some scrolling now
- to speed up the display. Many of the line starts will be the same,
- so scrolling here is a very good optimization.*/
+ to speed up the display. Many of the line starts will be the same,
+ so scrolling here is a very good optimization.*/
if (old_pagetop == window->pagetop)
- display_scroll_line_starts
- (window, old_pagetop, old_starts, old_lines);
+ display_scroll_line_starts
+ (window, old_pagetop, old_starts, old_lines);
maybe_free (old_starts);
}
window->flags |= W_UpdateWindow;
@@ -650,12 +648,12 @@ window_delete_window (window)
if (window == active_window)
{
/* If there isn't a next window, then there must be a previous one,
- since we cannot delete the last window. If there is a next window,
- prefer to use that as the active window. */
+ since we cannot delete the last window. If there is a next window,
+ prefer to use that as the active window. */
if (next)
- active_window = next;
+ active_window = next;
else
- active_window = prev;
+ active_window = prev;
}
if (next && active_window == next)
@@ -674,13 +672,13 @@ window_delete_window (window)
int diff;
/* Try to adjust the visible part of the node so that as little
- text as possible has to move. */
+ text as possible has to move. */
diff = window_to_fix->first_row - window->first_row;
window_to_fix->first_row = window->first_row;
window_to_fix->pagetop -= diff;
if (window_to_fix->pagetop < 0)
- window_to_fix->pagetop = 0;
+ window_to_fix->pagetop = 0;
}
/* The `+ 1' is to offset the difference between the first_row locations.
@@ -732,17 +730,17 @@ character_width (character, hpos)
else if (iscntrl (character))
{
switch (character)
- {
- case '\r':
- case '\n':
- width = the_screen->width - hpos;
- break;
- case '\t':
- width = ((hpos + 8) & 0xf8) - hpos;
- break;
- default:
- width = 2;
- }
+ {
+ case '\r':
+ case '\n':
+ width = the_screen->width - hpos;
+ break;
+ case '\t':
+ width = ((hpos + 8) & 0xf8) - hpos;
+ break;
+ default:
+ width = 2;
+ }
}
else if (character == DEL)
width = 2;
@@ -820,61 +818,61 @@ calculate_line_starts (window)
unsigned int cwidth, c;
add_pointer_to_array (line, line_starts_index, line_starts,
- line_starts_slots, 100, char *);
+ line_starts_slots, 100, char *);
if (bump_index)
- {
- i++;
- bump_index = 0;
- }
+ {
+ i++;
+ bump_index = 0;
+ }
while (1)
- {
- c = node->contents[i];
- cwidth = character_width (c, hpos);
-
- /* If this character fits within this line, just do the next one. */
- if ((hpos + cwidth) < window->width)
- {
- i++;
- hpos += cwidth;
- continue;
- }
- else
- {
- /* If this character would position the cursor at the start of
- the next printed screen line, then do the next line. */
- if (c == '\n' || c == '\r' || c == '\t')
- {
- i++;
- hpos = 0;
- break;
- }
- else
- {
- /* This character passes the window width border. Postion
- the cursor after the printed character, but remember this
- line start as where this character is. A bit tricky. */
-
- /* If this window doesn't wrap lines, proceed to the next
- physical line here. */
- if (window->flags & W_NoWrap)
- {
- hpos = 0;
- while (i < node->nodelen && node->contents[i] != '\n')
- i++;
-
- if (node->contents[i] == '\n')
- i++;
- }
- else
- {
- hpos = the_screen->width - hpos;
- bump_index++;
- }
- break;
- }
- }
- }
+ {
+ c = node->contents[i];
+ cwidth = character_width (c, hpos);
+
+ /* If this character fits within this line, just do the next one. */
+ if ((hpos + cwidth) < window->width)
+ {
+ i++;
+ hpos += cwidth;
+ continue;
+ }
+ else
+ {
+ /* If this character would position the cursor at the start of
+ the next printed screen line, then do the next line. */
+ if (c == '\n' || c == '\r' || c == '\t')
+ {
+ i++;
+ hpos = 0;
+ break;
+ }
+ else
+ {
+ /* This character passes the window width border. Postion
+ the cursor after the printed character, but remember this
+ line start as where this character is. A bit tricky. */
+
+ /* If this window doesn't wrap lines, proceed to the next
+ physical line here. */
+ if (window->flags & W_NoWrap)
+ {
+ hpos = 0;
+ while (i < node->nodelen && node->contents[i] != '\n')
+ i++;
+
+ if (node->contents[i] == '\n')
+ i++;
+ }
+ else
+ {
+ hpos = the_screen->width - hpos;
+ bump_index++;
+ }
+ break;
+ }
+ }
+ }
}
window->line_starts = line_starts;
window->line_count = line_starts_index;
@@ -916,7 +914,7 @@ window_adjust_pagetop (window)
line_start = window->line_starts[line];
if ((line_start - contents) > window->point)
- break;
+ break;
}
/* The line index preceding the line start which is past point is the
@@ -929,26 +927,26 @@ window_adjust_pagetop (window)
(line - window->pagetop > (window->height - 1)))
{
/* The user-settable variable "scroll-step" is used to attempt
- to make point visible, iff it is non-zero. If that variable
- is zero, then the line containing point is centered within
- the window. */
+ to make point visible, iff it is non-zero. If that variable
+ is zero, then the line containing point is centered within
+ the window. */
if (window_scroll_step < window->height)
- {
- if ((line < window->pagetop) &&
- ((window->pagetop - window_scroll_step) <= line))
- window->pagetop -= window_scroll_step;
- else if ((line - window->pagetop > (window->height - 1)) &&
- ((line - (window->pagetop + window_scroll_step)
- < window->height)))
- window->pagetop += window_scroll_step;
- else
- window->pagetop = line - ((window->height - 1) / 2);
- }
+ {
+ if ((line < window->pagetop) &&
+ ((window->pagetop - window_scroll_step) <= line))
+ window->pagetop -= window_scroll_step;
+ else if ((line - window->pagetop > (window->height - 1)) &&
+ ((line - (window->pagetop + window_scroll_step)
+ < window->height)))
+ window->pagetop += window_scroll_step;
+ else
+ window->pagetop = line - ((window->height - 1) / 2);
+ }
else
- window->pagetop = line - ((window->height - 1) / 2);
+ window->pagetop = line - ((window->height - 1) / 2);
if (window->pagetop < 0)
- window->pagetop = 0;
+ window->pagetop = 0;
window->flags |= W_UpdateWindow;
}
}
@@ -970,7 +968,7 @@ window_line_of_point (window)
for (i = start; i < window->line_count; i++)
{
if ((window->line_starts[i] - window->node->contents) > window->point)
- break;
+ break;
}
return (i - 1);
@@ -1029,7 +1027,7 @@ window_chars_to_goal (line, goal)
check = hpos + character_width (line[i], hpos);
if (check > goal)
- break;
+ break;
hpos = check;
}
@@ -1056,26 +1054,26 @@ window_make_modeline (window)
if (window->pagetop == 0)
{
if (lines_remaining <= window->height)
- strcpy (location_indicator, "All");
+ strcpy (location_indicator, "All");
else
- strcpy (location_indicator, "Top");
+ strcpy (location_indicator, "Top");
}
else
{
if (lines_remaining <= window->height)
- strcpy (location_indicator, "Bot");
+ strcpy (location_indicator, "Bot");
else
- {
- float pt, lc;
- int percentage;
+ {
+ float pt, lc;
+ int percentage;
- pt = (float)window->pagetop;
- lc = (float)window->line_count;
+ pt = (float)window->pagetop;
+ lc = (float)window->line_count;
- percentage = 100 * (pt / lc);
+ percentage = 100 * (pt / lc);
- sprintf (location_indicator, "%2d%%", percentage);
- }
+ sprintf (location_indicator, "%2d%%", percentage);
+ }
}
/* Calculate the maximum size of the information to stick in MODELINE. */
@@ -1088,49 +1086,49 @@ window_make_modeline (window)
if (node)
{
- if (node->nodename)
- nodename = node->nodename;
+ if (node->nodename)
+ nodename = node->nodename;
- if (node->parent)
- {
- parent = filename_non_directory (node->parent);
- modeline_len += strlen ("Subfile: ") + strlen (node->filename);
- }
+ if (node->parent)
+ {
+ parent = filename_non_directory (node->parent);
+ modeline_len += strlen ("Subfile: ") + strlen (node->filename);
+ }
- if (node->filename)
- filename = filename_non_directory (node->filename);
+ if (node->filename)
+ filename = filename_non_directory (node->filename);
- if (node->flags & N_UpdateTags)
- update_message = "--*** Tags out of Date ***";
+ if (node->flags & N_UpdateTags)
+ update_message = _("--*** Tags out of Date ***");
}
if (update_message)
modeline_len += strlen (update_message);
modeline_len += strlen (filename);
modeline_len += strlen (nodename);
- modeline_len += 4; /* strlen (location_indicator). */
+ modeline_len += 4; /* strlen (location_indicator). */
/* 10 for the decimal representation of the number of lines in this
node, and the remainder of the text that can appear in the line. */
- modeline_len += 10 + strlen ("-----Info: (), lines ----, ");
+ modeline_len += 10 + strlen (_("-----Info: (), lines ----, "));
modeline_len += window->width;
modeline = (char *)xmalloc (1 + modeline_len);
/* Special internal windows have no filename. */
if (!parent && !*filename)
- sprintf (modeline, "-%s---Info: %s, %d lines --%s--",
- (window->flags & W_NoWrap) ? "$" : "-",
- nodename, window->line_count, location_indicator);
+ sprintf (modeline, _("-%s---Info: %s, %d lines --%s--"),
+ (window->flags & W_NoWrap) ? "$" : "-",
+ nodename, window->line_count, location_indicator);
else
- sprintf (modeline, "-%s%s-Info: (%s)%s, %d lines --%s--",
- (window->flags & W_NoWrap) ? "$" : "-",
- (node && (node->flags & N_IsCompressed)) ? "zz" : "--",
- parent ? parent : filename,
- nodename, window->line_count, location_indicator);
+ sprintf (modeline, _("-%s%s-Info: (%s)%s, %d lines --%s--"),
+ (window->flags & W_NoWrap) ? "$" : "-",
+ (node && (node->flags & N_IsCompressed)) ? "zz" : "--",
+ parent ? parent : filename,
+ nodename, window->line_count, location_indicator);
if (parent)
- sprintf (modeline + strlen (modeline), " Subfile: %s", filename);
+ sprintf (modeline + strlen (modeline), _(" Subfile: %s"), filename);
if (update_message)
sprintf (modeline + strlen (modeline), "%s", update_message);
@@ -1141,9 +1139,9 @@ window_make_modeline (window)
modeline[window->width] = '\0';
else
{
- while (i < window->width)
- modeline[i++] = '-';
- modeline[i] = '\0';
+ while (i < window->width)
+ modeline[i++] = '-';
+ modeline[i] = '\0';
}
strcpy (window->modeline, modeline);
@@ -1197,9 +1195,9 @@ window_set_state (window, state)
/* **************************************************************** */
-/* */
-/* Manipulating Home-Made Nodes */
-/* */
+/* */
+/* Manipulating Home-Made Nodes */
+/* */
/* **************************************************************** */
/* A place to buffer echo area messages. */
@@ -1259,8 +1257,8 @@ message_in_echo_area (format, arg1, arg2)
if (echo_area_node)
{
add_pointer_to_array (echo_area_node, old_echo_area_nodes_index,
- old_echo_area_nodes, old_echo_area_nodes_slots,
- 4, NODE *);
+ old_echo_area_nodes, old_echo_area_nodes_slots,
+ 4, NODE *);
}
echo_area_node = (NODE *)NULL;
window_message_in_echo_area (format, arg1, arg2);
@@ -1299,7 +1297,7 @@ message_buffer_resize (length)
while (message_buffer_size <= message_buffer_index + length)
message_buffer = (char *)
xrealloc (message_buffer,
- message_buffer_size += 100 + (2 * length));
+ message_buffer_size += 100 + (2 * length));
}
/* Format MESSAGE_BUFFER with the results of printing FORMAT with ARG1 and
@@ -1323,70 +1321,70 @@ build_message_buffer (format, arg1, arg2)
for (i = 0; format[i]; i++)
{
if (format[i] != '%')
- {
- message_buffer[message_buffer_index++] = format[i];
- len--;
- }
+ {
+ message_buffer[message_buffer_index++] = format[i];
+ len--;
+ }
else
- {
- char c;
-
- c = format[++i];
-
- switch (c)
- {
- case '%': /* Insert a percent sign. */
- message_buffer_resize (len + 1);
- message_buffer[message_buffer_index++] = '%';
- break;
-
- case 's': /* Insert the current arg as a string. */
- {
- char *string;
- int string_len;
-
- string = (char *)args[arg_index++];
- string_len = strlen (string);
-
- message_buffer_resize (len + string_len);
- sprintf
- (message_buffer + message_buffer_index, "%s", string);
- message_buffer_index += string_len;
- }
- break;
-
- case 'd': /* Insert the current arg as an integer. */
- {
- long long_val;
- int integer;
-
- long_val = (long)args[arg_index++];
- integer = (int)long_val;
-
- message_buffer_resize (len + 32);
- sprintf
- (message_buffer + message_buffer_index, "%d", integer);
- message_buffer_index = strlen (message_buffer);
- }
- break;
-
- case 'c': /* Insert the current arg as a character. */
- {
- long long_val;
- int character;
-
- long_val = (long)args[arg_index++];
- character = (int)long_val;
-
- message_buffer_resize (len + 1);
- message_buffer[message_buffer_index++] = character;
- }
- break;
-
- default:
- abort ();
- }
- }
+ {
+ char c;
+
+ c = format[++i];
+
+ switch (c)
+ {
+ case '%': /* Insert a percent sign. */
+ message_buffer_resize (len + 1);
+ message_buffer[message_buffer_index++] = '%';
+ break;
+
+ case 's': /* Insert the current arg as a string. */
+ {
+ char *string;
+ int string_len;
+
+ string = (char *)args[arg_index++];
+ string_len = strlen (string);
+
+ message_buffer_resize (len + string_len);
+ sprintf
+ (message_buffer + message_buffer_index, "%s", string);
+ message_buffer_index += string_len;
+ }
+ break;
+
+ case 'd': /* Insert the current arg as an integer. */
+ {
+ long long_val;
+ int integer;
+
+ long_val = (long)args[arg_index++];
+ integer = (int)long_val;
+
+ message_buffer_resize (len + 32);
+ sprintf
+ (message_buffer + message_buffer_index, "%d", integer);
+ message_buffer_index = strlen (message_buffer);
+ }
+ break;
+
+ case 'c': /* Insert the current arg as a character. */
+ {
+ long long_val;
+ int character;
+
+ long_val = (long)args[arg_index++];
+ character = (int)long_val;
+
+ message_buffer_resize (len + 1);
+ message_buffer[message_buffer_index++] = character;
+ }
+ break;
+
+ default:
+ abort ();
+ }
+ }
}
message_buffer[message_buffer_index] = '\0';
}
@@ -1474,7 +1472,7 @@ pad_to (count, string)
else
{
while (i < count)
- string[i++] = ' ';
+ string[i++] = ' ';
}
string[i] = '\0';
diff --git a/texinfo/info/window.h b/texinfo/info/window.h
index 5bde64a10ac..17367cbd5a4 100644
--- a/texinfo/info/window.h
+++ b/texinfo/info/window.h
@@ -1,9 +1,10 @@
-/* window.h -- Structure and flags used in manipulating Info windows. */
+/* window.h -- Structure and flags used in manipulating Info windows.
+ $Id: window.h,v 1.4 1997/07/15 18:45:47 karl Exp $
-/* This file is part of GNU Info, a program for reading online documentation
+ This file is part of GNU Info, a program for reading online documentation
stored in Info format.
- Copyright (C) 1993 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97 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,8 +22,8 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_WINDOW_H_)
-#define _WINDOW_H_
+#ifndef INFO_WINDOW_H
+#define INFO_WINDOW_H
#include "nodes.h"
#include "infomap.h"
@@ -44,9 +45,9 @@
if you need to change window state information, here is where you would
do it. NB> The last element does NOT end with a semi-colon. */
#define WINDOW_STATE_DECL \
- NODE *node; /* The node displayed in this window. */ \
- int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
- long point /* Offset within NODE of the cursor position. */
+ NODE *node; /* The node displayed in this window. */ \
+ int pagetop; /* LINE_STARTS[PAGETOP] is first line in WINDOW. */ \
+ long point /* Offset within NODE of the cursor position. */
/* Structure which defines a window. Windows are doubly linked, next
and prev. The list of windows is kept on WINDOWS. The structure member
@@ -54,37 +55,38 @@
(0, window->height + window->first_row) is the first character of this
windows modeline. The number of lines that can be displayed in a window
is equal to window->height - 1. */
-typedef struct __window__ {
- struct __window__ *next; /* Next window in this chain. */
- struct __window__ *prev; /* Previous window in this chain. */
- int width; /* Width of this window. */
- int height; /* Height of this window. */
- int first_row; /* Offset of the first line in the_screen. */
- int goal_column; /* The column we would like the cursor to appear in. */
- Keymap keymap; /* Keymap used to read commands in this window. */
- WINDOW_STATE_DECL; /* Node, pagetop and point. */
- char *modeline; /* Calculated text of the modeline for this window. */
- char **line_starts; /* Array of printed line starts for this node. */
- int line_count; /* Number of lines appearing in LINE_STARTS. */
- int flags; /* See below for details. */
+typedef struct window_struct
+{
+ struct window_struct *next; /* Next window in this chain. */
+ struct window_struct *prev; /* Previous window in this chain. */
+ int width; /* Width of this window. */
+ int height; /* Height of this window. */
+ int first_row; /* Offset of the first line in the_screen. */
+ int goal_column; /* The column we would like the cursor to appear in. */
+ Keymap keymap; /* Keymap used to read commands in this window. */
+ WINDOW_STATE_DECL; /* Node, pagetop and point. */
+ char *modeline; /* Calculated text of the modeline for this window. */
+ char **line_starts; /* Array of printed line starts for this node. */
+ int line_count; /* Number of lines appearing in LINE_STARTS. */
+ int flags; /* See below for details. */
} WINDOW;
typedef struct {
- WINDOW_STATE_DECL; /* What gets saved. */
+ WINDOW_STATE_DECL; /* What gets saved. */
} WINDOW_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. */
-#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */
-#define W_NoWrap 0x10 /* Lines do not wrap in this window. */
-#define W_InputWindow 0x20 /* Window accepts input. */
-#define W_TempWindow 0x40 /* Window is less important. */
+#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. */
+#define W_InhibitMode 0x08 /* This WINDOW has no modeline. */
+#define W_NoWrap 0x10 /* Lines do not wrap in this window. */
+#define W_InputWindow 0x20 /* Window accepts input. */
+#define W_TempWindow 0x40 /* Window is less important. */
-extern WINDOW *windows; /* List of visible Info windows. */
-extern WINDOW *active_window; /* The currently active window. */
-extern WINDOW *the_screen; /* The Info screen is just another window. */
-extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
+extern WINDOW *windows; /* List of visible Info windows. */
+extern WINDOW *active_window; /* The currently active window. */
+extern WINDOW *the_screen; /* The Info screen is just another window. */
+extern WINDOW *the_echo_area; /* THE_ECHO_AREA is a window in THE_SCREEN. */
/* Global variable control redisplay of scrolled windows. If non-zero, it
is the desired number of lines to scroll the window in order to make
@@ -226,4 +228,4 @@ extern void window_get_state (), window_set_state ();
offset of GOAL. */
extern int window_chars_to_goal ();
-#endif /* !_WINDOW_H_ */
+#endif /* not INFO_WINDOW_H */