summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/texinfo/info
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/usr.bin/texinfo/info')
-rw-r--r--gnu/usr.bin/texinfo/info/Makefile.am25
-rw-r--r--gnu/usr.bin/texinfo/info/Makefile.in305
-rw-r--r--gnu/usr.bin/texinfo/info/dir.c190
-rw-r--r--gnu/usr.bin/texinfo/info/display.c502
-rw-r--r--gnu/usr.bin/texinfo/info/display.h13
-rw-r--r--gnu/usr.bin/texinfo/info/echo-area.c12
-rw-r--r--gnu/usr.bin/texinfo/info/echo-area.h2
-rw-r--r--gnu/usr.bin/texinfo/info/filesys.c309
-rw-r--r--gnu/usr.bin/texinfo/info/filesys.h15
-rw-r--r--gnu/usr.bin/texinfo/info/footnotes.c114
-rw-r--r--gnu/usr.bin/texinfo/info/footnotes.h16
-rw-r--r--gnu/usr.bin/texinfo/info/gc.h13
-rw-r--r--gnu/usr.bin/texinfo/info/indices.c522
-rw-r--r--gnu/usr.bin/texinfo/info/indices.h15
-rw-r--r--gnu/usr.bin/texinfo/info/info-utils.h26
-rw-r--r--gnu/usr.bin/texinfo/info/info.c549
-rw-r--r--gnu/usr.bin/texinfo/info/info.h145
-rw-r--r--gnu/usr.bin/texinfo/info/infodoc.c527
-rw-r--r--gnu/usr.bin/texinfo/info/infomap.c137
-rw-r--r--gnu/usr.bin/texinfo/info/m-x.c57
-rw-r--r--gnu/usr.bin/texinfo/info/makedoc.c263
-rw-r--r--gnu/usr.bin/texinfo/info/man.c271
-rw-r--r--gnu/usr.bin/texinfo/info/man.h13
-rw-r--r--gnu/usr.bin/texinfo/info/nodemenu.c126
-rw-r--r--gnu/usr.bin/texinfo/info/nodes.h111
-rw-r--r--gnu/usr.bin/texinfo/info/search.h26
-rw-r--r--gnu/usr.bin/texinfo/info/session.c2916
-rw-r--r--gnu/usr.bin/texinfo/info/signals.h19
-rw-r--r--gnu/usr.bin/texinfo/info/termdep.h76
-rw-r--r--gnu/usr.bin/texinfo/info/terminal.c18
-rw-r--r--gnu/usr.bin/texinfo/info/tilde.c258
-rw-r--r--gnu/usr.bin/texinfo/info/variables.c195
-rw-r--r--gnu/usr.bin/texinfo/info/variables.h21
-rw-r--r--gnu/usr.bin/texinfo/info/window.c656
-rw-r--r--gnu/usr.bin/texinfo/info/window.h70
35 files changed, 4396 insertions, 4137 deletions
diff --git a/gnu/usr.bin/texinfo/info/Makefile.am b/gnu/usr.bin/texinfo/info/Makefile.am
index 6ff91f8a51c..160b7eeac7e 100644
--- a/gnu/usr.bin/texinfo/info/Makefile.am
+++ b/gnu/usr.bin/texinfo/info/Makefile.am
@@ -1,5 +1,5 @@
## Makefile.am for texinfo/info.
-## $Id: Makefile.am,v 1.1 1997/08/01 21:59:59 kstailey Exp $
+## $Id: Makefile.am,v 1.2 1999/01/11 16:38:06 espie Exp $
## Run automake in .. to produce Makefile.in from this.
noinst_PROGRAMS = makedoc
@@ -13,7 +13,10 @@ transform = s/ginfo/info/; @program_transform_name@
localedir = $(datadir)/locale
# -I. for funs.h.
-INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
+# Automake puts -I.. and -I$(srcdir) into DEFS by default, but
+# we need to override it, so include them ourselves.
+INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -I.. -I$(srcdir)
+DEFS = -DINFODIR=\"$(infodir)\" -DLOCALEDIR=\"$(localedir)\" @DEFS@
LDADD = ../lib/libtxi.a @TERMLIBS@ @INTLLIBS@
makedoc_SOURCES = makedoc.c
@@ -32,13 +35,11 @@ EXTRA_DIST = README
# 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.
-#
-# 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)
+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
+
+$(BUILT_SOURCES): makedoc $(cmd_sources)
+ ./makedoc $(cmd_sources)
diff --git a/gnu/usr.bin/texinfo/info/Makefile.in b/gnu/usr.bin/texinfo/info/Makefile.in
index a472db0d673..c71d31959ec 100644
--- a/gnu/usr.bin/texinfo/info/Makefile.in
+++ b/gnu/usr.bin/texinfo/info/Makefile.in
@@ -1,8 +1,14 @@
-# Makefile.in generated automatically by automake 1.2 from Makefile.am
+# Makefile.in generated automatically by automake 1.2f from Makefile.am
-# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
SHELL = /bin/sh
@@ -42,12 +48,12 @@ 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
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
CATALOGS = @CATALOGS@
CATOBJEXT = @CATOBJEXT@
CC = @CC@
@@ -57,6 +63,7 @@ GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
GT_NO = @GT_NO@
GT_YES = @GT_YES@
+INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
@@ -87,7 +94,10 @@ transform = s/ginfo/info/; @program_transform_name@
localedir = $(datadir)/locale
# -I. for funs.h.
-INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -DLOCALEDIR=\"$(localedir)\"
+# Automake puts -I.. and -I$(srcdir) into DEFS by default, but
+# we need to override it, so include them ourselves.
+INCLUDES = -I. -I$(top_srcdir)/lib -I../intl -I.. -I$(srcdir)
+DEFS = -DINFODIR=\"$(infodir)\" -DLOCALEDIR=\"$(localedir)\" @DEFS@
LDADD = ../lib/libtxi.a @TERMLIBS@ @INTLLIBS@
makedoc_SOURCES = makedoc.c
@@ -101,13 +111,21 @@ ginfo_SOURCES = dir.c display.c display.h doc.c doc.h dribble.c dribble.h \
variables.c variables.h window.c window.h
EXTRA_DIST = README
+
+# The files `doc.c' and `funs.h' are created by ./makedoc run over the source
+# files which contain DECLARE_INFO_COMMAND. `funs.h' is a header file
+# listing the functions found. `doc.c' is a structure containing pointers
+# to those functions along with completable names and documentation strings.
+BUILT_SOURCES = doc.c funs.h
+
+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
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../config.h
CONFIG_CLEAN_FILES =
PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
-
-DEFS = @DEFS@ -I. -I$(srcdir) -I..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
@@ -138,7 +156,7 @@ OBJECTS = $(ginfo_OBJECTS) $(makedoc_OBJECTS)
default: all
.SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .S .c .o .s
$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps info/Makefile
@@ -150,7 +168,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
mostlyclean-binPROGRAMS:
clean-binPROGRAMS:
- test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
distclean-binPROGRAMS:
@@ -167,7 +185,7 @@ install-binPROGRAMS: $(bin_PROGRAMS)
done
uninstall-binPROGRAMS:
- $(NORMAL_UNINSTALL)
+ @$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do \
rm -f $(bindir)/`echo $$p|sed '$(transform)'`; \
done
@@ -175,7 +193,7 @@ uninstall-binPROGRAMS:
mostlyclean-noinstPROGRAMS:
clean-noinstPROGRAMS:
- test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
distclean-noinstPROGRAMS:
@@ -184,13 +202,19 @@ maintainer-clean-noinstPROGRAMS:
.c.o:
$(COMPILE) -c $<
+.s.o:
+ $(COMPILE) -c $<
+
+.S.o:
+ $(COMPILE) -c $<
+
mostlyclean-compile:
- rm -f *.o core
+ -rm -f *.o core *.core
clean-compile:
distclean-compile:
- rm -f *.tab.c
+ -rm -f *.tab.c
maintainer-clean-compile:
@@ -204,21 +228,26 @@ makedoc: $(makedoc_OBJECTS) $(makedoc_DEPENDENCIES)
tags: TAGS
-ID: $(HEADERS) $(SOURCES)
- here=`pwd` && cd $(srcdir) && mkid -f$$here/ID $(SOURCES) $(HEADERS)
+ID: $(HEADERS) $(SOURCES) $(LISP)
+ here=`pwd` && cd $(srcdir) \
+ && mkid -f$$here/ID $(SOURCES) $(HEADERS) $(LISP)
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES)
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
- test -z "$(ETAGS_ARGS)$(SOURCES)$(HEADERS)$$tags" \
- || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $(SOURCES) $(HEADERS) -o $$here/TAGS)
+ list='$(SOURCES) $(HEADERS)'; \
+ unique=`for i in $$list; do echo $$i; done | \
+ awk ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
+ || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
- rm -f TAGS ID
+ -rm -f TAGS ID
maintainer-clean-tags:
@@ -233,107 +262,101 @@ distdir: $(DISTFILES)
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file; \
done
-dir.o dir.lo: dir.c info.h ../lib/system.h ../config.h ../intl/libintl.h \
- filesys.h display.h info-utils.h nodes.h window.h infomap.h \
- search.h terminal.h session.h dribble.h echo-area.h doc.h \
- footnotes.h gc.h tilde.h
-display.o display.lo: display.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-doc.o doc.lo: doc.c doc.h info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h footnotes.h gc.h funs.h
-dribble.o dribble.lo: dribble.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-echo-area.o echo-area.lo: echo-area.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-filesys.o filesys.lo: filesys.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h tilde.h
-footnotes.o footnotes.lo: footnotes.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-gc.o gc.lo: gc.c info.h ../lib/system.h ../config.h ../intl/libintl.h \
- filesys.h display.h info-utils.h nodes.h window.h infomap.h \
- search.h terminal.h session.h dribble.h echo-area.h doc.h \
- footnotes.h gc.h
-indices.o indices.lo: indices.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h indices.h
-info-utils.o info-utils.lo: info-utils.c info.h ../lib/system.h \
- ../config.h ../intl/libintl.h filesys.h display.h info-utils.h \
- nodes.h window.h infomap.h search.h terminal.h session.h \
- dribble.h echo-area.h doc.h footnotes.h gc.h man.h
-info.o info.lo: info.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h indices.h ../lib/getopt.h \
- man.h
-infodoc.o infodoc.lo: infodoc.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-infomap.o infomap.lo: infomap.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h funs.h
-m-x.o m-x.lo: m-x.c info.h ../lib/system.h ../config.h ../intl/libintl.h \
- filesys.h display.h info-utils.h nodes.h window.h infomap.h \
- search.h terminal.h session.h dribble.h echo-area.h doc.h \
- footnotes.h gc.h
-makedoc.o makedoc.lo: makedoc.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-man.o man.lo: man.c info.h ../lib/system.h ../config.h ../intl/libintl.h \
- filesys.h display.h info-utils.h nodes.h window.h infomap.h \
- search.h terminal.h session.h dribble.h echo-area.h doc.h \
- footnotes.h gc.h signals.h tilde.h man.h
-nodemenu.o nodemenu.lo: nodemenu.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-nodes.o nodes.lo: nodes.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h man.h
-search.o search.lo: search.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-session.o session.lo: session.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h man.h
-signals.o signals.lo: signals.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h signals.h
-terminal.o terminal.lo: terminal.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h termdep.h
-tilde.o tilde.lo: tilde.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
-variables.o variables.lo: variables.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h variables.h
-window.o window.lo: window.c info.h ../lib/system.h ../config.h \
- ../intl/libintl.h filesys.h display.h info-utils.h nodes.h \
- window.h infomap.h search.h terminal.h session.h dribble.h \
- echo-area.h doc.h footnotes.h gc.h
+dir.o: dir.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h tilde.h
+display.o: display.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+doc.o: doc.c doc.h info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h footnotes.h gc.h \
+ funs.h
+dribble.o: dribble.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+echo-area.o: echo-area.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+filesys.o: filesys.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h tilde.h
+footnotes.o: footnotes.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+gc.o: gc.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h
+indices.o: indices.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h indices.h
+info-utils.o: info-utils.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h man.h
+info.o: info.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h \
+ indices.h ../lib/getopt.h man.h
+infodoc.o: infodoc.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+infomap.o: infomap.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h funs.h
+m-x.o: m-x.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h
+makedoc.o: makedoc.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+man.o: man.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h \
+ signals.h tilde.h man.h
+nodemenu.o: nodemenu.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+nodes.o: nodes.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h man.h
+search.o: search.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
+session.o: session.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h man.h
+signals.o: signals.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h signals.h
+terminal.o: terminal.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h termdep.h
+tilde.o: tilde.c info.h ../lib/system.h ../config.h filesys.h display.h \
+ info-utils.h nodes.h window.h infomap.h search.h terminal.h \
+ session.h dribble.h echo-area.h doc.h footnotes.h gc.h
+variables.o: variables.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h variables.h
+window.o: window.c info.h ../lib/system.h ../config.h filesys.h \
+ display.h info-utils.h nodes.h window.h infomap.h search.h \
+ terminal.h session.h dribble.h echo-area.h doc.h footnotes.h \
+ gc.h
info:
dvi:
@@ -360,19 +383,19 @@ installdirs:
mostlyclean-generic:
- test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
+ -test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
- test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+ -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)
+ -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)
+ -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
@@ -383,7 +406,7 @@ clean: clean-binPROGRAMS clean-noinstPROGRAMS clean-compile clean-tags \
distclean: distclean-binPROGRAMS distclean-noinstPROGRAMS \
distclean-compile distclean-tags distclean-generic \
clean
- rm -f config.status
+ -rm -f config.status
maintainer-clean: maintainer-clean-binPROGRAMS \
maintainer-clean-noinstPROGRAMS \
@@ -404,20 +427,8 @@ mostlyclean-generic distclean-generic clean-generic \
maintainer-clean-generic clean mostlyclean distclean maintainer-clean
-# 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.
-#
-# 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)
+$(BUILT_SOURCES): 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.
diff --git a/gnu/usr.bin/texinfo/info/dir.c b/gnu/usr.bin/texinfo/info/dir.c
index 4ccf8561310..3536cac3ffd 100644
--- a/gnu/usr.bin/texinfo/info/dir.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:06 espie 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/gnu/usr.bin/texinfo/info/display.c b/gnu/usr.bin/texinfo/info/display.c
index 0194afafa20..a9ca5d65689 100644
--- a/gnu/usr.bin/texinfo/info/display.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:06 espie 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/gnu/usr.bin/texinfo/info/display.h b/gnu/usr.bin/texinfo/info/display.h
index d8bd5a166fe..4ddaa9e3725 100644
--- a/gnu/usr.bin/texinfo/info/display.h
+++ b/gnu/usr.bin/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 1999/01/11 16:38:07 espie 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/gnu/usr.bin/texinfo/info/echo-area.c b/gnu/usr.bin/texinfo/info/echo-area.c
index f3e7a04f5af..4642a28e095 100644
--- a/gnu/usr.bin/texinfo/info/echo-area.c
+++ b/gnu/usr.bin/texinfo/info/echo-area.c
@@ -1,7 +1,7 @@
/* echo-area.c -- How to read a line in the echo area.
- $Id: echo-area.c,v 1.1 1997/08/01 22:00:07 kstailey Exp $
+ $Id: echo-area.c,v 1.2 1999/01/11 16:38:07 espie Exp $
- Copyright (C) 1993, 97 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98 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
@@ -938,11 +938,9 @@ DECLARE_INFO_COMMAND (ea_possible_completions, _("List possible completions"))
int limit, count, max_label = 0;
initialize_message_buffer ();
- printf_to_message_buffer
- (_("There %s %d "), completions_found_index == 1 ? _("is") : _("are"),
- completions_found_index);
- printf_to_message_buffer
- (_("completion%s:\n"), completions_found_index == 1 ? "" : "s");
+ printf_to_message_buffer (completions_found_index == 1
+ ? _("One completion:\n")
+ : _("%d completions:\n"));
/* Find the maximum length of a label. */
for (i = 0; i < completions_found_index; i++)
diff --git a/gnu/usr.bin/texinfo/info/echo-area.h b/gnu/usr.bin/texinfo/info/echo-area.h
index e794d596a4d..dfac04dd91e 100644
--- a/gnu/usr.bin/texinfo/info/echo-area.h
+++ b/gnu/usr.bin/texinfo/info/echo-area.h
@@ -1,5 +1,5 @@
/* echo-area.h -- Functions used in reading information from the echo area.
- $Id: echo-area.h,v 1.1 1997/08/01 22:00:08 kstailey Exp $
+ $Id: echo-area.h,v 1.2 1999/01/11 16:38:07 espie Exp $
This file is part of GNU Info, a program for reading online documentation
stored in Info format.
diff --git a/gnu/usr.bin/texinfo/info/filesys.c b/gnu/usr.bin/texinfo/info/filesys.c
index e684bf81f7b..714b98843e6 100644
--- a/gnu/usr.bin/texinfo/info/filesys.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:07 espie 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, 98 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;
@@ -72,6 +38,7 @@ static char *info_suffixes[] = {
"",
".info",
"-info",
+ "/index",
(char *)NULL
};
@@ -114,58 +81,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 +150,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 +176,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 +257,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 +284,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 +307,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 +324,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 +359,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 +403,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 +477,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 +539,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/gnu/usr.bin/texinfo/info/filesys.h b/gnu/usr.bin/texinfo/info/filesys.h
index 130a52a6357..8c326ca3773 100644
--- a/gnu/usr.bin/texinfo/info/filesys.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:07 espie 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/gnu/usr.bin/texinfo/info/footnotes.c b/gnu/usr.bin/texinfo/info/footnotes.c
index 35a0f352de8..ad69ceaaa8f 100644
--- a/gnu/usr.bin/texinfo/info/footnotes.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/footnotes.h b/gnu/usr.bin/texinfo/info/footnotes.h
index 89b1b3578e6..dafe731608c 100644
--- a/gnu/usr.bin/texinfo/info/footnotes.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/gc.h b/gnu/usr.bin/texinfo/info/gc.h
index 876062ad249..3f62a14dcbe 100644
--- a/gnu/usr.bin/texinfo/info/gc.h
+++ b/gnu/usr.bin/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 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/indices.c b/gnu/usr.bin/texinfo/info/indices.c
index 6848884288b..2a895e8a52b 100644
--- a/gnu/usr.bin/texinfo/info/indices.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/indices.h b/gnu/usr.bin/texinfo/info/indices.h
index 265b1472ba8..bd0a7273cf9 100644
--- a/gnu/usr.bin/texinfo/info/indices.h
+++ b/gnu/usr.bin/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 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/info-utils.h b/gnu/usr.bin/texinfo/info/info-utils.h
index 5ca2e0c15cd..2b2d6c250b6 100644
--- a/gnu/usr.bin/texinfo/info/info-utils.h
+++ b/gnu/usr.bin/texinfo/info/info-utils.h
@@ -1,9 +1,10 @@
-/* info-utils.h -- Exported functions and variables from info-util.c. */
+/* info-utils.h -- Exported functions and variables from info-util.c.
+ $Id: info-utils.h,v 1.2 1999/01/11 16:38:08 espie 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, 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
@@ -21,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
@@ -31,11 +32,6 @@
# define strrchr rindex
#endif /* !HAVE_STRCHR */
-#if !defined (HAVE_MEMCPY)
-# undef memcpy
-# define memcpy(dest, source, count) bcopy(source, dest, count)
-#endif /* !HAVE_MEMCPY */
-
#include "nodes.h"
#include "window.h"
#include "search.h"
@@ -44,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
@@ -141,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/gnu/usr.bin/texinfo/info/info.c b/gnu/usr.bin/texinfo/info/info.c
index f00d71bb187..46763b0ee58 100644
--- a/gnu/usr.bin/texinfo/info/info.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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, 96, 97, 98 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,8 +29,10 @@
/* The version numbers of this version of Info. */
int info_major_version = 2;
-int info_minor_version = 14;
-int info_patch_level = 0;
+int info_minor_version = 18;
+
+/* basename (argv[0]) */
+static char *program_name = NULL;
/* Non-zero means search all indices for APROPOS_SEARCH_STRING. */
static int apropos_p = 0;
@@ -39,6 +40,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 +79,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 +91,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}
};
@@ -91,13 +102,13 @@ static char *short_options = "d:n:f:o:s";
int info_windows_initialized_p = 0;
/* Some "forward" declarations. */
-static void usage (), info_short_help (), remember_info_program_name ();
+static void info_short_help (), remember_info_program_name ();
/* **************************************************************** */
-/* */
-/* Main Entry Point to the Info Program */
-/* */
+/* */
+/* Main Entry Point to the Info Program */
+/* */
/* **************************************************************** */
int
@@ -105,85 +116,102 @@ 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:
+ fprintf (stderr, _("Try --help for more information."));
+ exit (1);
+ }
}
/* If the output device is not a terminal, and no output filename has been
@@ -191,14 +219,20 @@ 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, Version %s.\n", version_string ());
+ printf ("%s (GNU %s %s) %s\n", program_name, PACKAGE, VERSION,
+ version_string ());
+ printf (_("Copyright (C) %s 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.\n"),
+ "1998");
exit (0);
}
@@ -209,34 +243,49 @@ main (argc, argv)
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.
+ Lowest priority is our messy hardwired list in filesys.h.
+ Then comes the user's INFODIR from the Makefile.
+ Highest priority is the environment variable, if set. */
if (!infopath)
{
- char *path_from_env, *getenv ();
-
- 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);
+ }
+#ifdef INFODIR /* from the Makefile */
+ info_add_path (INFODIR, INFOPATH_PREPEND);
+#endif
+ info_add_path (path_from_env, INFOPATH_PREPEND);
+ }
else
- info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+ {
+ info_add_path (DEFAULT_INFOPATH, INFOPATH_PREPEND);
+#ifdef INFODIR /* from the Makefile */
+ info_add_path (INFODIR, INFOPATH_PREPEND);
+#endif
+ }
}
/* 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);
}
@@ -251,39 +300,74 @@ main (argc, argv)
/* 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
@@ -299,125 +383,134 @@ main (argc, argv)
/* 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;
-
- for (i = 0; entry = menu[i]; i++)
- if (strncasecmp (entry->label, arg, strlen (arg)) == 0)
- break;
- }
+ {
+ 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
@@ -440,19 +533,12 @@ 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);
}
return (vstring);
}
-
-/* **************************************************************** */
-/* */
-/* Error Handling for Info */
-/* */
-/* **************************************************************** */
-static char *program_name = (char *)NULL;
+
+/* Error handling. */
static void
remember_info_program_name (fullpath)
@@ -461,7 +547,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. */
@@ -490,61 +576,52 @@ 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);
+ }
}
}
-/* Produce a very brief descripton of the available options and exit with
- an error. */
-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 ...]");
- exit (1);
-}
-
/* Produce a scaled down description of the available options to Info. */
static void
info_short_help ()
{
- printf ("%s", "\
-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\
+ printf (_("\
+Usage: %s [OPTION]... [INFO-FILE [MENU-ITEM...]]\n\
+\n\
+Read documentation in Info format.\n\
+For more complete documentation on how to use Info, run `info info options'.\n\
+\n\
+Options:\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 display this help and exit.\n\
+--version display version information and exit.\n\
\n\
- --directory DIR Add DIR to INFOPATH.\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\
- --dribble FILENAME Remember user keystrokes in 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\
+The first argument, if present, is the name of the Info file to read.\n\
+Any remaining arguments are treated as the names of menu\n\
+items in the initial node visited. For example, `info emacs buffers'\n\
+moves to the node `buffers' in the info file `emacs'.\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");
+Email bug reports to bug-texinfo@gnu.org."), program_name);
exit (0);
}
diff --git a/gnu/usr.bin/texinfo/info/info.h b/gnu/usr.bin/texinfo/info/info.h
index a8759227758..1be7f299e91 100644
--- a/gnu/usr.bin/texinfo/info/info.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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, 98 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
@@ -71,30 +125,41 @@ extern int info_error_rings_bell_p;
extern void info_error ();
/* The version numbers of Info. */
-extern int info_major_version, info_minor_version, info_patch_level;
+extern int info_major_version, info_minor_version;
/* How to get the version string for this version of Info. Returns
something similar to "2.11". */
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/gnu/usr.bin/texinfo/info/infodoc.c b/gnu/usr.bin/texinfo/info/infodoc.c
index 35675095e70..90aa2f19ded 100644
--- a/gnu/usr.bin/texinfo/info/infodoc.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/infomap.c b/gnu/usr.bin/texinfo/info/infomap.c
index 27a959eb517..9b46db1d319 100644
--- a/gnu/usr.bin/texinfo/info/infomap.c
+++ b/gnu/usr.bin/texinfo/info/infomap.c
@@ -1,9 +1,7 @@
-/* infomap.c -- Keymaps for Info. */
+/* infomap.c -- Keymaps for Info.
+ $Id: infomap.c,v 1.2 1999/01/11 16:38:08 espie 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,6 +334,35 @@ initialize_info_keymaps ()
map['o'].function = info_next_window;
map['t'].function = info_tile_windows;
map['w'].function = info_toggle_wrap;
-}
-
+ /* 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/gnu/usr.bin/texinfo/info/m-x.c b/gnu/usr.bin/texinfo/info/m-x.c
index 03ac1a52232..b504feff3ca 100644
--- a/gnu/usr.bin/texinfo/info/m-x.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/makedoc.c b/gnu/usr.bin/texinfo/info/makedoc.c
index c0c4587ff18..6e52af8478d 100644
--- a/gnu/usr.bin/texinfo/info/makedoc.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/man.c b/gnu/usr.bin/texinfo/info/man.c
index 4b4dca9b203..08052185c89 100644
--- a/gnu/usr.bin/texinfo/info/man.c
+++ b/gnu/usr.bin/texinfo/info/man.c
@@ -1,9 +1,7 @@
-/* man.c: How to read and format man files. */
+/* man.c: How to read and format man files.
+ $Id: man.c,v 1.2 1999/01/11 16:38:08 espie Exp $
-/* This file is part of GNU Info, a program for reading online documentation
- stored in Info format.
-
- Copyright (C) 1995 Free Software Foundation, Inc.
+ Copyright (C) 1995, 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
@@ -23,7 +21,6 @@
#include "info.h"
#include <sys/ioctl.h>
-#include <sys/file.h>
#include "signals.h"
#if defined (HAVE_SYS_TIME_H)
#include <sys/time.h>
@@ -31,8 +28,8 @@
#if defined (HAVE_SYS_WAIT_H)
#include <sys/wait.h>
#endif
-#include "tilde.h"
+#include "tilde.h"
#include "man.h"
#if !defined (_POSIX_VERSION)
@@ -75,31 +72,31 @@ get_manpage_node (file_buffer, pagename)
page = get_manpage_contents (pagename);
if (page)
- {
- char header[1024];
- long oldsize, newsize;
- int hlen, plen;
-
- sprintf (header, "\n\n%c\n%s %s, %s %s, %s (dir)\n\n",
- INFO_COOKIE,
- INFO_FILE_LABEL, file_buffer->filename,
- INFO_NODE_LABEL, pagename,
- INFO_UP_LABEL);
- oldsize = file_buffer->filesize;
- hlen = strlen (header);
- plen = strlen (page);
- newsize = (oldsize + hlen + plen);
- file_buffer->contents =
- (char *)xrealloc (file_buffer->contents, 1 + newsize);
- memcpy (file_buffer->contents + oldsize, header, hlen);
- oldsize += hlen;
- memcpy (file_buffer->contents + oldsize, page, plen);
- file_buffer->contents[newsize] = '\0';
- file_buffer->filesize = newsize;
- file_buffer->finfo.st_size = newsize;
- build_tags_and_nodes (file_buffer);
- free (page);
- }
+ {
+ char header[1024];
+ long oldsize, newsize;
+ int hlen, plen;
+
+ sprintf (header, "\n\n%c\n%s %s, %s %s, %s (dir)\n\n",
+ INFO_COOKIE,
+ INFO_FILE_LABEL, file_buffer->filename,
+ INFO_NODE_LABEL, pagename,
+ INFO_UP_LABEL);
+ oldsize = file_buffer->filesize;
+ hlen = strlen (header);
+ plen = strlen (page);
+ newsize = (oldsize + hlen + plen);
+ file_buffer->contents =
+ (char *)xrealloc (file_buffer->contents, 1 + newsize);
+ memcpy (file_buffer->contents + oldsize, header, hlen);
+ oldsize += hlen;
+ memcpy (file_buffer->contents + oldsize, page, plen);
+ file_buffer->contents[newsize] = '\0';
+ file_buffer->filesize = newsize;
+ file_buffer->finfo.st_size = newsize;
+ build_tags_and_nodes (file_buffer);
+ free (page);
+ }
node = manpage_node_of_file_buffer (file_buffer, pagename);
}
@@ -110,12 +107,9 @@ get_manpage_node (file_buffer, pagename)
FILE_BUFFER *
create_manpage_file_buffer ()
{
- FILE_BUFFER *file_buffer;
- struct stat *finfo;
-
- file_buffer = make_file_buffer ();
- file_buffer->filename = strdup (MANPAGE_FILE_BUFFER_NAME);
- file_buffer->fullpath = strdup (MANPAGE_FILE_BUFFER_NAME);
+ FILE_BUFFER *file_buffer = make_file_buffer ();
+ file_buffer->filename = xstrdup (MANPAGE_FILE_BUFFER_NAME);
+ file_buffer->fullpath = xstrdup (MANPAGE_FILE_BUFFER_NAME);
file_buffer->finfo.st_size = 0;
file_buffer->filesize = 0;
file_buffer->contents = (char *)NULL;
@@ -137,25 +131,24 @@ executable_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;
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);
free (temp_dirname);
@@ -164,10 +157,10 @@ executable_file_in_path (filename, path)
/* If we have found a regular executable file, then use it. */
if ((statable) && (S_ISREG (finfo.st_mode)) &&
- (access (temp, X_OK) == 0))
- return (temp);
+ (access (temp, X_OK) == 0))
+ return (temp);
else
- free (temp);
+ free (temp);
}
return ((char *)NULL);
}
@@ -221,7 +214,7 @@ static void
reap_children (sig)
int sig;
{
- unsigned int status;
+ int status;
wait (&status);
}
@@ -233,7 +226,6 @@ get_manpage_contents (pagename)
int pipes[2];
pid_t child;
char *formatted_page = (char *)NULL;
- char *section = (char *)NULL;
int arg_index = 1;
if (formatter_args[0] == (char *)NULL)
@@ -261,11 +253,11 @@ get_manpage_contents (pagename)
if (child == -1)
return ((char *)NULL);
-
+
if (child != 0)
{
/* In the parent, close the writing end of the pipe, and read from
- the exec'd child. */
+ the exec'd child. */
close (pipes[1]);
formatted_page = read_from_fd (pipes[0]);
close (pipes[0]);
@@ -273,16 +265,16 @@ get_manpage_contents (pagename)
else
{
/* In the child, close the read end of the pipe, make the write end
- of the pipe be stdout, and execute the man page formatter. */
+ of the pipe be stdout, and execute the man page formatter. */
close (pipes[0]);
close (fileno (stderr));
- close (fileno (stdin)); /* Don't print errors. */
+ close (fileno (stdin)); /* Don't print errors. */
dup2 (pipes[1], fileno (stdout));
execv (formatter_args[0], formatter_args);
/* If we get here, we couldn't exec, so close out the pipe and
- exit. */
+ exit. */
close (pipes[1]);
exit (0);
}
@@ -304,21 +296,21 @@ clean_manpage (manpage)
newpage = (char *)xmalloc (1 + strlen (manpage));
- for (i = 0, j = 0; newpage[j] = manpage[i]; i++, j++)
+ for (i = 0, j = 0; (newpage[j] = manpage[i]); i++, j++)
{
if (manpage[i] == '\n')
- newline_count++;
+ newline_count++;
else
- newline_count = 0;
+ newline_count = 0;
if (newline_count == 3)
- {
- j--;
- newline_count--;
- }
+ {
+ j--;
+ newline_count--;
+ }
- if (manpage[i] == '\b')
- j -= 2;
+ if (manpage[i] == '\b' || manpage[i] == '\f')
+ j -= 2;
}
newpage[j++] = '\0';
@@ -339,11 +331,11 @@ manpage_node_of_file_buffer (file_buffer, pagename)
{
register int i;
- for (i = 0; tag = file_buffer->tags[i]; i++)
- {
- if (strcasecmp (pagename, tag->nodename) == 0)
- break;
- }
+ for (i = 0; (tag = file_buffer->tags[i]); i++)
+ {
+ if (strcasecmp (pagename, tag->nodename) == 0)
+ break;
+ }
}
if (tag)
@@ -459,7 +451,7 @@ find_reference_section (node)
{
position = search_forward (reference_section_starters[i], &frs_binding);
if (position != -1)
- break;
+ break;
}
if (position == -1)
@@ -473,11 +465,11 @@ find_reference_section (node)
for (i = frs_binding.start; i < frs_binding.end - 2; i++)
{
if ((frs_binding.buffer[i] == '\n') &&
- (!whitespace (frs_binding.buffer[i + 1])))
- {
- frs_binding.end = i;
- break;
- }
+ (!whitespace (frs_binding.buffer[i + 1])))
+ {
+ frs_binding.end = i;
+ break;
+ }
}
return (&frs_binding);
@@ -508,43 +500,43 @@ xrefs_of_manpage (node)
register int start, end;
for (start = position; start > reference_section->start; start--)
- if (whitespace (reference_section->buffer[start]))
- break;
+ if (whitespace (reference_section->buffer[start]))
+ break;
start++;
for (end = position; end < reference_section->end; end++)
- {
- if (whitespace (reference_section->buffer[end]))
- {
- end = start;
- break;
- }
-
- if (reference_section->buffer[end] == ')')
- {
- end++;
- break;
- }
- }
+ {
+ if (whitespace (reference_section->buffer[end]))
+ {
+ end = start;
+ break;
+ }
+
+ if (reference_section->buffer[end] == ')')
+ {
+ end++;
+ break;
+ }
+ }
if (end != start)
- {
- REFERENCE *entry;
- int len = end - start;
-
- entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
- entry->label = (char *)xmalloc (1 + len);
- strncpy (entry->label, (reference_section->buffer) + start, len);
- entry->label[len] = '\0';
- entry->filename = strdup (node->filename);
- entry->nodename = strdup (entry->label);
- entry->start = start;
- entry->end = end;
-
- add_pointer_to_array
- (entry, refs_index, refs, refs_slots, 10, REFERENCE *);
- }
+ {
+ REFERENCE *entry;
+ int len = end - start;
+
+ entry = (REFERENCE *)xmalloc (sizeof (REFERENCE));
+ entry->label = (char *)xmalloc (1 + len);
+ strncpy (entry->label, (reference_section->buffer) + start, len);
+ entry->label[len] = '\0';
+ entry->filename = xstrdup (node->filename);
+ entry->nodename = xstrdup (entry->label);
+ entry->start = start;
+ entry->end = end;
+
+ add_pointer_to_array
+ (entry, refs_index, refs, refs_slots, 10, REFERENCE *);
+ }
reference_section->start = position + 1;
}
@@ -558,7 +550,6 @@ locate_manpage_xref (node, start, dir)
long start;
int dir;
{
- register int i, count;
REFERENCE **refs;
long position = -1;
@@ -573,27 +564,27 @@ locate_manpage_xref (node, start, dir)
count = i;
if (dir > 0)
- {
- for (i = 0; entry = refs[i]; i++)
- if (entry->start > start)
- {
- position = entry->start;
- break;
- }
- }
+ {
+ for (i = 0; (entry = refs[i]); i++)
+ if (entry->start > start)
+ {
+ position = entry->start;
+ break;
+ }
+ }
else
- {
- for (i = count - 1; i > 0; i--)
- {
- entry = refs[i];
-
- if (entry->start < start)
- {
- position = entry->start;
- break;
- }
- }
- }
+ {
+ for (i = count - 1; i > -1; i--)
+ {
+ entry = refs[i];
+
+ if (entry->start < start)
+ {
+ position = entry->start;
+ break;
+ }
+ }
+ }
info_free_references (refs);
}
@@ -622,20 +613,20 @@ manpage_xrefs_in_binding (node, binding)
start = binding->start + (binding->buffer - node->contents);
end = binding->end + (binding->buffer - node->contents);
- for (i = 0; entry = all_refs[i]; i++)
+ for (i = 0; (entry = all_refs[i]); i++)
{
if ((entry->start > start) && (entry->end < end))
- {
- add_pointer_to_array
- (entry, brefs_index, brefs, brefs_slots, 10, REFERENCE *);
- }
+ {
+ add_pointer_to_array
+ (entry, brefs_index, brefs, brefs_slots, 10, REFERENCE *);
+ }
else
- {
- maybe_free (entry->label);
- maybe_free (entry->filename);
- maybe_free (entry->nodename);
- free (entry);
- }
+ {
+ maybe_free (entry->label);
+ maybe_free (entry->filename);
+ maybe_free (entry->nodename);
+ free (entry);
+ }
}
free (all_refs);
diff --git a/gnu/usr.bin/texinfo/info/man.h b/gnu/usr.bin/texinfo/info/man.h
index 1584e260687..490b4c3b356 100644
--- a/gnu/usr.bin/texinfo/info/man.h
+++ b/gnu/usr.bin/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 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/nodemenu.c b/gnu/usr.bin/texinfo/info/nodemenu.c
index 33044157bd2..70878f4ca92 100644
--- a/gnu/usr.bin/texinfo/info/nodemenu.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/nodes.h b/gnu/usr.bin/texinfo/info/nodes.h
index 7ddea17ddda..c39b4bc81b1 100644
--- a/gnu/usr.bin/texinfo/info/nodes.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:08 espie 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/gnu/usr.bin/texinfo/info/search.h b/gnu/usr.bin/texinfo/info/search.h
index 72695c3f0b6..0fafa165eea 100644
--- a/gnu/usr.bin/texinfo/info/search.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:09 espie 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/gnu/usr.bin/texinfo/info/session.c b/gnu/usr.bin/texinfo/info/session.c
index 50befb8388b..2e7818487be 100644
--- a/gnu/usr.bin/texinfo/info/session.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:09 espie 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, 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,25 +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 ();
@@ -289,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;
}
@@ -360,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)
@@ -378,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
@@ -400,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;
}
@@ -426,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 */
@@ -458,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);
}
@@ -509,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
@@ -555,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;
@@ -570,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;
@@ -619,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;
@@ -631,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;
@@ -646,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;
@@ -661,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;
@@ -681,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;
@@ -700,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);
@@ -709,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);
@@ -725,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);
}
@@ -734,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;
@@ -753,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;
@@ -801,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;
@@ -857,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);
}
@@ -868,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;
@@ -897,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;
}
}
}
@@ -1046,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);
@@ -1163,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);
@@ -1208,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)
{
@@ -1277,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;
@@ -1298,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)
{
@@ -1317,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;
@@ -1349,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;
@@ -1373,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);
}
@@ -1430,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)
{
@@ -1438,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);
}
}
@@ -1461,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
@@ -1489,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++;
@@ -1517,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;
@@ -1537,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);
}
@@ -1548,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
@@ -1585,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);
@@ -1600,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);
@@ -1668,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);
@@ -1716,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);
@@ -1752,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);
@@ -1761,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;
@@ -1770,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);
@@ -1778,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;
@@ -1847,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;
@@ -1882,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;
}
@@ -1898,80 +1853,77 @@ info_menu_or_ref_item (window, count, key, builder, ask_p)
if (point_line != -1)
{
- SEARCH_BINDING binding;
-
- binding.start = 0;
- binding.buffer = window->line_starts[point_line];
- if (window->line_starts[point_line + 1])
- binding.end = window->line_starts[point_line + 1] - binding.buffer;
- else
- binding.end =
- (window->node->contents + window->node->nodelen) - binding.buffer;
- binding.flags = 0;
-
- if (builder == info_menu_of_node)
- {
- if (point_line)
- {
- binding.buffer--;
- binding.end++;
-
- 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);
+ }
}
}
@@ -1982,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);
@@ -2008,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)
@@ -2041,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);
@@ -2087,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);
}
@@ -2095,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;
@@ -2125,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;
@@ -2143,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)
@@ -2172,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. */
@@ -2240,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)
{
@@ -2260,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);
@@ -2275,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)
{
@@ -2338,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;
}
@@ -2355,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++];
@@ -2380,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);
@@ -2427,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);
@@ -2449,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);
}
@@ -2468,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
@@ -2500,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;
}
@@ -2513,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 */
}
@@ -2545,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;
}
@@ -2561,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);
@@ -2586,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);
@@ -2625,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;
}
@@ -2642,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 */
}
@@ -2651,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);
}
@@ -2661,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;
@@ -2673,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 */
}
@@ -2703,9 +2681,9 @@ write_node_to_stream (node, stream)
}
/* **************************************************************** */
-/* */
-/* Info Searching Commands */
-/* */
+/* */
+/* Info Searching Commands */
+/* */
/* **************************************************************** */
/* Variable controlling the garbage collection of files briefly visited
@@ -2780,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);
}
@@ -2800,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
@@ -2811,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--);
@@ -2845,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);
}
@@ -2881,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;
@@ -2985,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);
@@ -3001,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);
@@ -3013,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;
@@ -3022,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
@@ -3031,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);
}
@@ -3062,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. */
@@ -3088,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. */
@@ -3139,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;
@@ -3150,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);
@@ -3166,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);
@@ -3210,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;
}
@@ -3435,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. */
@@ -3515,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 =
@@ -3531,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;
}
@@ -3555,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
@@ -3565,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;
@@ -3580,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);
@@ -3598,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);
@@ -3607,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);
@@ -3617,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;
@@ -3633,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 ();
@@ -3655,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;
@@ -3665,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. */
@@ -3687,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)
{
@@ -3704,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);
@@ -3724,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 (). */
@@ -3747,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);
@@ -3800,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);
@@ -3834,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)
@@ -3871,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;
}
@@ -3888,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. */
@@ -3972,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);
}
@@ -3981,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);
@@ -3996,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;
@@ -4004,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. */
@@ -4110,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;
}
}
@@ -4121,7 +4104,7 @@ info_input_buffer_space_available ()
if (pop_index > push_index)
return (pop_index - push_index);
else
- return (sizeof (info_input_buffer - (push_index - pop_index)));
+ return (sizeof (info_input_buffer) - (push_index - pop_index));
}
/* Get a key from the buffer of characters to be read.
@@ -4149,28 +4132,12 @@ 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
info_gather_typeahead ()
{
+ register int i = 0;
int tty, space_avail;
long chars_avail;
unsigned char input[MAX_INFO_INPUT_BUFFERING];
@@ -4189,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)
@@ -4208,13 +4175,11 @@ info_gather_typeahead ()
# endif /* O_NDELAY */
#endif /* !FIONREAD */
- /* Store the input characters just read into our input buffer. */
- {
- register int i;
-
- for (i = 0; i < chars_avail; i++)
+ while (i < chars_avail)
+ {
info_push_typeahead (input[i]);
- }
+ i++;
+ }
}
/* How to read a single character. */
@@ -4233,34 +4198,55 @@ 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. */
+#ifdef EINTR
+ /* Keep reading if we got EINTR, so that we don't just exit.
+ --Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>,
+ 22 Dec 1997. */
+ {
+ int n;
+ do
+ n = read (tty, &c, 1);
+ while (n == -1 && errno == EINTR);
+ rawkey = n == 1 ? c : EOF;
+ }
+#else
+ rawkey = (read (tty, &c, 1) == 1) ? c : EOF;
+#endif
- 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/gnu/usr.bin/texinfo/info/signals.h b/gnu/usr.bin/texinfo/info/signals.h
index ab87a3b5495..ff82a0b3bee 100644
--- a/gnu/usr.bin/texinfo/info/signals.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:09 espie 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/gnu/usr.bin/texinfo/info/termdep.h b/gnu/usr.bin/texinfo/info/termdep.h
index 4784b7ab7ee..6ba89ab89bc 100644
--- a/gnu/usr.bin/texinfo/info/termdep.h
+++ b/gnu/usr.bin/texinfo/info/termdep.h
@@ -1,9 +1,10 @@
-/* termdep.h -- System things that terminal.c depends on. */
+/* termdep.h -- System things that terminal.c depends on.
+ $Id: termdep.h,v 1.2 1999/01/11 16:38:09 espie 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, 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,49 +22,36 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if !defined (_TERMDEP_H_)
-# define _TERMDEP_H_
+#ifndef INFO_TERMDEP_H
+#define INFO_TERMDEP_H
-#if defined (HAVE_SYS_FCNTL_H)
-# include <sys/fcntl.h>
-#else
-# include <fcntl.h>
-#endif /* !HAVE_SYS_FCNTL_H */
-
-#if defined (HAVE_TERMIO_H)
-# include <termio.h>
-# include <string.h>
-# if defined (HAVE_SYS_PTEM_H)
-# if defined (M_UNIX) || !defined (M_XENIX)
-# include <sys/stream.h>
-# include <sys/ptem.h>
-# undef TIOCGETC
-# else /* M_XENIX */
-# define tchars tc
-# endif /* M_XENIX */
-# endif /* HAVE_SYS_PTEM_H */
-#else /* !HAVE_TERMIO_H */
-# if defined (HAVE_SYS_FILE_H)
-# include <sys/file.h>
-# endif /* HAVE_SYS_FILE_H */
-# include <sgtty.h>
-# include <strings.h>
-#endif /* !HAVE_TERMIO_H */
+/* NeXT supplies <termios.h> but it is broken. Probably Autoconf should
+ have a separate test, but anyway ... */
+#ifdef NeXT
+#undef HAVE_TERMIOS_H
+#endif
-#if defined (HAVE_SYS_TTOLD_H)
+#ifdef HAVE_TERMIOS_H
+# include <termios.h>
+#else
+# if defined (HAVE_TERMIO_H)
+# include <termio.h>
+# if defined (HAVE_SYS_PTEM_H)
+# if defined (M_UNIX) || !defined (M_XENIX)
+# include <sys/stream.h>
+# include <sys/ptem.h>
+# undef TIOCGETC
+# else /* M_XENIX */
+# define tchars tc
+# endif /* M_XENIX */
+# endif /* HAVE_SYS_PTEM_H */
+# else /* !HAVE_TERMIO_H */
+# include <sgtty.h>
+# endif /* !HAVE_TERMIO_H */
+#endif /* !HAVE_TERMIOS_H */
+
+#ifdef HAVE_SYS_TTOLD_H
# include <sys/ttold.h>
#endif /* HAVE_SYS_TTOLD_H */
-#if !defined (HAVE_STRCHR)
-# undef strchr
-# undef strrchr
-# define strchr index
-# define strrchr rindex
-#endif /* !HAVE_STRCHR */
-
-#if !defined (HAVE_MEMCPY)
-#undef memcpy
-#define memcpy(dest, source, count) bcopy(source, dest, count)
-#endif /* !HAVE_MEMCPY */
-
-#endif /* _TERMDEP_H_ */
+#endif /* not INFO_TERMDEP_H */
diff --git a/gnu/usr.bin/texinfo/info/terminal.c b/gnu/usr.bin/texinfo/info/terminal.c
index 2e3c411a146..e1e3d2d4d0c 100644
--- a/gnu/usr.bin/texinfo/info/terminal.c
+++ b/gnu/usr.bin/texinfo/info/terminal.c
@@ -1,8 +1,8 @@
/* terminal.c -- How to handle the physical terminal for Info.
- $Id: terminal.c,v 1.3 1997/08/01 22:37:40 kstailey Exp $
+ $Id: terminal.c,v 1.4 1999/01/11 16:38:09 espie Exp $
- Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97 Free Software
- Foundation, Inc.
+ Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 97, 98
+ 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
@@ -141,7 +141,10 @@ terminal_begin_using_terminal ()
if (!term_begin_use || !*term_begin_use)
return;
+#ifdef SIGWINCH
sigsave = signal (SIGWINCH, SIG_IGN);
+#endif
+
send_to_terminal (term_begin_use);
/* Without this fflush and sleep, running info in a shelltool or
cmdtool (TERM=sun-cmd) with scrollbars loses -- the scrollbars are
@@ -149,7 +152,10 @@ terminal_begin_using_terminal ()
From: strube@physik3.gwdg.de (Hans Werner Strube). */
fflush (stdout);
sleep (1);
+
+#ifdef SIGWINCH
signal (SIGWINCH, sigsave);
+#endif
}
/* Tell the terminal that we will not be doing any more cursor
@@ -165,11 +171,17 @@ terminal_end_using_terminal ()
if (!term_end_use || !*term_end_use)
return;
+#ifdef SIGWINCH
sigsave = signal (SIGWINCH, SIG_IGN);
+#endif
+
send_to_terminal (term_end_use);
fflush (stdout);
sleep (1);
+
+#ifdef SIGWINCH
signal (SIGWINCH, sigsave);
+#endif
}
/* **************************************************************** */
diff --git a/gnu/usr.bin/texinfo/info/tilde.c b/gnu/usr.bin/texinfo/info/tilde.c
index df2f6dcde18..38cdf395396 100644
--- a/gnu/usr.bin/texinfo/info/tilde.c
+++ b/gnu/usr.bin/texinfo/info/tilde.c
@@ -1,13 +1,11 @@
-/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo). */
+/* tilde.c -- Tilde expansion code (~/foo := $HOME/foo).
+ $Id: tilde.c,v 1.2 1999/01/11 16:38:10 espie 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.
- This file has appeared in prior works by the Free Software Foundation;
- thus it carries copyright dates from 1988 through 1993.
-
- Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993 Free Software
- Foundation, Inc.
+ Copyright (C) 1988, 89, 90, 91, 92, 93, 96, 98
+ 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,39 +23,29 @@
Written by Brian Fox (bfox@ai.mit.edu). */
-#if defined (__GNUC__)
-# define alloca __builtin_alloca
-#else /* !__GNUC__ */
-# if defined (_AIX)
+/* Indent #pragma so that older Cpp's don't try to parse it. */
+#ifdef _AIX
#pragma alloca
-# else /* !_AIX */
-# if defined (HAVE_ALLOCA_H)
-# include <alloca.h>
-# endif /* HAVE_ALLOCA_H */
-# endif /* !AIX */
-#endif /* !__GNUC__ */
-
-#if defined (HAVE_STDLIB_H)
-#include <stdlib.h>
-#endif
+#endif /* _AIX */
-#include "tilde.h"
-#include <pwd.h>
-
-#if defined (HAVE_STRING_H)
-#include <string.h>
-#endif
+/* Include config.h before doing alloca. */
+#include "info.h"
-#include "clib.h"
-
-#if !defined (NULL)
-# define NULL 0x0
+#ifdef __GNUC__
+# undef alloca
+# define alloca __builtin_alloca
+#else
+# ifdef HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifndef _AIX
+char *alloca ();
+# endif
+# endif
#endif
#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
@@ -108,16 +96,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);
}
@@ -136,13 +124,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);
}
@@ -170,7 +158,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;
@@ -179,12 +167,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);
@@ -197,7 +185,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;
@@ -217,87 +205,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. */
- char *temp_home = (char *)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);
}
@@ -320,15 +308,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);
@@ -371,7 +359,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/gnu/usr.bin/texinfo/info/variables.c b/gnu/usr.bin/texinfo/info/variables.c
index 7798701c124..d1e29499714 100644
--- a/gnu/usr.bin/texinfo/info/variables.c
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:10 espie 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/gnu/usr.bin/texinfo/info/variables.h b/gnu/usr.bin/texinfo/info/variables.h
index 85bde27737b..ba6f1f33176 100644
--- a/gnu/usr.bin/texinfo/info/variables.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:10 espie 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/gnu/usr.bin/texinfo/info/window.c b/gnu/usr.bin/texinfo/info/window.c
index 304e89c0c75..944a8ce10be 100644
--- a/gnu/usr.bin/texinfo/info/window.c
+++ b/gnu/usr.bin/texinfo/info/window.c
@@ -1,9 +1,10 @@
-/* window.c -- Windows in Info. */
+/* window.c -- Windows in Info.
+ $Id: window.c,v 1.2 1999/01/11 16:38:10 espie 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.
@@ -725,24 +723,24 @@ character_width (character, hpos)
int width = 1;
if (ISO_Latin_p)
- printable_limit = 160;
+ printable_limit = 255;
if (character > printable_limit)
width = 3;
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/gnu/usr.bin/texinfo/info/window.h b/gnu/usr.bin/texinfo/info/window.h
index 5bde64a10ac..7c61f55464b 100644
--- a/gnu/usr.bin/texinfo/info/window.h
+++ b/gnu/usr.bin/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.2 1999/01/11 16:38:10 espie 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 */