diff options
author | Jeff Law <law@gcc.gnu.org> | 1998-03-22 14:47:59 -0700 |
---|---|---|
committer | Jeff Law <law@gcc.gnu.org> | 1998-03-22 14:47:59 -0700 |
commit | f8b2ac1ece6a3f082b68d854059648e2a6cb3e43 (patch) | |
tree | 87e2b2b74f7d097a6b65a3f5d90b032f669ab723 /texinfo | |
parent | 8491377bd19a528b1249b3a6ad67277d813720fc (diff) | |
download | gcc-f8b2ac1ece6a3f082b68d854059648e2a6cb3e43.tar.gz |
Merge in texinfo-3.11.
From-SVN: r18767
Diffstat (limited to 'texinfo')
-rw-r--r-- | texinfo/ChangeLog | 972 | ||||
-rw-r--r-- | texinfo/aclocal.m4 | 515 | ||||
-rwxr-xr-x | texinfo/configure | 2406 | ||||
-rw-r--r-- | texinfo/configure.in | 59 | ||||
-rw-r--r-- | texinfo/info/man.c | 267 | ||||
-rw-r--r-- | texinfo/info/termdep.h | 49 | ||||
-rw-r--r-- | texinfo/info/terminal.c | 225 | ||||
-rw-r--r-- | texinfo/makeinfo/makeinfo.c | 6164 | ||||
-rw-r--r-- | texinfo/util/install-info.c | 217 |
9 files changed, 7309 insertions, 3565 deletions
diff --git a/texinfo/ChangeLog b/texinfo/ChangeLog index 5885b59ea78..453750c49e4 100644 --- a/texinfo/ChangeLog +++ b/texinfo/ChangeLog @@ -1,131 +1,939 @@ -Tue Mar 17 10:33:28 1998 Manfred Hollstein <manfred@s-direktnet.de> +Mon Feb 2 17:17:17 1998 Jason Molenda (crash@bugshack.cygnus.com) - * Makefile.in (clean, distclean): Add 'info' explicitly. + * info/termdep.h (TIOCGETC): Don't define if we have termios.h. + From Robert Lipe. -Tue Mar 3 10:05:46 1998 Jeffrey A Law (law@cygnus.com) +Tue Oct 7 11:14:04 1997 Michael Meissner <meissner@cygnus.com> - * makeinfo/makeinfo.c (CommandTable): Fix braces in initializer. + * info/tilde.c (alloca): Don't redefine alloca as __builtin_alloca + if alloca was already defined. -Tue Jan 13 21:34:23 1998 H.J. Lu (hjl@gnu.org) +Mon Oct 6 12:46:27 1997 Ian Lance Taylor <ian@cygnus.com> - * libtxi/Makefile.in (AR_FLAGS): Defined as "rc". + * util/Makefile.am (bin_PROGRAMS): Remove install-info. + (noinst_PROGRAMS, install_inf_SOURCES): Define. + (install-exec-local): New target. + * util/Makefile.in: Rebuild. + * info/Makefile.in: Rebuild with current automake. -Tue Dec 2 20:24:40 1997 Bruno Haible <haible@ilog.fr> +Wed Sep 3 12:44:18 1997 Ian Lance Taylor <ian@cygnus.com> - * makeinfo/makeinfo.c (find_and_load, convert_from_stream): - Zero-terminate the file contents. + * po/Makefile.in.in: More --enable-maintainer-mode changes. -Fri Oct 31 09:39:31 1997 Jeffrey A Law (law@cygnus.com) +Thu Aug 28 23:52:29 1997 Ian Lance Taylor <ian@cygnus.com> - * Makefile.in (install targets): Add a dummy target for sunos make. - (SUBDIR): Remove 'info'. It's unneeded. + * po/Makefile.in.in: Make automatic dependencies only run programs + if --enable-maintainer-mode. -Wed Oct 29 22:56:46 1997 Robert Lipe (robertl@dgii.com) +Mon Aug 25 16:50:32 1997 Ian Lance Taylor <ian@cygnus.com> - * info/termdep.h: If POSIX, #undef TIOCGETC for benefit of systems - that provide TIOCETC but not struct tchars. + * configure.in: Add AM_MAINTAINER_MODE and AM_EXEEXT. + * Makefile.in, */Makefile.in: Rebuild with automake --cygnus. + * configure: Rebuild with current autoconf. -Wed Oct 15 09:49:57 1997 Richard Henderson <rth@cygnus.com> +Wed Feb 12 11:15:16 1997 Michael Meissner <meissner@cygnus.com> + + * util/texindex.c (main): Make main an int function, not void. + +Sat Jun 29 18:56:07 1996 Geoffrey Noer <noer@cygnus.com> + + * configure.in: if ac_cv_c_cross is yes, don't run the + AC_FUNC_SETVBUF_REVERSED call since it tries to do a run + test. This allows texinfo to build for cygwin32 Canadian + crosses/natives + * configure: regenerate + +Thu Jul 31 11:57:46 1997 Karl Berry <karl@cs.umb.edu> + + * Version 3.11. + + * info/man.c (reap_children): Declare status as int, not unsigned, + since that's what POSIX says the arg to wait should be. + + * makeinfo/makeinfo.c (cm_uref, cm_email): Rewrite to do macro + expansion in the arguments. + + * makeinfo/makeinfo.c (main): setlocale LC_MESSAGES and LC_TIME, + instead of LC_ALL. + From: Akim Demaille <demaille@inf.enst.fr>. + + * makeinfo/makeinfo.c (cm_today): Let the %d %s %d be translated, + so other languages can change the order of day/month/year. + From: Akim Demaille <demaille@inf.enst.fr>. + + * info/infomap.c: Doc fix. + + * lib/system.h [!O_RDONLY]: Prefer <fcntl.h> to <sys/fcntl.h>. + + * configure.in (AC_CHECK_HEADERS): Check for fcntl.h. + + * doc/Makefile.am (install-data-local): Suggest tex/generic/dvips + for epsf.tex. + From: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>. + + * configure.in (TEXMF): Move check to block with other program + checks. + +Wed Jul 30 11:20:37 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (defun_internal): Allow extra text after + most @def... commands, for tzname[2] in libc.texinfo. + + * info/info.c: Include indices.h. + * configure.in (AC_CHECK_HEADERS): Test for sys/wait.h, info/man.c + uses it. + From: Erick Branderhorst <Erick.Branderhorst@asml.nl>. + +Tue Jul 29 15:55:19 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in: Version 3.9j. + + * info/terminal.c (output_character_function): Return int (the + arg), not void. + + * info/infomap.c: Don't define term_kP as 'v', since that's undefined. + From: Tom Hageman <tom@basil.icce.rug.nl>. + + * makeinfo/makeinfo.c: Parameterize some messages to avoid + duplicate translations. + + * info/terminal.c: Only try to declare ospeed, PC, tputs, etc. if + we don't have <ncurses.h/termcap.h> or <termcap.h>. + + * makeinfo/makeinfo.c (cm_email): New function, like cm_uref. + +Sun Jul 27 17:09:20 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in: Only check for <ncurses/termcap.h> if we're using + -lncurses. + From: Bo Johansson <bo.johansson@mbox2.swipnet.se>. + + * info/dir.c (new_dir_file_p): Avoid automatic struct + initialization, SunOS 4 etc. cc can't handle it. + From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>. + +Sat Jul 26 15:08:13 1997 Karl Berry <karl@cs.umb.edu> + + * Version 3.9i. + + * configure.in: Check for termcap.h and ncurses/termcap.h. + From: bo.johansson@mbox2.swipnet.se. + +Fri Jul 25 14:09:05 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Document new second optional arg to email. + + * info/infodoc.c: Document CTRL-x 0 as the way to get out of help. + + * info/dir.c (maybe_build_dir_node): Really check for the same dir + file twice, not just by name. + (new_dir_file_p): New function. + + * util/install-info.c: Tell them about --help in doc strings. + +Thu Jul 24 14:25:44 1997 Karl Berry <karl@cs.umb.edu> + + * util/texindex.c (memory_error): Move to avoid incorrect implicit + decl. + + * makeinfo/makeinfo.c, + * makeinfo/multi.c, + * util/install-info.c, + * util/texindex.c, + * info/tilde.c, + * info/man.c, + * info/gc.c, + * info/session.c (info_replace_key_to_typeahead): Remove unused + function, + * info/nodemenu.c, + * info/man.c, + * info/m-x.c, + * info/footnotes.c + * info/info.c + * info/indices.c, + * info/filesys.c: Parenthesize to avoid -Wall warnings + remove unused variables, + make return types explicit, + printf type corrections. + + * lib/system.h: <ctype.h>: Include this. + * util/texindex.c, + * makeinfo/makeinfo.c, + * info/echo-area.c, + * info/display.c: ctype.h: Included in system.h now. + + * info/echo-area.c: Parenthesize to avoid -Wall warnings. + (ctype.h): #include for isprint. + (echo_area_stack_depth): Remove unused function. + * info/display.c: Parenthesize to avoid -Wall warnings. + (ctype.h): #include for isprint. + * info/dir.c: Parenthesize to avoid -Wall warnings. + (build_dir_node_internal): Remove declaration of nonexistent function. + From: Erick Branderhorst <Erick.Branderhorst@asml.nl>. + + * configure.in (TEXMF): Call texconfig to discover the default value, + for the sake of the warning in doc/Makefile. + From: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>. + + * doc/Makefile.am (TEXMF): New variable. + (install-data-local): Use it in warning. + From: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>. + + * info/session.c (initialize_info_session): Only call + terminal_prep_terminal if clear_screen is true. Otherwise, failed + --index-searches prep the terminal but do not unprep it. + From: William Edward Webber <wew@yallara.cs.rmit.EDU.AU>. + + * info/nodemenu.c: Doc fix. + +Mon Jul 21 17:11:09 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Comment out @smallbook and @set smallbook so + people at other sites can print it the way they want. + From: Thomas Walter <walter@pctc.chemie.uni-erlangen.de> + +Sun Jul 20 07:52:25 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in: 3.9h. + + * doc/Makefile.am (install-info-am, distclean-aminfo): New targets + to avoid assuming info files are in srcdir. + + * lib/system.h (xstrdup): Returns char *, not void *. + + * doc/Makefile.am (.texi.info), + * doc/Makefile.am (texinfo): Don't run in $(srcdir). + + * util/install-info.c (main): Remove unnecessary decl of strrchr. + + * info/tilde.c: Include info.h (for config.h) before alloca stuff. + + * makeinfo/makeinfo.c (validate_file): Rename `valid' to `valid_p' + to avoid conflict with SunOS 4 header files. + From: "Kaveh R. Ghazi" <ghazi@caip.rutgers.edu>. + + * info/session.c (initialize_info_session): Call + terminal_prep_terminal here (before calling terminal_clear_screen). + (info_session): Instead of here. + From: William Edward Webber <wew@yallara.cs.rmit.EDU.AU>. + + * Makefile.am (EXTRA_DIST): Add README-alpha. + +Sat Jul 19 13:50:27 1997 Karl Berry <karl@cs.umb.edu> + + * info/terminal.c: Use `keypad transmit' sequence if it's defined: + (term_keypad_on, term_keypad_off): New statics. + (terminal_begin_using_terminal): If term_keypad_on, send it. + (terminal_end_using_terminal): If term_keypad_off, send it. + (terminal_initialize_terminal): Look up ks and ke termcap strings. + From: William Edward Webber <wew@yallara.cs.rmit.EDU.AU>. + + * info/infomap.c (initialize_info_keymaps): Initialize hardwired + cases for arrow keys a la readline. Found by John Eaton, + jwe@bevo.che.wisc.edu. + + * makeinfo/makeinfo.c (output_pending_notes): Remove footnote + macro expansion code I #if 0'd out some time ago. And doc fixes. + + * Applied this patch: + +Sat Jul 19 16:29:01 1997 Karl Eichwalder <ke@suse.de> + + * info/info.c (main): setlocale, bindtextdomain, and textdomain. + +Fri Jul 18 10:02:18 1997 Karl Berry <karl@cs.umb.edu> + + * doc/Makefile.am (install-data-local), + * emacs/Makefile.am (install-data-local): Give subdir in warning. + + * configure.in: Version 3.9f. + + * doc/texinfo.texi: Correct \^ to @^. + From Andreas S. + + * Merged these changes: + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * info/display.c (display_cursor_at_point): Flush ouput. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * info/session.c (remember_window_and_node): Don't crash when the + current window has no current node. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * util/texindex.c (usage): Translate the doc strings. + * makeinfo/makeinfo.c (cm_today): Translate the month names. + * info/variables.c (describe_variable): Translate the doc strings. + * info/nodes.h: Don't translate the strings defining the info format. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * makeinfo/makeinfo.c (get_item_function): Remove superfluous call + to canon_white after get_rest_of_line. + (cm_end): Likewise. + (handle_variable): Likewise. + (cm_item): Likewise. + (cm_unmacro): Likewise. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * info/nodemenu.c (list_visited_nodes): Don't clear the internal + flag, this and other functions depend on it. Don't insist on + displaying the menu below the current window. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * makeinfo/makeinfo.c (cm_uref): Fix memory leaks. + (cm_inforef): Likewise. Handle empty cross reference name. + +1997-07-17 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * info/echo-area.c (ea_possible_completions): Check that the + current window can actually be split. + +Thu Jul 17 17:19:34 1997 Karl Berry <karl@cs.umb.edu> + + + * emacs/Makefile.am (*clean-lisp): Define, as Automake didn't. + From: Kenneth Stailey <kstailey@disclosure.com>. + + * doc/Makefile.am: Do not distribute info.1. + * makeinfo/macros: Do not distribute this directory, it's merged + into the main documentation. + * doc/makeinfo.texi: Don't distribute this either, it's in the + main manual. + + * util/install-info.c: Use \n\ for multiline string constant. + From: Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>. + +Wed Jul 16 15:29:50 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: @set must be after @setfilename, I guess. + Noted by Erick Branderhorst. + + * Applied this change: + +Tue Nov 12 22:20:22 1996 John Eaton <jwe@bevo.che.wisc.edu> + + * makeinfo.c (INDEX_ALIST): Use two indices, read_index and + write_index, instead of just one. + (find_index_offset): If a match is found, return index to the + current INDEX_ALIST struct, not the index pointing to the list of + index entries. + (translate_index): Return read_index from the matching + INDEX_ALIST. + (undefindex): Delete the list of index elements pointed to by + read_index from the INDEX_ALIST that matches name. + (defindex): Initialize read_index and write_index. + (index_add_arg): Add entries to the list pointed to by write_index + from the INDEX_ALIST matching name. + (index_append): Delete unused function. + (cm_synindex): Don't merge indcies, just make the write_index for + redirectee the same as the write_index for redirector. + +Tue Jul 15 09:32:04 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Bump edition number for 2.24. + + * util/Makefile.am (localedir): Define. + + * info/window.h: Rename __window__ to window_struct. + + * info/window.h, + * info/variables.h, + * info/search.h, + * info/man.h, + * info/info-utils.h, + * info/gc.h, + * info/footnotes.h, + * info/filesys.h, + * info/echo-area.h, + * info/display.h: Avoid leading _ in #define for #include protection. + + * makeinfo/makeinfo.c: Version 1.68. + * info/info.c: Version 2.17. + + * Most all files: Untabify. + + * doc/Makefile.am (texinfo): Add explicit target. + + * emacs/Makefile.am (noinst_LISP): Remove the obsolete + detexinfo.el (makeinfo --no-headers is better) and + texnfo-tex.el (now handled by TeX modes in general). + +Mon Jul 14 15:21:03 1997 Karl Berry <karl@cs.umb.edu> + + * util/texi2dvi: Update RCS file from 3.9 distribution. + + * util/Makefile.am (EXTRA_DIST): Add update-info, from + rhawes@dmapub.dma.org + +Sun Jul 13 17:05:03 1997 Karl Berry <karl@cs.umb.edu> + + * info/signals.c: Use RETSIGTYPE instead of hardwiring void. + From: "Jeffery L. JT Vogt" <lfm@atw.earthreach.com>. + + * info/session.c (info_history_node): Rewrite as + info_kill_node (current_node). + (kill_node, read_nodename_to_kill): New functions from info_kill_node. + (info_kill_node): Now this just calls them. + +Fri Jul 11 11:56:58 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Fix `Conditionals' xref. + +Thu Jul 10 17:58:12 1997 Karl Berry <karl@cs.umb.edu> + + * doc/info.texi: Don't say SPC clears ? screen. + +Sun Jul 6 16:26:41 1997 Karl Berry <karl@cs.umb.edu> + + * doc/info-stnd.texi: Document --index-search. + + * info/tilde.c, + * info/session.c: Remove redundant getenv decl. + + * Installed following change: +Tue Nov 12 14:44:00 1996 John W. Eaton <jwe@bevo.che.wisc.edu> + + * info/info.c (main): Handle new option, --index-search STRING. + (index_search_p, index_search_string): New static variables, used + to handle --index-search option. + + * info/session.c (initialize_info_session): New arg, + clear_screen. Change all callers. + + * info/indices.h (do_info_index_search, index_intry_exists): + Provide declarations here. + + * info/indices.c (do_info_index_search): New function, extracted + from info_index_search. + (info_index_search): Simply call do_info_index_search() with + search_string set to NULL. + (index_entry_exists): New function. + +Sat Jul 5 17:17:14 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Document @kbdinputstyle. + + * makeinfo/makeinfo.c (kbdinputstyle): New command. + (cm_no_op_line_arg): New function. + + * info/termdep.h (HAVE_TERMIOS_H) [NeXT]: #undef. + From: Gregor Hoffleit <flight@mathi.uni-heidelberg.de> et al. + +Fri Jul 4 14:18:08 1997 Karl Berry <karl@cs.umb.edu> + + * info/Makefile.am (EXTRA_DIST), + * util/Makefile.am (EXTRA_DIST), + * makeinfo/Makefile.am (EXTRA_DIST), + * lib/Makefile.am (EXTRA_DIST): Include README. - * info/man.c (find_man_formatter): Don't cast getenv(), but provide - a minimal declaration at top level. + * doc/texinfo.texi (makeinfo options): Document --paragraph-indent + values more completely. + * makeinfo/makeinfo.c (set_paragraph_indent): Allow translated + asis or none, improve doc. + From ke. - * makeinfo/makeinfo.c: Don't redefine alloca if it is already defined. + * doc/Makefile.am (dist-info): New empty target so that we do not + distribute info files. + From Erick Branderhorst. -Tue Oct 7 16:27:34 1997 Manfred Hollstein <manfred@s-direktnet.de> + * doc/texinfo.texi (Invoking install-info): Document that the dir + file is created now if need be. + * Makefile.am (EXTRA_DIST): No longer need dir. + * util/install-info.c (ensure_dirfile_exists): New routine. + (main): Call it before trying to open dirfile for reading. - * aclocal.m4: Substitute INSTALL. - * configure: Re-built. + * doc/texinfo.texi: Document install-info --delete a little better. + * util/install-info.c: Set something_deleted when we delete a + normal line. + Bug from: Denis Kosygin <dkosygin@math.Princeton.EDU>. -Tue Oct 7 10:25:22 1997 Manfred Hollstein (manfred@lts.sel.alcatel.de) + * util/install-info.c: If no info dir entry, give warning and exit 0. - * info/man.c (SIGCHLD): Define to SIGCLD if <sys/signal.h> - fails to provide it. +Wed Jul 2 06:35:17 1997 Karl Berry <karl@cs.umb.edu> -Wed Sep 17 23:56:11 1997 Jeffrey A Law (law@cygnus.com) + * configure.in (ALL_LINGUAS): Add fr. - * util/install-info.c: Only provide an external decl for strrchr - if HAVE_STRCHR is not defined. + * makeinfo/makeinfo.h (insertion_type, insertion_type_names): Add + ifnot... entries. Alphabetize. -Mon Sep 15 22:53:01 1997 Jeffrey A Law (law@cygnus.com) +Tue Jul 1 17:21:54 1997 Karl Berry <karl@cs.umb.edu> - * aclocal.m4: Add replacement for AC_PROG_INSTALL. - * configure.in: Use EGCS_PROG_INSTALL. + * makeinfo/makeinfo.c (sort_index): Set defining_line and + input_filename so errors in index entries are reported at + the correct location. From rms. -Tue Sep 9 23:16:35 1997 H.J. Lu (hjl@gnu.ai.mit.edu) + * makeinfo/makeinfo.c (cm_ifnothtml, etc.): Routines for new + commands. - * Makefile (all): Remove sub-all. - (stmp-sub-all): New target. Renamed from sub-all. - (info, texinfo): Also depend on stmp-sub-all. - (clean): Also remove stmp*. - (maintainer-clean): New target. Same as realclean. +Sun Jun 29 09:44:01 1997 Karl Berry <karl@cs.umb.edu> -Fri Sep 5 09:07:33 1997 Jeffrey A Law (law@cygnus.com) + * doc/texinfo.texi: Document new @ifnot... commands, etc. + * doc/texinfo.texi: Document @image, etc. - * install-sh: Delete duplicate install script. +Thu Jun 26 17:57:37 1997 Karl Berry <karl@cs.umb.edu> -Tue Sep 2 22:25:34 1997 Jeffrey A Law (law@cygnus.com) + * makeinfo/makeinfo.c (cm_image): New routine for new command @image. + (cm_end): Move to better place, doesn't need its own page. + Doc fixes. - * Makefile.in (install, install-info, installdirs, uninstall): Make - these phony targets. +Mon Jun 23 16:54:03 1997 Karl Berry <karl@cs.umb.edu> -Tue Sep 2 10:19:48 1997 Richard Henderson <rth@cygnus.com> + * Makefile.am (SUBDIRS): Do intl first. - * makeinfo/makeinfo.c: Maybe include <stdlib.h> for malloc et al. - * util/install-info.c: Include <string*.h>. - (my_strerror): Use strerror if available. + * doc/Makefile.am (EXTRA_DIST): Include epsf.tex. + (install-data-local): Suggest possible installation directory. + * epsf.tex: New file. -Tue Aug 26 11:18:52 1997 Jeffrey A Law (law@cygnus.com) +Wed Jun 18 17:51:52 1997 Karl Berry <karl@cs.umb.edu> - * libtxi/Makefile.in: Add dependencies for memcpy, memmove and strdup. + * doc/texinfo.texi: Document texinfo.cnf. -Mon Jul 28 17:26:48 1997 Rob Savoye <rob@chinadoll.cygnus.com> +Sun Jun 15 14:37:58 1997 Karl Berry <karl@cs.umb.edu> - * aclocal.m4: Add CYGWIN and EXEEXT autoconf macros. - * configure.in: Use CYGWIN and EXEEXT autoconf macro to look for - win32 dependencies. - * configure: Regenerated with autoconf 2.12. - * Makefile.in: Add $(EXEEXT) to all executables. - * makeinfo/Makefile.in: Add $(EXEEXT) to all executables. - * util/Makefile.in: Add $(EXEEXT) to all executables. + * doc/texinfo.texi (Command List): Various commands missing or + erroneous. + From: Karl_Heinz_Marbaise@p69.ks.fido.de. -Mon May 26 12:44:43 1997 Ian Lance Taylor <ian@cygnus.com> + * makeinfo/makeinfo.c: Oops, failed to break out of loop. - * texinfo.tex: Update to newest FSF version (2.201). + * util/texindex.c: Use <getopt.h> not "getopt.h". + + * All source files: Merge gettext changes from Karl E.; + his ChangeLog entries below. + +Sat Jun 14 17:04:28 1997 Karl Berry <karl@cs.umb.edu> + + * Makefile.am, + * makeinfo/Makefile.am: Doc fix. + * util/Makefile.am (EXTRA_DIST): Add texi2dvi. From Karl E. + +Fri Jun 13 17:39:34 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c [WIN32]: Handle read bogosity and c:\ + absolute paths. + From: Eric Hanchrow <erich@MICROSOFT.com>. + + * configure.in (AC_CHECK_HEADERS): Check for pwd.h. + * info/tilde.c (pwd.h): Move #include to system.h. + + * makeinfo/makeinfo.c (main): New option -P to prepend to search path. + From: Kenneth Stailey <kstailey@cvs.openbsd.org>. + + * doc/texinfo.texi (Invoking makeinfo), + * doc/makeinfo.texi: Mention -P. + +Thu Jun 12 16:25:40 1997 Karl Berry <karl@cs.umb.edu> + + * info/signals.h (SIGCHLD): #define as SIGCLD if undefined, for sysV68. + From: "Philippe De Muyter" <phdm%labauto1@ulb.ac.be>. + + * util/install-info.c (O_RDONLY): Remove this stuff, it's in system.h. + (main): Handle existing entry in dir file having .info extension. + From: "Bradley C. Kuszmaul" <bradley@GRANITE.SYSTEMSX.CS.YALE.EDU>. + + * makeinfo/makeinfo.c (get_char_len): Don't count 8-bit characters + as two chars in the output. + From: Sung-Hyun Nam <namsh@amuna.rms.lgic.co.kr>. + +Wed Jun 11 16:36:51 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi (Other Info Directories): Document new trailing + : in INFOPATH feature. + + * info/info.c (main): Have trailing : in INFOPATH expand to the + default path. + +Fri Jun 6 13:22:02 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi (uref): New node for new command. + +Thu Jun 5 18:13:48 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (cm_uref): New function to accept optional + second argument. Call it in command table. + +Sat Jun 14 10:54:16 1997 Karl Eichwalder <ke@suse.de> + + * mkinstalldirs: Update from automake-1.1p. + + * configure.in: Touch po/ChangeLog (gettext needs it). + +Thu Jun 12 08:37:52 1997 Karl Eichwalder <ke@ke.Central.DE> + + * util/texindex.c: Include system.h, remove config.h. + + * po/POTFILES.in: Fill it. + + * makeinfo/multi.c: Include system.h. + + * info/Makefile.am: + * makeinfo/Makefile.am: + * util/Makefile.am: + (localedir): Set. + (INCLUDES): Add intl/ and LOCALEDIR. + (LDADD): Add @INTLLIBS@. + + * makeinfo/makeinfo.c (main): + * util/texindex.c (main): + * util/install-info.c (main): + setlocale, bindtextdomain, and textdomain. + + * lib/system.h: Include locale.h and libintl.h. + + * acconfig.h: Include libintl.h. + (_, N_): Define. + Add ENABLE_NLS, HAVE_CATGETS, HAVE_GETTEXT, HAVE_LC_MESSAGES, + HAVE_STPCPY for libintl. + Add @TOP@ and @BOTTOM@. + + * configure.in (AM_GNU_GETTEXT): Add. + (AC_OUTPUT): Process Makefiles in intl/ and po/. + (ALL_LINGUAS): Available languages. + + * Makefile.am (AUTOMAKE_OPTIONS): Now use 1.1p. + +Wed Jun 11 17:05:37 1997 Karl Eichwalder <ke@ke.Central.DE> + + * Makefile.am (SUBDIRS): Add intl/ and po/ for NLS. + + * run `gettextize -c' to get the i18n skeleton. + +Wed Jun 4 17:51:08 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (uref): New command, another alias for @code + for now. + +Wed Jun 4 02:02:33 1997 Miles Bader <miles@gnu.ai.mit.edu> + + * doc/texinfo.texi (email): { and } need @ escapes. + +Sun Jun 1 16:34:12 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi (itemx): @itemx should always follow @item. + + * makeinfo/makeinfo.c (cm_item): Insert blank line if two + consecutive @item's. + From: Karl Eichwalder <ke@ke.central.de>. + Also various doc fixes. + +Tue May 27 17:20:44 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi (various): Document @deftypemethod. + (email): @ should have been @@ in the example. + From: Mate Wierdl <mw@wierdlmpc.msci.memphis.edu> + +Mon May 26 16:56:26 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/multi.c (setup_multitable_parameters): Avoid use of %n + for sake of m68k-hp-bsd. + From: Derek L Davies <ddavies@world.std.com>. + + * info/terminal.c (terminal_begin_using_terminal, + terminal_end_using_terminal): Call fflush and sleep to handle + cmdtool/shelltool with scrollbars. Also ignore + SIGWINCH so we do not prematurely exit. Move call. + (terminal_prep_terminal): Disable LNEXT (CTRL-V). + From: strube@physik3.gwdg.de (Hans Werner Strube). + + * configure.in (AC_TYPE_SIGNAL): Check this. + +Sun May 25 16:49:58 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (discard_insertions): Take arg saying + whether ifinfo/ifset/etc. are ok. + (convert_from_loaded_file): At `finished', call discard_insertions. + (handle_variable_internal): Complain if we reach eof before the + @end for a false condition. + From: HERBERT@boevm4.vnet.ibm.com. + + * info/Makefile.am (ginfo_SOURCES): Add doc.h. + * lib/Makefile.am (libtxi_a_SOURCES): Add system.h. + +Sat May 24 18:08:27 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c: Check that we have macro_expansion_filename + before using strcmp. + +Thu May 22 17:59:46 1997 Karl Berry <karl@cs.umb.edu> + + * doc/makeinfo.texi: Minimally document --force. + + * makeinfo/makeinfo.c (--force): New option. + (-E): Allow stdout via `-'. + (convert_from_loaded_file): Unlink output files if errors and !force. + +Tue May 20 17:48:42 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c: Change all strdup calls to xstrdup. + (xmalloc, xrealloc, memory_error): Remove these functions, they're + in lib. + (set_paragraph_indent, cm_paragraph_indent): Move to misc page. + (cm_footnote): Expand macros in the arg for the macro expansion output. + +Fri May 16 17:26:59 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (cm_macro): Allocate an empty body if the + macro was empty. + (cm_unmacro): Allocate one more byte for the null. + From: Robert Hoehne <robert.hoehne@Mathematik.TU-Chemnitz.DE>. + +Sun May 11 17:51:21 1997 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> + + * makeinfo/makeinfo.c (cm_printindex): Fix calculation of the + length of an index line. + +Sun May 11 14:47:42 1997 Tom Tromey <tromey@cygnus.com> + + * makeinfo/makeinfo.c (main): Don't unconditionally run usage when + -e specified. + +Sun May 11 17:47:42 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (init_indices): Free the source for an @synindex. + (undefindex): Do not go further if the target was already freed. + (free_index): Do not free the node names, as init_tags already did. + (cm_synindex, index_add_arg): Improve error message. + (program_index, function_index, etc.): Remove these unused #defines. + +Tue May 6 17:53:37 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (init_internals): Do not free current_node, + it already is, at least when multiple input files are specified. + From: Karl Eichwalder <ke@ke.central.de>. + +Mon May 5 16:14:39 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Mention both alignment and non-alignment of + continuation description lines in menus (Arnold). + +Sun Apr 27 16:12:44 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (apply): Handle body being `\string'. + Also, avoid dereferencing a null pointer when a macro has no named + parameters. + From: Eli Zaretskii <eliz@is.elta.co.il>. + + * makeinfo/makeinfo.c: Wording changes/fixes in warnings. + + * info/session.c (info_get_input_char): Do not mix stdio with raw I/O. + From: Egil Kvaleberg <egilk@sn.no>. + + From Tom Hageman <tom@basil.icce.rug.nl>. These changes make + arrow keys work: + * info/infomap.c: Add arrow key bindings. + (keymap_bind_keyseq): New support function. + (initialize_info_keymaps): Use it. + (term_ku,term_kd,term_kl,term_kr): Remove explicit declarations; + use #include "terminal.h" instead. + * info/session.c (initialize_info_session): Unbuffer stdin. + (info_get_another_input_char): Fix bug in `ready' logic. + * info/terminal.h, + * info/terminal.c (term_kP, term_kN): New variables to hold + PageUp, PageDown key sequences. + (terminal_initialize_terminal): Set them. + + * util/texindex.c (main), + * util/install-info.c (main), + * makeinfo/makeinfo.c (print_version_info), + * info/info.c (main): Use PACKAGE and VERSION from Automake for + printing version number. + +Sat Apr 26 19:19:46 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (get_until_in_line): Do not expand if + executing_string. + Also, free temporary strings. + Also, untabify entire file. + + * doc/texinfo.texi: Many corrections from Arnold. + +Thu Apr 24 16:31:09 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/multi.c (draw_horizontal_separator): Account for indent + here also. From Ulrich. + +Wed Apr 23 15:15:34 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (cm_today): Use time_t instead of long; + everyone else does. + (LOCALTIME_CAST): Remove kludge, we'll always use time_t now. + + * info/Makefile.am (ginfo_SOURCES): Remove general.h, that got + merged into system.h. + +Mon Apr 21 17:13:25 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/multi.c (output_multitable_row): Account for + column_indent, both the global one and for each column. + (setup_multitable_parameters): Account for column_indent in the table + width in the columnfrac case, but don't bother with the template + case for now. + +Sun Apr 20 16:32:00 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (output_stream): Remove redundant + definition; it's in makeinfo.h, + and a vaxstation-ultrix4.3 fails to link because of the two defns. + From: Anders Olofsson <anders@kid025.ericsson.se>. + + * makeinfo/makeinfo.c (expansion): Inhibit appending to the macro + expansion stream. + (get_until_in_line): Possibly expand the text. + Change caller in get_node_token to do the expansion, + all other calls to remain the same. + + * makeinfo/makeinfo.c (cm_node): No need to call strlen to check + for the empty string. + + * doc/texinfo.texi: Restore missing @c for initial comment. + +Fri Apr 18 17:41:36 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Mention that .info is unnecessary in the info + file name argument of an xref. + + * doc/texinfo.texi: Mention texi2dvi -t instead of embedding + @smallbook or @afourpaper in the document source. + +Sun Apr 13 15:19:08 1997 Karl Berry <karl@cs.umb.edu> + + * lib/system.h (_GNU_SOURCE): #define. + +Mon Apr 7 16:30:11 1997 Karl Berry <karl@cs.umb.edu> + + * doc/info.texi, + * doc/info-stnd.texi, + * doc/texinfo.texi: Do not make (dir) the previous ptr from the top node, + and tell people not to do that in the manual. + From: rmedina@kanojo.ivic.ve (Rodrigo Medina), + confirmed by rms. + +Fri Apr 4 16:30:33 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c: Move error page to top to avoid + prototypes, and do add prototypes for add_word_args and execute_string, + so we can use <stdarg.h>. + + * info/makedoc.c, + * info/nodemenu.c: Use %ld instead of %d for file offsets. + * makeinfo/makeinfo.c (delete_macro): Decrement macro_list_len. + (get_macro_args): Decrement line number if see \n. + * utils/texindex.c (indexify): Use fputs instead of fprintf + for constant string. + From: Eli Zaretskii <eliz@is.elta.co.il>. + +Thu Apr 3 17:40:52 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in (AC_CHECK_HEADERS): No need to check for vararg.h + here, AC_FUNC_VPRINTF does it. + (AC_CHECK_FUNCS): Likewise for vsprintf and vfprintf. + * makeinfo/makeinfo.c (add_word_args, execute_string): Rewrite + like the error functions. + +Wed Apr 2 17:46:28 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in: Add AC_FUNC_VPRINTF. + * makeinfo/makeinfo.c (error, line_error, warning): Rewrite a la + error.c from the *utils to use <stdarg.h> if available. + +Tue Apr 1 11:48:40 1997 Karl Berry <karl@cs.umb.edu> + + * doc/texinfo.texi: Tabs are a bad idea. + + * doc/userdoc.texi, + * doc/info.texi: Untabify. + +Sun Mar 30 17:36:47 1997 Karl Berry <karl@cs.umb.edu> + + * makeinfo/makeinfo.c (end_of_sentence_p): New function. + (add_char): Call it, instead of simply sentence_ender. + (post_sentence): New macro. + Also, remove some #include's now in system.h. + * lib/system.h [VMS]: #include <perror.h>, from makeinfo. + +Thu Mar 27 17:41:03 1997 Karl Berry <karl@cs.umb.edu> + + * info/search.c (skip_node_characters): Do not arbitrarily + strip trailing period from end of node name; this is valid. + +Mon Mar 24 16:44:42 1997 Karl Berry <karl@cs.umb.edu> + + * configure.in (AC_OUTPUT): Don't need to create stamp-h here, + tromey says AM_CONFIG_HEADER will do it. + + * info/Makefile.am, util/Makefile.am, makeinfo/Makefile.am (INCLUDES): + Don't need -I.. (for config.h) or -I$(srcdir), says tromey. + Automake includes those already. Fri Mar 14 15:05:17 1997 Karl Berry <karl@cs.umb.edu> + * info/Makefile.am: Build as ginfo, install as info, + to avoid conflict with the standard info target. + + * lib/system.h: New file. + * makeinfo/makeinfo.c (strerror): Remove declaration, + include system.h, remove other redundant #if stuff. + * info/general.h: Include system.h instead of doing common stuff. + * util/install-info.c (my_strerror): Remove this, use strerror, + include system.h. + * info/terminal.c (terminal_prep_terminal): Only use OCRNL and ONLCR if they are defined. Reported by many people. -Wed Feb 12 11:15:16 1997 Michael Meissner <meissner@cygnus.com> + * Installed: - * util/texindex.c (main): Make main an int function, not void. + Sun Dec 1 19:23:54 1996 Karl Eichwalder <ke@ke.Central.DE> -Sat Jun 29 18:56:07 1996 Geoffrey Noer <noer@cygnus.com> + * configure.in (TERMLIBS): Add ncurses. - * configure.in: if ac_cv_c_cross is yes, don't run the - AC_FUNC_SETVBUF_REVERSED call since it tries to do a run - test. This allows texinfo to build for cygwin32 Canadian - crosses/natives - * configure: regenerate +Thu Mar 13 13:59:45 1997 Karl Berry <karl@cs.umb.edu> + + * lib/Makefile.am (libtxi_a_SOURCES): Add xstrdup.c. + * info/*.c: Use xstrdup instead of strdup everywhere. + + * info/tilde.c: Do not include clib.h, move stdlib.h include to + * info/general.h: here. + + * configure.in (AC_CONFIG_HEADER): Use this, + to avoid hugely long compile line with all the -D's. + * info/general.h: Include <config.h>. + + * emacs/Makefile.am (install, install-data): Do @echo + to tell the user to compile/install the elisp manually. + + * configure.in (AC_REPLACE_FUNCS): Move strerror check to here. + (AC_CHECK_FUNCS): From here. + + * lib/strerror.c: New file, from enscript (et al.) distribution. + +Tue Mar 11 16:36:25 1997 Karl Berry <karl@cs.umb.edu> + + * info/Makefile.am (info_SOURCES): Add doc.c, dribble.c, infodoc.c. + (LDADD): Add @TERMLIBS@. + + * info/info.h: HANDLE_MAN_PAGES, NAMED_FUNCTIONS: Define these. + + * info/filesys.h: Spurious ! when DEFAULT_INFOPATH is not defined. + + * configure.in (AC_OUTPUT): Do lib first and doc last. + + * info/echo-area.c, + * info/echo-area.h, + * info/info.h: Rename echo_area to echo-area. + +Mon Mar 10 17:59:05 1997 Karl Berry <karl@cs.umb.edu> -Wed Jun 26 12:48:10 1996 Jason Molenda (crash@godzilla.cygnus.co.jp) - - * Makefile.in (bindir, libdir, mandir, infodir): Use autoconf-set - values. - * configure.in (AC_PREREQ): autoconf 2.5 or higher. - * configure: Rebuilt. - * emacs/Makefile.in (bindir, libdir, mandir, infodir): Use - autoconf-set values. - * info/Makefile.in (bindir, libdir, mandir, infodir): Use - autoconf-set values. - * libtxi/Makefile.in (bindir, libdir, mandir, infodir): Use - autoconf-set values. - * makeinfo/Makefile.in (bindir, libdir, mandir, infodir): - Use autoconf-set values. - * util/Makefile.in (bindir, libdir, mandir, infodir): Use - autoconf-set values. + * */Makefile.am: Write Makefile.am files for Automake. + * doc: New subdirectory, move all manuals and texinfo.tex there. + * AUTHORS, THANKS, config.guess, config.sub, mkinstalldirs: New files, + required by Automake. + * lib/xmalloc.c: Move from info/. Fri Oct 4 07:49:49 1996 Karl Berry <karl@cs.umb.edu> diff --git a/texinfo/aclocal.m4 b/texinfo/aclocal.m4 index 07594d88877..22a110009f8 100644 --- a/texinfo/aclocal.m4 +++ b/texinfo/aclocal.m4 @@ -1,17 +1,490 @@ dnl aclocal.m4 generated automatically by aclocal 1.2 -# Check to see if we're running under Cygwin32, without using -# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". -# Otherwise set it to "no". +# Macro to add for using GNU gettext. +# Ulrich Drepper <drepper@cygnus.com>, 1995. -dnl AM_CYGWIN32() -AC_DEFUN(AM_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, -[AC_TRY_COMPILE(,[int main () { return __CYGWIN32__; }], -am_cv_cygwin32=yes, am_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$am_cv_cygwin32" = yes && CYGWIN32=yes]) +# serial 2 + +AC_DEFUN(AM_WITH_NLS, + [AC_MSG_CHECKING([whether NLS is requested]) + dnl Default is enabled NLS + AC_ARG_ENABLE(nls, + [ --disable-nls do not use Native Language Support], + USE_NLS=$enableval, USE_NLS=yes) + AC_MSG_RESULT($USE_NLS) + AC_SUBST(USE_NLS) + + USE_INCLUDED_LIBINTL=no + + dnl If we use NLS figure out what method + if test "$USE_NLS" = "yes"; then + AC_DEFINE(ENABLE_NLS) + AC_MSG_CHECKING([whether included gettext is requested]) + AC_ARG_WITH(included-gettext, + [ --with-included-gettext use the GNU gettext library included here], + nls_cv_force_use_gnu_gettext=$withval, + nls_cv_force_use_gnu_gettext=no) + AC_MSG_RESULT($nls_cv_force_use_gnu_gettext) + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + dnl User does not insist on using GNU NLS library. Figure out what + dnl to use. If gettext or catgets are available (in this order) we + dnl use this. Else we have to fall back to GNU NLS library. + dnl catgets is only used if permitted by option --with-catgets. + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + AC_CHECK_HEADER(libintl.h, + [AC_CACHE_CHECK([for gettext in libc], gt_cv_func_gettext_libc, + [AC_TRY_LINK([#include <libintl.h>], [return (int) gettext ("")], + gt_cv_func_gettext_libc=yes, gt_cv_func_gettext_libc=no)]) + + if test "$gt_cv_func_gettext_libc" != "yes"; then + AC_CHECK_LIB(intl, bindtextdomain, + [AC_CACHE_CHECK([for gettext in libintl], + gt_cv_func_gettext_libintl, + [AC_TRY_LINK([], [return (int) gettext ("")], + gt_cv_func_gettext_libintl=yes, + gt_cv_func_gettext_libintl=no)])]) + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + AC_DEFINE(HAVE_GETTEXT) + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no)dnl + if test "$MSGFMT" != "no"; then + AC_CHECK_FUNCS(dcgettext) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_TRY_LINK(, [extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr], + [CATOBJEXT=.gmo + DATADIRNAME=share], + [CATOBJEXT=.mo + DATADIRNAME=lib]) + INSTOBJEXT=.mo + fi + fi + ]) + + if test "$CATOBJEXT" = "NONE"; then + AC_MSG_CHECKING([whether catgets can be used]) + AC_ARG_WITH(catgets, + [ --with-catgets use catgets functions if available], + nls_cv_use_catgets=$withval, nls_cv_use_catgets=no) + AC_MSG_RESULT($nls_cv_use_catgets) + + if test "$nls_cv_use_catgets" = "yes"; then + dnl No gettext in C library. Try catgets next. + AC_CHECK_LIB(i, main) + AC_CHECK_FUNC(catgets, + [AC_DEFINE(HAVE_CATGETS) + INTLOBJS="\$(CATOBJS)" + AC_PATH_PROG(GENCAT, gencat, no)dnl + if test "$GENCAT" != "no"; then + AC_PATH_PROG(GMSGFMT, gmsgfmt, no) + if test "$GMSGFMT" = "no"; then + AM_PATH_PROG_WITH_TEST(GMSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], no) + fi + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi]) + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + dnl Neither gettext nor catgets in included in the C library. + dnl Fall back on GNU gettext library. + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + dnl Mark actions used to generate GNU NLS library. + INTLOBJS="\$(GETTOBJS)" + AM_PATH_PROG_WITH_TEST(MSGFMT, msgfmt, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"], msgfmt) + AC_PATH_PROG(GMSGFMT, gmsgfmt, $MSGFMT) + AM_PATH_PROG_WITH_TEST(XGETTEXT, xgettext, + [test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"], :) + AC_SUBST(MSGFMT) + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + dnl Test whether we really found GNU xgettext. + if test "$XGETTEXT" != ":"; then + dnl If it is no GNU xgettext we define it as : so that the + dnl Makefiles still can work. + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + AC_MSG_RESULT( + [found xgettext programs is not GNU xgettext; ignore it]) + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + dnl These rules are solely for the distribution goal. While doing this + dnl we only have to keep exactly one list of the available catalogs + dnl in configure.in. + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + dnl Make all variables we use known to autoconf. + AC_SUBST(USE_INCLUDED_LIBINTL) + AC_SUBST(CATALOGS) + AC_SUBST(CATOBJEXT) + AC_SUBST(DATADIRNAME) + AC_SUBST(GMOFILES) + AC_SUBST(INSTOBJEXT) + AC_SUBST(INTLDEPS) + AC_SUBST(INTLLIBS) + AC_SUBST(INTLOBJS) + AC_SUBST(POFILES) + AC_SUBST(POSUB) + ]) + +AC_DEFUN(AM_GNU_GETTEXT, + [AC_REQUIRE([AC_PROG_MAKE_SET])dnl + AC_REQUIRE([AC_PROG_CC])dnl + AC_REQUIRE([AC_ISC_POSIX])dnl + AC_REQUIRE([AC_HEADER_STDC])dnl + AC_REQUIRE([AC_C_CONST])dnl + AC_REQUIRE([AC_C_INLINE])dnl + AC_REQUIRE([AC_TYPE_OFF_T])dnl + AC_REQUIRE([AC_TYPE_SIZE_T])dnl + AC_REQUIRE([AC_FUNC_ALLOCA])dnl + AC_REQUIRE([AC_FUNC_MMAP])dnl + + AC_CHECK_HEADERS([argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h]) + AC_CHECK_FUNCS([getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next]) + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + AC_CHECK_FUNCS(stpcpy) + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + AC_DEFINE(HAVE_STPCPY) + fi + + AM_LC_MESSAGES + AM_WITH_NLS + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + AC_MSG_CHECKING(for catalogs to be installed) + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + AC_MSG_RESULT($LINGUAS) + fi + + dnl Construct list of names of catalog files to be constructed. + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + dnl Determine which catalog format we have (if any is needed) + dnl For now we know about two different formats: + dnl Linux libc-5 and the normal X/Open format + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + AC_CHECK_HEADER(linux/version.h, msgformat=linux, msgformat=xopen) + + dnl Transform the SED scripts while copying because some dumb SEDs + dnl cannot handle comments. + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + dnl po2tbl.sed is always needed. + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + dnl In the intl/Makefile.in we have a special dependency which makes + dnl only sense for gettext. We comment this out for non-gettext + dnl packages. + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + AC_SUBST(GT_NO) + AC_SUBST(GT_YES) + + dnl If the AC_CONFIG_AUX_DIR macro for autoconf is used we possibly + dnl find the mkinstalldirs script in another subdir but ($top_srcdir). + dnl Try to locate is. + MKINSTALLDIRS= + if test $ac_aux_dir; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z $MKINSTALLDIRS; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + AC_SUBST(MKINSTALLDIRS) + + dnl *** For now the libtool support in intl/Makefile is not for real. + l= + AC_SUBST(l) + + dnl Generate list of files to be processed by xgettext which will + dnl be included in po/Makefile. + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + ]) + +# Search path for a program which passes the given test. +# Ulrich Drepper <drepper@cygnus.com>, 1996. + +# serial 1 + +dnl AM_PATH_PROG_WITH_TEST(VARIABLE, PROG-TO-CHECK-FOR, +dnl TEST-PERFORMED-ON-FOUND_PROGRAM [, VALUE-IF-NOT-FOUND [, PATH]]) +AC_DEFUN(AM_PATH_PROG_WITH_TEST, +[# Extract the first word of "$2", so it can be a program name with args. +set dummy $2; ac_word=[$]2 +AC_MSG_CHECKING([for $ac_word]) +AC_CACHE_VAL(ac_cv_path_$1, +[case "[$]$1" in + /*) + ac_cv_path_$1="[$]$1" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in ifelse([$5], , $PATH, [$5]); do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if [$3]; then + ac_cv_path_$1="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" +dnl If no 4th arg is given, leave the cache variable unset, +dnl so AC_PATH_PROGS will keep looking. +ifelse([$4], , , [ test -z "[$]ac_cv_path_$1" && ac_cv_path_$1="$4" +])dnl + ;; +esac])dnl +$1="$ac_cv_path_$1" +if test -n "[$]$1"; then + AC_MSG_RESULT([$]$1) +else + AC_MSG_RESULT(no) +fi +AC_SUBST($1)dnl +]) + +# Check whether LC_MESSAGES is available in <locale.h>. +# Ulrich Drepper <drepper@cygnus.com>, 1995. + +# serial 1 + +AC_DEFUN(AM_LC_MESSAGES, + [if test $ac_cv_header_locale_h = yes; then + AC_CACHE_CHECK([for LC_MESSAGES], am_cv_val_LC_MESSAGES, + [AC_TRY_LINK([#include <locale.h>], [return LC_MESSAGES], + am_cv_val_LC_MESSAGES=yes, am_cv_val_LC_MESSAGES=no)]) + if test $am_cv_val_LC_MESSAGES = yes; then + AC_DEFINE(HAVE_LC_MESSAGES) + fi + fi]) + + +# Like AC_CONFIG_HEADER, but automatically create stamp file. + +AC_DEFUN(AM_CONFIG_HEADER, +[AC_PREREQ([2.12]) +AC_CONFIG_HEADER([$1]) +dnl When config.status generates a header, we must update the stamp-h file. +dnl This file resides in the same directory as the config header +dnl that is generated. We must strip everything past the first ":", +dnl and everything past the last "/". +AC_OUTPUT_COMMANDS(changequote(<<,>>)dnl +ifelse(patsubst(<<$1>>, <<[^ ]>>, <<>>), <<>>, +<<test -z "<<$>>CONFIG_HEADERS" || echo timestamp > patsubst(<<$1>>, <<^\([^:]*/\)?.*>>, <<\1>>)stamp-h<<>>dnl>>, +<<am_indx=1 +for am_file in <<$1>>; do + case " <<$>>CONFIG_HEADERS " in + *" <<$>>am_file "*<<)>> + echo timestamp > `echo <<$>>am_file | sed -e 's%:.*%%' -e 's%[^/]*$%%'`stamp-h$am_indx + ;; + esac + am_indx=`expr "<<$>>am_indx" + 1` +done<<>>dnl>>) +changequote([,]))]) + +# Do all the work for Automake. This macro actually does too much -- +# some checks are only needed if your package does certain things. +# But this isn't really a big deal. + +# serial 1 + +dnl Usage: +dnl AM_INIT_AUTOMAKE(package,version, [no-define]) + +AC_DEFUN(AM_INIT_AUTOMAKE, +[AC_REQUIRE([AM_PROG_INSTALL]) +PACKAGE=[$1] +AC_SUBST(PACKAGE) +VERSION=[$2] +AC_SUBST(VERSION) +dnl test to see if srcdir already configured +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) +fi +ifelse([$3],, +AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE") +AC_DEFINE_UNQUOTED(VERSION, "$VERSION")) +AM_SANITY_CHECK +AC_ARG_PROGRAM +dnl FIXME This is truly gross. +missing_dir=`cd $ac_aux_dir && pwd` +AM_MISSING_PROG(ACLOCAL, aclocal, $missing_dir) +AM_MISSING_PROG(AUTOCONF, autoconf, $missing_dir) +AM_MISSING_PROG(AUTOMAKE, automake, $missing_dir) +AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir) +AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir) +AC_PROG_MAKE_SET]) + + +# serial 1 + +AC_DEFUN(AM_PROG_INSTALL, +[AC_REQUIRE([AC_PROG_INSTALL]) +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' +AC_SUBST(INSTALL_SCRIPT)dnl +]) + +# +# Check to make sure that the build environment is sane. +# + +AC_DEFUN(AM_SANITY_CHECK, +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "$@" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + test "[$]2" = conftestfile + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +rm -f conftest* +AC_MSG_RESULT(yes)]) + +dnl AM_MISSING_PROG(NAME, PROGRAM, DIRECTORY) +dnl The program must properly implement --version. +AC_DEFUN(AM_MISSING_PROG, +[AC_MSG_CHECKING(for working $2) +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if ($2 --version) < /dev/null > /dev/null 2>&1; then + $1=$2 + AC_MSG_RESULT(found) +else + $1="$3/missing $2" + AC_MSG_RESULT(missing) +fi +AC_SUBST($1)]) + +# Add --enable-maintainer-mode option to configure. +# From Jim Meyering + +# serial 1 + +AC_DEFUN(AM_MAINTAINER_MODE, +[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles]) + dnl maintainer-mode is disabled by default + AC_ARG_ENABLE(maintainer-mode, +[ --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + USE_MAINTAINER_MODE=$enableval, + USE_MAINTAINER_MODE=no) + AC_MSG_RESULT($USE_MAINTAINER_MODE) + if test $USE_MAINTAINER_MODE = yes; then + MAINT= + else + MAINT='#M#' + fi + AC_SUBST(MAINT)dnl +] +) # Check to see if we're running under Win32, without using # AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe". @@ -22,9 +495,9 @@ dnl This knows we add .exe if we're building in the Cygwin32 dnl environment. But if we're not, then it compiles a test program dnl to see if there is a suffix for executables. AC_DEFUN(AM_EXEEXT, -dnl AC_REQUIRE([AC_PROG_CC])AC_REQUIRE([AM_CYGWIN32]) +[AC_REQUIRE([AM_CYGWIN32]) AC_MSG_CHECKING([for executable suffix]) -[AC_CACHE_VAL(am_cv_exeext, +AC_CACHE_VAL(am_cv_exeext, [if test "$CYGWIN32" = yes; then am_cv_exeext=.exe else @@ -34,7 +507,7 @@ int main() { } EOF ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 -am_cv_exeext=`ls am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` +am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` rm -f am_c_test*]) test x"${am_cv_exeext}" = x && am_cv_exeext=no fi @@ -106,3 +579,17 @@ AC_SUBST(INSTALL_PROGRAM)dnl test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' AC_SUBST(INSTALL_DATA)dnl ]) + +# Check to see if we're running under Cygwin32, without using +# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes". +# Otherwise set it to "no". + +dnl AM_CYGWIN32() +AC_DEFUN(AM_CYGWIN32, +[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32, +[AC_TRY_COMPILE(,[int main () { return __CYGWIN32__; }], +am_cv_cygwin32=yes, am_cv_cygwin32=no) +rm -f conftest*]) +CYGWIN32= +test "$am_cv_cygwin32" = yes && CYGWIN32=yes]) + diff --git a/texinfo/configure b/texinfo/configure index be9efa036cf..1a02a2bd977 100755 --- a/texinfo/configure +++ b/texinfo/configure @@ -11,6 +11,15 @@ ac_help= ac_default_prefix=/usr/local # Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --disable-nls do not use Native Language Support" +ac_help="$ac_help + --with-included-gettext use the GNU gettext library included here" +ac_help="$ac_help + --with-catgets use catgets functions if available" # Initialize some variables set by options. # The variables have the same names as the options, with @@ -451,7 +460,7 @@ echo > confdefs.h # A filename unique to this package, relative to the directory that # configure is in, which we can look for to find out if srcdir is correct. -ac_unique_file=texinfo.texi +ac_unique_file=makeinfo/makeinfo.c # Find the source files, if location was not specified. if test -z "$srcdir"; then @@ -520,6 +529,9 @@ fi + + + ac_aux_dir= for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do if test -f $ac_dir/install-sh; then @@ -550,7 +562,7 @@ ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:554: checking for a BSD compatible install" >&5 +echo "configure:566: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -562,7 +574,7 @@ else /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. - for ac_prog in ginstall scoinst install; do + for ac_prog in ginstall installbsd scoinst install; do if test -f $ac_dir/$ac_prog; then if test $ac_prog = install && grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then @@ -599,40 +611,169 @@ test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -# Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:606: checking for $ac_word" >&5 -if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}' + + +PACKAGE=texinfo + +VERSION=3.11 + +if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then + { echo "configure: error: source directory already configured; run "make distclean" there first" 1>&2; exit 1; } +fi +cat >> confdefs.h <<EOF +#define PACKAGE "$PACKAGE" +EOF + +cat >> confdefs.h <<EOF +#define VERSION "$VERSION" +EOF + +echo $ac_n "checking whether build environment is sane""... $ac_c" 1>&6 +echo "configure:635: checking whether build environment is sane" >&5 +# Just in case +sleep 1 +echo timestamp > conftestfile +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt $srcdir/configure conftestfile 2> /dev/null` + if test "" = "X"; then + # -L didn't work. + set X `ls -t $srcdir/configure conftestfile` + fi + test "$2" = conftestfile + ) +then + # Ok. + : +else + { echo "configure: error: newly created file is older than distributed files! +Check your system clock" 1>&2; exit 1; } +fi +rm -f conftest* +echo "$ac_t""yes" 1>&6 +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + +missing_dir=`cd $ac_aux_dir && pwd` +echo $ac_n "checking for working aclocal""... $ac_c" 1>&6 +echo "configure:682: checking for working aclocal" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (aclocal --version) < /dev/null > /dev/null 2>&1; then + ACLOCAL=aclocal + echo "$ac_t""found" 1>&6 +else + ACLOCAL="$missing_dir/missing aclocal" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoconf""... $ac_c" 1>&6 +echo "configure:695: checking for working autoconf" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoconf --version) < /dev/null > /dev/null 2>&1; then + AUTOCONF=autoconf + echo "$ac_t""found" 1>&6 +else + AUTOCONF="$missing_dir/missing autoconf" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working automake""... $ac_c" 1>&6 +echo "configure:708: checking for working automake" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (automake --version) < /dev/null > /dev/null 2>&1; then + AUTOMAKE=automake + echo "$ac_t""found" 1>&6 +else + AUTOMAKE="$missing_dir/missing automake" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working autoheader""... $ac_c" 1>&6 +echo "configure:721: checking for working autoheader" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (autoheader --version) < /dev/null > /dev/null 2>&1; then + AUTOHEADER=autoheader + echo "$ac_t""found" 1>&6 +else + AUTOHEADER="$missing_dir/missing autoheader" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking for working makeinfo""... $ac_c" 1>&6 +echo "configure:734: checking for working makeinfo" >&5 +# Run test in a subshell; some versions of sh will print an error if +# an executable is not found, even if stderr is redirected. +# Redirect stdin to placate older versions of autoconf. Sigh. +if (makeinfo --version) < /dev/null > /dev/null 2>&1; then + MAKEINFO=makeinfo + echo "$ac_t""found" 1>&6 +else + MAKEINFO="$missing_dir/missing makeinfo" + echo "$ac_t""missing" 1>&6 +fi + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:747: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then - ac_cv_prog_RANLIB="ranlib" - break - fi - done - IFS="$ac_save_ifs" - test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" + eval ac_cv_prog_make_${ac_make}_set=no fi +rm -f conftestmake fi -RANLIB="$ac_cv_prog_RANLIB" -if test -n "$RANLIB"; then - echo "$ac_t""$RANLIB" 1>&6 +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= else echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:636: checking for $ac_word" >&5 +echo "configure:777: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -661,7 +802,7 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:665: checking for $ac_word" >&5 +echo "configure:806: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -709,7 +850,7 @@ fi fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:713: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:854: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -719,11 +860,11 @@ ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS cross_compiling=$ac_cv_prog_cc_cross cat > conftest.$ac_ext <<EOF -#line 723 "configure" +#line 864 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:727: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:868: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -743,12 +884,12 @@ if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:747: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:888: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:752: checking whether we are using GNU C" >&5 +echo "configure:893: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -757,7 +898,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:761: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -772,7 +913,7 @@ if test $ac_cv_prog_gcc = yes; then ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:776: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:917: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -799,29 +940,8 @@ else test "${CFLAGS+set}" = set || CFLAGS="-g" fi -echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 -echo "configure:804: checking for POSIXized ISC" >&5 -if test -d /etc/conf/kconfig.d && - grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 -then - echo "$ac_t""yes" 1>&6 - ISC=yes # If later tests want to check for ISC. - cat >> confdefs.h <<\EOF -#define _POSIX_SOURCE 1 -EOF - - if test "$GCC" = yes; then - CC="$CC -posix" - else - CC="$CC -Xp" - fi -else - echo "$ac_t""no" 1>&6 - ISC= -fi - echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:825: checking how to run the C preprocessor" >&5 +echo "configure:945: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -836,13 +956,13 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 840 "configure" +#line 960 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:846: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:966: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -853,13 +973,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 857 "configure" +#line 977 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:863: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:983: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then : @@ -881,19 +1001,211 @@ else fi echo "$ac_t""$CPP" 1>&6 +if test $ac_cv_prog_gcc = yes; then + echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 +echo "configure:1007: checking whether ${CC-cc} needs -traditional" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_pattern="Autoconf.*'x'" + cat > conftest.$ac_ext <<EOF +#line 1013 "configure" +#include "confdefs.h" +#include <sgtty.h> +Autoconf TIOCGETP +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +else + rm -rf conftest* + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat > conftest.$ac_ext <<EOF +#line 1031 "configure" +#include "confdefs.h" +#include <termio.h> +Autoconf TCGETA +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "$ac_pattern" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi + +echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6 + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:1063: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + for ac_prog in ginstall scoinst install; do + if test -f $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + # OSF/1 installbsd also uses dspmsg, but is usable. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +# Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1115: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_RANLIB="ranlib" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":" +fi +fi +RANLIB="$ac_cv_prog_RANLIB" +if test -n "$RANLIB"; then + echo "$ac_t""$RANLIB" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + +# We do this for the sake of a more helpful warning in doc/Makefile. +TEXMF='$(datadir)/texmf' +# Extract the first word of "texconfig", so it can be a program name with args. +set dummy texconfig; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:1147: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_TEXCONFIG'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$TEXCONFIG"; then + ac_cv_prog_TEXCONFIG="$TEXCONFIG" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_TEXCONFIG="true" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_prog_TEXCONFIG" && ac_cv_prog_TEXCONFIG="false" +fi +fi +TEXCONFIG="$ac_cv_prog_TEXCONFIG" +if test -n "$TEXCONFIG"; then + echo "$ac_t""$TEXCONFIG" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +$TEXCONFIG && eval `texconfig confall | grep '^TEXMF='` + + +echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6 +echo "configure:1177: checking for POSIXized ISC" >&5 +if test -d /etc/conf/kconfig.d && + grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 +then + echo "$ac_t""yes" 1>&6 + ISC=yes # If later tests want to check for ISC. + cat >> confdefs.h <<\EOF +#define _POSIX_SOURCE 1 +EOF + + if test "$GCC" = yes; then + CC="$CC -posix" + else + CC="$CC -Xp" + fi +else + echo "$ac_t""no" 1>&6 + ISC= +fi + ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:887: checking for minix/config.h" >&5 +echo "configure:1199: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 892 "configure" +#line 1204 "configure" #include "confdefs.h" #include <minix/config.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:897: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1209: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -931,20 +1243,38 @@ EOF fi +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:1248: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test $USE_MAINTAINER_MODE = yes; then + MAINT= + else + MAINT='#M#' + fi + + echo $ac_n "checking for Cygwin32 environment""... $ac_c" 1>&6 -echo "configure:936: checking for Cygwin32 environment" >&5 +echo "configure:1266: checking for Cygwin32 environment" >&5 if eval "test \"`echo '$''{'am_cv_cygwin32'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 941 "configure" +#line 1271 "configure" #include "confdefs.h" int main() { int main () { return __CYGWIN32__; } ; return 0; } EOF -if { (eval echo configure:948: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1278: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* am_cv_cygwin32=yes else @@ -960,8 +1290,9 @@ fi echo "$ac_t""$am_cv_cygwin32" 1>&6 CYGWIN32= test "$am_cv_cygwin32" = yes && CYGWIN32=yes + echo $ac_n "checking for executable suffix""... $ac_c" 1>&6 -echo "configure:965: checking for executable suffix" >&5 +echo "configure:1296: checking for executable suffix" >&5 if eval "test \"`echo '$''{'am_cv_exeext'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -974,7 +1305,7 @@ int main() { } EOF ${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5 -am_cv_exeext=`ls am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` +am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//` rm -f am_c_test* fi @@ -987,7 +1318,7 @@ echo "$ac_t""${am_cv_exeext}" 1>&6 # Needed on sysV68 for sigblock, sigsetmask. echo $ac_n "checking for sigblock in -lbsd""... $ac_c" 1>&6 -echo "configure:991: checking for sigblock in -lbsd" >&5 +echo "configure:1322: checking for sigblock in -lbsd" >&5 ac_lib_var=`echo bsd'_'sigblock | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -995,7 +1326,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <<EOF -#line 999 "configure" +#line 1330 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1006,7 +1337,7 @@ int main() { sigblock() ; return 0; } EOF -if { (eval echo configure:1010: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1341: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1034,10 +1365,12 @@ else fi +# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but +# rather ncurses. So we check for it. TERMLIBS= -for termlib in curses ncurses termcap terminfo termlib ; do +for termlib in ncurses curses termcap terminfo termlib ; do echo $ac_n "checking for tputs in -l${termlib}""... $ac_c" 1>&6 -echo "configure:1041: checking for tputs in -l${termlib}" >&5 +echo "configure:1374: checking for tputs in -l${termlib}" >&5 ac_lib_var=`echo ${termlib}'_'tputs | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1045,7 +1378,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l${termlib} $LIBS" cat > conftest.$ac_ext <<EOF -#line 1049 "configure" +#line 1382 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1056,7 +1389,7 @@ int main() { tputs() ; return 0; } EOF -if { (eval echo configure:1060: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1080,12 +1413,12 @@ done echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1084: checking for ANSI C header files" >&5 +echo "configure:1417: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1089 "configure" +#line 1422 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -1093,7 +1426,7 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1097: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1430: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1110,7 +1443,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1114 "configure" +#line 1447 "configure" #include "confdefs.h" #include <string.h> EOF @@ -1128,7 +1461,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 1132 "configure" +#line 1465 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -1149,7 +1482,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 1153 "configure" +#line 1486 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1160,7 +1493,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:1164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1497: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then : else @@ -1183,22 +1516,23 @@ EOF fi -for ac_hdr in unistd.h termios.h termio.h strings.h string.h varargs.h \ - sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h sys/file.h +for ac_hdr in fcntl.h pwd.h string.h strings.h termcap.h termio.h \ + termios.h unistd.h \ + sys/fcntl.h sys/file.h sys/ptem.h sys/time.h sys/ttold.h sys/wait.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1192: checking for $ac_hdr" >&5 +echo "configure:1526: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1197 "configure" +#line 1531 "configure" #include "confdefs.h" #include <$ac_hdr> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1202: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1536: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out` if test -z "$ac_err"; then rm -rf conftest* @@ -1225,13 +1559,49 @@ fi done +if test "x$termlib" = xncurses; then + ac_safe=`echo "ncurses/termcap.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for ncurses/termcap.h""... $ac_c" 1>&6 +echo "configure:1566: checking for ncurses/termcap.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1571 "configure" +#include "confdefs.h" +#include <ncurses/termcap.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:1576: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + : +else + echo "$ac_t""no" 1>&6 +fi + +fi + echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:1230: checking for off_t" >&5 +echo "configure:1600: checking for off_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1235 "configure" +#line 1605 "configure" #include "confdefs.h" #include <sys/types.h> #if STDC_HEADERS @@ -1258,13 +1628,54 @@ EOF fi +echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 +echo "configure:1633: checking return type of signal handlers" >&5 +if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 1638 "configure" +#include "confdefs.h" +#include <sys/types.h> +#include <signal.h> +#ifdef signal +#undef signal +#endif +#ifdef __cplusplus +extern "C" void (*signal (int, void (*)(int)))(int); +#else +void (*signal ()) (); +#endif + +int main() { +int i; +; return 0; } +EOF +if { (eval echo configure:1655: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_type_signal=void +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_type_signal=int +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_type_signal" 1>&6 +cat >> confdefs.h <<EOF +#define RETSIGTYPE $ac_cv_type_signal +EOF + + echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:1263: checking for working const" >&5 +echo "configure:1674: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1268 "configure" +#line 1679 "configure" #include "confdefs.h" int main() { @@ -1313,7 +1724,7 @@ ccp = (char const *const *) p; ; return 0; } EOF -if { (eval echo configure:1317: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -1334,12 +1745,12 @@ EOF fi echo $ac_n "checking whether struct tm is in sys/time.h or time.h""... $ac_c" 1>&6 -echo "configure:1338: checking whether struct tm is in sys/time.h or time.h" >&5 +echo "configure:1749: checking whether struct tm is in sys/time.h or time.h" >&5 if eval "test \"`echo '$''{'ac_cv_struct_tm'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1343 "configure" +#line 1754 "configure" #include "confdefs.h" #include <sys/types.h> #include <time.h> @@ -1347,7 +1758,7 @@ int main() { struct tm *tp; tp->tm_sec; ; return 0; } EOF -if { (eval echo configure:1351: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1762: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_struct_tm=time.h else @@ -1371,19 +1782,19 @@ fi # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6 -echo "configure:1375: checking for working alloca.h" >&5 +echo "configure:1786: checking for working alloca.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1380 "configure" +#line 1791 "configure" #include "confdefs.h" #include <alloca.h> int main() { char *p = alloca(2 * sizeof(int)); ; return 0; } EOF -if { (eval echo configure:1387: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_header_alloca_h=yes else @@ -1404,12 +1815,12 @@ EOF fi echo $ac_n "checking for alloca""... $ac_c" 1>&6 -echo "configure:1408: checking for alloca" >&5 +echo "configure:1819: checking for alloca" >&5 if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1413 "configure" +#line 1824 "configure" #include "confdefs.h" #ifdef __GNUC__ @@ -1432,7 +1843,7 @@ int main() { char *p = (char *) alloca(1); ; return 0; } EOF -if { (eval echo configure:1436: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* ac_cv_func_alloca_works=yes else @@ -1464,12 +1875,12 @@ EOF echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6 -echo "configure:1468: checking whether alloca needs Cray hooks" >&5 +echo "configure:1879: checking whether alloca needs Cray hooks" >&5 if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1473 "configure" +#line 1884 "configure" #include "confdefs.h" #if defined(CRAY) && ! defined(CRAY2) webecray @@ -1494,12 +1905,12 @@ echo "$ac_t""$ac_cv_os_cray" 1>&6 if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1498: checking for $ac_func" >&5 +echo "configure:1909: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1503 "configure" +#line 1914 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1522,7 +1933,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1526: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1549,7 +1960,7 @@ done fi echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6 -echo "configure:1553: checking stack direction for C alloca" >&5 +echo "configure:1964: checking stack direction for C alloca" >&5 if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1557,7 +1968,7 @@ else ac_cv_c_stack_direction=0 else cat > conftest.$ac_ext <<EOF -#line 1561 "configure" +#line 1972 "configure" #include "confdefs.h" find_stack_direction () { @@ -1576,7 +1987,7 @@ main () exit (find_stack_direction() < 0); } EOF -if { (eval echo configure:1580: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_c_stack_direction=1 else @@ -1597,9 +2008,114 @@ EOF fi +echo $ac_n "checking for vprintf""... $ac_c" 1>&6 +echo "configure:2013: checking for vprintf" >&5 +if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2018 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char vprintf(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char vprintf(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_vprintf) || defined (__stub___vprintf) +choke me +#else +vprintf(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2041: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_vprintf=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_vprintf=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'vprintf`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_VPRINTF 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +if test "$ac_cv_func_vprintf" != yes; then +echo $ac_n "checking for _doprnt""... $ac_c" 1>&6 +echo "configure:2065: checking for _doprnt" >&5 +if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2070 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char _doprnt(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char _doprnt(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub__doprnt) || defined (__stub____doprnt) +choke me +#else +_doprnt(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2093: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func__doprnt=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func__doprnt=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'_doprnt`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_DOPRNT 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi + +fi + if test "$ac_cv_c_cross" = no; then echo $ac_n "checking whether setvbuf arguments are reversed""... $ac_c" 1>&6 -echo "configure:1603: checking whether setvbuf arguments are reversed" >&5 +echo "configure:2119: checking whether setvbuf arguments are reversed" >&5 if eval "test \"`echo '$''{'ac_cv_func_setvbuf_reversed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1607,7 +2123,7 @@ else { echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <<EOF -#line 1611 "configure" +#line 2127 "configure" #include "confdefs.h" #include <stdio.h> /* If setvbuf has the reversed format, exit 0. */ @@ -1621,7 +2137,7 @@ main () { exit(0); /* Non-reversed systems segv here. */ } EOF -if { (eval echo configure:1625: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2141: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null then ac_cv_func_setvbuf_reversed=yes else @@ -1646,15 +2162,15 @@ fi fi for ac_func in setvbuf getcwd memset bzero strchr strcasecmp \ - vfprintf vsprintf strerror sigprocmask sigsetmask + sigprocmask sigsetmask do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1653: checking for $ac_func" >&5 +echo "configure:2169: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1658 "configure" +#line 2174 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1677,7 +2193,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2197: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1701,15 +2217,15 @@ else fi done -for ac_func in memcpy memmove strdup +for ac_func in memcpy memmove strdup strerror do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1708: checking for $ac_func" >&5 +echo "configure:2224: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1713 "configure" +#line 2229 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func(); below. */ @@ -1732,7 +2248,7 @@ $ac_func(); ; return 0; } EOF -if { (eval echo configure:1736: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:2252: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1759,6 +2275,1424 @@ done +ALL_LINGUAS="de fr" +echo $ac_n "checking for inline""... $ac_c" 1>&6 +echo "configure:2281: checking for inline" >&5 +if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_cv_c_inline=no +for ac_kw in inline __inline__ __inline; do + cat > conftest.$ac_ext <<EOF +#line 2288 "configure" +#include "confdefs.h" + +int main() { +} $ac_kw foo() { +; return 0; } +EOF +if { (eval echo configure:2295: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_c_inline=$ac_kw; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done + +fi + +echo "$ac_t""$ac_cv_c_inline" 1>&6 +case "$ac_cv_c_inline" in + inline | yes) ;; + no) cat >> confdefs.h <<\EOF +#define inline +EOF + ;; + *) cat >> confdefs.h <<EOF +#define inline $ac_cv_c_inline +EOF + ;; +esac + +echo $ac_n "checking for size_t""... $ac_c" 1>&6 +echo "configure:2321: checking for size_t" >&5 +if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2326 "configure" +#include "confdefs.h" +#include <sys/types.h> +#if STDC_HEADERS +#include <stdlib.h> +#include <stddef.h> +#endif +EOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + egrep "size_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then + rm -rf conftest* + ac_cv_type_size_t=yes +else + rm -rf conftest* + ac_cv_type_size_t=no +fi +rm -f conftest* + +fi +echo "$ac_t""$ac_cv_type_size_t" 1>&6 +if test $ac_cv_type_size_t = no; then + cat >> confdefs.h <<\EOF +#define size_t unsigned +EOF + +fi + +for ac_hdr in unistd.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2357: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2362 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2367: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +for ac_func in getpagesize +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2396: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2401 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2424: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + +echo $ac_n "checking for working mmap""... $ac_c" 1>&6 +echo "configure:2449: checking for working mmap" >&5 +if eval "test \"`echo '$''{'ac_cv_func_mmap_fixed_mapped'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test "$cross_compiling" = yes; then + ac_cv_func_mmap_fixed_mapped=no +else + cat > conftest.$ac_ext <<EOF +#line 2457 "configure" +#include "confdefs.h" + +/* Thanks to Mike Haertel and Jim Avera for this test. + Here is a matrix of mmap possibilities: + mmap private not fixed + mmap private fixed at somewhere currently unmapped + mmap private fixed at somewhere already mapped + mmap shared not fixed + mmap shared fixed at somewhere currently unmapped + mmap shared fixed at somewhere already mapped + For private mappings, we should verify that changes cannot be read() + back from the file, nor mmap's back from the file at a different + address. (There have been systems where private was not correctly + implemented like the infamous i386 svr4.0, and systems where the + VM page cache was not coherent with the filesystem buffer cache + like early versions of FreeBSD and possibly contemporary NetBSD.) + For shared mappings, we should conversely verify that changes get + propogated back to all the places they're supposed to be. + + Grep wants private fixed already mapped. + The main things grep needs to know about mmap are: + * does it exist and is it safe to write into the mmap'd area + * how to use it (BSD variants) */ +#include <sys/types.h> +#include <fcntl.h> +#include <sys/mman.h> + +/* This mess was copied from the GNU getpagesize.h. */ +#ifndef HAVE_GETPAGESIZE +# ifdef HAVE_UNISTD_H +# include <unistd.h> +# endif + +/* Assume that all systems that can run configure have sys/param.h. */ +# ifndef HAVE_SYS_PARAM_H +# define HAVE_SYS_PARAM_H 1 +# endif + +# ifdef _SC_PAGESIZE +# define getpagesize() sysconf(_SC_PAGESIZE) +# else /* no _SC_PAGESIZE */ +# ifdef HAVE_SYS_PARAM_H +# include <sys/param.h> +# ifdef EXEC_PAGESIZE +# define getpagesize() EXEC_PAGESIZE +# else /* no EXEC_PAGESIZE */ +# ifdef NBPG +# define getpagesize() NBPG * CLSIZE +# ifndef CLSIZE +# define CLSIZE 1 +# endif /* no CLSIZE */ +# else /* no NBPG */ +# ifdef NBPC +# define getpagesize() NBPC +# else /* no NBPC */ +# ifdef PAGESIZE +# define getpagesize() PAGESIZE +# endif /* PAGESIZE */ +# endif /* no NBPC */ +# endif /* no NBPG */ +# endif /* no EXEC_PAGESIZE */ +# else /* no HAVE_SYS_PARAM_H */ +# define getpagesize() 8192 /* punt totally */ +# endif /* no HAVE_SYS_PARAM_H */ +# endif /* no _SC_PAGESIZE */ + +#endif /* no HAVE_GETPAGESIZE */ + +#ifdef __cplusplus +extern "C" { void *malloc(unsigned); } +#else +char *malloc(); +#endif + +int +main() +{ + char *data, *data2, *data3; + int i, pagesize; + int fd; + + pagesize = getpagesize(); + + /* + * First, make a file with some known garbage in it. + */ + data = malloc(pagesize); + if (!data) + exit(1); + for (i = 0; i < pagesize; ++i) + *(data + i) = rand(); + umask(0); + fd = creat("conftestmmap", 0600); + if (fd < 0) + exit(1); + if (write(fd, data, pagesize) != pagesize) + exit(1); + close(fd); + + /* + * Next, try to mmap the file at a fixed address which + * already has something else allocated at it. If we can, + * also make sure that we see the same garbage. + */ + fd = open("conftestmmap", O_RDWR); + if (fd < 0) + exit(1); + data2 = malloc(2 * pagesize); + if (!data2) + exit(1); + data2 += (pagesize - ((int) data2 & (pagesize - 1))) & (pagesize - 1); + if (data2 != mmap(data2, pagesize, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_FIXED, fd, 0L)) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data2 + i)) + exit(1); + + /* + * Finally, make sure that changes to the mapped area + * do not percolate back to the file as seen by read(). + * (This is a bug on some variants of i386 svr4.0.) + */ + for (i = 0; i < pagesize; ++i) + *(data2 + i) = *(data2 + i) + 1; + data3 = malloc(pagesize); + if (!data3) + exit(1); + if (read(fd, data3, pagesize) != pagesize) + exit(1); + for (i = 0; i < pagesize; ++i) + if (*(data + i) != *(data3 + i)) + exit(1); + close(fd); + unlink("conftestmmap"); + exit(0); +} + +EOF +if { (eval echo configure:2597: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +then + ac_cv_func_mmap_fixed_mapped=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -fr conftest* + ac_cv_func_mmap_fixed_mapped=no +fi +rm -fr conftest* +fi + +fi + +echo "$ac_t""$ac_cv_func_mmap_fixed_mapped" 1>&6 +if test $ac_cv_func_mmap_fixed_mapped = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_MMAP 1 +EOF + +fi + + + for ac_hdr in argz.h limits.h locale.h nl_types.h malloc.h string.h \ +unistd.h values.h +do +ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 +echo "configure:2625: checking for $ac_hdr" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2630 "configure" +#include "confdefs.h" +#include <$ac_hdr> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2635: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'` + cat >> confdefs.h <<EOF +#define $ac_tr_hdr 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + for ac_func in getcwd munmap putenv setenv setlocale strchr strcasecmp \ +__argz_count __argz_stringify __argz_next +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2665: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2670 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2693: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + + if test "${ac_cv_func_stpcpy+set}" != "set"; then + for ac_func in stpcpy +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:2722: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2727 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:2750: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + fi + if test "${ac_cv_func_stpcpy}" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_STPCPY 1 +EOF + + fi + + if test $ac_cv_header_locale_h = yes; then + echo $ac_n "checking for LC_MESSAGES""... $ac_c" 1>&6 +echo "configure:2784: checking for LC_MESSAGES" >&5 +if eval "test \"`echo '$''{'am_cv_val_LC_MESSAGES'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2789 "configure" +#include "confdefs.h" +#include <locale.h> +int main() { +return LC_MESSAGES +; return 0; } +EOF +if { (eval echo configure:2796: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + am_cv_val_LC_MESSAGES=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + am_cv_val_LC_MESSAGES=no +fi +rm -f conftest* +fi + +echo "$ac_t""$am_cv_val_LC_MESSAGES" 1>&6 + if test $am_cv_val_LC_MESSAGES = yes; then + cat >> confdefs.h <<\EOF +#define HAVE_LC_MESSAGES 1 +EOF + + fi + fi + echo $ac_n "checking whether NLS is requested""... $ac_c" 1>&6 +echo "configure:2817: checking whether NLS is requested" >&5 + # Check whether --enable-nls or --disable-nls was given. +if test "${enable_nls+set}" = set; then + enableval="$enable_nls" + USE_NLS=$enableval +else + USE_NLS=yes +fi + + echo "$ac_t""$USE_NLS" 1>&6 + + + USE_INCLUDED_LIBINTL=no + + if test "$USE_NLS" = "yes"; then + cat >> confdefs.h <<\EOF +#define ENABLE_NLS 1 +EOF + + echo $ac_n "checking whether included gettext is requested""... $ac_c" 1>&6 +echo "configure:2837: checking whether included gettext is requested" >&5 + # Check whether --with-included-gettext or --without-included-gettext was given. +if test "${with_included_gettext+set}" = set; then + withval="$with_included_gettext" + nls_cv_force_use_gnu_gettext=$withval +else + nls_cv_force_use_gnu_gettext=no +fi + + echo "$ac_t""$nls_cv_force_use_gnu_gettext" 1>&6 + + nls_cv_use_gnu_gettext="$nls_cv_force_use_gnu_gettext" + if test "$nls_cv_force_use_gnu_gettext" != "yes"; then + nls_cv_header_intl= + nls_cv_header_libgt= + CATOBJEXT=NONE + + ac_safe=`echo "libintl.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for libintl.h""... $ac_c" 1>&6 +echo "configure:2856: checking for libintl.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2861 "configure" +#include "confdefs.h" +#include <libintl.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:2866: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libc""... $ac_c" 1>&6 +echo "configure:2883: checking for gettext in libc" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2888 "configure" +#include "confdefs.h" +#include <libintl.h> +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:2895: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + gt_cv_func_gettext_libc=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libc=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libc" 1>&6 + + if test "$gt_cv_func_gettext_libc" != "yes"; then + echo $ac_n "checking for bindtextdomain in -lintl""... $ac_c" 1>&6 +echo "configure:2911: checking for bindtextdomain in -lintl" >&5 +ac_lib_var=`echo intl'_'bindtextdomain | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-lintl $LIBS" +cat > conftest.$ac_ext <<EOF +#line 2919 "configure" +#include "confdefs.h" +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char bindtextdomain(); + +int main() { +bindtextdomain() +; return 0; } +EOF +if { (eval echo configure:2930: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + echo $ac_n "checking for gettext in libintl""... $ac_c" 1>&6 +echo "configure:2946: checking for gettext in libintl" >&5 +if eval "test \"`echo '$''{'gt_cv_func_gettext_libintl'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 2951 "configure" +#include "confdefs.h" + +int main() { +return (int) gettext ("") +; return 0; } +EOF +if { (eval echo configure:2958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + gt_cv_func_gettext_libintl=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + gt_cv_func_gettext_libintl=no +fi +rm -f conftest* +fi + +echo "$ac_t""$gt_cv_func_gettext_libintl" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + + if test "$gt_cv_func_gettext_libc" = "yes" \ + || test "$gt_cv_func_gettext_libintl" = "yes"; then + cat >> confdefs.h <<\EOF +#define HAVE_GETTEXT 1 +EOF + + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:2986: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="no" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$MSGFMT" != "no"; then + for ac_func in dcgettext +do +echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 +echo "configure:3020: checking for $ac_func" >&5 +if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3025 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +$ac_func(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3048: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_$ac_func=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_$ac_func=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` + cat >> confdefs.h <<EOF +#define $ac_tr_func 1 +EOF + +else + echo "$ac_t""no" 1>&6 +fi +done + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3075: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3110: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + cat > conftest.$ac_ext <<EOF +#line 3142 "configure" +#include "confdefs.h" + +int main() { +extern int _nl_msg_cat_cntr; + return _nl_msg_cat_cntr +; return 0; } +EOF +if { (eval echo configure:3150: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + CATOBJEXT=.gmo + DATADIRNAME=share +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CATOBJEXT=.mo + DATADIRNAME=lib +fi +rm -f conftest* + INSTOBJEXT=.mo + fi + fi + +else + echo "$ac_t""no" 1>&6 +fi + + + if test "$CATOBJEXT" = "NONE"; then + echo $ac_n "checking whether catgets can be used""... $ac_c" 1>&6 +echo "configure:3173: checking whether catgets can be used" >&5 + # Check whether --with-catgets or --without-catgets was given. +if test "${with_catgets+set}" = set; then + withval="$with_catgets" + nls_cv_use_catgets=$withval +else + nls_cv_use_catgets=no +fi + + echo "$ac_t""$nls_cv_use_catgets" 1>&6 + + if test "$nls_cv_use_catgets" = "yes"; then + echo $ac_n "checking for main in -li""... $ac_c" 1>&6 +echo "configure:3186: checking for main in -li" >&5 +ac_lib_var=`echo i'_'main | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + ac_save_LIBS="$LIBS" +LIBS="-li $LIBS" +cat > conftest.$ac_ext <<EOF +#line 3194 "configure" +#include "confdefs.h" + +int main() { +main() +; return 0; } +EOF +if { (eval echo configure:3201: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_lib_$ac_lib_var=no" +fi +rm -f conftest* +LIBS="$ac_save_LIBS" + +fi +if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then + echo "$ac_t""yes" 1>&6 + ac_tr_lib=HAVE_LIB`echo i | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` + cat >> confdefs.h <<EOF +#define $ac_tr_lib 1 +EOF + + LIBS="-li $LIBS" + +else + echo "$ac_t""no" 1>&6 +fi + + echo $ac_n "checking for catgets""... $ac_c" 1>&6 +echo "configure:3229: checking for catgets" >&5 +if eval "test \"`echo '$''{'ac_cv_func_catgets'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3234 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char catgets(); below. */ +#include <assert.h> +/* Override any gcc2 internal prototype to avoid an error. */ +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char catgets(); + +int main() { + +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_catgets) || defined (__stub___catgets) +choke me +#else +catgets(); +#endif + +; return 0; } +EOF +if { (eval echo configure:3257: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then + rm -rf conftest* + eval "ac_cv_func_catgets=yes" +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_func_catgets=no" +fi +rm -f conftest* +fi + +if eval "test \"`echo '$ac_cv_func_'catgets`\" = yes"; then + echo "$ac_t""yes" 1>&6 + cat >> confdefs.h <<\EOF +#define HAVE_CATGETS 1 +EOF + + INTLOBJS="\$(CATOBJS)" + # Extract the first word of "gencat", so it can be a program name with args. +set dummy gencat; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3279: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GENCAT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GENCAT" in + /*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GENCAT="$GENCAT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GENCAT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GENCAT" && ac_cv_path_GENCAT="no" + ;; +esac +fi +GENCAT="$ac_cv_path_GENCAT" +if test -n "$GENCAT"; then + echo "$ac_t""$GENCAT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + if test "$GENCAT" != "no"; then + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3314: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test "$GMSGFMT" = "no"; then + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3350: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="no" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + fi + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3385: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.cat + INSTOBJEXT=.cat + DATADIRNAME=lib + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi +else + echo "$ac_t""no" 1>&6 +fi + + fi + fi + + if test "$CATOBJEXT" = "NONE"; then + nls_cv_use_gnu_gettext=yes + fi + fi + + if test "$nls_cv_use_gnu_gettext" = "yes"; then + INTLOBJS="\$(GETTOBJS)" + # Extract the first word of "msgfmt", so it can be a program name with args. +set dummy msgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3443: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_MSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$MSGFMT" in + /*) + ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep 'dv '`"; then + ac_cv_path_MSGFMT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT="msgfmt" + ;; +esac +fi +MSGFMT="$ac_cv_path_MSGFMT" +if test -n "$MSGFMT"; then + echo "$ac_t""$MSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "gmsgfmt", so it can be a program name with args. +set dummy gmsgfmt; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3477: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_GMSGFMT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$GMSGFMT" in + /*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a path. + ;; + ?:/*) + ac_cv_path_GMSGFMT="$GMSGFMT" # Let the user override the test with a dos path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_path_GMSGFMT="$ac_dir/$ac_word" + break + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" + ;; +esac +fi +GMSGFMT="$ac_cv_path_GMSGFMT" +if test -n "$GMSGFMT"; then + echo "$ac_t""$GMSGFMT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + # Extract the first word of "xgettext", so it can be a program name with args. +set dummy xgettext; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:3512: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_path_XGETTEXT'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + case "$XGETTEXT" in + /*) + ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. + ;; + *) + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + if test -z "`$ac_dir/$ac_word -h 2>&1 | grep '(HELP)'`"; then + ac_cv_path_XGETTEXT="$ac_dir/$ac_word" + break + fi + fi + done + IFS="$ac_save_ifs" + test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" + ;; +esac +fi +XGETTEXT="$ac_cv_path_XGETTEXT" +if test -n "$XGETTEXT"; then + echo "$ac_t""$XGETTEXT" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + USE_INCLUDED_LIBINTL=yes + CATOBJEXT=.gmo + INSTOBJEXT=.mo + DATADIRNAME=share + INTLDEPS="../intl/libintl.a" + INTLLIBS=$INTLDEPS + LIBS=`echo $LIBS | sed -e 's/-lintl//'` + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + if test "$XGETTEXT" != ":"; then + if $XGETTEXT --omit-header /dev/null 2> /dev/null; then + : ; + else + echo "$ac_t""found xgettext programs is not GNU xgettext; ignore it" 1>&6 + XGETTEXT=":" + fi + fi + + # We need to process the po/ directory. + POSUB=po + else + DATADIRNAME=share + nls_cv_header_intl=intl/libintl.h + nls_cv_header_libgt=intl/libgettext.h + fi + + # If this is used in GNU gettext we have to set USE_NLS to `yes' + # because some of the sources are only built for this goal. + if test "$PACKAGE" = gettext; then + USE_NLS=yes + USE_INCLUDED_LIBINTL=yes + fi + + for lang in $ALL_LINGUAS; do + GMOFILES="$GMOFILES $lang.gmo" + POFILES="$POFILES $lang.po" + done + + + + + + + + + + + + + + + if test "x$CATOBJEXT" != "x"; then + if test "x$ALL_LINGUAS" = "x"; then + LINGUAS= + else + echo $ac_n "checking for catalogs to be installed""... $ac_c" 1>&6 +echo "configure:3602: checking for catalogs to be installed" >&5 + NEW_LINGUAS= + for lang in ${LINGUAS=$ALL_LINGUAS}; do + case "$ALL_LINGUAS" in + *$lang*) NEW_LINGUAS="$NEW_LINGUAS $lang" ;; + esac + done + LINGUAS=$NEW_LINGUAS + echo "$ac_t""$LINGUAS" 1>&6 + fi + + if test -n "$LINGUAS"; then + for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done + fi + fi + + test -d intl || mkdir intl + if test "$CATOBJEXT" = ".cat"; then + ac_safe=`echo "linux/version.h" | sed 'y%./+-%__p_%'` +echo $ac_n "checking for linux/version.h""... $ac_c" 1>&6 +echo "configure:3622: checking for linux/version.h" >&5 +if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext <<EOF +#line 3627 "configure" +#include "confdefs.h" +#include <linux/version.h> +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:3632: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out` +if test -z "$ac_err"; then + rm -rf conftest* + eval "ac_cv_header_$ac_safe=yes" +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + eval "ac_cv_header_$ac_safe=no" +fi +rm -f conftest* +fi +if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then + echo "$ac_t""yes" 1>&6 + msgformat=linux +else + echo "$ac_t""no" 1>&6 +msgformat=xopen +fi + + + sed -e '/^#/d' $srcdir/intl/$msgformat-msg.sed > intl/po2msg.sed + fi + sed -e '/^#.*[^\\]$/d' -e '/^#$/d' \ + $srcdir/intl/po2tbl.sed.in > intl/po2tbl.sed + + if test "$PACKAGE" = "gettext"; then + GT_NO="#NO#" + GT_YES= + else + GT_NO= + GT_YES="#YES#" + fi + + + + MKINSTALLDIRS= + if test $ac_aux_dir; then + MKINSTALLDIRS="$ac_aux_dir/mkinstalldirs" + fi + if test -z $MKINSTALLDIRS; then + MKINSTALLDIRS="\$(top_srcdir)/mkinstalldirs" + fi + + + l= + + + test -d po || mkdir po + if test "x$srcdir" != "x."; then + if test "x`echo $srcdir | sed 's@/.*@@'`" = "x"; then + posrcprefix="$srcdir/" + else + posrcprefix="../$srcdir/" + fi + else + posrcprefix="../" + fi + sed -e "/^#/d" -e "/^\$/d" -e "s,.*, $posrcprefix& \\\\," -e "\$s/\(.*\) \\\\/\1/" \ + < $srcdir/po/POTFILES.in > po/POTFILES + + + trap '' 1 2 15 cat > confcache <<\EOF # This file is a shell script that caches the results of configure @@ -1782,7 +3716,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1` in + case `(ac_space=' '; set) 2>&1 | grep ac_space` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1822,19 +3756,7 @@ fi trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 -# Transform confdefs.h into DEFS. -# Protect against shell expansion while executing Makefile rules. -# Protect against Makefile macro expansion. -cat > conftest.defs <<\EOF -s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g -s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g -s%\[%\\&%g -s%\]%\\&%g -s%\$%$$%g -EOF -DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '` -rm -f conftest.defs - +DEFS=-DHAVE_CONFIG_H # Without the "./", some shells look in PATH for config.status. : ${CONFIG_STATUS=./config.status} @@ -1870,8 +3792,18 @@ do done ac_given_srcdir=$srcdir - -trap 'rm -fr `echo "Makefile libtxi/Makefile makeinfo/Makefile info/Makefile util/Makefile emacs/Makefile" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +ac_given_INSTALL="$INSTALL" + +trap 'rm -fr `echo "Makefile \ + doc/Makefile \ + emacs/Makefile \ + info/Makefile \ + intl/Makefile \ + lib/Makefile \ + makeinfo/Makefile \ + po/Makefile.in \ + util/Makefile \ + config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 EOF cat >> $CONFIG_STATUS <<EOF @@ -1902,16 +3834,48 @@ s%@includedir@%$includedir%g s%@oldincludedir@%$oldincludedir%g s%@infodir@%$infodir%g s%@mandir@%$mandir%g -s%@INSTALL@%$INSTALL%g s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g s%@INSTALL_DATA@%$INSTALL_DATA%g -s%@RANLIB@%$RANLIB%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@PACKAGE@%$PACKAGE%g +s%@VERSION@%$VERSION%g +s%@ACLOCAL@%$ACLOCAL%g +s%@AUTOCONF@%$AUTOCONF%g +s%@AUTOMAKE@%$AUTOMAKE%g +s%@AUTOHEADER@%$AUTOHEADER%g +s%@MAKEINFO@%$MAKEINFO%g +s%@SET_MAKE@%$SET_MAKE%g s%@CC@%$CC%g s%@CPP@%$CPP%g +s%@INSTALL@%$INSTALL%g +s%@RANLIB@%$RANLIB%g +s%@TEXCONFIG@%$TEXCONFIG%g +s%@TEXMF@%$TEXMF%g +s%@MAINT@%$MAINT%g s%@EXEEXT@%$EXEEXT%g s%@TERMLIBS@%$TERMLIBS%g s%@ALLOCA@%$ALLOCA%g s%@LIBOBJS@%$LIBOBJS%g +s%@USE_NLS@%$USE_NLS%g +s%@MSGFMT@%$MSGFMT%g +s%@GMSGFMT@%$GMSGFMT%g +s%@XGETTEXT@%$XGETTEXT%g +s%@GENCAT@%$GENCAT%g +s%@USE_INCLUDED_LIBINTL@%$USE_INCLUDED_LIBINTL%g +s%@CATALOGS@%$CATALOGS%g +s%@CATOBJEXT@%$CATOBJEXT%g +s%@DATADIRNAME@%$DATADIRNAME%g +s%@GMOFILES@%$GMOFILES%g +s%@INSTOBJEXT@%$INSTOBJEXT%g +s%@INTLDEPS@%$INTLDEPS%g +s%@INTLLIBS@%$INTLLIBS%g +s%@INTLOBJS@%$INTLOBJS%g +s%@POFILES@%$POFILES%g +s%@POSUB@%$POSUB%g +s%@GT_NO@%$GT_NO%g +s%@GT_YES@%$GT_YES%g +s%@MKINSTALLDIRS@%$MKINSTALLDIRS%g +s%@l@%$l%g CEOF EOF @@ -1953,7 +3917,16 @@ EOF cat >> $CONFIG_STATUS <<EOF -CONFIG_FILES=\${CONFIG_FILES-"Makefile libtxi/Makefile makeinfo/Makefile info/Makefile util/Makefile emacs/Makefile"} +CONFIG_FILES=\${CONFIG_FILES-"Makefile \ + doc/Makefile \ + emacs/Makefile \ + info/Makefile \ + intl/Makefile \ + lib/Makefile \ + makeinfo/Makefile \ + po/Makefile.in \ + util/Makefile \ + "} EOF cat >> $CONFIG_STATUS <<\EOF for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then @@ -1988,6 +3961,10 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then top_srcdir="$ac_dots$ac_given_srcdir" ;; esac + case "$ac_given_INSTALL" in + [/$]*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac echo creating "$ac_file" rm -f "$ac_file" @@ -2003,16 +3980,171 @@ for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then s%@configure_input@%$configure_input%g s%@srcdir@%$srcdir%g s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g " $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file fi; done rm -f conftest.s* +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ]*%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then EOF cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS="config.h" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"` + cat $ac_file_inputs > conftest.in EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF + +cat >> $CONFIG_STATUS <<EOF +ac_sources="$nls_cv_header_libgt" +ac_dests="$nls_cv_header_intl" +EOF + cat >> $CONFIG_STATUS <<\EOF +srcdir=$ac_given_srcdir +while test -n "$ac_sources"; do + set $ac_dests; ac_dest=$1; shift; ac_dests=$* + set $ac_sources; ac_source=$1; shift; ac_sources=$* + + echo "linking $srcdir/$ac_source to $ac_dest" + + if test ! -r $srcdir/$ac_source; then + { echo "configure: error: $srcdir/$ac_source: File not found" 1>&2; exit 1; } + fi + rm -f $ac_dest + + # Make relative symlinks. + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dest_dir=`echo $ac_dest|sed 's%/[^/][^/]*$%%'` + if test "$ac_dest_dir" != "$ac_dest" && test "$ac_dest_dir" != .; then + # The dest file is in a subdirectory. + test ! -d "$ac_dest_dir" && mkdir "$ac_dest_dir" + ac_dest_dir_suffix="/`echo $ac_dest_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dest_dir_suffix. + ac_dots=`echo $ac_dest_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dest_dir_suffix= ac_dots= + fi + + case "$srcdir" in + [/$]*) ac_rel_source="$srcdir/$ac_source" ;; + *) ac_rel_source="$ac_dots$srcdir/$ac_source" ;; + esac + # Make a symlink if possible; otherwise try a hard link. + if ln -s $ac_rel_source $ac_dest 2>/dev/null || + ln $srcdir/$ac_source $ac_dest; then : + else + { echo "configure: error: can not link $ac_dest to $srcdir/$ac_source" 1>&2; exit 1; } + fi +done +EOF +cat >> $CONFIG_STATUS <<EOF + + +EOF +cat >> $CONFIG_STATUS <<\EOF +test -z "$CONFIG_HEADERS" || echo timestamp > stamp-h +sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in >po/Makefile exit 0 EOF chmod +x $CONFIG_STATUS diff --git a/texinfo/configure.in b/texinfo/configure.in index c3b5544d3d9..ca9fcb1bd93 100644 --- a/texinfo/configure.in +++ b/texinfo/configure.in @@ -1,25 +1,39 @@ dnl Process this file with autoconf to produce a configure script. -dnl $Id: configure.in,v 1.2 1997/09/16 05:01:43 law Exp $ -AC_PREREQ(2.5) -AC_INIT(texinfo.texi) +dnl $Id: configure.in,v 1.5 1998/03/24 18:05:13 law Exp $ +dnl +AC_INIT(makeinfo/makeinfo.c) +AC_PREREQ(2.12)dnl Minimum Autoconf version required. +AM_CONFIG_HEADER(config.h) + +AM_INIT_AUTOMAKE([texinfo], [3.11]) dnl Checks for programs. -dnl AC_PROG_GCC_TRADITIONAL +AC_PROG_CC +AC_PROG_GCC_TRADITIONAL EGCS_PROG_INSTALL AC_PROG_RANLIB +# We do this for the sake of a more helpful warning in doc/Makefile. +TEXMF='$(datadir)/texmf' +AC_CHECK_PROG(TEXCONFIG, texconfig, true, false) +$TEXCONFIG && eval `texconfig confall | grep '^TEXMF='` +AC_SUBST(TEXMF) + AC_ISC_POSIX AC_MINIX -AM_CYGWIN32 +dnl CYGNUS LOCAL: Add AM_MAINTAINER_MODE and AM_EXEEXT +AM_MAINTAINER_MODE AM_EXEEXT dnl Checks for libraries. # Needed on sysV68 for sigblock, sigsetmask. AC_CHECK_LIB(bsd, sigblock) +# Some GNU/Linux systems (e.g., SuSE 4.3, 1996) don't have curses, but +# rather ncurses. So we check for it. TERMLIBS= -for termlib in curses ncurses termcap terminfo termlib ; do +for termlib in ncurses curses termcap terminfo termlib ; do AC_CHECK_LIB(${termlib}, tputs, [TERMLIBS="${TERMLIBS} -l${termlib}"; break]) done @@ -27,22 +41,45 @@ AC_SUBST(TERMLIBS) dnl Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS(unistd.h termios.h termio.h strings.h string.h varargs.h \ - sys/time.h sys/fcntl.h sys/ttold.h sys/ptem.h sys/file.h) +AC_CHECK_HEADERS(fcntl.h pwd.h string.h strings.h termcap.h termio.h \ + termios.h unistd.h \ + sys/fcntl.h sys/file.h sys/ptem.h sys/time.h sys/ttold.h sys/wait.h) + +dnl Do not use <ncurses/termcap.h> unless we're linking with ncurses. +if test "x$termlib" = xncurses; then + AC_CHECK_HEADER(ncurses/termcap.h) +fi dnl Checks for typedefs, structures, and compiler characteristics. AC_TYPE_OFF_T +AC_TYPE_SIGNAL AC_C_CONST AC_STRUCT_TM dnl Checks for library functions. AC_FUNC_ALLOCA +AC_FUNC_VPRINTF if test "$ac_cv_c_cross" = no; then AC_FUNC_SETVBUF_REVERSED fi AC_CHECK_FUNCS(setvbuf getcwd memset bzero strchr strcasecmp \ - vfprintf vsprintf strerror sigprocmask sigsetmask) + sigprocmask sigsetmask) dnl strcasecmp, strerror, xmalloc, xrealloc, probably others should be added. -AC_REPLACE_FUNCS(memcpy memmove strdup) +AC_REPLACE_FUNCS(memcpy memmove strdup strerror) + +dnl Set of available languages and i18n macros. +ALL_LINGUAS="de fr" +AM_GNU_GETTEXT +AC_LINK_FILES($nls_cv_header_libgt, $nls_cv_header_intl) -AC_OUTPUT(Makefile libtxi/Makefile makeinfo/Makefile info/Makefile util/Makefile emacs/Makefile) +AC_OUTPUT([Makefile \ + doc/Makefile \ + emacs/Makefile \ + info/Makefile \ + intl/Makefile \ + lib/Makefile \ + makeinfo/Makefile \ + po/Makefile.in \ + util/Makefile \ + ], + [sed -e "/POTFILES =/r po/POTFILES" po/Makefile.in >po/Makefile]) diff --git a/texinfo/info/man.c b/texinfo/info/man.c index 603325886b4..d57b0d30719 100644 --- a/texinfo/info/man.c +++ b/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.4 1998/03/22 21:47:54 law 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 (SIGCHLD) && defined (SIGCLD) @@ -81,31 +78,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); } @@ -116,12 +113,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; @@ -143,25 +137,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); @@ -170,10 +163,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); } @@ -227,7 +220,7 @@ static void reap_children (sig) int sig; { - unsigned int status; + int status; wait (&status); } @@ -239,7 +232,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) @@ -271,7 +263,7 @@ get_manpage_contents (pagename) 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]); @@ -279,16 +271,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); } @@ -310,21 +302,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' || manpage[i] == '\f') - j -= 2; + j -= 2; } newpage[j++] = '\0'; @@ -345,11 +337,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) @@ -465,7 +457,7 @@ find_reference_section (node) { position = search_forward (reference_section_starters[i], &frs_binding); if (position != -1) - break; + break; } if (position == -1) @@ -479,11 +471,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); @@ -514,43 +506,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; } @@ -564,7 +556,6 @@ locate_manpage_xref (node, start, dir) long start; int dir; { - register int i, count; REFERENCE **refs; long position = -1; @@ -579,27 +570,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 > -1; 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); } @@ -628,20 +619,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/texinfo/info/termdep.h b/texinfo/info/termdep.h index 4cad5ffd287..09c03e2f913 100644 --- a/texinfo/info/termdep.h +++ b/texinfo/info/termdep.h @@ -1,10 +1,10 @@ /* termdep.h -- System things that terminal.c depends on. - $Id: termdep.h,v 1.2 1997/10/30 05:55:14 law Exp $ + $Id: termdep.h,v 1.4 1998/03/24 18:06:50 law Exp $ This file is part of GNU Info, a program for reading online documentation stored in Info format. - Copyright (C) 1993, 96 Free Software Foundation, Inc. + Copyright (C) 1993, 96, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -22,33 +22,21 @@ 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_SYS_FILE_H) -# include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ - -#if defined (HAVE_STRINGS_H) -# include <strings.h> -#else -# if defined (HAVE_STRING_H) -# include <string.h> -# endif +/* 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_TERMIOS_H) +#ifdef HAVE_TERMIOS_H # include <termios.h> -/* - * POSIX does not mandate that we have these and it may, in fact, be only - * partially implemented - */ + /* + POSIX does not mandate that we have these and it may, in fact, be only + partially implemented. + */ # undef TIOCGETC #else # if defined (HAVE_TERMIO_H) @@ -67,15 +55,8 @@ # endif /* !HAVE_TERMIO_H */ #endif /* !HAVE_TERMIOS_H */ -#if defined (HAVE_SYS_TTOLD_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 */ - -#endif /* _TERMDEP_H_ */ +#endif /* not INFO_TERMDEP_H */ diff --git a/texinfo/info/terminal.c b/texinfo/info/terminal.c index 7275d00cb5b..9b90e5de9e1 100644 --- a/texinfo/info/terminal.c +++ b/texinfo/info/terminal.c @@ -1,12 +1,8 @@ -/* terminal.c -- How to handle the physical terminal for Info. */ +/* terminal.c -- How to handle the physical terminal for Info. + $Id: terminal.c,v 1.4 1998/03/24 18:06:53 law Exp $ -/* 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, 89, 90, 91, 92, 93, 96 Free Software Foundation, Inc. + Copyright (C) 1988, 89, 90, 91, 92, 93, 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 @@ -24,19 +20,33 @@ Written by Brian Fox (bfox@ai.mit.edu). */ -#include <stdio.h> -#include <sys/types.h> +#include "info.h" #include "terminal.h" #include "termdep.h" -extern void *xmalloc (), *xrealloc (); +#include <sys/types.h> +#include <signal.h> /* The Unix termcap interface code. */ +#ifdef HAVE_NCURSES_TERMCAP_H +#include <ncurses/termcap.h> +#else +#ifdef HAVE_TERMCAP_H +#include <termcap.h> +#else +/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC. + Unfortunately, PC is a global variable used by the termcap library. */ +#undef PC +/* Termcap requires these variables, whether we access them or not. */ +char *BC, *UP; +char PC; /* Pad character */ +short ospeed; /* Terminal output baud rate */ extern int tgetnum (), tgetflag (), tgetent (); extern char *tgetstr (), *tgoto (); -extern char *getenv (); extern void tputs (); +#endif /* not HAVE_TERMCAP_H */ +#endif /* not HAVE_NCURSES_TERMCAP_H */ /* Function "hooks". If you make one of these point to a function, that function is called when appropriate instead of its namesake. Your @@ -60,20 +70,11 @@ VFunction *terminal_write_chars_hook = (VFunction *)NULL; VFunction *terminal_scroll_terminal_hook = (VFunction *)NULL; /* **************************************************************** */ -/* */ -/* Terminal and Termcap */ -/* */ +/* */ +/* Terminal and Termcap */ +/* */ /* **************************************************************** */ -/* On Solaris2, sys/types.h #includes sys/reg.h, which #defines PC. - Unfortunately, PC is a global variable used by the termcap library. */ -#undef PC - -/* TERMCAP requires these variables, whether we access them or not. */ -char PC; -char *BC, *UP; -short ospeed; - /* A buffer which holds onto the current terminal description, and a pointer used to float within it. */ static char *term_buffer = (char *)NULL; @@ -84,6 +85,8 @@ static char *term_goto, *term_clreol, *term_cr, *term_clrpag; static char *term_begin_use, *term_end_use; static char *term_AL, *term_DL, *term_al, *term_dl; +static char *term_keypad_on, *term_keypad_off; + /* How to go up a line. */ static char *term_up; @@ -108,11 +111,15 @@ static char *term_invbeg; /* The string to turn off inverse mode, if this term has one. */ static char *term_invend; -static void +/* Although I can't find any documentation that says this is supposed to + return its argument, all the code I've looked at (termutils, less) + does so, so fine. */ +static int output_character_function (c) int c; { putc (c, stdout); + return c; } /* Macro to send STRING to the terminal. */ @@ -122,25 +129,53 @@ output_character_function (c) tputs (string, 1, output_character_function); \ } while (0) -/* Tell the terminal that we will be doing cursor addressable motion. */ +/* Tell the terminal that we will be doing cursor addressable motion. */ static void terminal_begin_using_terminal () { + RETSIGTYPE (*sigsave) (); + + if (term_keypad_on) + send_to_terminal (term_keypad_on); + + if (!term_begin_use || !*term_begin_use) + return; + + sigsave = signal (SIGWINCH, SIG_IGN); 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 + not restored properly. + From: strube@physik3.gwdg.de (Hans Werner Strube). */ + fflush (stdout); + sleep (1); + signal (SIGWINCH, sigsave); } -/* Tell the terminal that we will not be doing any more cursor addressable - motion. */ +/* Tell the terminal that we will not be doing any more cursor + addressable motion. */ static void terminal_end_using_terminal () { + RETSIGTYPE (*sigsave) (); + + if (term_keypad_off) + send_to_terminal (term_keypad_off); + + if (!term_end_use || !*term_end_use) + return; + + sigsave = signal (SIGWINCH, SIG_IGN); send_to_terminal (term_end_use); + fflush (stdout); + sleep (1); + signal (SIGWINCH, sigsave); } /* **************************************************************** */ -/* */ -/* Necessary Terminal Functions */ -/* */ +/* */ +/* Necessary Terminal Functions */ +/* */ /* **************************************************************** */ /* The functions and variables on this page implement the user visible @@ -169,6 +204,8 @@ char *term_ku = (char *)NULL; char *term_kd = (char *)NULL; char *term_kr = (char *)NULL; char *term_kl = (char *)NULL; +char *term_kP = (char *)NULL; /* page-up */ +char *term_kN = (char *)NULL; /* page-down */ /* Move the cursor to the terminal location of X and Y. */ void @@ -180,7 +217,7 @@ terminal_goto_xy (x, y) else { if (term_goto) - tputs (tgoto (term_goto, x, y), 1, output_character_function); + tputs (tgoto (term_goto, x, y), 1, output_character_function); } } @@ -208,7 +245,7 @@ terminal_write_chars (string, nchars) else { if (nchars) - fwrite (string, 1, nchars, stdout); + fwrite (string, 1, nchars, stdout); } } @@ -294,9 +331,9 @@ terminal_ring_bell () else { if (terminal_has_visible_bell_p && terminal_use_visible_bell_p) - send_to_terminal (visible_bell); + send_to_terminal (visible_bell); else - send_to_terminal (audible_bell); + send_to_terminal (audible_bell); } } @@ -318,7 +355,7 @@ terminal_delete_lines (start, count) else { while (count--) - tputs (term_dl, lines, output_character_function); + tputs (term_dl, lines, output_character_function); } fflush (stdout); @@ -343,7 +380,7 @@ terminal_insert_lines (start, count) else { while (count--) - tputs (term_al, lines, output_character_function); + tputs (term_al, lines, output_character_function); } fflush (stdout); @@ -369,22 +406,22 @@ terminal_scroll_terminal (start, end, amount) else { /* If we are scrolling down, delete AMOUNT lines at END. Then insert - AMOUNT lines at START. */ + AMOUNT lines at START. */ if (amount > 0) - { - terminal_delete_lines (end, amount); - terminal_insert_lines (start, amount); - } + { + terminal_delete_lines (end, amount); + terminal_insert_lines (start, amount); + } /* If we are scrolling up, delete AMOUNT lines before START. This - actually does the upwards scroll. Then, insert AMOUNT lines - after the already scrolled region (i.e., END - AMOUNT). */ + actually does the upwards scroll. Then, insert AMOUNT lines + after the already scrolled region (i.e., END - AMOUNT). */ if (amount < 0) - { - int abs_amount = -amount; - terminal_delete_lines (start - abs_amount, abs_amount); - terminal_insert_lines (end - abs_amount, abs_amount); - } + { + int abs_amount = -amount; + terminal_delete_lines (start - abs_amount, abs_amount); + terminal_insert_lines (end - abs_amount, abs_amount); + } } } @@ -414,55 +451,55 @@ terminal_get_screen_size () #if defined (TIOCGWINSZ) { - struct winsize window_size; + struct winsize window_size; - if (ioctl (fileno (stdout), TIOCGWINSZ, &window_size) == 0) - { - screenwidth = (int) window_size.ws_col; - screenheight = (int) window_size.ws_row; - } + if (ioctl (fileno (stdout), TIOCGWINSZ, &window_size) == 0) + { + screenwidth = (int) window_size.ws_col; + screenheight = (int) window_size.ws_row; + } } -#endif /* TIOCGWINSZ */ +#endif /* TIOCGWINSZ */ /* Environment variable COLUMNS overrides setting of "co". */ if (screenwidth <= 0) - { - char *sw = getenv ("COLUMNS"); + { + char *sw = getenv ("COLUMNS"); - if (sw) - screenwidth = atoi (sw); + if (sw) + screenwidth = atoi (sw); - if (screenwidth <= 0) - screenwidth = tgetnum ("co"); - } + if (screenwidth <= 0) + screenwidth = tgetnum ("co"); + } /* Environment variable LINES overrides setting of "li". */ if (screenheight <= 0) - { - char *sh = getenv ("LINES"); + { + char *sh = getenv ("LINES"); - if (sh) - screenheight = atoi (sh); + if (sh) + screenheight = atoi (sh); - if (screenheight <= 0) - screenheight = tgetnum ("li"); - } + if (screenheight <= 0) + screenheight = tgetnum ("li"); + } /* If all else fails, default to 80x24 terminal. */ if (screenwidth <= 0) - screenwidth = 80; + screenwidth = 80; if (screenheight <= 0) - screenheight = 24; + screenheight = 24; } } -/* Initialize the terminal which is known as TERMINAL_NAME. If this terminal - doesn't have cursor addressability, TERMINAL_IS_DUMB_P becomes non-zero. - The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that - this terminal actually has. The variable TERMINAL_HAS_META_P becomes non- - zero if this terminal supports a Meta key. Finally, the terminal screen is - cleared. */ +/* Initialize the terminal which is known as TERMINAL_NAME. If this + terminal doesn't have cursor addressability, `terminal_is_dumb_p' + becomes nonzero. The variables SCREENHEIGHT and SCREENWIDTH are set + to the dimensions that this terminal actually has. The variable + TERMINAL_HAS_META_P becomes nonzero if this terminal supports a Meta + key. Finally, the terminal screen is cleared. */ void terminal_initialize_terminal (terminal_name) char *terminal_name; @@ -500,6 +537,7 @@ terminal_initialize_terminal (terminal_name) term_cr = "\r"; term_up = term_dn = audible_bell = visible_bell = (char *)NULL; term_ku = term_kd = term_kl = term_kr = (char *)NULL; + term_kP = term_kN = (char *)NULL; return; } @@ -517,7 +555,7 @@ terminal_initialize_terminal (terminal_name) } #else ospeed = B9600; -#endif /* !TIOCGETP */ +#endif /* !TIOCGETP */ term_cr = tgetstr ("cr", &buffer); term_clreol = tgetstr ("ce", &buffer); @@ -553,6 +591,9 @@ terminal_initialize_terminal (terminal_name) term_begin_use = tgetstr ("ti", &buffer); term_end_use = tgetstr ("te", &buffer); + term_keypad_on = tgetstr ("ks", &buffer); + term_keypad_off = tgetstr ("ke", &buffer); + /* Check to see if this terminal has a meta key. */ terminal_has_meta_p = (tgetflag ("km") || tgetflag ("MT")); if (terminal_has_meta_p) @@ -572,17 +613,18 @@ terminal_initialize_terminal (terminal_name) term_kr = tgetstr ("kr", &buffer); term_kl = tgetstr ("kl", &buffer); + term_kP = tgetstr ("kP", &buffer); + term_kN = tgetstr ("kN", &buffer); + /* If this terminal is not cursor addressable, then it is really dumb. */ if (!term_goto) terminal_is_dumb_p = 1; - - terminal_begin_using_terminal (); } /* **************************************************************** */ -/* */ -/* How to Read Characters From the Terminal */ -/* */ +/* */ +/* How to Read Characters From the Terminal */ +/* */ /* **************************************************************** */ #if defined (TIOCGETC) @@ -623,6 +665,8 @@ terminal_prep_terminal () return; } + terminal_begin_using_terminal (); + tty = fileno (stdin); #if defined (HAVE_TERMIOS_H) @@ -655,7 +699,12 @@ terminal_prep_terminal () if (ttybuff.c_cc[VQUIT] == '\177') ttybuff.c_cc[VQUIT] = -1; -#endif + +#ifdef VLNEXT + if (ttybuff.c_cc[VLNEXT] == '\026') + ttybuff.c_cc[VLNEXT] = -1; +#endif /* VLNEXT */ +#endif /* TERMIOS or TERMIO */ #if defined (HAVE_TERMIOS_H) tcsetattr (tty, TCSANOW, &ttybuff); @@ -719,9 +768,9 @@ terminal_prep_terminal () temp = original_ltchars; /* Make the interrupt keys go away. Just enough to make people happy. */ - temp.t_lnextc = -1; /* C-v. */ - temp.t_dsuspc = -1; /* C-y. */ - temp.t_flushc = -1; /* C-o. */ + temp.t_lnextc = -1; /* C-v. */ + temp.t_dsuspc = -1; /* C-y. */ + temp.t_flushc = -1; /* C-o. */ ioctl (tty, TIOCSLTC, &temp); } # endif /* TIOCGLTC */ diff --git a/texinfo/makeinfo/makeinfo.c b/texinfo/makeinfo/makeinfo.c index 21ffee0a9ea..aab04722faf 100644 --- a/texinfo/makeinfo/makeinfo.c +++ b/texinfo/makeinfo/makeinfo.c @@ -1,7 +1,7 @@ -/* Makeinfo -- convert texinfo format files into info files. - $Id: makeinfo.c,v 1.5 1998/03/03 09:03:45 law Exp $ +/* Makeinfo -- convert Texinfo source files into Info files. + $Id: makeinfo.c,v 1.6 1998/03/22 21:47:57 law Exp $ - Copyright (C) 1987, 92, 93, 94, 95, 96 Free Software Foundation, Inc. + Copyright (C) 1987, 92, 93, 94, 95, 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 @@ -17,12 +17,58 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - Makeinfo is authored by Brian Fox (bfox@ai.mit.edu). */ + Makeinfo was authored by Brian Fox (bfox@ai.mit.edu). */ + +/* Indent #pragma so that older Cpp's don't try to parse it. */ +#ifdef _AIX + #pragma alloca +#endif /* _AIX */ int major_version = 1; -int minor_version = 67; +int minor_version = 68; + +#include "system.h" +#include "getopt.h" + +#ifdef TM_IN_SYS_TIME +#include <sys/time.h> +#else +#include <time.h> +#endif /* !TM_IN_SYS_TIME */ + +#ifdef __GNUC__ +# undef alloca +# define alloca __builtin_alloca +#else +# ifdef HAVE_ALLOCA_H +# include <alloca.h> +# else +# ifndef _AIX +char *alloca (); +# endif +# endif +#endif -/* You can change some of the behaviour of Makeinfo by changing the +/* We'd like to take advantage of _doprnt if it's around, a la error.c, + but then we'd have no VA_SPRINTF. */ +#if HAVE_VPRINTF +# if __STDC__ +# include <stdarg.h> +# define VA_START(args, lastarg) va_start(args, lastarg) +# else +# include <varargs.h> +# define VA_START(args, lastarg) va_start(args) +# endif +# define VA_FPRINTF(file, fmt, ap) vfprintf (file, fmt, ap) +# define VA_SPRINTF(str, fmt, ap) vsprintf (str, fmt, ap) +#else /* not HAVE_VPRINTF */ +# define VA_START(args, lastarg) +# define va_alist a1, a2, a3, a4, a5, a6, a7, a8 +# define va_dcl char *a1, *a2, *a3, *a4, *a5, *a6, *a7, *a8; +# define va_end(args) +#endif + +/* You can change some of the behavior of Makeinfo by changing the following defines: */ /* Define INDENT_PARAGRAPHS_IN_TABLE if you want the paragraphs which @@ -50,119 +96,45 @@ int minor_version = 67; #define DEFAULT_PARAGRAPH_SPACING 1 /* Define HAVE_MACROS to enable the macro facility of Texinfo. Using this - facility, users can create their own command procedures with arguments. */ + facility, users can create their own command procedures with + arguments. Must always be defined. */ #define HAVE_MACROS -/* Indent #pragma so that older Cpp's don't try to parse it. */ -#if defined (_AIX) - # pragma alloca -#endif /* _AIX */ - -#include <stdio.h> -#include <sys/types.h> -#include <ctype.h> -#include <sys/stat.h> -#include <pwd.h> -#include <errno.h> - -#if defined (HAVE_VARARGS_H) -#include <varargs.h> -#endif /* HAVE_VARARGS_H */ -#include "getopt.h" - -#if defined (HAVE_UNISTD_H) -#include <unistd.h> -#endif /* HAVE_UNISTD_H */ - -#if defined (VMS) -#include <perror.h> -#endif - -#if defined (STDC_HEADERS) -#include <stdlib.h> -#endif - -#if defined (HAVE_STRING_H) -#include <string.h> -#else -#include <strings.h> -#endif /* !HAVE_STRING_H */ - -#if defined (TM_IN_SYS_TIME) -#include <sys/time.h> -#else -#include <time.h> -#endif /* !TM_IN_SYS_TIME */ - -#if defined (HAVE_SYS_FCNTL_H) -#include <sys/fcntl.h> -#else -#include <fcntl.h> -#endif /* !HAVE_SYS_FCNTL_H */ - -#if defined (HAVE_SYS_FILE_H) -#include <sys/file.h> -#endif /* HAVE_SYS_FILE_H */ - -#if !defined(alloca) -#if defined (__GNUC__) -#define alloca __builtin_alloca -#else -#if defined(HAVE_ALLOCA_H) -#include <alloca.h> -#else /* !HAVE_ALLOCA_H */ -#if !defined (_AIX) -extern char *alloca (); -#endif /* !_AIX */ -#endif /* !HAVE_ALLOCA_H */ -#endif /* !__GNUC__ */ -#endif /* alloca */ - -void *xmalloc (), *xrealloc (); -#if defined (__osf__) -extern void *malloc (), *realloc (); -#endif /* __osf__ */ - -char **get_brace_args (); -int array_len (); -void free_array (); -static void isolate_nodename (); - #define COMPILING_MAKEINFO #include "makeinfo.h" -/* Non-zero means that we are currently hacking the insides of an +/* Nonzero means that we are currently hacking the insides of an insertion which would use a fixed width font. */ static int in_fixed_width_font = 0; -/* Non-zero means that start_paragraph () MUST be called before we pay +/* Nonzero means that start_paragraph () MUST be called before we pay any attention to close_paragraph () calls. */ int must_start_paragraph = 0; -/* Non-zero means a string is in execution, as opposed to a file. */ +/* Nonzero means a string is in execution, as opposed to a file. */ static int executing_string = 0; #if defined (HAVE_MACROS) /* If non-NULL, this is an output stream to write the full macro expansion - of the input text to. The resultant file is another texinfo file, but + of the input text to. The result is another texinfo file, but missing @include, @infoinclude, @macro, and macro invocations. Instead, all of the text is placed within the file. */ FILE *macro_expansion_output_stream = (FILE *)NULL; +char *macro_expansion_filename; /* Here is a structure used to remember input text strings and offsets within them. */ typedef struct { - char *pointer; /* Pointer to the input text. */ - int offset; /* Offset of the last character output. */ + char *pointer; /* Pointer to the input text. */ + int offset; /* Offset of the last character output. */ } ITEXT; static ITEXT **itext_info = (ITEXT **)NULL; static int itext_size = 0; -/* Non-zero means to inhibit the writing of macro expansions to the output - stream. This is used in special cases where the output has already been - written. */ +/* Nonzero means to inhibit writing macro expansions to the output + stream, because it has already been written. */ int me_inhibit_expansion = 0; ITEXT *remember_itext (); @@ -171,19 +143,17 @@ void append_to_expansion_output (), write_region_to_macro_output (); void maybe_write_itext (), me_execute_string (); #endif /* HAVE_MACROS */ -/* Some systems don't declare this function in pwd.h. */ -struct passwd *getpwnam (); /* **************************************************************** */ -/* */ -/* Global Variables */ -/* */ +/* */ +/* Global Variables */ +/* */ /* **************************************************************** */ /* Global pointer to argv[0]. */ char *progname; -/* Return non-zero if STRING is the text at input_text + input_text_offset, +/* Return nonzero if STRING is the text at input_text + input_text_offset, else zero. */ #define looking_at(string) \ (strncmp (input_text + input_text_offset, string, strlen (string)) == 0) @@ -202,24 +172,20 @@ char *command_output_filename = (char *)NULL; with @include. This can be controlled with the `-I' option to makeinfo. */ char *include_files_path = (char *)NULL; -/* Current output stream. */ -FILE *output_stream; - /* Position in the output file. */ int output_position; #define INITIAL_PARAGRAPH_SPACE 5000 int paragraph_buffer_len = INITIAL_PARAGRAPH_SPACE; -/* Filling.. */ -/* Non-zero indicates that filling will take place on long lines. */ +/* Nonzero indicates that filling will take place on long lines. */ int filling_enabled = 1; -/* Non-zero means that words are not to be split, even in long lines. This +/* Nonzero means that words are not to be split, even in long lines. This gets changed for cm_w (). */ int non_splitting_words = 0; -/* Non-zero indicates that filling a line also indents the new line. */ +/* Nonzero indicates that filling a line also indents the new line. */ int indented_fill = 0; /* The amount of indentation to add at the starts of paragraphs. @@ -232,7 +198,7 @@ int indented_fill = 0; this is 3. */ int paragraph_start_indent = PARAGRAPH_START_INDENT; -/* Non-zero means that the use of paragraph_start_indent is inhibited. +/* Nonzero means that the use of paragraph_start_indent is inhibited. @example uses this to line up the left columns of the example text. A negative value for this variable is incremented each time it is used. @noindent uses this to inhibit indentation for a single paragraph. */ @@ -246,17 +212,17 @@ int pending_indent = 0; /* The amount that indentation increases/decreases by. */ int default_indentation_increment = DEFAULT_INDENTATION_INCREMENT; -/* Non-zero indicates that indentation is temporarily turned off. */ +/* Nonzero indicates that indentation is temporarily turned off. */ int no_indent = 1; -/* Non-zero means forcing output text to be flushright. */ +/* Nonzero means forcing output text to be flushright. */ int force_flush_right = 0; -/* Non-zero means that the footnote style for this document was set on +/* Nonzero means that the footnote style for this document was set on the command line, which overrides any other settings. */ int footnote_style_preset = 0; -/* Non-zero means that we automatically number footnotes that have no +/* Nonzero means that we automatically number footnotes that have no specified marker. */ int number_footnotes = 1; @@ -273,16 +239,16 @@ int command_index; /* A search string which is used to find a line defining a node. */ char node_search_string[] = - { '\n', COMMAND_PREFIX, 'n', 'o', 'd', 'e', ' ', '\0' }; + { '\n', COMMAND_PREFIX, 'n', 'o', 'd', 'e', ' ', 0 }; /* A search string which is used to find a line defining a menu. */ char menu_search_string[] = - { '\n', COMMAND_PREFIX, 'm', 'e', 'n', 'u', '\0' }; + { '\n', COMMAND_PREFIX, 'm', 'e', 'n', 'u', 0 }; /* A search string which is used to find the first @setfilename. */ char setfilename_search[] = { COMMAND_PREFIX, - 's', 'e', 't', 'f', 'i', 'l', 'e', 'n', 'a', 'm', 'e', '\0' }; + 's', 'e', 't', 'f', 'i', 'l', 'e', 'n', 'a', 'm', 'e', 0 }; /* A stack of file information records. If a new file is read in with "@input", we remember the old input file state on this stack. */ @@ -312,15 +278,15 @@ char *node_filename = (char *)NULL; typedef struct tentry { struct tentry *next_ent; - char *node; /* name of this node. */ - char *prev; /* name of "Prev:" for this node. */ - char *next; /* name of "Next:" for this node. */ - char *up; /* name of "Up:" for this node. */ - int position; /* output file position of this node. */ - int line_no; /* defining line in source file. */ - char *filename; /* The file that this node was found in. */ - int touched; /* non-zero means this node has been referenced. */ - int flags; /* Room for growth. Right now, contains 1 bit. */ + char *node; /* name of this node. */ + char *prev; /* name of "Prev:" for this node. */ + char *next; /* name of "Next:" for this node. */ + char *up; /* name of "Up:" for this node. */ + int position; /* output file position of this node. */ + int line_no; /* defining line in source file. */ + char *filename; /* The file that this node was found in. */ + int touched; /* Nonzero means this node has been referenced. */ + int flags; /* Room for growth. Right now, contains 1 bit. */ } TAG_ENTRY; /* If node-a has a "Next" for node-b, but node-b has no "Prev" for node-a, @@ -330,24 +296,30 @@ typedef struct tentry #define PREV_ERROR 0x1 #define NEXT_ERROR 0x2 #define UP_ERROR 0x4 -#define NO_WARN 0x8 -#define IS_TOP 0x10 +#define NO_WARN 0x8 +#define IS_TOP 0x10 TAG_ENTRY *tag_table = (TAG_ENTRY *) NULL; +/* Values for calling handle_variable_internal (). */ +#define SET 1 +#define CLEAR 2 +#define IFSET 3 +#define IFCLEAR 4 + #if defined (HAVE_MACROS) -#define ME_RECURSE 0x01 -#define ME_QUOTE_ARG 0x02 +#define ME_RECURSE 0x01 +#define ME_QUOTE_ARG 0x02 /* Macro definitions for user-defined commands. */ typedef struct { - char *name; /* Name of the macro. */ - char **arglist; /* Args to replace when executing. */ - char *body; /* Macro body. */ - char *source_file; /* File where this macro is defined. */ - int source_lineno; /* Line number within FILENAME. */ - int inhibited; /* Non-zero means make find_macro () fail. */ - int flags; /* ME_RECURSE, ME_QUOTE_ARG, etc. */ + char *name; /* Name of the macro. */ + char **arglist; /* Args to replace when executing. */ + char *body; /* Macro body. */ + char *source_file; /* File where this macro is defined. */ + int source_lineno; /* Line number within FILENAME. */ + int inhibited; /* Nonzero means make find_macro () fail. */ + int flags; /* ME_RECURSE, ME_QUOTE_ARG, etc. */ } MACRO_DEF; void add_macro (), execute_macro (); @@ -367,12 +339,12 @@ enum reftype typedef struct node_ref { struct node_ref *next; - char *node; /* Name of node referred to. */ - char *containing_node; /* Name of node containing this reference. */ - int line_no; /* Line number where the reference occurs. */ - int section; /* Section level where the reference occurs. */ - char *filename; /* Name of file where the reference occurs. */ - enum reftype type; /* Type of reference, either menu or note. */ + char *node; /* Name of node referred to. */ + char *containing_node; /* Name of node containing this reference. */ + int line_no; /* Line number where the reference occurs. */ + int section; /* Section level where the reference occurs. */ + char *filename; /* Name of file where the reference occurs. */ + enum reftype type; /* Type of reference, either menu or note. */ } NODE_REF; /* The linked list of such structures. */ @@ -384,21 +356,24 @@ int in_menu = 0; /* Flag which tells us how to examine menu lines. */ int in_detailmenu = 0; -/* Non-zero means that we have seen "@top" once already. */ +/* Nonzero means that we have seen "@top" once already. */ int top_node_seen = 0; -/* Non-zero means that we have seen a non-"@top" node already. */ +/* Nonzero means that we have seen a non-"@top" node already. */ int non_top_node_seen = 0; /* Flags controlling the operation of the program. */ +/* Default is to remove output if there were errors. */ +int force = 0; + /* Default is to notify users of bad choices. */ int print_warnings = 1; /* Default is to check node references. */ int validating = 1; -/* Non-zero means do not output "Node: Foo" for node separations. */ +/* Nonzero means do not output "Node: Foo" for node separations. */ int no_headers = 0; /* Number of errors that we tolerate on a given fileset. */ @@ -407,11 +382,11 @@ int max_error_level = 100; /* Maximum number of references to a single node before complaining. */ int reference_warning_limit = 1000; -/* Non-zero means print out information about what is going on when it +/* Nonzero means print out information about what is going on when it is going on. */ int verbose_mode = 0; -/* Non-zero means to be relaxed about the input file. This is useful when +/* Nonzero means to be relaxed about the input file. This is useful when we can successfully format the input, but it doesn't strictly match our somewhat pedantic ideas of correctness. Right now, it affects what @table and @itemize do without arguments. */ @@ -437,17 +412,12 @@ typedef struct brace_element BRACE_ELEMENT *brace_stack = (BRACE_ELEMENT *) NULL; -/* Forward declarations. */ -#if !defined (HAVE_STRDUP) -extern char *strdup (); -#endif /* HAVE_STRDUP */ - extern void do_multitable (); void print_version_info (); void usage (); void push_node_filename (), pop_node_filename (); -void remember_error (); +void remember_error (), flush_file_stack (); void convert_from_stream (), convert_from_file (), convert_from_loaded_file (); void init_internals (), init_paragraph (), init_brace_stack (); void init_insertion_stack (), init_indices (); @@ -455,21 +425,34 @@ void init_tag_table (), write_tag_table (), write_tag_table_internal (); void validate_file (), validate_other_references (), split_file (); void free_node_references (), do_enumeration (), handle_variable (); void handle_variable_internal (); -void execute_string (); void normalize_node_name (); void undefindex (), top_defindex (), gen_defindex (); void define_user_command (); void free_pending_notes (), output_pending_notes (); +char **get_brace_args (); +char *expansion (); +int array_len (); +void free_array (); +static int end_of_sentence_p (); +static void isolate_nodename (); void reader_loop (), read_command (); void remember_brace (), remember_brace_1 (); void pop_and_call_brace (), discard_braces (); -void add_word_args (), add_word (), add_char (), insert (), flush_output (); +void add_word (), add_char (), insert (), flush_output (); void insert_string (); void close_paragraph_with_lines (), close_paragraph (); void ignore_blank_line (); -void do_flush_right_indentation (); +void do_flush_right_indentation (), discard_insertions (); void start_paragraph (), indent (); +#if defined (VA_FPRINTF) && __STDC__ +/* Unfortunately we must use prototypes if we are to use <stdarg.h>. */ +void add_word_args (char *, ...); +void execute_string (char *, ...); +#else +void add_word_args (); +void execute_string (); +#endif /* will not use prototypes */ void insert_self (), insert_space (), cm_ignore_line (); @@ -477,8 +460,8 @@ void cm_TeX (), cm_asterisk (), cm_bullet (), cm_cite (), cm_code (), cm_copyright (), cm_ctrl (), cm_dfn (), cm_dircategory (), cm_direntry (), cm_dots (), cm_emph (), cm_enddots (), - cm_kbd (), cm_angle_brackets (), cm_no_op (), cm_not_fixed_width (), - cm_strong (), cm_var (), cm_w (); + cm_kbd (), cm_key (), cm_no_op (), cm_no_op_line_arg (), + cm_not_fixed_width (), cm_strong (), cm_var_sc (), cm_w (), cm_image (); /* Sectioning. */ void @@ -489,21 +472,22 @@ void cm_heading (), cm_chapheading (), cm_subheading (), cm_subsubheading (), cm_majorheading (), cm_raisesections (), cm_lowersections (); -/* All @defxxx commands map to cm_defun, most accent commands map to +/* All @def... commands map to cm_defun, most accent commands map to cm_accent, most non-English letters map to cm_special_char. */ void cm_defun (), cm_accent (), cm_special_char (), cm_dotless (); void cm_node (), cm_menu (), cm_xref (), cm_ftable (), cm_vtable (), cm_pxref (), - cm_inforef (), cm_quotation (), cm_display (), cm_itemize (), + cm_inforef (), cm_uref (), cm_email (), cm_quotation (), + cm_display (), cm_itemize (), cm_enumerate (), cm_tab (), cm_table (), cm_itemx (), cm_noindent (), cm_setfilename (), cm_br (), cm_sp (), cm_page (), cm_group (), cm_center (), cm_include (), cm_bye (), cm_item (), cm_end (), - cm_ifinfo (), cm_kindex (), cm_cindex (), + cm_ifinfo (), cm_ifnothtml (), cm_ifnottex (), cm_kindex (), cm_cindex (), cm_findex (), cm_pindex (), cm_vindex (), cm_tindex (), cm_synindex (), cm_printindex (), cm_minus (), cm_footnote (), cm_example (), cm_smallexample (), cm_lisp (), cm_format (), cm_exdent (), - cm_defindex (), cm_defcodeindex (), cm_sc (), cm_result (), cm_expansion (), + cm_defindex (), cm_defcodeindex (), cm_result (), cm_expansion (), cm_equiv (), cm_print (), cm_error (), cm_point (), cm_today (), cm_flushleft (), cm_flushright (), cm_smalllisp (), cm_finalout (), cm_cartouche (), cm_detailmenu (), cm_multitable (); @@ -538,7 +522,7 @@ int user_command_array_len = 0; #define NO_BRACE_ARGS 0 #define BRACE_ARGS 1 -static COMMAND CommandTable[] = { +static COMMAND command_table[] = { { "\t", insert_space, NO_BRACE_ARGS }, { "\n", insert_space, NO_BRACE_ARGS }, { " ", insert_self, NO_BRACE_ARGS }, @@ -638,7 +622,7 @@ static COMMAND CommandTable[] = { { "dotaccent", cm_accent, BRACE_ARGS }, { "dotless", cm_dotless, BRACE_ARGS }, { "dots", cm_dots, BRACE_ARGS }, - { "email", cm_angle_brackets, BRACE_ARGS }, + { "email", cm_email, BRACE_ARGS }, { "emph", cm_emph, BRACE_ARGS }, { "end", cm_end, NO_BRACE_ARGS }, { "enddots", cm_enddots, BRACE_ARGS }, @@ -661,29 +645,33 @@ static COMMAND CommandTable[] = { { "group", cm_group, NO_BRACE_ARGS }, { "heading", cm_heading, NO_BRACE_ARGS }, { "headings", cm_ignore_line, NO_BRACE_ARGS }, + { "html", command_name_condition, NO_BRACE_ARGS }, { "hyphenation", cm_no_op, BRACE_ARGS }, { "i", cm_not_fixed_width, BRACE_ARGS }, { "ifclear", cm_ifclear, NO_BRACE_ARGS }, { "ifeq", cm_ifeq, NO_BRACE_ARGS }, { "ifhtml", command_name_condition, NO_BRACE_ARGS }, { "ifinfo", cm_ifinfo, NO_BRACE_ARGS }, + { "ifnothtml", cm_ifnothtml, NO_BRACE_ARGS }, + { "ifnotinfo", command_name_condition, NO_BRACE_ARGS }, + { "ifnottex", cm_ifnottex, NO_BRACE_ARGS }, { "ifset", cm_ifset, NO_BRACE_ARGS }, { "iftex", command_name_condition, NO_BRACE_ARGS }, { "ignore", command_name_condition, NO_BRACE_ARGS }, + { "image", cm_image, BRACE_ARGS }, { "include", cm_include, NO_BRACE_ARGS }, { "inforef", cm_inforef, BRACE_ARGS }, { "item", cm_item, NO_BRACE_ARGS }, { "itemize", cm_itemize, NO_BRACE_ARGS }, { "itemx", cm_itemx, NO_BRACE_ARGS }, { "kbd", cm_kbd, BRACE_ARGS }, - { "key", cm_angle_brackets, BRACE_ARGS }, + { "kbdinputstyle", cm_no_op_line_arg, NO_BRACE_ARGS }, + { "key", cm_key, BRACE_ARGS }, { "kindex", cm_kindex, NO_BRACE_ARGS }, { "l", cm_special_char, BRACE_ARGS }, { "lisp", cm_lisp, NO_BRACE_ARGS }, { "lowersections", cm_lowersections, NO_BRACE_ARGS }, -#if defined (HAVE_MACROS) { "macro", cm_macro, NO_BRACE_ARGS }, -#endif { "majorheading", cm_majorheading, NO_BRACE_ARGS }, { "math", cm_no_op, BRACE_ARGS }, { "menu", cm_menu, NO_BRACE_ARGS }, @@ -712,7 +700,7 @@ static COMMAND CommandTable[] = { { "result", cm_result, BRACE_ARGS }, { "ringaccent", cm_accent, BRACE_ARGS }, { "samp", cm_code, BRACE_ARGS }, - { "sc", cm_sc, BRACE_ARGS }, + { "sc", cm_var_sc, BRACE_ARGS }, { "section", cm_section, NO_BRACE_ARGS }, { "set", cm_set, NO_BRACE_ARGS }, { "setchapternewpage", cm_ignore_line, NO_BRACE_ARGS }, @@ -754,10 +742,11 @@ static COMMAND CommandTable[] = { { "unnumberedsec", cm_unnumberedsec, NO_BRACE_ARGS }, { "unnumberedsubsec", cm_unnumberedsubsec, NO_BRACE_ARGS }, { "unnumberedsubsubsec", cm_unnumberedsubsubsec, NO_BRACE_ARGS }, + { "uref", cm_uref, BRACE_ARGS }, { "url", cm_code, BRACE_ARGS }, { "v", cm_accent, BRACE_ARGS }, { "value", cm_value, BRACE_ARGS }, - { "var", cm_var, BRACE_ARGS }, + { "var", cm_var_sc, BRACE_ARGS }, { "vindex", cm_vindex, NO_BRACE_ARGS }, { "vtable", cm_vtable, NO_BRACE_ARGS }, { "w", cm_w, BRACE_ARGS }, @@ -778,48 +767,160 @@ static COMMAND CommandTable[] = { { "iunnumberedsubsec", cm_ideprecated, NO_BRACE_ARGS }, { "iunnumberedsubsubsec", cm_ideprecated, NO_BRACE_ARGS }, - /* Now @include does what this was supposed to. */ + /* Now @include does what this was used to. */ { "infoinclude", cm_obsolete, NO_BRACE_ARGS }, { "titlespec", cm_obsolete, NO_BRACE_ARGS }, - {(char *) NULL, (COMMAND_FUNCTION *) NULL, NO_BRACE_ARGS} + { NULL, NULL, NO_BRACE_ARGS } }; struct option long_options[] = { - { "error-limit", 1, 0, 'e' }, /* formerly -el */ - { "fill-column", 1, 0, 'f' }, /* formerly -fc */ - { "footnote-style", 1, 0, 's' }, /* formerly -ft */ - { "no-headers", 0, &no_headers, 1 }, /* Do not output Node: foo */ + { "error-limit", 1, 0, 'e' }, /* formerly -el */ + { "fill-column", 1, 0, 'f' }, /* formerly -fc */ + { "footnote-style", 1, 0, 's' }, /* formerly -ft */ + { "force", 0, 0, 'F' }, /* do not remove output */ + { "no-headers", 0, &no_headers, 1 }, /* do not output Node: foo */ { "no-pointer-validate", 0, &validating, 0 }, /* formerly -nv */ - { "no-validate", 0, &validating, 0 }, /* formerly -nv */ - { "no-split", 0, &splitting, 0 }, /* formerly -ns */ - { "no-warn", 0, &print_warnings, 0 }, /* formerly -nw */ -#if defined (HAVE_MACROS) + { "no-validate", 0, &validating, 0 }, /* formerly -nv */ + { "no-split", 0, &splitting, 0 }, /* formerly -ns */ + { "no-warn", 0, &print_warnings, 0 }, /* formerly -nw */ { "macro-expand", 1, 0, 'E' }, -#endif /* HAVE_MACROS */ { "number-footnotes", 0, &number_footnotes, 1 }, { "no-number-footnotes", 0, &number_footnotes, 0 }, { "output", 1, 0, 'o' }, - { "paragraph-indent", 1, 0, 'p' }, /* formerly -pi */ - { "reference-limit", 1, 0, 'r' }, /* formerly -rl */ - { "verbose", 0, &verbose_mode, 1 }, /* formerly -verbose */ + { "paragraph-indent", 1, 0, 'p' }, /* formerly -pi */ + { "reference-limit", 1, 0, 'r' }, /* formerly -rl */ + { "verbose", 0, &verbose_mode, 1 }, /* formerly -verbose */ { "help", 0, 0, 'h' }, { "version", 0, 0, 'V' }, {NULL, 0, NULL, 0} }; -/* Values for calling handle_variable_internal (). */ -#define SET 1 -#define CLEAR 2 -#define IFSET 3 -#define IFCLEAR 4 +/* **************************************************************** */ +/* */ +/* Error Handling */ +/* */ +/* **************************************************************** */ + +/* Number of errors encountered. */ +int errors_printed = 0; + +/* Print the last error gotten from the file system. */ +int +fs_error (filename) + char *filename; +{ + remember_error (); + perror (filename); + return (0); +} + +/* Print an error message, and return false. */ +void +#if defined (VA_FPRINTF) && __STDC__ +error (char *format, ...) +#else +error (format, va_alist) + char *format; + va_dcl +#endif +{ +#ifdef VA_FPRINTF + va_list ap; +#endif + + remember_error (); + + VA_START (ap, format); +#ifdef VA_FPRINTF + VA_FPRINTF (stderr, format, ap); +#else + fprintf (stderr, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_FPRINTF */ + va_end (ap); + + putc ('\n', stderr); +} + +/* Just like error (), but print the line number as well. */ +void +#if defined (VA_FPRINTF) && __STDC__ +line_error (char *format, ...) +#else +line_error (format, va_alist) + char *format; + va_dcl +#endif +{ +#ifdef VA_FPRINTF + va_list ap; +#endif + + remember_error (); + fprintf (stderr, "%s:%d: ", input_filename, line_number); + + VA_START (ap, format); +#ifdef VA_FPRINTF + VA_FPRINTF (stderr, format, ap); +#else + fprintf (stderr, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_FPRINTF */ + va_end (ap); + + fprintf (stderr, ".\n"); +} + +void +#if defined (VA_FPRINTF) && __STDC__ +warning (char *format, ...) +#else +warning (format, va_alist) + char *format; + va_dcl +#endif +{ +#ifdef VA_FPRINTF + va_list ap; +#endif + + if (print_warnings) + { + fprintf (stderr, _("%s:%d: warning: "), input_filename, line_number); + VA_START (ap, format); +#ifdef VA_FPRINTF + VA_FPRINTF (stderr, format, ap); +#else + fprintf (stderr, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_FPRINTF */ + va_end (ap); + + fprintf (stderr, ".\n"); + } +} + + +/* Remember that an error has been printed. If more than + max_error_level have been printed, then exit the program. */ +void +remember_error () +{ + errors_printed++; + if (max_error_level && (errors_printed > max_error_level)) + { + fprintf (stderr, _("Too many errors! Gave up.\n")); + flush_file_stack (); + cm_bye (); + exit (FATAL); + } +} + /* **************************************************************** */ -/* */ -/* Main () Start of code */ -/* */ +/* */ +/* Main () Start of code */ +/* */ /* **************************************************************** */ /* For each file mentioned in the command line, process it, turning @@ -837,144 +938,173 @@ main (argc, argv) /* The name of this program is the last filename in argv[0]. */ progname = filename_part (argv[0]); +#ifdef HAVE_SETLOCALE + /* Do not use LC_ALL, because LC_NUMERIC screws up the scanf parsing + of the argument to @multicolumn. */ + setlocale (LC_TIME, ""); + setlocale (LC_MESSAGES, ""); +#endif + + /* Set the text message domain. */ + bindtextdomain (PACKAGE, LOCALEDIR); + textdomain (PACKAGE); + /* Parse argument flags from the input line. */ - while ((c = getopt_long - (argc, argv, -#if defined (HAVE_MACROS) - "D:E:U:I:f:o:p:e:r:s:V", -#else - "D:U:I:f:o:p:e:r:s:V", -#endif /* !HAVE_MACROS */ - long_options, &ind)) - != EOF) + while ((c = getopt_long (argc, argv, "D:e:E:f:I:o:p:P:r:s:U:V", + long_options, &ind)) != EOF) { if (c == 0 && long_options[ind].flag == 0) - c = long_options[ind].val; + c = long_options[ind].val; switch (c) - { - /* User specified variable to set or clear? */ - case 'D': - case 'U': - handle_variable_internal ((c == 'D') ? SET : CLEAR, optarg); - break; - -#if defined (HAVE_MACROS) - /* Use specified a macro expansion output file? */ - case 'E': - if (!macro_expansion_output_stream) - { - macro_expansion_output_stream = fopen (optarg, "w"); - if (!macro_expansion_output_stream) - error ("Couldn't open macro expansion output \"%s\"", optarg); - } - else - error ("Cannot specify more than one macro expansion output"); - break; -#endif /* HAVE_MACROS */ - - /* User specified include file path? */ - case 'I': - if (!include_files_path) - include_files_path = strdup ("."); - - include_files_path = (char *) - xrealloc (include_files_path, - 2 + strlen (include_files_path) + strlen (optarg)); - strcat (include_files_path, ":"); - strcat (include_files_path, optarg); - break; - - /* User specified fill_column? */ - case 'f': - if (sscanf (optarg, "%d", &fill_column) != 1) - { - fprintf (stderr, - "%s: --fill-column arg must be numeric, not `%s'.\n", - progname, optarg); - usage (FATAL); - } - break; - - /* User specified output file? */ - case 'o': - command_output_filename = strdup (optarg); - break; - - /* User specified paragraph indent (paragraph_start_index)? */ - case 'p': - if (set_paragraph_indent (optarg) < 0) - { - fprintf (stderr, - "%s: --paragraph-indent arg must be numeric/none/asis, not `%s'.\n", - progname, optarg); - usage (FATAL); - } - break; - - /* User specified error level? */ - case 'e': - if (sscanf (optarg, "%d", &max_error_level) != 1) - { - fprintf (stderr, - "%s: --error-limit arg must be numeric, not `%s'.\n", - progname, optarg); - } - usage (stderr, FATAL); - break; - - /* User specified reference warning limit? */ - case 'r': - if (sscanf (optarg, "%d", &reference_warning_limit) != 1) - { - fprintf (stderr, - "%s: --reference-limit arg must be numeric, not `%s'.\n", + { + case 'D': + case 'U': + /* User specified variable to set or clear. */ + handle_variable_internal ((c == 'D') ? SET : CLEAR, optarg); + break; + + case 'e': + /* User specified error level. */ + if (sscanf (optarg, "%d", &max_error_level) != 1) + { + fprintf (stderr, + _("%s: %s arg must be numeric, not `%s'.\n"), + "--error-limit", progname, optarg); + usage (stderr, FATAL); + } + break; + + case 'E': + /* User specified a macro expansion output file. */ + if (!macro_expansion_output_stream) + { + macro_expansion_filename = optarg; + macro_expansion_output_stream + = strcmp (optarg, "-") == 0 ? stdout : fopen (optarg, "w"); + if (!macro_expansion_output_stream) + error (_("Couldn't open macro expansion output `%s'"), optarg); + } + else + error (_("Cannot specify more than one macro expansion output")); + break; + + case 'f': + /* User specified fill_column. */ + if (sscanf (optarg, "%d", &fill_column) != 1) + { + fprintf (stderr, + _("%s: %s arg must be numeric, not `%s'.\n"), + "--fill-column", progname, optarg); + usage (FATAL); + } + break; + + case 'F': + force++; /* Do not remove erroneous output. */ + break; + + case 'h': + usage (NO_ERROR); + break; + + case 'I': + /* Append user-specified dir to include file path. */ + if (!include_files_path) + include_files_path = xstrdup ("."); + + include_files_path = (char *) + xrealloc (include_files_path, + 2 + strlen (include_files_path) + strlen (optarg)); + strcat (include_files_path, ":"); + strcat (include_files_path, optarg); + break; + + case 'o': + /* User specified output file. */ + command_output_filename = xstrdup (optarg); + break; + + case 'p': + /* User specified paragraph indent (paragraph_start_index). */ + if (set_paragraph_indent (optarg) < 0) + { + fprintf (stderr, + _("%s: --paragraph-indent arg must be numeric/`none'/`asis', not `%s'.\n"), progname, optarg); - usage (FATAL); - } - break; - - /* User specified footnote style? */ - case 's': - if (set_footnote_style (optarg) < 0) - { - fprintf (stderr, - "%s: --footnote-style arg must be `separate' or `end', not `%s'.\n", + usage (FATAL); + } + break; + + case 'P': + /* Prepend user-specified include dir to include path. */ + if (!include_files_path) + { + include_files_path = xstrdup (optarg); + include_files_path = (char *) xrealloc (include_files_path, + strlen (include_files_path) + 3); /* 3 for ":.\0" */ + strcat (include_files_path, ":."); + } + else + { + char *tmp = xstrdup (include_files_path); + include_files_path = (char *) xrealloc (include_files_path, + strlen (include_files_path) + strlen (optarg) + 2); /* 2 for ":\0" */ + strcpy (include_files_path, optarg); + strcat (include_files_path, ":"); + strcat (include_files_path, tmp); + free (tmp); + } + break; + + case 'r': + /* User specified reference warning limit. */ + if (sscanf (optarg, "%d", &reference_warning_limit) != 1) + { + fprintf (stderr, + _("%s: %s arg must be numeric, not `%s'.\n"), + "--reference-limit", progname, optarg); + usage (FATAL); + } + break; + + case 's': + /* User specified footnote style. */ + if (set_footnote_style (optarg) < 0) + { + fprintf (stderr, + _("%s: --footnote-style arg must be `separate' or `end', not `%s'.\n"), progname, optarg); - usage (FATAL); - } - footnote_style_preset = 1; - break; - - case 'h': - usage (NO_ERROR); - break; - - /* User requested version info? */ - case 'V': - print_version_info (); - puts ("Copyright (C) 1996 Free Software Foundation, Inc.\n\ + usage (FATAL); + } + footnote_style_preset = 1; + break; + + case 'V': + /* User requested version info. */ + print_version_info (); + puts (_("Copyright (C) 1996 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."); - exit (NO_ERROR); - break; +For more information about these matters, see the files named COPYING.")); + exit (NO_ERROR); + break; - case '?': - usage (FATAL); - break; - } + case '?': + usage (FATAL); + break; + } } if (optind == argc) { /* Check to see if input is a file. If so, process that. */ if (!isatty (fileno (stdin))) - reading_from_stdin = 1; + reading_from_stdin = 1; else { - fprintf (stderr, "%s: missing file argument.\n", progname); - usage (FATAL); + fprintf (stderr, _("%s: missing file argument.\n"), progname); + usage (FATAL); } } @@ -986,10 +1116,9 @@ For more information about these matters, see the files named COPYING."); { splitting = 0; - /* If the user has not specified an output file, then use stdout by - default. */ + /* If the user has not specified an output file, use stdout. */ if (!command_output_filename) - command_output_filename = strdup ("-"); + command_output_filename = xstrdup ("-"); } if (verbose_mode) @@ -1000,7 +1129,7 @@ For more information about these matters, see the files named COPYING."); if (!reading_from_stdin) { while (optind != argc) - convert_from_file (argv[optind++]); + convert_from_file (argv[optind++]); } else convert_from_stream (stdin, "stdin"); @@ -1015,41 +1144,8 @@ For more information about these matters, see the files named COPYING."); void print_version_info () { - printf ("GNU Makeinfo (Texinfo 3.9) %d.%d\n", major_version, minor_version); -} - -/* **************************************************************** */ -/* */ -/* Generic Utilities */ -/* */ -/* **************************************************************** */ - -static void -memory_error (callers_name, bytes_wanted) - char *callers_name; - int bytes_wanted; -{ - char printable_string[80]; - - sprintf (printable_string, - "Virtual memory exhausted in %s ()! Needed %d bytes.", - callers_name, bytes_wanted); - - error (printable_string); - abort (); -} - -/* Just like malloc, but kills the program in case of fatal error. */ -void * -xmalloc (nbytes) - unsigned int nbytes; -{ - void *temp = (void *) malloc (nbytes); - - if (nbytes && temp == (void *)NULL) - memory_error ("xmalloc", nbytes); - - return (temp); + printf (_("makeinfo (GNU %s %s) %d.%d\n"), PACKAGE, VERSION, + major_version, minor_version); } /* Like realloc (), but barfs if there isn't enough memory. */ @@ -1079,17 +1175,18 @@ usage (exit_value) int exit_value; { if (exit_value != 0) - fprintf (stderr, "Try `%s --help' for more information.\n", progname); + fprintf (stderr, _("Try `%s --help' for more information.\n"), progname); else - printf ("Usage: %s [OPTION]... TEXINFO-FILE...\n\ + printf (_("Usage: %s [OPTION]... TEXINFO-FILE...\n\ \n\ Translate Texinfo source documentation to a format suitable for reading\n\ with GNU Info.\n\ \n\ Options:\n\ -D VAR define a variable, as with @set.\n\ --E MACRO-OFILE process macros only, output texinfo source.\n\ --I DIR add DIR to the directory search list for @include.\n\ +-E MACRO-OFILE process macros only, output texinfo source.\n\ +-I DIR append DIR to the @include directory search path.\n\ +-P DIR prepend DIR to the @include directory search path.\n\ -U VAR undefine a variable, as with @clear.\n\ --error-limit NUM quit after NUM errors (default %d).\n\ --fill-column NUM break lines at NUM characters (default %d).\n\ @@ -1097,21 +1194,24 @@ Options:\n\ `separate' to place footnotes in their own node,\n\ `end' to place the footnotes at the end of\n\ the node in which they are defined (the default).\n\ +--force preserve output even if errors.\n\ --help display this help and exit.\n\ --no-validate suppress node cross-reference validation.\n\ --no-warn suppress warnings (but not errors).\n\ --no-split suppress splitting of large files.\n\ --no-headers suppress node separators and Node: Foo headers.\n\ --output FILE, -o FILE output to FILE, and ignore any @setfilename.\n\ ---paragraph-indent NUM indent paragraphs with NUM spaces (default %d).\n\ +--paragraph-indent VAL indent paragraphs with VAL spaces (default %d).\n\ + if VAL is `none', do not indent; if VAL is `asis',\n\ + preserve any existing indentation.\n\ --reference-limit NUM complain about at most NUM references (default %d).\n\ --verbose report about what is being done.\n\ --version display version information and exit.\n\ \n\ Email bug reports to bug-texinfo@prep.ai.mit.edu.\n\ -", - progname, paragraph_start_indent, - fill_column, max_error_level, reference_warning_limit); +"), + progname, paragraph_start_indent, + fill_column, max_error_level, reference_warning_limit); exit (exit_value); } @@ -1151,7 +1251,7 @@ find_and_load (filename) { struct stat fileinfo; long file_size; - int file = -1, n, i, count = 0; + int file = -1, count = 0; char *fullpath, *result, *get_file_info_in_path (); result = fullpath = (char *)NULL; @@ -1175,24 +1275,28 @@ find_and_load (filename) readable bytes is always less than this value. The arcane mysteries of VMS/RMS are too much to probe, so this hack suffices to make things work. */ -#if defined (VMS) +#if defined (VMS) || defined (WIN32) +#ifdef VMS while ((n = read (file, result + count, file_size)) > 0) +#else /* WIN32 */ + while ((n = read (file, result + count, 1)) > 0) +#endif /* WIN32 */ count += n; if (n == -1) -#else /* !VMS */ +#else /* !VMS && !WIN32 */ count = file_size; if (read (file, result, file_size) != file_size) -#endif /* !VMS */ +#endif /* !VMS && !WIN32 */ error_exit: { if (result) - free (result); + free (result); if (fullpath) - free (fullpath); + free (fullpath); if (file != -1) - close (file); + close (file); return ((char *) NULL); } @@ -1202,7 +1306,7 @@ find_and_load (filename) input_text = result; size_of_input_text = count; input_filename = fullpath; - node_filename = strdup (fullpath); + node_filename = xstrdup (fullpath); input_text_offset = 0; line_number = 1; /* Not strictly necessary. This magic prevents read_token () from doing @@ -1237,7 +1341,7 @@ popfile () FSTACK *tos = filestack; if (!tos) - abort (); /* My fault. I wonder what I did? */ + abort (); /* My fault. I wonder what I did? */ #if defined (HAVE_MACROS) if (macro_expansion_output_stream) @@ -1316,7 +1420,7 @@ filename_part (filename) else basename++; - basename = strdup (basename); + basename = xstrdup (basename); #if defined (REMOVE_OUTPUT_EXTENSIONS) /* See if there is an extension to remove. If so, remove it. */ @@ -1325,7 +1429,7 @@ filename_part (filename) temp = strrchr (basename, '.'); if (temp) - *temp = '\0'; + *temp = 0; } #endif /* REMOVE_OUTPUT_EXTENSIONS */ return (basename); @@ -1353,7 +1457,7 @@ pathname_part (filename) { result = (char *)xmalloc (1 + i); strncpy (result, filename, i); - result[i] = '\0'; + result[i] = 0; } free (filename); return (result); @@ -1367,9 +1471,9 @@ filename_non_directory (name) for (i = strlen (name) - 1; i; i--) if (name[i] == '/') - return (strdup (name + i + 1)); + return (xstrdup (name + i + 1)); - return (strdup (name)); + return (xstrdup (name)); } /* Return the expansion of FILENAME. */ @@ -1387,24 +1491,24 @@ expand_filename (filename, input_name) filename = filename_non_directory (input_name); if (!*filename) - { - free (filename); - filename = strdup ("noname.texi"); - } + { + free (filename); + filename = xstrdup ("noname.texi"); + } for (i = strlen (filename) - 1; i; i--) - if (filename[i] == '.') - break; + if (filename[i] == '.') + break; if (!i) - i = strlen (filename); + i = strlen (filename); if (i + 6 > (strlen (filename))) - filename = (char *)xrealloc (filename, i + 6); + filename = (char *)xrealloc (filename, i + 6); strcpy (filename + i, ".info"); return (filename); } - + if (filename[0] == '.' || filename[0] == '/') return (filename); @@ -1419,10 +1523,10 @@ expand_filename (filename, input_name) strcpy (result, input_name); while (result[i] != '/' && i) - i--; + i--; if (result[i] == '/') - i++; + i++; strcpy (&result[i], filename); free (filename); @@ -1441,13 +1545,13 @@ full_pathname (filename) /* No filename given? */ if (!filename || !(initial_character = *filename)) - return (strdup ("")); + return (xstrdup ("")); /* Already absolute? */ if ((initial_character == '/') || ((strncmp (filename, "./", 2) == 0) || (strncmp (filename, "../", 3) == 0))) - return (strdup (filename)); + return (xstrdup (filename)); if (initial_character != '~') { @@ -1457,66 +1561,68 @@ full_pathname (filename) #if defined (HAVE_GETCWD) if (!getcwd (localdir, 1024)) #else /* !HAVE_GETCWD */ - if (!getwd (localdir)) + if (!getwd (localdir)) #endif /* !HAVE_GETCWD */ - { - fprintf (stderr, "%s: getwd: %s, %s\n", - progname, filename, localdir); - exit (1); - } + { + fprintf (stderr, _("%s: getwd: %s, %s\n"), + progname, filename, localdir); + exit (1); + } strcat (localdir, "/"); strcat (localdir, filename); - result = strdup (localdir); + result = xstrdup (localdir); free (localdir); } else { +#ifndef WIN32 if (filename[1] == '/') - { - /* Return the concatenation of the environment variable HOME - and the rest of the string. */ - char *temp_home; - - temp_home = (char *) getenv ("HOME"); - result = (char *)xmalloc (strlen (&filename[1]) - + 1 - + temp_home ? strlen (temp_home) - : 0); - *result = '\0'; - - if (temp_home) - strcpy (result, temp_home); - - strcat (result, &filename[1]); - } + { + /* Return the concatenation of the environment variable HOME + and the rest of the string. */ + char *temp_home; + + temp_home = (char *) getenv ("HOME"); + result = (char *)xmalloc (strlen (&filename[1]) + + 1 + + temp_home ? strlen (temp_home) + : 0); + *result = 0; + + if (temp_home) + strcpy (result, temp_home); + + strcat (result, &filename[1]); + } else - { - struct passwd *user_entry; - int i, c; - char *username = (char *)xmalloc (257); - - for (i = 1; c = filename[i]; i++) - { - if (c == '/') - break; - else - username[i - 1] = c; - } - if (c) - username[i - 1] = '\0'; - - user_entry = getpwnam (username); - - if (!user_entry) - return (strdup (filename)); - - result = (char *)xmalloc (1 + strlen (user_entry->pw_dir) - + strlen (&filename[i])); - strcpy (result, user_entry->pw_dir); - strcat (result, &filename[i]); - } + { + struct passwd *user_entry; + int i, c; + char *username = (char *)xmalloc (257); + + for (i = 1; (c = filename[i]); i++) + { + if (c == '/') + break; + else + username[i - 1] = c; + } + if (c) + username[i - 1] = 0; + + user_entry = getpwnam (username); + + if (!user_entry) + return (xstrdup (filename)); + + result = (char *)xmalloc (1 + strlen (user_entry->pw_dir) + + strlen (&filename[i])); + strcpy (result, user_entry->pw_dir); + strcat (result, &filename[i]); + } } +#endif /* not WIN32 */ return (result); } @@ -1528,139 +1634,9 @@ output_name_from_input_name (name) } /* **************************************************************** */ -/* */ -/* Error Handling */ -/* */ -/* **************************************************************** */ - -/* Number of errors encountered. */ -int errors_printed = 0; - -/* Print the last error gotten from the file system. */ -int -fs_error (filename) - char *filename; -{ - remember_error (); - perror (filename); - return (0); -} - -/* Print an error message, and return false. */ -#if defined (HAVE_VARARGS_H) && defined (HAVE_VFPRINTF) - -int -error (va_alist) - va_dcl -{ - char *format; - va_list args; - - remember_error (); - va_start (args); - format = va_arg (args, char *); - vfprintf (stderr, format, args); - va_end (args); - putc ('\n', stderr); -} - -/* Just like error (), but print the line number as well. */ -int -line_error (va_alist) - va_dcl -{ - char *format; - va_list args; - - remember_error (); - va_start (args); - format = va_arg (args, char *); - fprintf (stderr, "%s:%d: ", input_filename, line_number); - vfprintf (stderr, format, args); - fprintf (stderr, ".\n"); - va_end (args); - return ((int) 0); -} - -int -warning (va_alist) - va_dcl -{ - char *format; - va_list args; - - va_start (args); - format = va_arg (args, char *); - if (print_warnings) - { - fprintf (stderr, "%s:%d: Warning: ", input_filename, line_number); - vfprintf (stderr, format, args); - fprintf (stderr, ".\n"); - } - va_end (args); - return ((int) 0); -} - -#else /* !(HAVE_VARARGS_H && HAVE_VFPRINTF) */ - -int -error (format, arg1, arg2, arg3, arg4, arg5) - char *format; -{ - remember_error (); - fprintf (stderr, format, arg1, arg2, arg3, arg4, arg5); - putc ('\n', stderr); - return ((int) 0); -} - -/* Just like error (), but print the line number as well. */ -int -line_error (format, arg1, arg2, arg3, arg4, arg5) - char *format; -{ - remember_error (); - fprintf (stderr, "%s:%d: ", input_filename, line_number); - fprintf (stderr, format, arg1, arg2, arg3, arg4, arg5); - fprintf (stderr, ".\n"); - return ((int) 0); -} - -int -warning (format, arg1, arg2, arg3, arg4, arg5) - char *format; -{ - if (print_warnings) - { - fprintf (stderr, "%s:%d: Warning: ", input_filename, line_number); - fprintf (stderr, format, arg1, arg2, arg3, arg4, arg5); - fprintf (stderr, ".\n"); - } - return ((int) 0); -} - -#endif /* !(HAVE_VARARGS_H && HAVE_VFPRINTF) */ - -/* Remember that an error has been printed. If this is the first - error printed, then tell them which program is printing them. - If more than max_error_level have been printed, then exit the - program. */ -void -remember_error () -{ - errors_printed++; - if (max_error_level && (errors_printed > max_error_level)) - { - fprintf (stderr, "Too many errors! Gave up.\n"); - flush_file_stack (); - cm_bye (); - exit (1); - } -} - -/* **************************************************************** */ -/* */ -/* Hacking Tokens and Strings */ -/* */ +/* */ +/* Hacking Tokens and Strings */ +/* */ /* **************************************************************** */ /* Return the next token as a string pointer. We cons the string. */ @@ -1678,24 +1654,24 @@ read_token () input_text_offset++; if (character == '\n') - line_number++; + line_number++; - result = strdup (" "); + result = xstrdup (" "); *result = character; return (result); } for (i = 0; ((input_text_offset != size_of_input_text) - && (character = curchar ()) - && command_char (character)); + && (character = curchar ()) + && command_char (character)); i++, input_text_offset++); result = (char *)xmalloc (i + 1); memcpy (result, &input_text[input_text_offset - i], i); - result[i] = '\0'; + result[i] = 0; return (result); } -/* Return non-zero if CHARACTER is self-delimiting. */ +/* Return nonzero if CHARACTER is self-delimiting. */ int self_delimiting (character) int character; @@ -1719,17 +1695,17 @@ canon_white (string) for (x = 0; x < len; x++) { if (!cr_or_whitespace (string[x])) - { - strcpy (string, string + x); - break; - } + { + strcpy (string, string + x); + break; + } } len = strlen (string); if (len) len--; while (len > -1 && cr_or_whitespace (string[len])) len--; - string[len + 1] = '\0'; + string[len + 1] = 0; } /* Bash STRING, replacing all whitespace with just one space. */ @@ -1749,15 +1725,15 @@ fix_whitespace (string) c = temp[temp_index++] = string[string_index++]; if (c == ' ' || c == '\n' || c == '\t') - { - temp[temp_index - 1] = ' '; - while ((c = string[string_index]) && (c == ' ' || - c == '\t' || - c == '\n')) - string_index++; - } - } - temp[temp_index] = '\0'; + { + temp[temp_index - 1] = ' '; + while ((c = string[string_index]) && (c == ' ' || + c == '\t' || + c == '\n')) + string_index++; + } + } + temp[temp_index] = 0; strcpy (string, temp); free (temp); } @@ -1783,10 +1759,10 @@ discard_until (string) input_text_offset = size_of_input_text - strlen (string); if (strcmp (string, "\n") != 0) - { - line_error ("Expected `%s'", string); - return; - } + { + line_error (_("Expected `%s'"), string); + return; + } } else input_text_offset = temp; @@ -1820,7 +1796,7 @@ get_until (match, string) *string = (char *)xmalloc (len + 1); memcpy (*string, &input_text[current_point], len); - (*string)[len] = '\0'; + (*string)[len] = 0; /* Now leave input_text_offset in a consistent state. */ input_text_offset = tem; @@ -1834,18 +1810,65 @@ get_until (match, string) /* Read characters from the file until we are at MATCH or end of line. Place the characters read into STRING. */ void -get_until_in_line (match, string) +get_until_in_line (expand, match, string) + int expand; char *match, **string; { - int real_bottom, temp; - - real_bottom = size_of_input_text; - temp = search_forward ("\n", input_text_offset); - - if (temp < 0) - temp = size_of_input_text; + int real_bottom = size_of_input_text; + int limit = search_forward ("\n", input_text_offset); + if (limit < 0) + limit = size_of_input_text; + + /* Replace input_text[input_text_offset .. limit-1] with its macro + expansion (actually, we expand all commands). This allows the node + names themselves to be constructed via a macro, as in: + @macro foo{p, q} + Together: \p\ & \q\. + @end macro + + @node @foo{A,B}, next, prev, top + + Otherwise, the `,' separating the macro args A and B is taken as + the node argument separator, so the node name is `@foo{A'. This + expansion is only necessary on the first call, since we expand the + whole line then. + + Furthermore, if we're executing a string, don't do it -- we'll end + up shrinking the execution string which is currently aliased to + `input_text', so it might get moved, and not updated in the + `execution_strings' array. This happens when processing the + (synthetic) Overview-Footnotes node in the Texinfo manual. */ + + if (expand && !executing_string) + { + char *xp; + unsigned xp_len, new_len; + + /* Get original string from input. */ + unsigned raw_len = limit - input_text_offset; + char *str = xmalloc (raw_len + 1); + strncpy (str, input_text + input_text_offset, raw_len); + str[raw_len] = 0; + + /* Expand it. */ + xp = expansion (str, 0); + xp_len = strlen (xp); + free (str); + + /* Plunk the expansion into the middle of input_text. */ + str = xstrdup (input_text + limit); + new_len = input_text_offset + xp_len + strlen (str) + 1; + input_text = xrealloc (input_text, new_len); + strcpy (input_text + input_text_offset, xp); + strcat (input_text, str); + free (str); + free (xp); + + limit += xp_len - raw_len; + real_bottom += xp_len - raw_len; + } - size_of_input_text = temp; + size_of_input_text = limit; get_until (match, string); size_of_input_text = real_bottom; } @@ -1857,7 +1880,7 @@ get_rest_of_line (string) get_until ("\n", string); canon_white (*string); - if (curchar () == '\n') /* as opposed to the end of the file... */ + if (curchar () == '\n') /* as opposed to the end of the file... */ { line_number++; input_text_offset++; @@ -1873,7 +1896,7 @@ backup_input_pointer () { input_text_offset--; if (curchar () == '\n') - line_number--; + line_number--; } } @@ -1883,36 +1906,36 @@ void get_until_in_braces (match, string) char *match, **string; { + char *temp; int i, brace = 0; int match_len = strlen (match); - char *temp; for (i = input_text_offset; i < size_of_input_text; i++) { if (input_text[i] == '{') - brace++; + brace++; else if (input_text[i] == '}') - brace--; + brace--; else if (input_text[i] == '\n') - line_number++; + line_number++; if (brace < 0 || - (brace == 0 && strncmp (input_text + i, match, match_len) == 0)) - break; + (brace == 0 && strncmp (input_text + i, match, match_len) == 0)) + break; } match_len = i - input_text_offset; temp = (char *)xmalloc (2 + match_len); strncpy (temp, input_text + input_text_offset, match_len); - temp[match_len] = '\0'; + temp[match_len] = 0; input_text_offset = i; *string = temp; } /* **************************************************************** */ -/* */ -/* Converting the File */ -/* */ +/* */ +/* Converting the File */ +/* */ /* **************************************************************** */ /* Convert the file named by NAME. The output is saved on the file @@ -1944,7 +1967,7 @@ initialize_conversion () on unix systems. */ #define READ_BUFFER_GROWTH (4 * 4096) -/* Convert the texinfo file coming from the open stream STREAM. Assume the +/* Convert the Texinfo file coming from the open stream STREAM. Assume the source of the stream is named NAME. */ void convert_from_stream (stream, name) @@ -1964,28 +1987,28 @@ convert_from_stream (stream, name) { int count; - if (buffer_offset + READ_BUFFER_GROWTH > buffer_size) - buffer = (char *) - xrealloc (buffer, (buffer_size += READ_BUFFER_GROWTH) + 2); + if (buffer_offset + (READ_BUFFER_GROWTH + 1) >= buffer_size) + buffer = (char *) + xrealloc (buffer, (buffer_size += READ_BUFFER_GROWTH)); count = fread (buffer + buffer_offset, 1, READ_BUFFER_GROWTH, stream); if (count < 0) - { - perror (name); - exit (FATAL); - } + { + perror (name); + exit (FATAL); + } buffer_offset += count; if (count == 0) - break; + break; } /* Set the globals to the new file. */ input_text = buffer; size_of_input_text = buffer_offset; - input_filename = strdup (name); - node_filename = strdup (name); + input_filename = xstrdup (name); + node_filename = xstrdup (name); input_text_offset = 0; line_number = 1; @@ -2017,14 +2040,14 @@ convert_from_file (name) strcat (filename, suffixes[i]); if (find_and_load (filename)) - break; + break; if (!suffixes[i][0] && strrchr (filename, '.')) - { - fs_error (filename); - free (filename); - return; - } + { + fs_error (filename); + free (filename); + return; + } } if (!suffixes[i]) @@ -2056,47 +2079,47 @@ convert_from_loaded_file (name) while (input_text_offset >= 0) { input_text_offset = - search_forward (setfilename_search, input_text_offset); + search_forward (setfilename_search, input_text_offset); if ((input_text_offset == 0) || - ((input_text_offset > 0) && - (input_text[input_text_offset -1] == '\n'))) - break; + ((input_text_offset > 0) && + (input_text[input_text_offset -1] == '\n'))) + break; else if (input_text_offset > 0) - input_text_offset++; + input_text_offset++; } if (input_text_offset < 0) { if (!command_output_filename) - { + { #if defined (REQUIRE_SETFILENAME) - error ("No `%s' found in `%s'", setfilename_search, name); - goto finished; + error (_("No `%s' found in `%s'"), setfilename_search, name); + goto finished; #else - register int i, end_of_first_line; - - /* Find the end of the first line in the file. */ - for (i = 0; i < size_of_input_text - 1; i++) - if (input_text[i] == '\n') - break; - - end_of_first_line = i + 1; - - input_text_offset = 0; - - for (i = 0; i < end_of_first_line; i++) - { - if ((input_text[i] == '\\') && - (strncmp (input_text + i + 1, "include", 7) == 0)) - { - input_text_offset = end_of_first_line; - break; - } - } - command_output_filename = output_name_from_input_name (name); + register int i, end_of_first_line; + + /* Find the end of the first line in the file. */ + for (i = 0; i < size_of_input_text - 1; i++) + if (input_text[i] == '\n') + break; + + end_of_first_line = i + 1; + + input_text_offset = 0; + + for (i = 0; i < end_of_first_line; i++) + { + if ((input_text[i] == '\\') && + (strncmp (input_text + i + 1, "include", 7) == 0)) + { + input_text_offset = end_of_first_line; + break; + } + } + command_output_filename = output_name_from_input_name (name); #endif /* !REQUIRE_SETFILENAME */ - } + } } else input_text_offset += strlen (setfilename_search); @@ -2106,9 +2129,9 @@ convert_from_loaded_file (name) else { if (input_text_offset != -1) - discard_until ("\n"); + discard_until ("\n"); else - input_text_offset = 0; + input_text_offset = 0; real_output_filename = output_filename = command_output_filename; command_output_filename = (char *)NULL; @@ -2116,25 +2139,31 @@ convert_from_loaded_file (name) canon_white (output_filename); - if (real_output_filename && - strcmp (real_output_filename, "-") == 0) + if (real_output_filename && strcmp (real_output_filename, "-") == 0) { - real_output_filename = strdup (real_output_filename); + if (macro_expansion_filename + && strcmp (macro_expansion_filename, "-") == 0) + { + fprintf (stderr, _("%s: Skipping macro expansion to stdout as Info output is going there.\n"), + progname); + macro_expansion_output_stream = NULL; + } + real_output_filename = xstrdup (real_output_filename); output_stream = stdout; - splitting = 0; /* Cannot split when writing to stdout. */ + splitting = 0; /* Cannot split when writing to stdout. */ } else { if (!real_output_filename) - real_output_filename = expand_filename (output_filename, name); + real_output_filename = expand_filename (output_filename, name); else - real_output_filename = strdup (real_output_filename); + real_output_filename = xstrdup (real_output_filename); output_stream = fopen (real_output_filename, "w"); } if (output_stream != stdout) - printf ("Making %s file `%s' from `%s'.\n", + printf (_("Making %s file `%s' from `%s'.\n"), no_headers ? "text" : "info", output_filename, input_filename); if (output_stream == NULL) @@ -2148,7 +2177,7 @@ convert_from_loaded_file (name) if (output_stream != stdout) pretty_output_filename = filename_part (output_filename); else - pretty_output_filename = strdup ("stdout"); + pretty_output_filename = xstrdup ("stdout"); /* For this file only, count the number of newlines from the top of the file to here. This way, we keep track of line numbers for @@ -2159,50 +2188,69 @@ convert_from_loaded_file (name) line_number = 1; while (temp != input_text_offset) if (input_text[temp++] == '\n') - line_number++; + line_number++; } if (!no_headers) { - add_word_args ("This is Info file %s, produced by Makeinfo version %d.%d", - output_filename, major_version, minor_version); - add_word_args (" from the input file %s.\n", input_filename); + add_word_args (_("This is Info file %s, produced by Makeinfo version %d.%d"), + output_filename, major_version, minor_version); + add_word_args (_(" from the input file %s.\n"), input_filename); } close_paragraph (); reader_loop (); finished: + discard_insertions (0); close_paragraph (); flush_file_stack (); #if defined (HAVE_MACROS) if (macro_expansion_output_stream) - fclose (macro_expansion_output_stream); + { + fclose (macro_expansion_output_stream); + if (errors_printed && !force + && strcmp (macro_expansion_filename, "-") != 0 + && strcmp (macro_expansion_filename, "/dev/null") != 0) + { + fprintf (stderr, _("%s: Removing macro output file `%s' due to errors; use --force to preserve.\n"), + progname, macro_expansion_filename); + if (unlink (macro_expansion_filename) < 0) + perror (macro_expansion_filename); + } + } #endif /* HAVE_MACROS */ - if (output_stream != NULL) + if (output_stream) { output_pending_notes (); free_pending_notes (); if (tag_table != NULL) - { - tag_table = (TAG_ENTRY *) reverse_list (tag_table); - if (!no_headers) - write_tag_table (); - } + { + tag_table = (TAG_ENTRY *) reverse_list (tag_table); + if (!no_headers) + write_tag_table (); + } if (output_stream != stdout) - fclose (output_stream); + fclose (output_stream); /* If validating, then validate the entire file right now. */ if (validating) - validate_file (tag_table); - - /* This used to test && !errors_printed. - But some files might have legit warnings. So split anyway. */ - if (splitting) - split_file (real_output_filename, 0); + validate_file (tag_table); + + if (splitting && (!errors_printed || force)) + split_file (real_output_filename, 0); + else if (errors_printed && !force + && strcmp (real_output_filename, "-") != 0 + && strcmp (real_output_filename, "/dev/null") != 0) + { /* If there were errors, and no --force, remove the output. */ + fprintf (stderr, _("%s: Removing output file `%s' due to errors; use --force to preserve.\n"), + progname, real_output_filename); + if (unlink (real_output_filename) < 0) + perror (real_output_filename); + } } free (real_output_filename); } @@ -2211,7 +2259,7 @@ void free_and_clear (pointer) char **pointer; { - if ((*pointer) != (char *) NULL) + if (*pointer) { free (*pointer); *pointer = (char *) NULL; @@ -2222,13 +2270,13 @@ free_and_clear (pointer) void init_internals () { - free_and_clear (¤t_node); free_and_clear (&output_filename); free_and_clear (&command); free_and_clear (&input_filename); free_node_references (); init_insertion_stack (); init_brace_stack (); + current_node = NULL; /* sometimes already freed */ command_index = 0; in_menu = 0; in_detailmenu = 0; @@ -2241,7 +2289,7 @@ init_paragraph () { free_and_clear (&output_paragraph); output_paragraph = (unsigned char *)xmalloc (paragraph_buffer_len); - output_paragraph[0] = '\0'; + output_paragraph[0] = 0; output_paragraph_offset = 0; output_column = 0; paragraph_is_open = 0; @@ -2263,100 +2311,99 @@ reader_loop () while (!done) { if (input_text_offset >= size_of_input_text) - break; + break; character = curchar (); if (!in_fixed_width_font && - (character == '\'' || character == '`') && - input_text[input_text_offset + 1] == character) - { - input_text_offset++; - character = '"'; - } + (character == '\'' || character == '`') && + input_text[input_text_offset + 1] == character) + { + input_text_offset++; + character = '"'; + } if (character == '-') - { - dash_count++; - if (dash_count == 2 && !in_fixed_width_font) - { - input_text_offset++; - continue; - } - } + { + dash_count++; + if (dash_count == 2 && !in_fixed_width_font) + { + input_text_offset++; + continue; + } + } else - { - dash_count = 0; - } + { + dash_count = 0; + } /* If this is a whitespace character, then check to see if the line - is blank. If so, advance to the carriage return. */ + is blank. If so, advance to the carriage return. */ if (whitespace (character)) - { - register int i = input_text_offset + 1; + { + register int i = input_text_offset + 1; - while (i < size_of_input_text && whitespace (input_text[i])) - i++; + while (i < size_of_input_text && whitespace (input_text[i])) + i++; - if (i == size_of_input_text || input_text[i] == '\n') - { - if (i == size_of_input_text) - i--; + if (i == size_of_input_text || input_text[i] == '\n') + { + if (i == size_of_input_text) + i--; - input_text_offset = i; - character = curchar (); - } - } + input_text_offset = i; + character = curchar (); + } + } if (character == '\n') - { - line_number++; - - /* Check for a menu entry here, since the "escape sequence" - that begins menu entries is "\n* ". */ - if (in_menu && input_text_offset + 1 < size_of_input_text) - { - char *glean_node_from_menu (), *tem; - - /* Note that the value of TEM is discarded, since it is - gauranteed to be NULL when glean_node_from_menu () is - called with a non-zero argument. */ - if (!in_detailmenu) - tem = glean_node_from_menu (1); - } - } + { + line_number++; + + /* Check for a menu entry here, since the "escape sequence" + that begins menu entries is "\n* ". */ + if (in_menu && input_text_offset + 1 < size_of_input_text) + { + char *glean_node_from_menu (), *tem; + + /* Note that the value of TEM is discarded, since it is + gauranteed to be NULL when glean_node_from_menu () is + called with a Nonzero argument. */ + if (!in_detailmenu) + tem = glean_node_from_menu (1); + } + } switch (character) - { - case COMMAND_PREFIX: - read_command (); - break; - - case '{': - - /* Special case. I'm not supposed to see this character by itself. - If I do, it means there is a syntax error in the input text. - Report the error here, but remember this brace on the stack so - you can ignore its partner. */ - - line_error ("Misplaced `{'"); - remember_brace (misplaced_brace); - - /* Don't advance input_text_offset since this happens in - remember_brace (). - input_text_offset++; + { + case COMMAND_PREFIX: + read_command (); + break; + + case '{': + /* Special case. I'm not supposed to see this character by itself. + If I do, it means there is a syntax error in the input text. + Report the error here, but remember this brace on the stack so + you can ignore its partner. */ + + line_error (_("Misplaced %c"), '{'); + remember_brace (misplaced_brace); + + /* Don't advance input_text_offset since this happens in + remember_brace (). + input_text_offset++; */ - break; + break; - case '}': - pop_and_call_brace (); - input_text_offset++; - break; + case '}': + pop_and_call_brace (); + input_text_offset++; + break; - default: - add_char (character); - input_text_offset++; - } + default: + add_char (character); + input_text_offset++; + } } #if defined (HAVE_MACROS) if (macro_expansion_output_stream) @@ -2373,18 +2420,18 @@ get_command_entry (string) { register int i; - for (i = 0; CommandTable[i].name; i++) - if (strcmp (CommandTable[i].name, string) == 0) - return (&CommandTable[i]); + for (i = 0; command_table[i].name; i++) + if (strcmp (command_table[i].name, string) == 0) + return (&command_table[i]); /* This command is not in our predefined command table. Perhaps it is a user defined command. */ for (i = 0; i < user_command_array_len; i++) if (user_command_array[i] && - (strcmp (user_command_array[i]->name, string) == 0)) + (strcmp (user_command_array[i]->name, string) == 0)) return (user_command_array[i]); - /* Nope, we never heard of this command. */ + /* We never heard of this command. */ return ((COMMAND *) -1); } @@ -2408,26 +2455,25 @@ read_command () if (def) { - /* We disallow recursive use of a macro call. Inhibit the expansion - of this macro during the life of its execution. */ - if (!(def->flags & ME_RECURSE)) - def->inhibited = 1; + /* We disallow recursive use of a macro call. Inhibit the expansion + of this macro during the life of its execution. */ + if (!(def->flags & ME_RECURSE)) + def->inhibited = 1; - execute_macro (def); + execute_macro (def); - if (!(def->flags & ME_RECURSE)) - def->inhibited = 0; + if (!(def->flags & ME_RECURSE)) + def->inhibited = 0; - return; + return; } } #endif /* HAVE_MACROS */ entry = get_command_entry (command); - if (entry == (COMMAND *)-1) { - line_error ("Unknown command `%s'", command); + line_error (_("Unknown command `%s'"), command); return; } @@ -2444,10 +2490,10 @@ find_proc_name (proc) { register int i; - for (i = 0; CommandTable[i].name; i++) - if (proc == CommandTable[i].proc) - return (CommandTable[i].name); - return ("NO_NAME!"); + for (i = 0; command_table[i].name; i++) + if (proc == command_table[i].proc) + return command_table[i].name; + return _("NO_NAME!"); } void @@ -2461,7 +2507,7 @@ remember_brace (proc) COMMAND_FUNCTION *proc; { if (curchar () != '{') - line_error ("%c%s expected `{..}'", COMMAND_PREFIX, command); + line_error (_("%c%s expected `{...}'"), COMMAND_PREFIX, command); else input_text_offset++; remember_brace_1 (proc, output_paragraph_offset); @@ -2494,7 +2540,7 @@ pop_and_call_brace () if (brace_stack == (BRACE_ELEMENT *) NULL) { - line_error ("Unmatched }"); + line_error (_("Unmatched }")); return; } @@ -2518,7 +2564,7 @@ adjust_braces_following (here, amount) while (stack) { if (stack->pos >= here) - stack->pos += amount; + stack->pos += amount; stack = stack->next; } } @@ -2536,23 +2582,23 @@ discard_braces () while (brace_stack) { if (brace_stack->proc != misplaced_brace) - { - char *proc_name; - int temp_line_number = line_number; - - line_number = brace_stack->line; - proc_name = find_proc_name (brace_stack->proc); - line_error ("%c%s missing close brace", COMMAND_PREFIX, proc_name); - line_number = temp_line_number; - pop_and_call_brace (); - } + { + char *proc_name; + int temp_line_number = line_number; + + line_number = brace_stack->line; + proc_name = find_proc_name (brace_stack->proc); + line_error (_("%c%s missing close brace"), COMMAND_PREFIX, proc_name); + line_number = temp_line_number; + pop_and_call_brace (); + } else - { - BRACE_ELEMENT *temp; - temp = brace_stack->next; - free (brace_stack); - brace_stack = temp; - } + { + BRACE_ELEMENT *temp; + temp = brace_stack->next; + free (brace_stack); + brace_stack = temp; + } } } @@ -2568,9 +2614,9 @@ get_char_len (character) case '\t': len = (output_column + 8) & 0xf7; if (len > fill_column) - len = fill_column - output_column; + len = fill_column - output_column; else - len = len - output_column; + len = len - output_column; break; case '\n': @@ -2578,44 +2624,42 @@ get_char_len (character) break; default: - if (character < ' ') - len = 2; + /* ASCII control characters appear as two characters in the output + (e.g., ^A). But characters with the high bit set are just one + on suitable terminals, so don't count them as two for line + breaking purposes. */ + if (0 <= character && character < ' ') + len = 2; else - len = 1; + len = 1; } return (len); } -#if defined (HAVE_VARARGS_H) && defined (HAVE_VSPRINTF) - void -add_word_args (va_alist) - va_dcl +#if defined (VA_FPRINTF) && __STDC__ +add_word_args (char *format, ...) +#else +add_word_args (format, va_alist) + char *format; + va_dcl +#endif { char buffer[1000]; - char *format; - va_list args; - - va_start (args); - format = va_arg (args, char *); - vsprintf (buffer, format, args); - va_end (args); - add_word (buffer); -} - -#else /* !(HAVE_VARARGS_H && HAVE_VSPRINTF) */ +#ifdef VA_FPRINTF + va_list ap; +#endif -void -add_word_args (format, arg1, arg2, arg3, arg4, arg5) - char *format; -{ - char buffer[1000]; - sprintf (buffer, format, arg1, arg2, arg3, arg4, arg5); + VA_START (ap, format); +#ifdef VA_SPRINTF + VA_SPRINTF (buffer, format, ap); +#else + sprintf (temp_string, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_SPRINTF */ + va_end (ap); add_word (buffer); } -#endif /* !(HAVE_VARARGS_H && HAVE_VSPRINTF) */ - /* Add STRING to output_paragraph. */ void add_word (string) @@ -2625,26 +2669,26 @@ add_word (string) add_char (*string++); } -/* Non-zero if the last character inserted has the syntax class of NEWLINE. */ +/* Nonzero if the last character inserted has the syntax class of NEWLINE. */ int last_char_was_newline = 1; /* The actual last inserted character. Note that this may be something other than NEWLINE even if last_char_was_newline is 1. */ int last_inserted_character = 0; -/* Non-zero means that a newline character has already been +/* Nonzero means that a newline character has already been inserted, so close_paragraph () should insert one less. */ int line_already_broken = 0; -/* When non-zero we have finished an insertion (see end_insertion ()) and we +/* When nonzero we have finished an insertion (see `end_insertion') and we want to ignore false continued paragraph closings. */ int insertion_paragraph_closed = 0; -/* Non-zero means attempt to make all of the lines have fill_column width. */ +/* Nonzero means attempt to make all of the lines have fill_column width. */ int do_justification = 0; /* Add the character to the current paragraph. If filling_enabled is - non-zero, then do filling as well. */ + nonzero, then do filling as well. */ void add_char (character) int character; @@ -2659,12 +2703,12 @@ add_char (character) if (must_start_paragraph && character != '\n') { must_start_paragraph = 0; - line_already_broken = 0; /* The line is no longer broken. */ + line_already_broken = 0; /* The line is no longer broken. */ if (current_indent > output_column) - { - indent (current_indent - output_column); - output_column = current_indent; - } + { + indent (current_indent - output_column); + output_column = current_indent; + } } if (non_splitting_words && member (character, " \t\n")) @@ -2676,168 +2720,168 @@ add_char (character) { case '\n': if (!filling_enabled) - { - insert ('\n'); - - if (force_flush_right) - { - close_paragraph (); - /* Hack to force single blank lines out in this mode. */ - flush_output (); - } - - output_column = 0; - - if (!no_indent && paragraph_is_open) - indent (output_column = current_indent); - break; - } + { + insert ('\n'); + + if (force_flush_right) + { + close_paragraph (); + /* Hack to force single blank lines out in this mode. */ + flush_output (); + } + + output_column = 0; + + if (!no_indent && paragraph_is_open) + indent (output_column = current_indent); + break; + } else /* CHARACTER is newline, and filling is enabled. */ - { - if (sentence_ender (last_inserted_character)) - { - insert (' '); - output_column++; - last_inserted_character = character; - } - } + { + if (end_of_sentence_p ()) + { + insert (' '); + output_column++; + last_inserted_character = character; + } + } if (last_char_was_newline) - { - close_paragraph (); - pending_indent = 0; - } + { + close_paragraph (); + pending_indent = 0; + } else - { - last_char_was_newline = 1; - insert (' '); - output_column++; - } + { + last_char_was_newline = 1; + insert (' '); + output_column++; + } break; default: { - int len = get_char_len (character); - int suppress_insert = 0; - - if ((character == ' ') && (last_char_was_newline)) - { - if (!paragraph_is_open) - { - pending_indent++; - return; - } - } - - if (!paragraph_is_open) - { - start_paragraph (); - - /* If the paragraph is supposed to be indented a certain way, - then discard all of the pending whitespace. Otherwise, we - let the whitespace stay. */ - if (!paragraph_start_indent) - indent (pending_indent); - pending_indent = 0; - } - - if ((output_column += len) > fill_column) - { - if (filling_enabled) - { - int temp = output_paragraph_offset; - while (--temp > 0 && output_paragraph[temp] != '\n') - { - /* If we have found a space, we have the place to break - the line. */ - if (output_paragraph[temp] == ' ') - { - /* Remove trailing whitespace from output. */ - while (temp && whitespace (output_paragraph[temp - 1])) - temp--; - - output_paragraph[temp++] = '\n'; - - /* We have correctly broken the line where we want - to. What we don't want is spaces following where - we have decided to break the line. We get rid of - them. */ - { - int t1 = temp; - - for (;; t1++) - { - if (t1 == output_paragraph_offset) - { - if (whitespace (character)) - suppress_insert = 1; - break; - } - if (!whitespace (output_paragraph[t1])) - break; - } - - if (t1 != temp) - { - adjust_braces_following (temp, (- (t1 - temp))); - strncpy ((char *) &output_paragraph[temp], - (char *) &output_paragraph[t1], - (output_paragraph_offset - t1)); - output_paragraph_offset -= (t1 - temp); - } - } - - /* Filled, but now indent if that is right. */ - if (indented_fill && current_indent) - { - int buffer_len = ((output_paragraph_offset - temp) - + current_indent); - char *temp_buffer = (char *)xmalloc (buffer_len); - int indentation = 0; - - /* We have to shift any markers that are in - front of the wrap point. */ - adjust_braces_following (temp, current_indent); - - while (current_indent > 0 && - indentation != current_indent) - temp_buffer[indentation++] = ' '; - - strncpy ((char *) &temp_buffer[current_indent], - (char *) &output_paragraph[temp], - buffer_len - current_indent); - - if (output_paragraph_offset + buffer_len - >= paragraph_buffer_len) - { - unsigned char *tt = xrealloc - (output_paragraph, - (paragraph_buffer_len += buffer_len)); - output_paragraph = tt; - } - strncpy ((char *) &output_paragraph[temp], - temp_buffer, buffer_len); - output_paragraph_offset += current_indent; - free (temp_buffer); - } - output_column = 0; - while (temp < output_paragraph_offset) - output_column += - get_char_len (output_paragraph[temp++]); - output_column += len; - break; - } - } - } - } - - if (!suppress_insert) - { - insert (character); - last_inserted_character = character; - } - last_char_was_newline = 0; - line_already_broken = 0; + int len = get_char_len (character); + int suppress_insert = 0; + + if ((character == ' ') && (last_char_was_newline)) + { + if (!paragraph_is_open) + { + pending_indent++; + return; + } + } + + if (!paragraph_is_open) + { + start_paragraph (); + + /* If the paragraph is supposed to be indented a certain way, + then discard all of the pending whitespace. Otherwise, we + let the whitespace stay. */ + if (!paragraph_start_indent) + indent (pending_indent); + pending_indent = 0; + } + + if ((output_column += len) > fill_column) + { + if (filling_enabled) + { + int temp = output_paragraph_offset; + while (--temp > 0 && output_paragraph[temp] != '\n') + { + /* If we have found a space, we have the place to break + the line. */ + if (output_paragraph[temp] == ' ') + { + /* Remove trailing whitespace from output. */ + while (temp && whitespace (output_paragraph[temp - 1])) + temp--; + + output_paragraph[temp++] = '\n'; + + /* We have correctly broken the line where we want + to. What we don't want is spaces following where + we have decided to break the line. We get rid of + them. */ + { + int t1 = temp; + + for (;; t1++) + { + if (t1 == output_paragraph_offset) + { + if (whitespace (character)) + suppress_insert = 1; + break; + } + if (!whitespace (output_paragraph[t1])) + break; + } + + if (t1 != temp) + { + adjust_braces_following (temp, (- (t1 - temp))); + strncpy ((char *) &output_paragraph[temp], + (char *) &output_paragraph[t1], + (output_paragraph_offset - t1)); + output_paragraph_offset -= (t1 - temp); + } + } + + /* Filled, but now indent if that is right. */ + if (indented_fill && current_indent) + { + int buffer_len = ((output_paragraph_offset - temp) + + current_indent); + char *temp_buffer = (char *)xmalloc (buffer_len); + int indentation = 0; + + /* We have to shift any markers that are in + front of the wrap point. */ + adjust_braces_following (temp, current_indent); + + while (current_indent > 0 && + indentation != current_indent) + temp_buffer[indentation++] = ' '; + + strncpy ((char *) &temp_buffer[current_indent], + (char *) &output_paragraph[temp], + buffer_len - current_indent); + + if (output_paragraph_offset + buffer_len + >= paragraph_buffer_len) + { + unsigned char *tt = xrealloc + (output_paragraph, + (paragraph_buffer_len += buffer_len)); + output_paragraph = tt; + } + strncpy ((char *) &output_paragraph[temp], + temp_buffer, buffer_len); + output_paragraph_offset += current_indent; + free (temp_buffer); + } + output_column = 0; + while (temp < output_paragraph_offset) + output_column += + get_char_len (output_paragraph[temp++]); + output_column += len; + break; + } + } + } + } + + if (!suppress_insert) + { + insert (character); + last_inserted_character = character; + } + last_char_was_newline = 0; + line_already_broken = 0; } } } @@ -2851,7 +2895,7 @@ insert (character) if (output_paragraph_offset == paragraph_buffer_len) { output_paragraph = - xrealloc (output_paragraph, (paragraph_buffer_len += 100)); + xrealloc (output_paragraph, (paragraph_buffer_len += 100)); } } @@ -2864,6 +2908,23 @@ insert_string (string) insert (*string++); } + +/* Sentences might have these characters after the period (or whatever). */ +#define post_sentence(c) ((c) == ')' || (c) == '\'' || (c) == '"' \ + || (c) == ']') + +/* Return true if at an end-of-sentence character, possibly followed by + post-sentence punctuation to ignore. */ +static int +end_of_sentence_p () +{ + int loc = output_paragraph_offset - 1; + while (loc > 0 && post_sentence (output_paragraph[loc])) + loc--; + return sentence_ender (output_paragraph[loc]); +} + + /* Remove upto COUNT characters of whitespace from the the current output line. If COUNT is less than zero, then remove until none left. */ @@ -2876,24 +2937,24 @@ kill_self_indent (count) { output_column = 0; while (output_paragraph_offset) - { - if (whitespace (output_paragraph[output_paragraph_offset - 1])) - output_paragraph_offset--; - else - break; - } + { + if (whitespace (output_paragraph[output_paragraph_offset - 1])) + output_paragraph_offset--; + else + break; + } } else { while (output_paragraph_offset && count--) - if (whitespace (output_paragraph[output_paragraph_offset - 1])) - output_paragraph_offset--; - else - break; + if (whitespace (output_paragraph[output_paragraph_offset - 1])) + output_paragraph_offset--; + else + break; } } -/* Non-zero means do not honor calls to flush_output (). */ +/* Nonzero means do not honor calls to flush_output (). */ static int flushing_ignored = 0; /* Prevent calls to flush_output () from having any effect. */ @@ -2926,7 +2987,7 @@ flush_output () { int temp = UNMETA (output_paragraph[i]); if (temp == ' ') - output_paragraph[i] &= 0x7f; + output_paragraph[i] &= 0x7f; } } @@ -2960,30 +3021,28 @@ close_insertion_paragraph () /* Close the current paragraph, breaking the line. */ close_single_paragraph (); - /* Start a new paragraph here, inserting whatever indention is correct - for the now current insertion level (one above the one that we are - ending). */ + /* Start a new paragraph, with the correct indentation for the now + current insertion level (one above the one that we are ending). */ start_paragraph (); - /* Tell close_paragraph () that the previous line has already been - broken, so it should insert one less newline. */ + /* Tell `close_paragraph' that the previous line has already been + broken, so it should insert one less newline. */ line_already_broken = 1; - /* Let functions such as add_char () know that we have already found a - newline. */ + /* Tell functions such as `add_char' we've already found a newline. */ ignore_blank_line (); } else { /* If the insertion paragraph is closed already, then we are seeing - two `@end' commands in a row. Note that the first one we saw was - handled in the first part of this if-then-else clause, and at that - time start_paragraph () was called, partially to handle the proper - indentation of the current line. However, the indentation level - may have just changed again, so we may have to outdent the current - line to the new indentation level. */ + two `@end' commands in a row. Note that the first one we saw was + handled in the first part of this if-then-else clause, and at that + time `start_paragraph' was called, partially to handle the proper + indentation of the current line. However, the indentation level + may have just changed again, so we may have to outdent the current + line to the new indentation level. */ if (current_indent < output_column) - kill_self_indent (output_column - current_indent); + kill_self_indent (output_column - current_indent); } insertion_paragraph_closed = 1; @@ -3015,37 +3074,37 @@ close_paragraph () tindex = output_paragraph_offset; /* Back up to last non-newline/space character, forcing all such - subsequent characters to be newlines. This isn't strictly - necessary, but a couple of functions use the presence of a newline - to make decisions. */ + subsequent characters to be newlines. This isn't strictly + necessary, but a couple of functions use the presence of a newline + to make decisions. */ for (tindex = output_paragraph_offset - 1; tindex >= 0; --tindex) - { - c = output_paragraph[tindex]; + { + c = output_paragraph[tindex]; - if (c == ' '|| c == '\n') - output_paragraph[tindex] = '\n'; - else - break; - } + if (c == ' '|| c == '\n') + output_paragraph[tindex] = '\n'; + else + break; + } /* All trailing whitespace is ignored. */ output_paragraph_offset = ++tindex; /* Break the line if that is appropriate. */ if (paragraph_spacing >= 0) - insert ('\n'); + insert ('\n'); - /* Add as many blank lines as is specified in PARAGRAPH_SPACING. */ + /* Add as many blank lines as is specified in `paragraph_spacing'. */ if (!force_flush_right) - { - for (i = 0; i < (paragraph_spacing - line_already_broken); i++) - insert ('\n'); - } + { + for (i = 0; i < (paragraph_spacing - line_already_broken); i++) + insert ('\n'); + } /* If we are doing flush right indentation, then do it now - on the paragraph (really a single line). */ + on the paragraph (really a single line). */ if (force_flush_right) - do_flush_right_indentation (); + do_flush_right_indentation (); flush_output (); paragraph_is_open = 0; @@ -3074,28 +3133,28 @@ do_flush_right_indentation () if (output_paragraph[0] != '\n') { - output_paragraph[output_paragraph_offset] = '\0'; + output_paragraph[output_paragraph_offset] = 0; if (output_paragraph_offset < fill_column) - { - register int i; + { + register int i; - if (fill_column >= paragraph_buffer_len) - output_paragraph = - xrealloc (output_paragraph, - (paragraph_buffer_len += fill_column)); + if (fill_column >= paragraph_buffer_len) + output_paragraph = + xrealloc (output_paragraph, + (paragraph_buffer_len += fill_column)); - temp_len = strlen ((char *)output_paragraph); - temp = (char *)xmalloc (temp_len + 1); - memcpy (temp, (char *)output_paragraph, temp_len); + temp_len = strlen ((char *)output_paragraph); + temp = (char *)xmalloc (temp_len + 1); + memcpy (temp, (char *)output_paragraph, temp_len); - for (i = 0; i < fill_column - output_paragraph_offset; i++) - output_paragraph[i] = ' '; + for (i = 0; i < fill_column - output_paragraph_offset; i++) + output_paragraph[i] = ' '; - memcpy ((char *)output_paragraph + i, temp, temp_len); - free (temp); - output_paragraph_offset = fill_column; - } + memcpy ((char *)output_paragraph + i, temp, temp_len); + free (temp); + output_paragraph_offset = fill_column; + } } } @@ -3122,25 +3181,25 @@ start_paragraph () /* If doing indentation, then insert the appropriate amount. */ if (!no_indent) - { - if (inhibit_paragraph_indentation) - { - amount_to_indent = current_indent; - if (inhibit_paragraph_indentation < 0) - inhibit_paragraph_indentation++; - } - else if (paragraph_start_indent < 0) - amount_to_indent = current_indent; - else - amount_to_indent = current_indent + paragraph_start_indent; - - if (amount_to_indent >= output_column) - { - amount_to_indent -= output_column; - indent (amount_to_indent); - output_column += amount_to_indent; - } - } + { + if (inhibit_paragraph_indentation) + { + amount_to_indent = current_indent; + if (inhibit_paragraph_indentation < 0) + inhibit_paragraph_indentation++; + } + else if (paragraph_start_indent < 0) + amount_to_indent = current_indent; + else + amount_to_indent = current_indent + paragraph_start_indent; + + if (amount_to_indent >= output_column) + { + amount_to_indent -= output_column; + indent (amount_to_indent); + output_column += amount_to_indent; + } + } } else must_start_paragraph = 0; @@ -3158,7 +3217,7 @@ indent (amount) while (elt) { if (elt->pos >= output_paragraph_offset) - elt->pos += amount; + elt->pos += amount; elt = elt->next; } @@ -3178,7 +3237,7 @@ search_forward (string, from) while (from < size_of_input_text) { if (strncmp (input_text + from, string, len) == 0) - return (from); + return (from); from++; } return (-1); @@ -3200,13 +3259,13 @@ strcasecmp (string1, string2) ch2 = *string2++; if (!(ch1 | ch2)) - return (0); + return (0); ch1 = coerce_to_upper (ch1); ch2 = coerce_to_upper (ch2); if (ch1 != ch2) - return (ch1 - ch2); + return (ch1 - ch2); } } #endif /* !HAVE_STRCASECMP */ @@ -3243,18 +3302,20 @@ current_item_function () while (!done && (elt != NULL)) { switch (elt->insertion) - { - case ifinfo: - case ifset: - case ifclear: - case cartouche: - elt = elt->next; - level--; - break; - - default: - done = 1; - } + { + case ifinfo: + case ifnothtml: + case ifnottex: + case ifset: + case ifclear: + case cartouche: + elt = elt->next; + level--; + break; + + default: + done = 1; + } } if (!level) @@ -3269,7 +3330,6 @@ get_item_function () char *item_function; get_rest_of_line (&item_function); backup_input_pointer (); - canon_white (item_function); return (item_function); } @@ -3286,7 +3346,7 @@ push_insertion (type, item_function) new->indented_fill = indented_fill; new->insertion = type; new->line_number = line_number; - new->filename = strdup (input_filename); + new->filename = xstrdup (input_filename); new->inhibited = inhibit_paragraph_indentation; new->in_fixed_width_font = in_fixed_width_font; new->next = insertion_stack; @@ -3324,7 +3384,7 @@ insertion_type_pname (type) if ((int) type < (int) bad_type) return (insertion_type_names[(int) type]); else - return ("Broken-Type in insertion_type_pname"); + return (_("Broken-Type in insertion_type_pname")); } /* Return the insertion_type associated with NAME. @@ -3337,7 +3397,7 @@ find_type_from_name (name) while (index < (int) bad_type) { if (strcmp (name, insertion_type_names[index]) == 0) - return (enum insertion_type) index; + return (enum insertion_type) index; index++; } return (bad_type); @@ -3390,7 +3450,7 @@ start_enumerating (at, type) { if ((enumstack_offset + 1) == max_stack_depth) { - line_error ("Enumeration stack overflow"); + line_error (_("Enumeration stack overflow")); return; } enumstack[enumstack_offset].enumtype = current_enumtype; @@ -3420,10 +3480,10 @@ enumerate_item () if (current_enumtype == ENUM_ALPHA) { if (current_enumval == ('z' + 1) || current_enumval == ('Z' + 1)) - { - current_enumval = ((current_enumval - 1) == 'z' ? 'a' : 'A'); - warning ("Lettering overflow, restarting at %c", current_enumval); - } + { + current_enumval = ((current_enumval - 1) == 'z' ? 'a' : 'A'); + warning (_("lettering overflow, restarting at %c"), current_enumval); + } sprintf (temp, "%c. ", current_enumval); } else @@ -3445,7 +3505,7 @@ begin_insertion (type) if (defun_insertion (type)) { - push_insertion (type, strdup ("")); + push_insertion (type, xstrdup ("")); no_discard++; } else @@ -3455,30 +3515,29 @@ begin_insertion (type) { case menu: if (!no_headers) - close_paragraph (); + close_paragraph (); filling_enabled = no_indent = 0; inhibit_paragraph_indentation = 1; if (!no_headers) - add_word ("* Menu:\n"); + add_word (_("* Menu:\n")); in_menu++; no_discard++; break; case detailmenu: - if (!in_menu) - { - if (!no_headers) - close_paragraph (); + { + if (!no_headers) + close_paragraph (); - filling_enabled = no_indent = 0; - inhibit_paragraph_indentation = 1; + filling_enabled = no_indent = 0; + inhibit_paragraph_indentation = 1; - no_discard++; - } + no_discard++; + } in_detailmenu++; break; @@ -3491,7 +3550,7 @@ begin_insertion (type) break; /* I think @quotation is meant to do filling. - If you don't want filling, then use @display. */ + If you don't want filling, then use @display. */ case quotation: close_single_paragraph (); last_char_was_newline = no_indent = 0; @@ -3507,16 +3566,13 @@ begin_insertion (type) case smalllisp: /* Just like @example, but no indentation. */ case format: - close_single_paragraph (); inhibit_paragraph_indentation = 1; in_fixed_width_font++; filling_enabled = 0; last_char_was_newline = 0; - if (type != format) - current_indent += default_indentation_increment; - + current_indent += default_indentation_increment; break; case multitable: @@ -3538,20 +3594,20 @@ begin_insertion (type) /* Make things work for losers who forget the itemize syntax. */ if (allow_lax_format && (type == itemize)) - { - if (!(*insertion_stack->item_function)) - { - free (insertion_stack->item_function); - insertion_stack->item_function = strdup ("@bullet"); - insertion_stack->item_function[0] = COMMAND_PREFIX; - } - } + { + if (!(*insertion_stack->item_function)) + { + free (insertion_stack->item_function); + insertion_stack->item_function = xstrdup ("@bullet"); + insertion_stack->item_function[0] = COMMAND_PREFIX; + } + } if (!*insertion_stack->item_function) - { - line_error ("%s requires an argument: the formatter for %citem", - insertion_type_pname (type), COMMAND_PREFIX); - } + { + line_error (_("%s requires an argument: the formatter for %citem"), + insertion_type_pname (type), COMMAND_PREFIX); + } break; case enumerate: @@ -3567,26 +3623,28 @@ begin_insertion (type) filling_enabled = indented_fill = 1; if (isdigit (*enumeration_arg)) - start_enumerating (atoi (enumeration_arg), ENUM_DIGITS); + start_enumerating (atoi (enumeration_arg), ENUM_DIGITS); else - start_enumerating (*enumeration_arg, ENUM_ALPHA); + start_enumerating (*enumeration_arg, ENUM_ALPHA); break; /* Does nothing special in makeinfo. */ case group: /* Only close the paragraph if we are not inside of an @example. */ if (!insertion_stack->next || - insertion_stack->next->insertion != example) - close_single_paragraph (); + insertion_stack->next->insertion != example) + close_single_paragraph (); break; /* Insertions that are no-ops in info, but do something in TeX. */ case ifinfo: + case ifnothtml: + case ifnottex: case ifset: case ifclear: case cartouche: if (in_menu) - no_discard++; + no_discard++; break; case deffn: @@ -3630,11 +3688,10 @@ begin_insertion (type) discard_until ("\n"); } -/* Try to end the insertion with the specified TYPE. - TYPE, with a value of bad_type, gets translated to match - the value currently on top of the stack. - Otherwise, if TYPE doesn't match the top of the insertion stack, - give error. */ +/* Try to end the insertion with the specified TYPE. With a value of + `bad_type', TYPE gets translated to match the value currently on top + of the stack. Otherwise, if TYPE doesn't match the top of the + insertion stack, give error. */ void end_insertion (type) enum insertion_type type; @@ -3652,8 +3709,8 @@ end_insertion (type) if (type != temp_type) { line_error - ("`%cend' expected `%s', but saw `%s'", COMMAND_PREFIX, - insertion_type_pname (temp_type), insertion_type_pname (type)); + (_("`%cend' expected `%s', but saw `%s'"), COMMAND_PREFIX, + insertion_type_pname (temp_type), insertion_type_pname (type)); return; } @@ -3662,6 +3719,8 @@ end_insertion (type) switch (type) { /* Insertions which have no effect on paragraph formatting. */ + case ifnothtml: + case ifnottex: case ifinfo: case ifset: case ifclear: @@ -3673,18 +3732,18 @@ end_insertion (type) break; case detailmenu: - in_detailmenu--; /* No longer hacking menus. */ + in_detailmenu--; /* No longer hacking menus. */ if (!in_menu) - { - if (!no_headers) - close_insertion_paragraph (); - } + { + if (!no_headers) + close_insertion_paragraph (); + } break; case menu: - in_menu--; /* No longer hacking menus. */ + in_menu--; /* No longer hacking menus. */ if (!no_headers) - close_insertion_paragraph (); + close_insertion_paragraph (); break; case multitable: @@ -3710,14 +3769,13 @@ end_insertion (type) case lisp: case smalllisp: case quotation: - /* @format is the only fixed_width insertion without a change - in indentation. */ + in indentation. */ if (type != format) - current_indent -= default_indentation_increment; + current_indent -= default_indentation_increment; /* The ending of one of these insertions always marks the - start of a new paragraph. */ + start of a new paragraph. */ close_insertion_paragraph (); break; @@ -3742,33 +3800,32 @@ end_insertion (type) } /* Insertions cannot cross certain boundaries, such as node beginnings. In - code that creates such boundaries, you should call discard_insertions () + code that creates such boundaries, you should call `discard_insertions' before doing anything else. It prints the errors for you, and cleans up - the insertion stack. */ + the insertion stack. With nonzero SPECIALS_OK, allows unmatched + ifinfo, ifset, ifclear, otherwise not. */ void -discard_insertions () +discard_insertions (specials_ok) + int specials_ok; { int real_line_number = line_number; while (insertion_stack) { - if (insertion_stack->insertion == ifinfo || - insertion_stack->insertion == ifset || - insertion_stack->insertion == ifclear) - break; + if (specials_ok && (insertion_stack->insertion == ifinfo + || insertion_stack->insertion == ifset + || insertion_stack->insertion == ifclear)) + break; else - { - char *offender; - char *current_filename; - - current_filename = input_filename; - offender = (char *)insertion_type_pname (insertion_stack->insertion); - input_filename = insertion_stack->filename; - line_number = insertion_stack->line_number; - line_error ("This `%s' doesn't have a matching `%cend %s'", offender, - COMMAND_PREFIX, offender); - input_filename = current_filename; - pop_insertion (); - } + { + char *offender = insertion_type_pname (insertion_stack->insertion); + char *current_filename = input_filename; + + input_filename = insertion_stack->filename; + line_number = insertion_stack->line_number; + line_error (_("No matching `%cend %s'"), COMMAND_PREFIX, offender); + input_filename = current_filename; + pop_insertion (); + } } line_number = real_line_number; } @@ -3797,9 +3854,7 @@ void cm_asterisk () { close_single_paragraph (); -#if !defined (ASTERISK_NEW_PARAGRAPH) cm_noindent (); -#endif /* ASTERISK_NEW_PARAGRAPH */ } /* Insert ellipsis. */ @@ -3906,7 +3961,7 @@ cm_special_char (arg) else if (strcmp (command, "questiondown") == 0) add_char ('?'); else - fprintf (stderr, "How did @%s end up in cm_special_char?\n", command); + fprintf (stderr, _("How did @%s end up in cm_special_char?\n"), command); } } @@ -3920,39 +3975,31 @@ cm_dotless (arg, start, end) if (output_paragraph[start] != 'i' && output_paragraph[start] != 'j') /* This error message isn't perfect if the argument is multiple characters, but it doesn't seem worth getting right. */ - line_error ("%c%s expects `i' or `j' as argument, not `%c'", + line_error (_("%c%s expects `i' or `j' as argument, not `%c'"), COMMAND_PREFIX, command, output_paragraph[start]); else if (end - start != 1) - line_error ("%c%s expects a single character `i' or `j' as argument", - COMMAND_PREFIX, command); + line_error (_("%c%s expects a single character `i' or `j' as argument"), + COMMAND_PREFIX, command); /* We've already inserted the `i' or `j', so nothing to do. */ } } -#if defined (__osf__) -#define LOCALTIME_CAST(x) (time_t *)(x) -#else -#define LOCALTIME_CAST(x) (x) -#endif - void cm_today (arg) int arg; { - static char * months [12] = - { "January", "February", "March", "April", "May", "June", "July", - "August", "September", "October", "November", "December" }; + static char *months [12] = + { N_("January"), N_("February"), N_("March"), N_("April"), N_("May"), + N_("June"), N_("July"), N_("August"), N_("September"), N_("October"), + N_("November"), N_("December") }; if (arg == START) { - long timer = time (0); - struct tm *ts = localtime (LOCALTIME_CAST (&timer)); - add_word_args - ("%d %s %d", - (ts -> tm_mday), - (months [ts -> tm_mon]), - ((ts -> tm_year) + 1900)); + time_t timer = time (0); + struct tm *ts = localtime (&timer); + add_word_args (_("%d %s %d"), ts->tm_mday, _(months[ts->tm_mon]), + ts->tm_year + 1900); } } @@ -3967,12 +4014,12 @@ cm_code (arg) in_fixed_width_font++; if (!printing_index) - add_char ('`'); + add_char ('`'); } else { if (!printing_index) - add_char ('\''); + add_char ('\''); } } @@ -3987,7 +4034,7 @@ cm_kbd (arg) } void -cm_angle_brackets (arg) +cm_key (arg) int arg; { add_char (arg == START ? '<' : '>'); @@ -4004,17 +4051,17 @@ cm_ctrl (arg, start, end) register int i, character; #if defined (NO_MULTIPLE_CTRL) if ((end - start) != 1) - line_error ("%c%s expects a single character as an argument", - COMMAND_PREFIX, command); + line_error (_("%c%s expects a single character as an argument"), + COMMAND_PREFIX, command); else #endif - for (i = start; i < end; i++) - { - character = output_paragraph[i]; + for (i = start; i < end; i++) + { + character = output_paragraph[i]; - if (isletter (character)) - output_paragraph[i] = CTL (coerce_to_upper (character)); - } + if (isletter (character)) + output_paragraph[i] = CTL (coerce_to_upper (character)); + } } } @@ -4027,9 +4074,9 @@ not_fixed_width (arg) in_fixed_width_font = 0; } -/* Small caps in makeinfo has to do just all caps. */ +/* Small caps and @var in makeinfo just uppercase the text. */ void -cm_sc (arg, start_pos, end_pos) +cm_var_sc (arg, start_pos, end_pos) int arg, start_pos, end_pos; { not_fixed_width (arg); @@ -4037,29 +4084,11 @@ cm_sc (arg, start_pos, end_pos) if (arg == END) { while (start_pos < end_pos) - { - output_paragraph[start_pos] = - coerce_to_upper (output_paragraph[start_pos]); - start_pos++; - } - } -} - -/* @var in makeinfo just uppercases the text. */ -void -cm_var (arg, start_pos, end_pos) - int arg, start_pos, end_pos; -{ - not_fixed_width (arg); - - if (arg == END) - { - while (start_pos < end_pos) - { - output_paragraph[start_pos] = - coerce_to_upper (output_paragraph[start_pos]); - start_pos++; - } + { + output_paragraph[start_pos] = + coerce_to_upper (output_paragraph[start_pos]); + start_pos++; + } } } @@ -4102,12 +4131,21 @@ cm_not_fixed_width (arg, start, end) not_fixed_width (arg); } -/* Various commands are NOP's. */ +/* Various commands are no-op's. */ void cm_no_op () { } +/* No-op that eats its argument on same line. */ +void +cm_no_op_line_arg () +{ + char *temp; + get_rest_of_line (&temp); + free (temp); +} + /* Prevent the argument from being split across two lines. */ void cm_w (arg, start, end) @@ -4127,7 +4165,7 @@ cm_obsolete (arg, start, end) int arg, start, end; { if (arg == START) - warning ("The command `%c%s' is obsolete", COMMAND_PREFIX, command); + warning (_("%c%s is obsolete"), COMMAND_PREFIX, command); } /* Insert the text following input_text_offset up to the end of the line @@ -4157,9 +4195,7 @@ insert_and_underscore (with_char) #if defined (HAVE_MACROS) if (macro_expansion_output_stream) { - char *temp1; - - temp1 = (char *)xmalloc (2 + strlen (temp)); + char *temp1 = (char *) xmalloc (2 + strlen (temp)); sprintf (temp1, "%s\n", temp); remember_itext (input_text, input_text_offset); me_execute_string (temp1); @@ -4167,7 +4203,7 @@ insert_and_underscore (with_char) } else #endif /* HAVE_MACROS */ - execute_string ("%s\n", temp); + execute_string ("%s\n", temp); ending_pos = output_position + output_paragraph_offset; free (temp); @@ -4256,20 +4292,20 @@ what_section (text) for (j = 0; text[j] && !cr_or_whitespace (text[j]); j++); - for (i = 0; t = section_alist[i].name; i++) + for (i = 0; (t = section_alist[i].name); i++) { if (j == strlen (t) && strncmp (t, text, j) == 0) - { - int return_val; + { + int return_val; - return_val = (section_alist[i].level + section_alist_offset); + return_val = (section_alist[i].level + section_alist_offset); - if (return_val < 0) - return_val = 0; - else if (return_val > 5) - return_val = 5; - return (return_val); - } + if (return_val < 0) + return_val = 0; + else if (return_val > 5) + return_val = 5; + return (return_val); + } } return (-1); } @@ -4284,9 +4320,9 @@ set_top_section_level (level) for (i = 0; section_alist[i].name; i++) if (strcmp (section_alist[i].name, "top") == 0) { - result = section_alist[i].level; - section_alist[i].level = level; - break; + result = section_alist[i].level; + section_alist[i].level = level; + break; } return (result); } @@ -4301,25 +4337,25 @@ cm_top () { TAG_ENTRY *tag = tag_table; - line_error ("There already is a node having %ctop as a section", - COMMAND_PREFIX); + line_error (_("There already is a node having %ctop as a section"), + COMMAND_PREFIX); while (tag != (TAG_ENTRY *)NULL) - { - if ((tag->flags & IS_TOP)) - { - int old_line_number = line_number; - char *old_input_filename = input_filename; - - line_number = tag->line_no; - input_filename = tag->filename; - line_error ("Here is the %ctop node", COMMAND_PREFIX); - input_filename = old_input_filename; - line_number = old_line_number; - return; - } - tag = tag->next_ent; - } + { + if ((tag->flags & IS_TOP)) + { + int old_line_number = line_number; + char *old_input_filename = input_filename; + + line_number = tag->line_no; + input_filename = tag->filename; + line_error (_("Here is the %ctop node"), COMMAND_PREFIX); + input_filename = old_input_filename; + line_number = old_line_number; + return; + } + tag = tag->next_ent; + } } else { @@ -4327,16 +4363,16 @@ cm_top () /* It is an error to use @top before you have used @node. */ if (!tag_table) - { - char *top_name; - - get_rest_of_line (&top_name); - free (top_name); - line_error ("%ctop used before %cnode, defaulting to %s", - COMMAND_PREFIX, COMMAND_PREFIX, top_name); - execute_string ("@node Top, , (dir), (dir)\n@top %s\n", top_name); - return; - } + { + char *top_name; + + get_rest_of_line (&top_name); + free (top_name); + line_error (_("%ctop used before %cnode, defaulting to %s"), + COMMAND_PREFIX, COMMAND_PREFIX, top_name); + execute_string ("@node Top, , (dir), (dir)\n@top %s\n", top_name); + return; + } cm_unnumbered (); @@ -4345,33 +4381,33 @@ cm_top () /* Now set the logical hierarchical level of the Top node. */ { - int orig_offset = input_text_offset; + int orig_offset = input_text_offset; - input_text_offset = search_forward (node_search_string, orig_offset); + input_text_offset = search_forward (node_search_string, orig_offset); - if (input_text_offset > 0) - { - int this_section; + if (input_text_offset > 0) + { + int this_section; - /* We have encountered a non-top node, so mark that one exists. */ - non_top_node_seen = 1; + /* We have encountered a non-top node, so mark that one exists. */ + non_top_node_seen = 1; - /* Move to the end of this line, and find out what the - sectioning command is here. */ - while (input_text[input_text_offset] != '\n') - input_text_offset++; + /* Move to the end of this line, and find out what the + sectioning command is here. */ + while (input_text[input_text_offset] != '\n') + input_text_offset++; - if (input_text_offset < size_of_input_text) - input_text_offset++; + if (input_text_offset < size_of_input_text) + input_text_offset++; - this_section = what_section (input_text + input_text_offset); + this_section = what_section (input_text + input_text_offset); - /* If we found a sectioning command, then give the top section - a level of this section - 1. */ - if (this_section != -1) - set_top_section_level (this_section - 1); - } - input_text_offset = orig_offset; + /* If we found a sectioning command, then give the top section + a level of this section - 1. */ + if (this_section != -1) + set_top_section_level (this_section - 1); + } + input_text_offset = orig_offset; } } } @@ -4407,8 +4443,8 @@ void cm_ideprecated (arg, start, end) int arg, start, end; { - warning ("The command `%c%s' is obsolete; use `%c%s' instead", - COMMAND_PREFIX, command, COMMAND_PREFIX, command + 1); + warning (_("%c%s is obsolete; use %c%s instead"), + COMMAND_PREFIX, command, COMMAND_PREFIX, command + 1); sectioning_underscore (command + 1); } @@ -4531,9 +4567,9 @@ cm_subsubheading () } /* **************************************************************** */ -/* */ -/* Adding nodes, and making tags */ -/* */ +/* */ +/* Adding nodes, and making tags */ +/* */ /* **************************************************************** */ /* Start a new tag table. */ @@ -4555,7 +4591,7 @@ init_tag_table () void write_tag_table () { - write_tag_table_internal (0); /* Not indirect. */ + write_tag_table_internal (0); /* Not indirect. */ } void @@ -4599,11 +4635,12 @@ write_tag_table_internal (indirect_p) } char * -get_node_token () +get_node_token (expand) + int expand; { char *string; - get_until_in_line (",", &string); + get_until_in_line (expand, ",", &string); if (curchar () == ',') input_text_offset++; @@ -4636,7 +4673,7 @@ find_node (name) while (tag != (TAG_ENTRY *) NULL) { if (strcmp (tag->node, name) == 0) - return (tag); + return (tag); tag = tag->next_ent; } return ((TAG_ENTRY *) NULL); @@ -4653,11 +4690,12 @@ remember_node (node, prev, next, up, position, line_no, no_warn) { register TAG_ENTRY *tag = find_node (node); if (tag) - { - line_error ("Node `%s' multiply defined (%d is first definition)", - node, tag->line_no); - return; - } + { + line_error ( + _("Node `%s' multiply defined (line %d is first definition at)"), + node, tag->line_no); + return; + } } /* First, make this the current node. */ @@ -4673,7 +4711,7 @@ remember_node (node, prev, next, up, position, line_no, no_warn) new->position = position; new->line_no = line_no; new->filename = node_filename; - new->touched = 0; /* not yet referenced. */ + new->touched = 0; /* not yet referenced. */ new->flags = 0; if (no_warn) new->flags |= NO_WARN; @@ -4703,7 +4741,7 @@ cm_node () /* There also might be insertions left lying around that haven't been ended yet. Do that also. */ - discard_insertions (); + discard_insertions (1); if (!already_outputting_pending_notes) { @@ -4721,11 +4759,14 @@ cm_node () append_to_expansion_output (input_text_offset + 1); #endif /* HAVE_MACROS */ - node = get_node_token (); - next = get_node_token (); - prev = get_node_token (); - up = get_node_token (); + node = get_node_token (1); + next = get_node_token (0); + prev = get_node_token (0); + up = get_node_token (0); + if (verbose_mode) + printf (_("Formatting node %s...\n"), node); + #if defined (HAVE_MACROS) if (macro_expansion_output_stream) remember_itext (input_text, input_text_offset); @@ -4738,17 +4779,15 @@ cm_node () #if defined (HAVE_MACROS) if (macro_expansion_output_stream) - me_execute_string (node); + me_execute_string (node); else #endif /* HAVE_MACROS */ - execute_string ("%s", node); + execute_string ("%s", node); filling_enabled = indented_fill = 0; } /* Check for defaulting of this node's next, prev, and up fields. */ - defaulting = ((strlen (next) == 0) && - (strlen (prev) == 0) && - (strlen (up) == 0)); + defaulting = (*next == 0 && *prev == 0 && *up == 0); this_section = what_section (input_text + input_text_offset); @@ -4763,158 +4802,158 @@ cm_node () NODE_REF *ref = node_references; if ((this_section < 0) && (strcmp (node, "Top") != 0)) - { - char *polite_section_name = "top"; - int i; - - for (i = 0; section_alist[i].name; i++) - if (section_alist[i].level == current_section + 1) - { - polite_section_name = section_alist[i].name; - break; - } - - line_error - ("Node `%s' requires a sectioning command (e.g. %c%s)", - node, COMMAND_PREFIX, polite_section_name); - } + { + char *polite_section_name = "top"; + int i; + + for (i = 0; section_alist[i].name; i++) + if (section_alist[i].level == current_section + 1) + { + polite_section_name = section_alist[i].name; + break; + } + + line_error + (_("Node `%s' requires a sectioning command (e.g. %c%s)"), + node, COMMAND_PREFIX, polite_section_name); + } else - { - if (strcmp (node, "Top") == 0) - { - /* Default the NEXT pointer to be the first menu item in - this node, if there is a menu in this node. We have to - try very hard to find the menu, as it may be obscured - by execution_strings which are on the filestack. For - every member of the filestack which has a FILENAME - member which is identical to the current INPUT_FILENAME, - search forward from that offset. */ - int saved_input_text_offset = input_text_offset; - int saved_size_of_input_text = size_of_input_text; - char *saved_input_text = input_text; - FSTACK *next_file = filestack; - - int orig_offset, orig_size; - char *glean_node_from_menu (); - - /* No matter what, make this file point back at `(dir)'. */ - free (up); up = strdup ("(dir)"); - - while (1) - { - orig_offset = input_text_offset; - orig_size = - search_forward (node_search_string, orig_offset); - - if (orig_size < 0) - orig_size = size_of_input_text; - - input_text_offset = - search_forward (menu_search_string, orig_offset); - - if (input_text_offset > -1) - { - char *nodename_from_menu = (char *)NULL; - - input_text_offset = - search_forward ("\n* ", input_text_offset); - - if (input_text_offset != -1) - nodename_from_menu = glean_node_from_menu (0); - - if (nodename_from_menu) - { - free (next); next = nodename_from_menu; - break; - } - } - - /* We got here, so it hasn't been found yet. Try - the next file on the filestack if there is one. */ - if (next_file && - (strcmp (next_file->filename, input_filename) == 0)) - { - input_text = next_file->text; - input_text_offset = next_file->offset; - size_of_input_text = next_file->size; - next_file = next_file->next; - } - else - { - /* No more input files to check. */ - break; - } - } - - input_text = saved_input_text; - input_text_offset = saved_input_text_offset; - size_of_input_text = saved_size_of_input_text; - } - } + { + if (strcmp (node, "Top") == 0) + { + /* Default the NEXT pointer to be the first menu item in + this node, if there is a menu in this node. We have to + try very hard to find the menu, as it may be obscured + by execution_strings which are on the filestack. For + every member of the filestack which has a FILENAME + member which is identical to the current INPUT_FILENAME, + search forward from that offset. */ + int saved_input_text_offset = input_text_offset; + int saved_size_of_input_text = size_of_input_text; + char *saved_input_text = input_text; + FSTACK *next_file = filestack; + + int orig_offset, orig_size; + char *glean_node_from_menu (); + + /* No matter what, make this file point back at `(dir)'. */ + free (up); up = xstrdup ("(dir)"); + + while (1) + { + orig_offset = input_text_offset; + orig_size = + search_forward (node_search_string, orig_offset); + + if (orig_size < 0) + orig_size = size_of_input_text; + + input_text_offset = + search_forward (menu_search_string, orig_offset); + + if (input_text_offset > -1) + { + char *nodename_from_menu = (char *)NULL; + + input_text_offset = + search_forward ("\n* ", input_text_offset); + + if (input_text_offset != -1) + nodename_from_menu = glean_node_from_menu (0); + + if (nodename_from_menu) + { + free (next); next = nodename_from_menu; + break; + } + } + + /* We got here, so it hasn't been found yet. Try + the next file on the filestack if there is one. */ + if (next_file && + (strcmp (next_file->filename, input_filename) == 0)) + { + input_text = next_file->text; + input_text_offset = next_file->offset; + size_of_input_text = next_file->size; + next_file = next_file->next; + } + else + { + /* No more input files to check. */ + break; + } + } + + input_text = saved_input_text; + input_text_offset = saved_input_text_offset; + size_of_input_text = saved_size_of_input_text; + } + } /* Fix the level of the menu references in the Top node, iff it - was declared with @top, and no subsequent reference was found. */ + was declared with @top, and no subsequent reference was found. */ if (top_node_seen && !non_top_node_seen) - { - /* Then this is the first non-@top node seen. */ - int level; + { + /* Then this is the first non-@top node seen. */ + int level; - level = set_top_section_level (this_section - 1); - non_top_node_seen = 1; + level = set_top_section_level (this_section - 1); + non_top_node_seen = 1; - while (ref) - { - if (ref->section == level) - ref->section = this_section - 1; - ref = ref->next; - } + while (ref) + { + if (ref->section == level) + ref->section = this_section - 1; + ref = ref->next; + } - ref = node_references; - } + ref = node_references; + } while (ref) - { - if (ref->section == (this_section - 1) && - ref->type == menu_reference && - strcmp (ref->node, node) == 0) - { - char *containing_node = ref->containing_node; - - free (up); - up = strdup (containing_node); - - if (last_ref && - last_ref->type == menu_reference && - (strcmp (last_ref->containing_node, - containing_node) == 0)) - { - free (next); - next = strdup (last_ref->node); - } - - while ((ref->section == this_section - 1) && - (ref->next) && - (ref->next->type != menu_reference)) - ref = ref->next; - - if (ref->next && ref->type == menu_reference && - (strcmp (ref->next->containing_node, - containing_node) == 0)) - { - free (prev); - prev = strdup (ref->next->node); - } - else if (!ref->next && - strcasecmp (ref->containing_node, "Top") == 0) - { - free (prev); - prev = strdup (ref->containing_node); - } - break; - } - last_ref = ref; - ref = ref->next; - } + { + if (ref->section == (this_section - 1) && + ref->type == menu_reference && + strcmp (ref->node, node) == 0) + { + char *containing_node = ref->containing_node; + + free (up); + up = xstrdup (containing_node); + + if (last_ref && + last_ref->type == menu_reference && + (strcmp (last_ref->containing_node, + containing_node) == 0)) + { + free (next); + next = xstrdup (last_ref->node); + } + + while ((ref->section == this_section - 1) && + (ref->next) && + (ref->next->type != menu_reference)) + ref = ref->next; + + if (ref->next && ref->type == menu_reference && + (strcmp (ref->next->containing_node, + containing_node) == 0)) + { + free (prev); + prev = xstrdup (ref->next->node); + } + else if (!ref->next && + strcasecmp (ref->containing_node, "Top") == 0) + { + free (prev); + prev = xstrdup (ref->containing_node); + } + break; + } + last_ref = ref; + ref = ref->next; + } } #if defined (HAVE_MACROS) @@ -4948,29 +4987,29 @@ cm_node () { #if defined (HAVE_MACROS) if (macro_expansion_output_stream) - me_inhibit_expansion++; + me_inhibit_expansion++; #endif /* HAVE_MACROS */ if (*next) - { - execute_string (", Next: %s", next); - filling_enabled = indented_fill = 0; - } + { + execute_string (", Next: %s", next); + filling_enabled = indented_fill = 0; + } if (*prev) - { - execute_string (", Prev: %s", prev); - filling_enabled = indented_fill = 0; - } + { + execute_string (", Prev: %s", prev); + filling_enabled = indented_fill = 0; + } if (*up) - { - execute_string (", Up: %s", up); - filling_enabled = indented_fill = 0; - } + { + execute_string (", Up: %s", up); + filling_enabled = indented_fill = 0; + } #if defined (HAVE_MACROS) if (macro_expansion_output_stream) - me_inhibit_expansion--; + me_inhibit_expansion--; #endif /* HAVE_MACROS */ } @@ -4980,7 +5019,7 @@ cm_node () if (!*node) { line_error ("No node name specified for `%c%s' command", - COMMAND_PREFIX, command); + COMMAND_PREFIX, command); free (node); free (next); free (prev); @@ -5031,141 +5070,141 @@ validate_file (tag_table) /* If this is a "no warn" node, don't validate it in any way. */ if (tags->flags & NO_WARN) - { - tags = tags->next_ent; - continue; - } + { + tags = tags->next_ent; + continue; + } /* If this node has a Next, then make sure that the Next exists. */ if (tags->next) - { - validate (tags->next, tags->line_no, "Next"); - - /* If the Next node exists, and there is no Up, then make - sure that the Prev of the Next points back. */ - if (temp_tag = find_node (tags->next)) - { - char *prev; - - if (temp_tag->flags & NO_WARN) - { - /* Do nothing if we aren't supposed to issue warnings - about this node. */ - } - else - { - prev = temp_tag->prev; - if (!prev || (strcmp (prev, tags->node) != 0)) - { - line_error ("Node `%s''s Next field not pointed back to", - tags->node); - line_number = temp_tag->line_no; - input_filename = temp_tag->filename; - line_error - ("This node (`%s') is the one with the bad `Prev'", - temp_tag->node); - input_filename = tags->filename; - line_number = tags->line_no; - temp_tag->flags |= PREV_ERROR; - } - } - } - } + { + validate (tags->next, tags->line_no, "Next"); + + /* If the Next node exists, and there is no Up, then make + sure that the Prev of the Next points back. */ + temp_tag = find_node (tags->next); + if (temp_tag) + { + char *prev; + + if (temp_tag->flags & NO_WARN) + { + /* Do nothing if we aren't supposed to issue warnings + about this node. */ + } + else + { + prev = temp_tag->prev; + if (!prev || (strcmp (prev, tags->node) != 0)) + { + line_error (_("Node `%s''s Next field not pointed back to"), + tags->node); + line_number = temp_tag->line_no; + input_filename = temp_tag->filename; + line_error + (_("This node (`%s') is the one with the bad `Prev'"), + temp_tag->node); + input_filename = tags->filename; + line_number = tags->line_no; + temp_tag->flags |= PREV_ERROR; + } + } + } + } /* Validate the Prev field if there is one, and we haven't already - complained about it in some way. You don't have to have a Prev - field at this stage. */ + complained about it in some way. You don't have to have a Prev + field at this stage. */ if (!(tags->flags & PREV_ERROR) && tags->prev) - { - int valid = validate (tags->prev, tags->line_no, "Prev"); - - if (!valid) - tags->flags |= PREV_ERROR; - else - { - /* If the Prev field is not the same as the Up field, - then the node pointed to by the Prev field must have - a Next field which points to this node. */ - if (tags->up && (strcmp (tags->prev, tags->up) != 0)) - { - temp_tag = find_node (tags->prev); - - /* If we aren't supposed to issue warnings about the - target node, do nothing. */ - if (!temp_tag || (temp_tag->flags & NO_WARN)) - { - /* Do nothing. */ - } - else - { - if (!temp_tag->next || - (strcmp (temp_tag->next, tags->node) != 0)) - { - line_error - ("Node `%s''s Prev field not pointed back to", - tags->node); - line_number = temp_tag->line_no; - input_filename = temp_tag->filename; - line_error - ("This node (`%s') is the one with the bad `Next'", - temp_tag->node); - input_filename = tags->filename; - line_number = tags->line_no; - temp_tag->flags |= NEXT_ERROR; - } - } - } - } - } - - if (!tags->up && (strcasecmp (tags->node, "Top") != 0)) - line_error ("Node `%s' is missing an \"Up\" field", tags->node); + { + int valid_p = validate (tags->prev, tags->line_no, "Prev"); + + if (!valid_p) + tags->flags |= PREV_ERROR; + else + { + /* If the Prev field is not the same as the Up field, + then the node pointed to by the Prev field must have + a Next field which points to this node. */ + if (tags->up && (strcmp (tags->prev, tags->up) != 0)) + { + temp_tag = find_node (tags->prev); + + /* If we aren't supposed to issue warnings about the + target node, do nothing. */ + if (!temp_tag || (temp_tag->flags & NO_WARN)) + { + /* Do nothing. */ + } + else + { + if (!temp_tag->next || + (strcmp (temp_tag->next, tags->node) != 0)) + { + line_error + (_("Node `%s's Prev field not pointed back to"), + tags->node); + line_number = temp_tag->line_no; + input_filename = temp_tag->filename; + line_error (_("This node (`%s') has the bad Next"), + temp_tag->node); + input_filename = tags->filename; + line_number = tags->line_no; + temp_tag->flags |= NEXT_ERROR; + } + } + } + } + } + + if (!tags->up && (strcasecmp (tags->node, _("Top")) != 0)) + line_error (_("Node `%s' missing Up field"), tags->node); else if (tags->up) - { - int valid = validate (tags->up, tags->line_no, "Up"); - - /* If node X has Up: Y, then warn if Y fails to have a menu item - or note pointing at X, if Y isn't of the form "(Y)". */ - if (valid && *tags->up != '(') - { - NODE_REF *nref, *tref, *list; - NODE_REF *find_node_reference (); - - tref = (NODE_REF *) NULL; - list = node_references; - - for (;;) - { - if (!(nref = find_node_reference (tags->node, list))) - break; - - if (strcmp (nref->containing_node, tags->up) == 0) - { - if (nref->type != menu_reference) - { - tref = nref; - list = nref->next; - } - else - break; - } - list = nref->next; - } - - if (!nref) - { - temp_tag = find_node (tags->up); - line_number = temp_tag->line_no; - input_filename = temp_tag->filename; - if (!tref) - line_error ( -"`%s' has an Up field of `%s', but `%s' has no menu item for `%s'", - tags->node, tags->up, tags->up, tags->node); - line_number = tags->line_no; - input_filename = tags->filename; - } - } - } + { + int valid_p = validate (tags->up, tags->line_no, "Up"); + + /* If node X has Up: Y, then warn if Y fails to have a menu item + or note pointing at X, if Y isn't of the form "(Y)". */ + if (valid_p && *tags->up != '(') + { + NODE_REF *nref, *tref, *list; + NODE_REF *find_node_reference (); + + tref = (NODE_REF *) NULL; + list = node_references; + + for (;;) + { + if (!(nref = find_node_reference (tags->node, list))) + break; + + if (strcmp (nref->containing_node, tags->up) == 0) + { + if (nref->type != menu_reference) + { + tref = nref; + list = nref->next; + } + else + break; + } + list = nref->next; + } + + if (!nref) + { + temp_tag = find_node (tags->up); + line_number = temp_tag->line_no; + input_filename = temp_tag->filename; + if (!tref) + line_error ( +_("`%s' has an Up field of `%s', but `%s' has no menu item for `%s'"), + tags->node, tags->up, tags->up, tags->node); + line_number = tags->line_no; + input_filename = tags->filename; + } + } + } tags = tags->next_ent; } @@ -5178,32 +5217,32 @@ validate_file (tag_table) { /* If this node is a "no warn" node, do nothing. */ if (tags->flags & NO_WARN) - { - tags = tags->next_ent; - continue; - } + { + tags = tags->next_ent; + continue; + } /* Special hack. If the node in question appears to have been referenced more than REFERENCE_WARNING_LIMIT times, give a warning. */ if (tags->touched > reference_warning_limit) - { - input_filename = tags->filename; - line_number = tags->line_no; - warning ("Node `%s' has been referenced %d times", - tags->node, tags->touched); - } + { + input_filename = tags->filename; + line_number = tags->line_no; + warning (_("node `%s' has been referenced %d times"), + tags->node, tags->touched); + } if (tags->touched == 0) - { - input_filename = tags->filename; - line_number = tags->line_no; - - /* Notice that the node "Top" is special, and doesn't have to - be referenced. */ - if (strcasecmp (tags->node, "Top") != 0) - warning ("Unreferenced node `%s'", tags->node); - } + { + input_filename = tags->filename; + line_number = tags->line_no; + + /* Notice that the node "Top" is special, and doesn't have to + be referenced. */ + if (strcasecmp (tags->node, _("Top")) != 0) + warning (_("unreferenced node `%s'"), tags->node); + } tags = tags->next_ent; } input_filename = old_input_filename; @@ -5229,9 +5268,7 @@ validate (tag, line, label) if (!result) { line_number = line; - line_error ( -"Validation error. `%s' field points to node `%s', which doesn't exist", - label, tag); + line_error (_("%s reference to nonexistent node `%s'"), label, tag); return (0); } result->touched++; @@ -5275,7 +5312,7 @@ split_file (filename, size) root_pathname = pathname_part (filename); if (!root_pathname) - root_pathname = strdup (""); + root_pathname = xstrdup (""); /* Start splitting the file. Walk along the tag table outputting sections of the file. When we have written @@ -5294,122 +5331,122 @@ split_file (filename, size) while (tags) { - int file_top, file_bot, limit; - - /* Have to include the Control-_. */ - file_top = file_bot = tags->position; - limit = file_top + size; - - /* If the rest of this file is only one node, then - that is the entire subfile. */ - if (!tags->next_ent) - { - int i = tags->position + 1; - char last_char = the_file[i]; - - while (i < file_size) - { - if ((the_file[i] == '\037') && - ((last_char == '\n') || - (last_char == '\014'))) - break; - else - last_char = the_file[i]; - i++; - } - file_bot = i; - tags = tags->next_ent; - goto write_region; - } - - /* Otherwise, find the largest number of nodes that can fit in - this subfile. */ - for (; tags; tags = tags->next_ent) - { - if (!tags->next_ent) - { - /* This entry is the last node. Search forward for the end - of this node, and that is the end of this file. */ - int i = tags->position + 1; - char last_char = the_file[i]; - - while (i < file_size) - { - if ((the_file[i] == '\037') && - ((last_char == '\n') || - (last_char == '\014'))) - break; - else - last_char = the_file[i]; - i++; - } - file_bot = i; - - if (file_bot < limit) - { - tags = tags->next_ent; - goto write_region; - } - else - { - /* Here we want to write out everything before the last - node, and then write the last node out in a file - by itself. */ - file_bot = tags->position; - goto write_region; - } - } - - if (tags->next_ent->position > limit) - { - if (tags->position == file_top) - tags = tags->next_ent; - - file_bot = tags->position; - - write_region: - { - int fd; - char *split_filename; - - split_filename = (char *) xmalloc - (10 + strlen (root_pathname) + strlen (root_filename)); - sprintf - (split_filename, - "%s%s-%d", root_pathname, root_filename, which_file); - - fd = open - (split_filename, O_WRONLY | O_TRUNC | O_CREAT, 0666); - - if ((fd < 0) || - (write (fd, the_header, header_size) != header_size) || - (write (fd, the_file + file_top, file_bot - file_top) - != (file_bot - file_top)) || - ((close (fd)) < 0)) - { - perror (split_filename); - if (fd != -1) - close (fd); - exit (FATAL); - } - - if (!indirect_info) - { - indirect_info = the_file + file_top; - sprintf (indirect_info, "\037\nIndirect:\n"); - indirect_info += strlen (indirect_info); - } - - sprintf (indirect_info, "%s-%d: %d\n", - root_filename, which_file, file_top); - - free (split_filename); - indirect_info += strlen (indirect_info); - which_file++; - break; - } - } - } + int file_top, file_bot, limit; + + /* Have to include the Control-_. */ + file_top = file_bot = tags->position; + limit = file_top + size; + + /* If the rest of this file is only one node, then + that is the entire subfile. */ + if (!tags->next_ent) + { + int i = tags->position + 1; + char last_char = the_file[i]; + + while (i < file_size) + { + if ((the_file[i] == '\037') && + ((last_char == '\n') || + (last_char == '\014'))) + break; + else + last_char = the_file[i]; + i++; + } + file_bot = i; + tags = tags->next_ent; + goto write_region; + } + + /* Otherwise, find the largest number of nodes that can fit in + this subfile. */ + for (; tags; tags = tags->next_ent) + { + if (!tags->next_ent) + { + /* This entry is the last node. Search forward for the end + of this node, and that is the end of this file. */ + int i = tags->position + 1; + char last_char = the_file[i]; + + while (i < file_size) + { + if ((the_file[i] == '\037') && + ((last_char == '\n') || + (last_char == '\014'))) + break; + else + last_char = the_file[i]; + i++; + } + file_bot = i; + + if (file_bot < limit) + { + tags = tags->next_ent; + goto write_region; + } + else + { + /* Here we want to write out everything before the last + node, and then write the last node out in a file + by itself. */ + file_bot = tags->position; + goto write_region; + } + } + + if (tags->next_ent->position > limit) + { + if (tags->position == file_top) + tags = tags->next_ent; + + file_bot = tags->position; + + write_region: + { + int fd; + char *split_filename; + + split_filename = (char *) xmalloc + (10 + strlen (root_pathname) + strlen (root_filename)); + sprintf + (split_filename, + "%s%s-%d", root_pathname, root_filename, which_file); + + fd = open + (split_filename, O_WRONLY | O_TRUNC | O_CREAT, 0666); + + if ((fd < 0) || + (write (fd, the_header, header_size) != header_size) || + (write (fd, the_file + file_top, file_bot - file_top) + != (file_bot - file_top)) || + ((close (fd)) < 0)) + { + perror (split_filename); + if (fd != -1) + close (fd); + exit (FATAL); + } + + if (!indirect_info) + { + indirect_info = the_file + file_top; + sprintf (indirect_info, "\037\nIndirect:\n"); + indirect_info += strlen (indirect_info); + } + + sprintf (indirect_info, "%s-%d: %d\n", + root_filename, which_file, file_top); + + free (split_filename); + indirect_info += strlen (indirect_info); + which_file++; + break; + } + } + } } /* We have sucessfully created the subfiles. Now write out the @@ -5418,8 +5455,8 @@ split_file (filename, size) output_stream = fopen (filename, "w"); if (!output_stream) { - perror (filename); - exit (FATAL); + perror (filename); + exit (FATAL); } { @@ -5438,10 +5475,8 @@ split_file (filename, size) } } -/* Some menu hacking. This is used to remember menu references while - reading the input file. After the output file has been written, if - validation is on, then we use the contents of NODE_REFERENCES as a - list of nodes to validate. */ +/* The strings here are followed in the message by `reference to...' in + the `validate' routine. */ char * reftype_type_string (type) enum reftype type; @@ -5451,13 +5486,16 @@ reftype_type_string (type) case menu_reference: return ("Menu"); case followed_reference: - return ("Followed-Reference"); + return ("Cross"); default: return ("Internal-bad-reference-type"); } } -/* Remember this node name for later validation use. */ +/* Remember this node name for later validation use. This is used to + remember menu references while reading the input file. After the + output file has been written, if validation is on, then we use the + contents of `node_references' as a list of nodes to validate. */ void remember_node_reference (node, line, type) char *node; @@ -5467,11 +5505,11 @@ remember_node_reference (node, line, type) NODE_REF *temp = (NODE_REF *) xmalloc (sizeof (NODE_REF)); temp->next = node_references; - temp->node = strdup (node); + temp->node = xstrdup (node); temp->line_no = line; temp->section = current_section; temp->type = type; - temp->containing_node = strdup (current_node ? current_node : ""); + temp->containing_node = xstrdup (current_node ? current_node : ""); temp->filename = node_filename; node_references = temp; @@ -5487,7 +5525,7 @@ validate_other_references (ref_list) { input_filename = ref_list->filename; validate (ref_list->node, ref_list->line_no, - reftype_type_string (ref_list->type)); + reftype_type_string (ref_list->type)); ref_list = ref_list->next; } input_filename = old_input_filename; @@ -5502,7 +5540,7 @@ find_node_reference (node, ref_list) while (ref_list) { if (strcmp (node, ref_list->node) == 0) - break; + break; ref_list = ref_list->next; } return (ref_list); @@ -5539,13 +5577,13 @@ glean_node_from_menu (remember_reference) char *nodename; if (strncmp (&input_text[input_text_offset + 1], - menu_starter, - strlen (menu_starter)) != 0) + menu_starter, + strlen (menu_starter)) != 0) return ((char *)NULL); else input_text_offset += strlen (menu_starter) + 1; - get_until_in_line (":", &nodename); + get_until_in_line (0, ":", &nodename); if (curchar () == ':') input_text_offset++; canon_white (nodename); @@ -5571,7 +5609,7 @@ save_node: normalize_node_name (nodename); i = strlen (nodename); if (i && nodename[i - 1] == ':') - nodename[i - 1] = '\0'; + nodename[i - 1] = 0; if (remember_reference) { @@ -5598,7 +5636,7 @@ isolate_nodename (nodename) if (*nodename == '.' || !*nodename) { - *nodename = '\0'; + *nodename = 0; return; } @@ -5609,32 +5647,32 @@ isolate_nodename (nodename) i++; } - for (; c = nodename[i]; i++) + for (; (c = nodename[i]); i++) { if (paren) - { - if (c == '(') - paren++; - else if (c == ')') - paren--; + { + if (c == '(') + paren++; + else if (c == ')') + paren--; - continue; - } + continue; + } /* If the character following the close paren is a space, then this - node has no more characters associated with it. */ + node has no more characters associated with it. */ if (c == '\t' || - c == '\n' || - c == ',' || - ((paren_seen && nodename[i - 1] == ')') && - (c == ' ' || c == '.')) || - (c == '.' && - ((!nodename[i + 1] || - (cr_or_whitespace (nodename[i + 1])) || - (nodename[i + 1] == ')'))))) - break; + c == '\n' || + c == ',' || + ((paren_seen && nodename[i - 1] == ')') && + (c == ' ' || c == '.')) || + (c == '.' && + ((!nodename[i + 1] || + (cr_or_whitespace (nodename[i + 1])) || + (nodename[i + 1] == ')'))))) + break; } - nodename[i] = '\0'; + nodename[i] = 0; } void @@ -5642,8 +5680,8 @@ cm_menu () { if (current_node == (char *)NULL) { - warning ("%cmenu seen before a node has been defined", COMMAND_PREFIX); - warning ("Creating `TOP' node."); + warning (_("%cmenu seen before first node"), COMMAND_PREFIX); + warning (_("creating `Top' node")); execute_string ("@node Top"); } begin_insertion (menu); @@ -5654,19 +5692,21 @@ cm_detailmenu () { if (current_node == (char *)NULL) { - warning ("%cmenu seen before a node has been defined", COMMAND_PREFIX); - warning ("Creating `TOP' node."); + warning (_("%cmenu seen before first node"), COMMAND_PREFIX); + warning (_("creating `Top' node")); execute_string ("@node Top"); } begin_insertion (detailmenu); } /* **************************************************************** */ -/* */ -/* Cross Reference Hacking */ -/* */ +/* */ +/* Cross Reference Hacking */ +/* */ /* **************************************************************** */ +/* Return next comma-delimited argument, but do not cross a close-brace + boundary. Clean up whitespace, too. */ char * get_xref_token () { @@ -5679,7 +5719,7 @@ get_xref_token () return (string); } -int px_ref_flag = 0; /* Controls initial output string. */ +int px_ref_flag = 0; /* Controls initial output string. */ /* Make a cross reference. */ void @@ -5698,45 +5738,45 @@ cm_xref (arg) add_word_args ("%s", px_ref_flag ? "*note " : "*Note "); if (*arg5 || *arg4) - { - char *node_name; - - if (!*arg2) - { - if (*arg3) - node_name = arg3; - else - node_name = arg1; - } - else - node_name = arg2; - - execute_string ("%s: (%s)%s", node_name, arg4, arg1); - /* Free all of the arguments found. */ - if (arg1) free (arg1); - if (arg2) free (arg2); - if (arg3) free (arg3); - if (arg4) free (arg4); - if (arg5) free (arg5); - return; - } + { + char *node_name; + + if (!*arg2) + { + if (*arg3) + node_name = arg3; + else + node_name = arg1; + } + else + node_name = arg2; + + execute_string ("%s: (%s)%s", node_name, arg4, arg1); + /* Free all of the arguments found. */ + if (arg1) free (arg1); + if (arg2) free (arg2); + if (arg3) free (arg3); + if (arg4) free (arg4); + if (arg5) free (arg5); + return; + } else - remember_node_reference (arg1, line_number, followed_reference); + remember_node_reference (arg1, line_number, followed_reference); if (*arg3) - { - if (!*arg2) - execute_string ("%s: %s", arg3, arg1); - else - execute_string ("%s: %s", arg2, arg1); - } + { + if (!*arg2) + execute_string ("%s: %s", arg3, arg1); + else + execute_string ("%s: %s", arg2, arg1); + } else - { - if (*arg2) - execute_string ("%s: %s", arg2, arg1); - else - execute_string ("%s::", arg1); - } + { + if (*arg2) + execute_string ("%s: %s", arg2, arg1); + else + execute_string ("%s::", arg1); + } /* Free all of the arguments found. */ if (arg1) free (arg1); @@ -5753,26 +5793,25 @@ cm_xref (arg) int temp = input_text_offset + 1; if (output_paragraph[output_paragraph_offset - 2] == ':' && - output_paragraph[output_paragraph_offset - 1] == ':') - return; + output_paragraph[output_paragraph_offset - 1] == ':') + return; while (temp < size_of_input_text) - { - if (cr_or_whitespace (input_text[temp])) - temp++; - else - { - if (input_text[temp] == '.' || - input_text[temp] == ',' || - input_text[temp] == '\t') - return; - else - { - line_error ( - "Cross-reference must be terminated with a period or a comma"); - return; - } - } - } + { + if (cr_or_whitespace (input_text[temp])) + temp++; + else + { + if (input_text[temp] != '.' + && input_text[temp] != ',' + && input_text[temp] != '\t') + { + line_error ( + _("`.' or `,' must follow cross reference, not %c"), + input_text[temp]); + } + break; + } + } } } @@ -5796,20 +5835,159 @@ cm_inforef (arg) { if (arg == START) { - char *node, *pname, *file; + char *node = get_xref_token (); + char *pname = get_xref_token (); + char *file = get_xref_token (); + + if (*pname) + execute_string ("*note %s: (%s)%s", pname, file, node); + else + execute_string ("*note (%s)%s::", file, node); + + free (node); + free (pname); + free (file); + } +} + +/* A URL reference. */ +void +cm_uref (arg, start_pos, end_pos) + int arg, start_pos, end_pos; +{ + if (arg == END) + { + char *comma; + char *arg = &output_paragraph[start_pos]; + + output_paragraph[end_pos] = 0; + output_column -= end_pos - start_pos; + output_paragraph_offset = start_pos; + + arg = xstrdup (arg); + comma = strchr (arg, ','); /* let's hope for no commas in the url */ + if (comma) + { + *comma = 0; + /* Ignore spaces at beginning of second arg. */ + for (comma++; isspace (*comma); comma++) + ; + add_word (comma); + add_char (' '); + add_char ('('); + add_word (arg); + add_char (')'); + } + else + { + extern int printing_index; + + if (!printing_index) + add_char ('`'); + + add_word (arg); + + if (!printing_index) + add_char ('\''); + } + free (arg); + } +} + +/* An email reference. */ +void +cm_email (arg, start_pos, end_pos) + int arg, start_pos, end_pos; +{ + if (arg == END) + { + char *comma; + char *arg = &output_paragraph[start_pos]; + + output_paragraph[end_pos] = 0; + output_column -= end_pos - start_pos; + output_paragraph_offset = start_pos; - node = get_xref_token (); - pname = get_xref_token (); - file = get_xref_token (); + arg = xstrdup (arg); + comma = strchr (arg, ','); + if (comma) + { + *comma = 0; + for (comma++; isspace (*comma); comma++) + ; + add_word (comma); + add_char (' '); + } + add_char ('<'); + add_word (arg); + add_char ('>'); + free (arg); + } +} + +/* An external image is a reference, kind of. The parsing is (not + coincidentally) similar, anyway. */ +void +cm_image (arg) + int arg; +{ + if (arg == START) + { + char *name_arg = get_xref_token (); + /* We don't yet care about any other args, but read them so they + don't end up in the text. */ + char *arg = get_xref_token (); + if (arg) free (arg); + arg = get_xref_token (); + if (arg) free (arg); + + if (*name_arg) + { + /* Try to open foo.txt. */ + FILE *image_file; + char *name = xmalloc (strlen (name_arg) + 4); + strcpy (name, name_arg); + strcat (name, ".txt"); + image_file = fopen (name, "r"); + if (image_file) + { + int ch; + int save_inhibit_indentation = inhibit_paragraph_indentation; + int save_filling_enabled = filling_enabled; + + inhibit_paragraph_indentation = 1; + filling_enabled = 0; + last_char_was_newline = 0; + + /* Maybe we need to remove the final newline if the image + file is only one line to allow in-line images. On the + other hand, they could just make the file without a + final newline. */ + while ((ch = getc (image_file)) != EOF) + add_char (ch); + + inhibit_paragraph_indentation = save_inhibit_indentation; + filling_enabled = save_filling_enabled; + + if (fclose (image_file) != 0) { + perror (name); + } + } + else + warning (_("@image file `%s' unreadable: %s"), name, + strerror (errno)); + } + else + line_error (_("@image missing filename argument")); - execute_string ("*note %s: (%s)%s", pname, file, node); + if (name_arg) free (name_arg); } } /* **************************************************************** */ -/* */ -/* Insertion Command Stubs */ -/* */ +/* */ +/* Insertion Command Stubs */ +/* */ /* **************************************************************** */ void @@ -5843,7 +6021,7 @@ cm_smalllisp () } /* @cartouche/@end cartouche draws box with rounded corners in - TeX output. Right now, just a NOP insertion. */ + TeX output. Right now, just a no-op insertion. */ void cm_cartouche () { @@ -5890,26 +6068,26 @@ do_enumeration (type, default_string) int type; char *default_string; { - get_until_in_line (".", &enumeration_arg); + get_until_in_line (0, ".", &enumeration_arg); canon_white (enumeration_arg); if (!*enumeration_arg) { free (enumeration_arg); - enumeration_arg = strdup (default_string); + enumeration_arg = xstrdup (default_string); } if (!isdigit (*enumeration_arg) && !isletter (*enumeration_arg)) { - warning ("%s requires a letter or a digit", insertion_type_pname (type)); + warning (_("%s requires letter or digit"), insertion_type_pname (type)); switch (type) - { - case enumerate: - default_string = "1"; - break; - } - enumeration_arg = strdup (default_string); + { + case enumerate: + default_string = "1"; + break; + } + enumeration_arg = xstrdup (default_string); } begin_insertion (type); } @@ -5923,7 +6101,7 @@ cm_table () void cm_multitable () { - begin_insertion (multitable); /* @@ */ + begin_insertion (multitable); /* @@ */ } void @@ -5950,6 +6128,18 @@ cm_ifinfo () begin_insertion (ifinfo); } +void +cm_ifnothtml () +{ + begin_insertion (ifnothtml); +} + +void +cm_ifnottex () +{ + begin_insertion (ifnottex); +} + /* Begin an insertion where the lines are not filled or indented. */ void cm_flushleft () @@ -5964,11 +6154,40 @@ cm_flushright () { begin_insertion (flushright); } + +/* End existing insertion block. */ +void +cm_end () +{ + char *temp; + enum insertion_type type; + + if (!insertion_level) + { + line_error (_("Unmatched `%c%s'"), COMMAND_PREFIX, command); + return; + } + + get_rest_of_line (&temp); + + if (temp[0] == 0) + line_error (_("`%c%s' needs something after it"), COMMAND_PREFIX, command); + + type = find_type_from_name (temp); + + if (type == bad_type) + { + line_error (_("Bad argument to `%s', `%s', using `%s'"), + command, temp, insertion_type_pname (current_insertion_type ())); + } + end_insertion (type); + free (temp); +} /* **************************************************************** */ -/* */ -/* Conditional Handling */ -/* */ +/* */ +/* Conditional Handling */ +/* */ /* **************************************************************** */ /* A structure which contains `defined' variables. */ @@ -5992,15 +6211,15 @@ set (name, value) for (temp = defines; temp; temp = temp->next) if (strcmp (name, temp->name) == 0) { - free (temp->value); - temp->value = strdup (value); - return; + free (temp->value); + temp->value = xstrdup (value); + return; } temp = (DEFINE *)xmalloc (sizeof (DEFINE)); temp->next = defines; - temp->name = strdup (name); - temp->value = strdup (value); + temp->name = xstrdup (name); + temp->value = xstrdup (value); defines = temp; } @@ -6017,17 +6236,17 @@ clear (name) while (temp) { if (strcmp (temp->name, name) == 0) - { - if (last) - last->next = temp->next; - else - defines = temp->next; - - free (temp->name); - free (temp->value); - free (temp); - break; - } + { + if (last) + last->next = temp->next; + else + defines = temp->next; + + free (temp->name); + free (temp->value); + free (temp); + break; + } last = temp; temp = temp->next; } @@ -6097,7 +6316,6 @@ cm_ifclear () void cm_ifeq () { - register int i; char **arglist; arglist = get_brace_args (0); @@ -6105,11 +6323,11 @@ cm_ifeq () if (arglist) { if (array_len (arglist) > 1) - { - if ((strcasecmp (arglist[0], arglist[1]) == 0) && - (arglist[2] != (char *)NULL)) - execute_string ("%s\n", arglist[2]); - } + { + if ((strcasecmp (arglist[0], arglist[1]) == 0) && + (arglist[2] != (char *)NULL)) + execute_string ("%s\n", arglist[2]); + } free_array (arglist); } @@ -6122,9 +6340,9 @@ cm_value (arg, start_pos, end_pos) if (arg == END) { char *name, *value; - name = (char *)&output_paragraph[start_pos]; - output_paragraph[end_pos] = '\0'; - name = strdup (name); + name = &output_paragraph[start_pos]; + output_paragraph[end_pos] = 0; + name = xstrdup (name); value = set_p (name); output_column -= end_pos - start_pos; output_paragraph_offset = start_pos; @@ -6132,7 +6350,7 @@ cm_value (arg, start_pos, end_pos) if (value) execute_string ("%s", value); else - add_word_args ("{No Value For \"%s\"}", name); + add_word_args (_("{No Value For \"%s\"}"), name); free (name); } @@ -6147,7 +6365,6 @@ handle_variable (action) get_rest_of_line (&name); backup_input_pointer (); - canon_white (name); handle_variable_internal (action, name); free (name); } @@ -6167,12 +6384,12 @@ handle_variable_internal (action, name) { /* #if defined (SET_WITH_EQUAL) */ if (*temp == '"' || *temp == '\'') - { - if (*temp == delimiter) - delimiter = 0; - else - delimiter = *temp; - } + { + if (*temp == delimiter) + delimiter = 0; + else + delimiter = *temp; + } /* #endif SET_WITH_EQUAL */ temp++; } @@ -6180,135 +6397,146 @@ handle_variable_internal (action, name) if (*temp) additional_text_present++; - *temp = '\0'; + *temp = 0; if (!*name) - line_error ("%c%s requires a name", COMMAND_PREFIX, command); + line_error (_("%c%s requires a name"), COMMAND_PREFIX, command); else { switch (action) - { - case SET: - { - char *value; + { + case SET: + { + char *value; #if defined (SET_WITH_EQUAL) - /* Allow a value to be saved along with a variable. The value is - the text following an `=' sign in NAME, if any is present. */ + /* Allow a value to be saved along with a variable. The value is + the text following an `=' sign in NAME, if any is present. */ - for (value = name; *value && *value != '='; value++); + for (value = name; *value && *value != '='; value++); - if (*value) - *value++ = '\0'; + if (*value) + *value++ = 0; - if (*value == '"' || *value == '\'') - { - value++; - value[strlen (value) - 1] = '\0'; - } + if (*value == '"' || *value == '\'') + { + value++; + value[strlen (value) - 1] = 0; + } #else /* !SET_WITH_EQUAL */ - /* The VALUE of NAME is the remainder of the line sans - whitespace. */ - if (additional_text_present) - { - value = temp + 1; - canon_white (value); - } - else - value = ""; + /* The VALUE of NAME is the remainder of the line sans + whitespace. */ + if (additional_text_present) + { + value = temp + 1; + canon_white (value); + } + else + value = ""; #endif /* !SET_WITH_VALUE */ - set (name, value); - } - break; - - case CLEAR: - clear (name); - break; - - case IFSET: - case IFCLEAR: - /* If IFSET and NAME is not set, or if IFCLEAR and NAME is set, - read lines from the the file until we reach a matching - "@end CONDITION". This means that we only take note of - "@ifset/clear" and "@end" commands. */ - { - char condition[8]; - int condition_len; - - if (action == IFSET) - strcpy (condition, "ifset"); - else - strcpy (condition, "ifclear"); - - condition_len = strlen (condition); - - if ((action == IFSET && !set_p (name)) || - (action == IFCLEAR && set_p (name))) - { - int level = 0, done = 0; - - while (!done) - { - char *freeable_line, *line; - - get_rest_of_line (&freeable_line); - - for (line = freeable_line; whitespace (*line); line++); - - if (*line == COMMAND_PREFIX && - (strncmp (line + 1, condition, condition_len) == 0)) - level++; - else if (strncmp (line, "@end", 4) == 0) - { - char *cname = line + 4; - char *temp; - - while (*cname && whitespace (*cname)) - cname++; - temp = cname; - - while (*temp && !whitespace (*temp)) - temp++; - *temp = '\0'; - - if (strcmp (cname, condition) == 0) - { - if (!level) - { - done = 1; - } - else - level--; - } - } - free (freeable_line); - } - /* We found the end of a false @ifset/ifclear. If we are - in a menu, back up over the newline that ends the ifset, - since that newline may also begin the next menu entry. */ - break; - } - else - { - if (action == IFSET) - begin_insertion (ifset); - else - begin_insertion (ifclear); - } - } - break; - } + set (name, value); + } + break; + + case CLEAR: + clear (name); + break; + + case IFSET: + case IFCLEAR: + /* If IFSET and NAME is not set, or if IFCLEAR and NAME is set, + read lines from the the file until we reach a matching + "@end CONDITION". This means that we only take note of + "@ifset/clear" and "@end" commands. */ + { + char condition[8]; + int condition_len; + int orig_line_number = line_number; + + if (action == IFSET) + strcpy (condition, "ifset"); + else + strcpy (condition, "ifclear"); + + condition_len = strlen (condition); + + if ((action == IFSET && !set_p (name)) + || (action == IFCLEAR && set_p (name))) + { + int level = 0, done = 0; + + while (!done && input_text_offset < size_of_input_text) + { + char *freeable_line, *line; + + get_rest_of_line (&freeable_line); + + for (line = freeable_line; whitespace (*line); line++); + + if (*line == COMMAND_PREFIX && + (strncmp (line + 1, condition, condition_len) == 0)) + level++; + else if (strncmp (line, "@end", 4) == 0) + { + char *cname = line + 4; + char *temp; + + while (*cname && whitespace (*cname)) + cname++; + temp = cname; + + while (*temp && !whitespace (*temp)) + temp++; + *temp = 0; + + if (strcmp (cname, condition) == 0) + { + if (!level) + { + done = 1; + } + else + level--; + } + } + free (freeable_line); + } + + if (!done) + { + int save = line_number; + line_number = orig_line_number; + line_error (_("Reached eof before matching @end %s"), + condition); + line_number = save; + } + + /* We found the end of a false @ifset/ifclear. If we are + in a menu, back up over the newline that ends the ifset, + since that newline may also begin the next menu entry. */ + break; + } + else + { + if (action == IFSET) + begin_insertion (ifset); + else + begin_insertion (ifclear); + } + } + break; + } } } /* Execution of random text not in file. */ typedef struct { - char *string; /* The string buffer. */ - int size; /* The size of the buffer. */ - int in_use; /* Non-zero means string currently in use. */ + char *string; /* The string buffer. */ + int size; /* The size of the buffer. */ + int in_use; /* Nonzero means string currently in use. */ } EXECUTION_STRING; static EXECUTION_STRING **execution_strings = (EXECUTION_STRING **)NULL; @@ -6325,26 +6553,26 @@ get_execution_string (initial_size) if (execution_strings) { for (i = 0; i < execution_strings_index; i++) - if (execution_strings[i] && (execution_strings[i]->in_use == 0)) - { - es = execution_strings[i]; - break; - } + if (execution_strings[i] && (execution_strings[i]->in_use == 0)) + { + es = execution_strings[i]; + break; + } } if (!es) { if (execution_strings_index + 1 >= execution_strings_slots) - { - execution_strings = (EXECUTION_STRING **)xrealloc - (execution_strings, - (execution_strings_slots += 3) * sizeof (EXECUTION_STRING *)); - for (; i < execution_strings_slots; i++) - execution_strings[i] = (EXECUTION_STRING *)NULL; - } + { + execution_strings = (EXECUTION_STRING **)xrealloc + (execution_strings, + (execution_strings_slots += 3) * sizeof (EXECUTION_STRING *)); + for (; i < execution_strings_slots; i++) + execution_strings[i] = (EXECUTION_STRING *)NULL; + } execution_strings[execution_strings_index] = - (EXECUTION_STRING *)xmalloc (sizeof (EXECUTION_STRING)); + (EXECUTION_STRING *)xmalloc (sizeof (EXECUTION_STRING)); es = execution_strings[execution_strings_index]; execution_strings_index++; @@ -6363,46 +6591,37 @@ get_execution_string (initial_size) /* Execute the string produced by formatting the ARGs with FORMAT. This is like submitting a new file with @include. */ -#if defined (HAVE_VARARGS_H) && defined (HAVE_VSPRINTF) -void -execute_string (va_alist) - va_dcl -{ - EXECUTION_STRING *es; - char *temp_string; - char *format; - va_list args; - - es = get_execution_string (4000); - temp_string = es->string; - es->in_use = 1; - - va_start (args); - format = va_arg (args, char *); - vsprintf (temp_string, format, args); - va_end (args); - -#else /* !(HAVE_VARARGS_H && HAVE_VSPRINTF) */ - void -execute_string (format, arg1, arg2, arg3, arg4, arg5) - char *format; +#if defined (VA_FPRINTF) && __STDC__ +execute_string (char *format, ...) +#else +execute_string (format, va_alist) + char *format; + va_dcl +#endif { EXECUTION_STRING *es; char *temp_string; +#ifdef VA_FPRINTF + va_list ap; +#endif es = get_execution_string (4000); temp_string = es->string; es->in_use = 1; - sprintf (temp_string, format, arg1, arg2, arg3, arg4, arg5); - -#endif /* !(HAVE_VARARGS_H && HAVE_VSPRINTF) */ + VA_START (ap, format); +#ifdef VA_SPRINTF + VA_SPRINTF (temp_string, format, ap); +#else + sprintf (temp_string, format, a1, a2, a3, a4, a5, a6, a7, a8); +#endif /* not VA_SPRINTF */ + va_end (ap); pushfile (); input_text_offset = 0; input_text = temp_string; - input_filename = strdup (input_filename); + input_filename = xstrdup (input_filename); size_of_input_text = strlen (temp_string); executing_string++; @@ -6429,9 +6648,13 @@ expansion (str, implicit_code) /* Inhibit any real output. */ int start = output_paragraph_offset; int saved_paragraph_is_open = paragraph_is_open; + FILE *saved_macro_expansion_output_stream = macro_expansion_output_stream; inhibit_output_flushing (); + macro_expansion_output_stream = NULL; + paragraph_is_open = 1; execute_string (implicit_code ? "@code{%s}" : "%s", str); + macro_expansion_output_stream = saved_macro_expansion_output_stream; uninhibit_output_flushing (); /* Copy the expansion from the buffer. */ @@ -6474,179 +6697,183 @@ cm_item () original_input_text_offset = input_text_offset; get_rest_of_line (&rest_of_line); - canon_white (rest_of_line); item_func = current_item_function (); /* Okay, do the right thing depending on which insertion function - is active. */ + is active. */ switch_top: switch (stack->insertion) - { - case multitable: - multitable_item (); - /* Ultra special hack. It appears that some people incorrectly - place text directly after the @item, instead of on a new line - by itself. This happens to work in TeX, so I make it work - here. */ - if (*rest_of_line) - { - line_number--; - input_text_offset = original_input_text_offset; - } - break; - - case ifinfo: - case ifset: - case ifclear: - case cartouche: - stack = stack->next; - if (!stack) - goto no_insertion; - else - goto switch_top; - break; - - case menu: - case quotation: - case example: - case smallexample: - case lisp: - case format: - case display: - case group: - line_error ("The `%c%s' command is meaningless within a `@%s' block", - COMMAND_PREFIX, command, - insertion_type_pname (current_insertion_type ())); - break; - - case itemize: - case enumerate: - if (itemx_flag) - { - line_error ("%citemx is not meaningful inside of a `%s' block", - COMMAND_PREFIX, - insertion_type_pname (current_insertion_type ())); - } - else - { - start_paragraph (); - kill_self_indent (-1); - filling_enabled = indented_fill = 1; - - if (current_insertion_type () == itemize) - { - indent (output_column = current_indent - 2); - - /* I need some way to determine whether this command - takes braces or not. I believe the user can type - either "@bullet" or "@bullet{}". Of course, they - can also type "o" or "#" or whatever else they want. */ - if (item_func && *item_func) - { - if (*item_func == COMMAND_PREFIX) - if (item_func[strlen (item_func) - 1] != '}') - execute_string ("%s{}", item_func); - else - execute_string ("%s", item_func); - else - execute_string ("%s", item_func); - } - insert (' '); - output_column++; - } - else - enumerate_item (); - - /* Special hack. This makes close paragraph ignore you until - the start_paragraph () function has been called. */ - must_start_paragraph = 1; - - /* Ultra special hack. It appears that some people incorrectly - place text directly after the @item, instead of on a new line - by itself. This happens to work in TeX, so I make it work - here. */ - if (*rest_of_line) - { - line_number--; - input_text_offset = original_input_text_offset; - } - } - break; - - case table: - case ftable: - case vtable: - { - /* Get rid of extra characters. */ - kill_self_indent (-1); - - /* close_paragraph () almost does what we want. The problem - is when paragraph_is_open, and last_char_was_newline, and - the last newline has been turned into a space, because - filling_enabled. I handle it here. */ - if (last_char_was_newline && filling_enabled && paragraph_is_open) - insert ('\n'); - close_paragraph (); + { + case multitable: + multitable_item (); + /* Ultra special hack. It appears that some people incorrectly + place text directly after the @item, instead of on a new line + by itself. This happens to work in TeX, so I make it work + here. */ + if (*rest_of_line) + { + line_number--; + input_text_offset = original_input_text_offset; + } + break; + + case ifinfo: + case ifset: + case ifclear: + case cartouche: + stack = stack->next; + if (!stack) + goto no_insertion; + else + goto switch_top; + break; + + case menu: + case quotation: + case example: + case smallexample: + case lisp: + case format: + case display: + case group: + line_error (_("The `%c%s' command is meaningless within a `@%s' block"), + COMMAND_PREFIX, command, + insertion_type_pname (current_insertion_type ())); + break; + + case itemize: + case enumerate: + if (itemx_flag) + { + line_error (_("%citemx is not meaningful inside of a `%s' block"), + COMMAND_PREFIX, + insertion_type_pname (current_insertion_type ())); + } + else + { + start_paragraph (); + kill_self_indent (-1); + filling_enabled = indented_fill = 1; + + if (current_insertion_type () == itemize) + { + indent (output_column = current_indent - 2); + + /* I need some way to determine whether this command + takes braces or not. I believe the user can type + either "@bullet" or "@bullet{}". Of course, they + can also type "o" or "#" or whatever else they want. */ + if (item_func && *item_func) + { + if (*item_func == COMMAND_PREFIX) + if (item_func[strlen (item_func) - 1] != '}') + execute_string ("%s{}", item_func); + else + execute_string ("%s", item_func); + else + execute_string ("%s", item_func); + } + insert (' '); + output_column++; + } + else + enumerate_item (); + + /* Special hack. This makes `close_paragraph' a no-op until + `start_paragraph' has been called. */ + must_start_paragraph = 1; + + /* Handle text directly after the @item. */ + if (*rest_of_line) + { + line_number--; + input_text_offset = original_input_text_offset; + } + } + break; + + case table: + case ftable: + case vtable: + { + /* We need this to determine if we have two @item's in a row + (see test just below). */ + static int last_item_output_position = 0; + + /* Get rid of extra characters. */ + kill_self_indent (-1); + + /* If we have one @item followed directly by another @item, + we need to insert a blank line. This is not true for + @itemx, though. */ + if (!itemx_flag && last_item_output_position == output_position) + insert ('\n'); + + /* `close_paragraph' almost does what we want. The problem + is when paragraph_is_open, and last_char_was_newline, and + the last newline has been turned into a space, because + filling_enabled. I handle it here. */ + if (last_char_was_newline && filling_enabled && paragraph_is_open) + insert ('\n'); + close_paragraph (); #if defined (INDENT_PARAGRAPHS_IN_TABLE) - /* Indent on a new line, but back up one indentation level. */ - { - int t; - - t = inhibit_paragraph_indentation; - inhibit_paragraph_indentation = 1; - /* At this point, inserting any non-whitespace character will - force the existing indentation to be output. */ - add_char ('i'); - inhibit_paragraph_indentation = t; - } + /* Indent on a new line, but back up one indentation level. */ + { + int save = inhibit_paragraph_indentation; + inhibit_paragraph_indentation = 1; + /* At this point, inserting any non-whitespace character will + force the existing indentation to be output. */ + add_char ('i'); + inhibit_paragraph_indentation = save; + } #else /* !INDENT_PARAGRAPHS_IN_TABLE */ - add_char ('i'); + add_char ('i'); #endif /* !INDENT_PARAGRAPHS_IN_TABLE */ - output_paragraph_offset--; - kill_self_indent (default_indentation_increment + 1); - - /* Add item's argument to the line. */ - filling_enabled = 0; - if (item_func && *item_func) - execute_string ("%s{%s}", item_func, rest_of_line); - else - execute_string ("%s", rest_of_line); - - if (current_insertion_type () == ftable) - execute_string ("%cfindex %s\n", COMMAND_PREFIX, rest_of_line); - - if (current_insertion_type () == vtable) - execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line); - - /* Start a new line, and let start_paragraph () - do the indenting of it for you. */ - close_single_paragraph (); - indented_fill = filling_enabled = 1; - } - } + output_paragraph_offset--; + kill_self_indent (default_indentation_increment + 1); + + /* Add item's argument to the line. */ + filling_enabled = 0; + if (item_func && *item_func) + execute_string ("%s{%s}", item_func, rest_of_line); + else + execute_string ("%s", rest_of_line); + + if (current_insertion_type () == ftable) + execute_string ("%cfindex %s\n", COMMAND_PREFIX, rest_of_line); + else if (current_insertion_type () == vtable) + execute_string ("%cvindex %s\n", COMMAND_PREFIX, rest_of_line); + + /* Start a new line, and let start_paragraph () + do the indenting of it for you. */ + close_single_paragraph (); + indented_fill = filling_enabled = 1; + last_item_output_position = output_position; + } + } free (rest_of_line); } else { no_insertion: - line_error ("%c%s found outside of an insertion block", - COMMAND_PREFIX, command); + line_error (_("%c%s found outside of an insertion block"), + COMMAND_PREFIX, command); } } /* **************************************************************** */ -/* */ -/* Defun and Friends */ -/* */ +/* */ +/* Defun and Friends */ +/* */ /* **************************************************************** */ -#define DEFUN_SELF_DELIMITING(c) \ - (((c) == '(') \ - || ((c) == ')') \ - || ((c) == '[') \ +#define DEFUN_SELF_DELIMITING(c) \ + (((c) == '(') \ + || ((c) == ')') \ + || ((c) == '[') \ || ((c) == ']')) struct token_accumulator @@ -6674,7 +6901,7 @@ accumulate_token (accumulator, token) { (accumulator->length) += 10; (accumulator->tokens) = (char **) xrealloc - (accumulator->tokens, (accumulator->length * sizeof (char *))); + (accumulator->tokens, (accumulator->length * sizeof (char *))); } accumulator->tokens[accumulator->index] = token; accumulator->index += 1; @@ -6694,7 +6921,7 @@ copy_substring (start, end) while (scan < end) *scan_result++ = *scan++; - *scan_result = '\0'; + *scan_result = 0; return (result); } @@ -6713,25 +6940,25 @@ scan_group_in_string (string_pointer) while (1) { if (level == 0) - { - (*string_pointer) = scan_string; - return (1); - } + { + (*string_pointer) = scan_string; + return (1); + } c = (*scan_string++); - if (c == '\0') - { - /* Tweak line_number to compensate for fact that - we gobbled the whole line before coming here. */ - line_number -= 1; - line_error ("Missing `}' in %cdef arg", COMMAND_PREFIX); - line_number += 1; - (*string_pointer) = (scan_string - 1); - return (0); - } + if (c == 0) + { + /* Tweak line_number to compensate for fact that + we gobbled the whole line before coming here. */ + line_number -= 1; + line_error (_("Missing `}' in %cdef arg"), COMMAND_PREFIX); + line_number += 1; + (*string_pointer) = (scan_string - 1); + return (0); + } if (c == '{') - level += 1; + level += 1; if (c == '}') - level -= 1; + level -= 1; } } @@ -6749,103 +6976,103 @@ args_from_string (string) initialize_token_accumulator (&accumulator); - while ((*scan_string) != '\0') + while ((*scan_string) != 0) { /* Replace arbitrary whitespace by a single space. */ if (whitespace (*scan_string)) - { - scan_string += 1; - while (whitespace (*scan_string)) - scan_string += 1; - accumulate_token ((&accumulator), (strdup (" "))); - continue; - } + { + scan_string += 1; + while (whitespace (*scan_string)) + scan_string += 1; + accumulate_token ((&accumulator), (xstrdup (" "))); + continue; + } /* Commands count as single tokens. */ if ((*scan_string) == COMMAND_PREFIX) - { - token_start = scan_string; - scan_string += 1; - if (self_delimiting (*scan_string)) - scan_string += 1; - else - { - register int c; - while (1) - { - c = *scan_string++; - - if ((c == '\0') || (c == '{') || (whitespace (c))) - { - scan_string -= 1; - break; - } - } - - if (*scan_string == '{') - { - char *s = scan_string; - (void) scan_group_in_string (&s); - scan_string = s; - } - } - token_end = scan_string; - } + { + token_start = scan_string; + scan_string += 1; + if (self_delimiting (*scan_string)) + scan_string += 1; + else + { + register int c; + while (1) + { + c = *scan_string++; + + if ((c == 0) || (c == '{') || (whitespace (c))) + { + scan_string -= 1; + break; + } + } + + if (*scan_string == '{') + { + char *s = scan_string; + (void) scan_group_in_string (&s); + scan_string = s; + } + } + token_end = scan_string; + } /* Parentheses and brackets are self-delimiting. */ else if (DEFUN_SELF_DELIMITING (*scan_string)) - { - token_start = scan_string; - scan_string += 1; - token_end = scan_string; - } + { + token_start = scan_string; + scan_string += 1; + token_end = scan_string; + } /* Open brace introduces a group that is a single token. */ else if (*scan_string == '{') - { - char *s = scan_string; - int balanced = scan_group_in_string (&s); + { + char *s = scan_string; + int balanced = scan_group_in_string (&s); - token_start = scan_string + 1; - scan_string = s; - token_end = balanced ? (scan_string - 1) : scan_string; - } + token_start = scan_string + 1; + scan_string = s; + token_end = balanced ? (scan_string - 1) : scan_string; + } /* Otherwise a token is delimited by whitespace, parentheses, - brackets, or braces. A token is also ended by a command. */ + brackets, or braces. A token is also ended by a command. */ else - { - token_start = scan_string; + { + token_start = scan_string; - while (1) - { - register int c; + while (1) + { + register int c; - c = *scan_string++; + c = *scan_string++; /* Do not back up if we're looking at a }; since the only valid }'s are those matched with {'s, we want to give an error. If we back up, we go into an infinite loop. */ - if (!c || whitespace (c) || DEFUN_SELF_DELIMITING (c) - || c == '{') - { - scan_string--; - break; - } - - /* If we encounter a command embedded within a token, - then end the token. */ - if (c == COMMAND_PREFIX) - { - scan_string--; - break; - } - } - token_end = scan_string; - } + if (!c || whitespace (c) || DEFUN_SELF_DELIMITING (c) + || c == '{') + { + scan_string--; + break; + } + + /* If we encounter a command embedded within a token, + then end the token. */ + if (c == COMMAND_PREFIX) + { + scan_string--; + break; + } + } + token_end = scan_string; + } accumulate_token - (&accumulator, copy_substring (token_start, token_end)); + (&accumulator, copy_substring (token_start, token_end)); } accumulate_token (&accumulator, NULL); return (accumulator.tokens); @@ -6863,30 +7090,30 @@ process_defun_args (defun_args, auto_var_p) char *defun_arg = *defun_args++; if (defun_arg == NULL) - break; + break; if (defun_arg[0] == ' ') - { - pending_space = 1; - continue; - } + { + pending_space = 1; + continue; + } if (pending_space) - { - add_char (' '); - pending_space = 0; - } + { + add_char (' '); + pending_space = 0; + } if (DEFUN_SELF_DELIMITING (defun_arg[0])) - add_char (defun_arg[0]); + add_char (defun_arg[0]); else if (defun_arg[0] == '&') - add_word (defun_arg); + add_word (defun_arg); else if (defun_arg[0] == COMMAND_PREFIX) - execute_string ("%s", defun_arg); + execute_string ("%s", defun_arg); else if (auto_var_p) - execute_string ("%cvar{%s}", COMMAND_PREFIX, defun_arg); + execute_string ("%cvar{%s}", COMMAND_PREFIX, defun_arg); else - add_word (defun_arg); + add_word (defun_arg); } } @@ -6910,7 +7137,7 @@ next_nonwhite_defun_arg (arg_pointer) /* Make the defun type insertion. TYPE says which insertion this is. - X_P says not to start a new insertion if non-zero. */ + X_P, if nonzero, says not to start a new insertion. */ void defun_internal (type, x_p) enum insertion_type type; @@ -6932,43 +7159,43 @@ defun_internal (type, x_p) switch (type) { case defun: - category = "Function"; + category = _("Function"); base_type = deffn; break; case defmac: - category = "Macro"; + category = _("Macro"); base_type = deffn; break; case defspec: - category = "Special Form"; + category = _("Special Form"); base_type = deffn; break; case defvar: - category = "Variable"; + category = _("Variable"); base_type = defvr; break; case defopt: - category = "User Option"; + category = _("User Option"); base_type = defvr; break; case deftypefun: - category = "Function"; + category = _("Function"); base_type = deftypefn; break; case deftypevar: - category = "Variable"; + category = _("Variable"); base_type = deftypevr; break; case defivar: - category = "Instance Variable"; + category = _("Instance Variable"); base_type = defcv; break; case defmethod: - category = "Method"; + category = _("Method"); base_type = defop; break; case deftypemethod: - category = "Method"; + category = _("Method"); base_type = deftypemethod; break; default: @@ -7034,7 +7261,7 @@ defun_internal (type, x_p) break; case deftypemethod: execute_string (" -- %s on %s: %s %s", category, type_name, type_name2, - defined_name); + defined_name); break; } current_indent += default_indentation_increment; @@ -7051,9 +7278,15 @@ defun_internal (type, x_p) case defop: process_defun_args (scan_args, 1); break; - case deftp: - case deftypefn: - case deftypemethod: + + /* Through Makeinfo 1.67 we processed remaining args only for deftp, + deftypefn, and deftypemethod. But the libc manual, for example, + needs to say: + @deftypevar {char *} tzname[2] + And simply allowing the extra text seems far simpler than trying + to invent yet more defn commands. In any case, we should either + output it or give an error, not silently ignore it. */ + default: process_defun_args (scan_args, 0); break; } @@ -7090,7 +7323,7 @@ defun_internal (type, x_p) { char * arg = (*scan_args++); if (arg == NULL) - break; + break; free (arg); } free (defun_args); @@ -7104,12 +7337,12 @@ cm_defun () { int x_p; enum insertion_type type; - char *temp = strdup (command); + char *temp = xstrdup (command); x_p = (command[strlen (command) - 1] == 'x'); if (x_p) - temp[strlen (temp) - 1] = '\0'; + temp[strlen (temp) - 1] = 0; type = find_type_from_name (temp); free (temp); @@ -7119,8 +7352,8 @@ cm_defun () if (x_p && (!insertion_level || insertion_stack->insertion != type)) { - line_error ("Must be in a `%s' insertion in order to use `%s'x", - command, command); + line_error (_("Must be in a `%s' insertion in order to use `%s'x"), + command, command); discard_until ("\n"); return; } @@ -7128,40 +7361,10 @@ cm_defun () defun_internal (type, x_p); } -/* End existing insertion block. */ -void -cm_end () -{ - char *temp; - enum insertion_type type; - - if (!insertion_level) - { - line_error ("Unmatched `%c%s'", COMMAND_PREFIX, command); - return; - } - - get_rest_of_line (&temp); - canon_white (temp); - - if (strlen (temp) == 0) - line_error ("`%c%s' needs something after it", COMMAND_PREFIX, command); - - type = find_type_from_name (temp); - - if (type == bad_type) - { - line_error ("Bad argument to `%s', `%s', using `%s'", - command, temp, insertion_type_pname (current_insertion_type ())); - } - end_insertion (type); - free (temp); -} - /* **************************************************************** */ -/* */ -/* Other Random Commands */ -/* */ +/* */ +/* Other Random Commands */ +/* */ /* **************************************************************** */ /* This says to inhibit the indentation of the next paragraph, but @@ -7221,15 +7424,15 @@ cm_sp () if (sscanf (line, "%d", &lines) != 1) { - line_error ("%csp requires a positive numeric argument", COMMAND_PREFIX); + line_error (_("%csp requires a positive numeric argument"), COMMAND_PREFIX); } else { if (lines < 0) - lines = 0; + lines = 0; while (lines--) - add_char ('\n'); + add_char ('\n'); } free (line); } @@ -7240,11 +7443,11 @@ cm_sp () void cm_dircategory () { - char *line, *p; + char *line; get_rest_of_line (&line);; - if (! no_headers) + if (!no_headers) { insert_string ("INFO-DIR-SECTION "); insert_string (line); @@ -7276,7 +7479,7 @@ cm_center () i = output_paragraph_offset - 1; while (i > (start - 1) && output_paragraph[i] == '\n') - i--; + i--; output_paragraph_offset = ++i; length = output_paragraph_offset - start; @@ -7290,10 +7493,10 @@ cm_center () output_paragraph_offset = start; while (i--) - insert (' '); + insert (' '); for (i = 0; i < length; i++) - insert (line[i]); + insert (line[i]); free (line); } @@ -7376,20 +7579,6 @@ cm_exdent () close_single_paragraph (); } -#if !defined (HAVE_STRERROR) -extern char *sys_errlist[]; -extern int sys_nerr; - -char * -strerror (num) - int num; -{ - if (num >= sys_nerr) - return ("Unknown file system error"); - else - return (sys_errlist[num]); -} -#endif /* !HAVE_STRERROR */ /* Remember this file, and move onto the next. */ void @@ -7435,8 +7624,8 @@ cm_include () line_number--; /* Cannot "@include foo", in line 5 of "/wh/bar". */ - line_error ("`%c%s %s': %s", COMMAND_PREFIX, command, filename, - strerror (errno)); + line_error ("%c%s %s: %s", COMMAND_PREFIX, command, filename, + strerror (errno)); free (filename); return; @@ -7445,7 +7634,7 @@ cm_include () { #if defined (HAVE_MACROS) if (macro_expansion_output_stream) - remember_itext (input_text, input_text_offset); + remember_itext (input_text, input_text_offset); #endif /* HAVE_MACROS */ reader_loop (); } @@ -7457,7 +7646,7 @@ cm_include () void misplaced_brace () { - line_error ("Misplaced `}'"); + line_error (_("Misplaced %c"), '}'); } /* Signals end of processing. Easy to make this happen. */ @@ -7466,11 +7655,51 @@ cm_bye () { input_text_offset = size_of_input_text; } + +/* Set the paragraph indentation variable to the value specified in STRING. + Values can be: + `asis': Don't change existing indentation. + `none': Remove existing indentation. + NUM: Indent NUM spaces at the starts of paragraphs. + If NUM is zero, we assume `none'. + Returns 0 if successful, or nonzero if STRING isn't one of the above. */ +int +set_paragraph_indent (string) + char *string; +{ + if (strcmp (string, "asis") == 0 || strcmp (string, _("asis")) == 0) + paragraph_start_indent = 0; + else if (strcmp (string, "none") == 0 || strcmp (string, _("none")) == 0) + paragraph_start_indent = -1; + else + { + if (sscanf (string, "%d", ¶graph_start_indent) != 1) + return (-1); + else + { + if (paragraph_start_indent == 0) + paragraph_start_indent = -1; + } + } + return (0); +} + +void +cm_paragraphindent () +{ + char *arg; + + get_rest_of_line (&arg); + if (set_paragraph_indent (arg) != 0) + line_error (_("Bad argument to %c%s"), COMMAND_PREFIX, command); + + free (arg); +} /* **************************************************************** */ -/* */ -/* Indexing Stuff */ -/* */ +/* */ +/* Indexing Stuff */ +/* */ /* **************************************************************** */ @@ -7478,21 +7707,48 @@ cm_bye () typedef struct index_elt { struct index_elt *next; - char *entry; /* The index entry itself. */ - char *node; /* The node from whence it came. */ - int code; /* Non-zero means add `@code{...}' when - printing this element. */ - int defining_line; /* Line number where this entry was written. */ + char *entry; /* The index entry itself. */ + char *node; /* The node from whence it came. */ + int code; /* Nonzero means add `@code{...}' when + printing this element. */ + int defining_line; /* Line number where this entry was written. */ + char *defining_file; /* Source file for defining_line. */ } INDEX_ELT; -/* A list of short-names for each index, and the index to that index in our - index array, the_indices. In addition, for each index, it is remembered - whether that index is a code index or not. Code indices have @code{} - inserted around the first word when they are printed with printindex. */ +/* A list of short-names for each index. + + There are two indices into the the_indices array. + + * read_index is the index that points to the list of index + entries that we will find if we ask for the list of entries for + this name. + + * write_index is the index that points to the list of index entries + that we will add new entries to. + + Initially, read_index and write index are the same, but the + @syncodeindex and @synindex commands can change the list we add + entries to. + + For example, after the commands + + @cindex foo + @defindex ii + @synindex cp ii + @cindex bar + + the cp index will contain the entry `foo', and the new ii + index will contain the entry `bar'. This is consistent with the + way texinfo.tex handles the same situation. + + In addition, for each index, it is remembered whether that index is + a code index or not. Code indices have @code{} inserted around the + first word when they are printed with printindex. */ typedef struct { char *name; - int index; + int read_index; /* index entries for `name' */ + int write_index; /* store index entries here, @synindex can change it */ int code; } INDEX_ALIST; @@ -7506,14 +7762,6 @@ INDEX_ELT **the_indices = (INDEX_ELT **) NULL; /* The number of defined indices. */ int defined_indices = 0; -/* We predefine these. */ -#define program_index 0 -#define function_index 1 -#define concept_index 2 -#define variable_index 3 -#define datatype_index 4 -#define key_index 5 - void init_indices () { @@ -7525,26 +7773,38 @@ init_indices () if (!the_indices) { the_indices = (INDEX_ELT **) xmalloc ((1 + defined_indices) * - sizeof (INDEX_ELT *)); + sizeof (INDEX_ELT *)); the_indices[defined_indices] = (INDEX_ELT *) NULL; name_index_alist = (INDEX_ALIST **) xmalloc ((1 + defined_indices) * - sizeof (INDEX_ALIST *)); + sizeof (INDEX_ALIST *)); name_index_alist[defined_indices] = (INDEX_ALIST *) NULL; } /* If there were existing indices, get rid of them now. */ for (i = 0; i < defined_indices; i++) - undefindex (name_index_alist[i]->name); + { + undefindex (name_index_alist[i]->name); + if (name_index_alist[i]) + { /* Suppose we're called with two input files, and the first + does a @synindex pg cp. Then, when we get here to start + the second file, the "pg" element won't get freed by + undefindex (because it's pointing to "cp"). So free it + here; otherwise, when we try to define the pg index again + just below, it will still point to cp. */ + free (name_index_alist[i]->name); + free (name_index_alist[i]); + name_index_alist[i] = (INDEX_ALIST *) NULL; + } + } /* Add the default indices. */ - top_defindex ("pg", 0); - top_defindex ("fn", 1); /* "fn" is a code index. */ - top_defindex ("cp", 0); - top_defindex ("vr", 0); - top_defindex ("tp", 0); - top_defindex ("ky", 0); - + top_defindex ("cp", 0); /* cp is the only non-code index. */ + top_defindex ("fn", 1); + top_defindex ("ky", 1); + top_defindex ("pg", 1); + top_defindex ("tp", 1); + top_defindex ("vr", 1); } /* Find which element in the known list of indices has this name. @@ -7556,8 +7816,8 @@ find_index_offset (name) register int i; for (i = 0; i < defined_indices; i++) if (name_index_alist[i] && - strcmp (name, name_index_alist[i]->name) == 0) - return (name_index_alist[i]->index); + strcmp (name, name_index_alist[i]->name) == 0) + return (i); return (-1); } @@ -7583,7 +7843,7 @@ translate_index (name) INDEX_ALIST *which = find_index (name); if (which) - return (which->index); + return (which->read_index); else return (-1); } @@ -7610,13 +7870,16 @@ free_index (index) while ((temp = index) != (INDEX_ELT *) NULL) { free (temp->entry); - free (temp->node); + /* Do not free the node, because we already freed the tag table, + which freed all the node names. */ + /* free (temp->node); */ index = index->next; free (temp); } } -/* Flush an index by name. */ +/* Flush an index by name. This will delete the list of entries that + would be written by a @printindex command for this index. */ void undefindex (name) char *name; @@ -7624,10 +7887,12 @@ undefindex (name) int i; int which = find_index_offset (name); - if (which < 0) + /* The index might have already been freed if this was the target of + an @synindex. */ + if (which < 0 || !name_index_alist[which]) return; - i = name_index_alist[which]->index; + i = name_index_alist[which]->read_index; free_index (the_indices[i]); the_indices[i] = (INDEX_ELT *) NULL; @@ -7638,7 +7903,7 @@ undefindex (name) } /* Define an index known as NAME. We assign the slot number. - CODE if non-zero says to make this a code index. */ + CODE if Nonzero says to make this a code index. */ void defindex (name, code) char *name; @@ -7654,8 +7919,8 @@ defindex (name, code) for (i = 0; i < defined_indices; i++) if (!name_index_alist[i]) { - slot = i; - break; + slot = i; + break; } if (slot < 0) @@ -7665,17 +7930,18 @@ defindex (name, code) defined_indices++; name_index_alist = (INDEX_ALIST **) - xrealloc ((char *)name_index_alist, - (1 + defined_indices) * sizeof (INDEX_ALIST *)); + xrealloc ((char *)name_index_alist, + (1 + defined_indices) * sizeof (INDEX_ALIST *)); the_indices = (INDEX_ELT **) - xrealloc ((char *)the_indices, - (1 + defined_indices) * sizeof (INDEX_ELT *)); + xrealloc ((char *)the_indices, + (1 + defined_indices) * sizeof (INDEX_ELT *)); } /* We have a slot. Start assigning. */ name_index_alist[slot] = (INDEX_ALIST *) xmalloc (sizeof (INDEX_ALIST)); - name_index_alist[slot]->name = strdup (name); - name_index_alist[slot]->index = slot; + name_index_alist[slot]->name = xstrdup (name); + name_index_alist[slot]->read_index = slot; + name_index_alist[slot]->write_index = slot; name_index_alist[slot]->code = code; the_indices[slot] = (INDEX_ELT *) NULL; @@ -7692,7 +7958,7 @@ index_add_arg (name) tem = find_index (name); - which = tem ? tem->index : -1; + which = tem ? tem->write_index : -1; #if defined (HAVE_MACROS) if (macro_expansion_output_stream) @@ -7717,7 +7983,7 @@ index_add_arg (name) if (which < 0) { - line_error ("Unknown index reference `%s'", name); + line_error (_("Unknown index `%s'"), name); free (index_entry); } else @@ -7728,6 +7994,7 @@ index_add_arg (name) new->node = current_node; new->code = tem->code; new->defining_line = line_number - 1; + new->defining_file = input_filename; the_indices[which] = new; } } @@ -7738,9 +8005,9 @@ index_add_arg (name) void gen_index () { - char *name = strdup (command); + char *name = xstrdup (command); if (strlen (name) >= strlen ("index")) - name[strlen (name) - strlen ("index")] = '\0'; + name[strlen (name) - strlen ("index")] = 0; index_add_arg (name); free (name); } @@ -7781,7 +8048,7 @@ gen_defindex (code) if (find_index (name)) { - line_error ("Index `%s' already exists", name); + line_error (_("Index `%s' already exists"), name); free (name); return; } @@ -7795,96 +8062,68 @@ gen_defindex (code) } } -/* Append LIST2 to LIST1. Return the head of the list. */ -INDEX_ELT * -index_append (head, tail) - INDEX_ELT *head, *tail; -{ - register INDEX_ELT *t_head = head; - - if (!t_head) - return (tail); - - while (t_head->next) - t_head = t_head->next; - t_head->next = tail; - return (head); -} - /* Expects 2 args, on the same line. Both are index abbreviations. Make the first one be a synonym for the second one, i.e. make the first one have the same index as the second one. */ void cm_synindex () { - int redirector, redirectee; - char *temp; + int source, target; + char *abbrev1, *abbrev2; skip_whitespace (); - get_until_in_line (" ", &temp); - redirectee = find_index_offset (temp); + get_until_in_line (0, " ", &abbrev1); + target = find_index_offset (abbrev1); skip_whitespace (); - free_and_clear (&temp); - get_until_in_line (" ", &temp); - redirector = find_index_offset (temp); - free (temp); - if (redirector < 0 || redirectee < 0) + get_until_in_line (0, " ", &abbrev2); + source = find_index_offset (abbrev2); + if (source < 0 || target < 0) { - line_error ("Unknown index reference"); + line_error (_("Unknown index `%s' and/or `%s' in @synindex"), + abbrev1, abbrev2); } else { - /* I think that we should let the user make indices synonymous to - each other without any lossage of info. This means that one can - say @synindex cp dt anywhere in the file, and things that used to - be in cp will go into dt. */ - INDEX_ELT *i1 = the_indices[redirectee], *i2 = the_indices[redirector]; - - if (i1 || i2) - { - if (i1) - the_indices[redirectee] = index_append (i1, i2); - else - the_indices[redirectee] = index_append (i2, i1); - } - - name_index_alist[redirectee]->index = - name_index_alist[redirector]->index; + name_index_alist[target]->write_index + = name_index_alist[source]->write_index; } + + free (abbrev1); + free (abbrev2); } void -cm_pindex () /* Pinhead index. */ +cm_pindex () /* Pinhead index. */ { index_add_arg ("pg"); } void -cm_vindex () /* Variable index. */ +cm_vindex () /* Variable index. */ { index_add_arg ("vr"); } void -cm_kindex () /* Key index. */ +cm_kindex () /* Key index. */ { index_add_arg ("ky"); } void -cm_cindex () /* Concept index. */ +cm_cindex () /* Concept index. */ { index_add_arg ("cp"); } void -cm_findex () /* Function index. */ +cm_findex () /* Function index. */ { index_add_arg ("fn"); } void -cm_tindex () /* Data Type index. */ +cm_tindex () /* Data Type index. */ { index_add_arg ("tp"); } @@ -7912,14 +8151,14 @@ make_index_entries_unique (array, count) for (i = 0, j = 0; i < count; i++) { if ((i == (count - 1)) || - (array[i]->node != array[i + 1]->node) || - (strcmp (array[i]->entry, array[i + 1]->entry) != 0)) - copy[j++] = array[i]; + (array[i]->node != array[i + 1]->node) || + (strcmp (array[i]->entry, array[i + 1]->entry) != 0)) + copy[j++] = array[i]; else - { - free (array[i]->entry); - free (array[i]); - } + { + free (array[i]->entry); + free (array[i]); + } } copy[j] = (INDEX_ELT *)NULL; @@ -7932,20 +8171,20 @@ make_index_entries_unique (array, count) copy[i]->next = copy[i + 1]; /* Fix entry names which are the same. They point to different nodes, - so we make the entry name unique. */ + so we make the entry name unique. */ if ((copy[i + 1] != (INDEX_ELT *)NULL) && - (strcmp (copy[i]->entry, copy[i + 1]->entry) == 0)) - { - char *new_entry_name; - - new_entry_name = (char *)xmalloc (10 + strlen (copy[i]->entry)); - sprintf (new_entry_name, "%s <%d>", copy[i]->entry, counter); - free (copy[i]->entry); - copy[i]->entry = new_entry_name; - counter++; - } + (strcmp (copy[i]->entry, copy[i + 1]->entry) == 0)) + { + char *new_entry_name; + + new_entry_name = (char *)xmalloc (10 + strlen (copy[i]->entry)); + sprintf (new_entry_name, "%s <%d>", copy[i]->entry, counter); + free (copy[i]->entry); + copy[i]->entry = new_entry_name; + counter++; + } else - counter = 1; + counter = 1; array[i] = copy[i]; } @@ -7963,9 +8202,11 @@ INDEX_ELT ** sort_index (index) INDEX_ELT *index; { - INDEX_ELT *temp = index; INDEX_ELT **array; + INDEX_ELT *temp = index; int count = 0; + int save_line_number = line_number; + char *save_input_filename = input_filename; while (temp != (INDEX_ELT *) NULL) { @@ -7983,16 +8224,20 @@ sort_index (index) { array[count++] = temp; - /* Maybe should set line number to the defining_line? Any errors - have already been given, though, I think. */ + /* Set line number and input filename to the source line for this + index entry, as this expansion finds any errors. */ + line_number = array[count - 1]->defining_line; + input_filename = array[count - 1]->defining_file; /* If this particular entry should be printed as a "code" index, - then wrap the entry with "@code{...}". */ + then wrap the entry with "@code{...}". */ array[count - 1]->entry = expansion (temp->entry, index->code); temp = temp->next; } - array[count] = (INDEX_ELT *) NULL; /* terminate the array. */ + array[count] = (INDEX_ELT *) NULL; /* terminate the array. */ + line_number = save_line_number; + input_filename = save_input_filename; /* Sort the array. */ qsort (array, count, sizeof (INDEX_ELT *), index_element_compare); @@ -8000,7 +8245,7 @@ sort_index (index) return (array); } -/* Non-zero means that we are in the middle of printing an index. */ +/* Nonzero means that we are in the middle of printing an index. */ int printing_index = 0; /* Takes one arg, a short name of an index to print. @@ -8023,7 +8268,7 @@ cm_printindex () index = index_list (index_name); if (index == (INDEX_ELT *)-1) { - line_error ("Unknown index name `%s'", index_name); + line_error (_("Unknown index `%s' in @printindex"), index_name); free (index_name); return; } @@ -8038,7 +8283,7 @@ cm_printindex () array = sort_index (index); close_paragraph (); - add_word ("* Menu:\n\n"); + add_word (_("* Menu:\n\n")); #if defined (HAVE_MACROS) me_inhibit_expansion++; @@ -8053,11 +8298,15 @@ cm_printindex () /* A pathological document might have an index entry outside of any node. Don't crash. Perhaps should warn. */ char *index_node = index->node ? index->node : "(none)"; - unsigned new_length = strlen (index->entry) + strlen (index_node); + unsigned new_length = strlen (index->entry); + + if (new_length < 37) /* minimum length used below */ + new_length = 37; + new_length += strlen (index_node) + 7; /* * : .\n\0 */ if (new_length > line_length) { - line_length = new_length + 6; /* * : .\0 */ + line_length = new_length; line = xrealloc (line, line_length); } @@ -8085,8 +8334,8 @@ cm_printindex () filling_enabled = saved_filling_enabled; inhibit_paragraph_indentation = saved_inhibit_paragraph_indentation; } - -/* User-defined commands. */ + +/* User-defined commands, which happens only from user-defined indexes. */ void define_user_command (name, proc, needs_braces_p) @@ -8101,68 +8350,27 @@ define_user_command (name, proc, needs_braces_p) user_command_array = (COMMAND **) xmalloc (1 * sizeof (COMMAND *)); user_command_array = (COMMAND **) xrealloc (user_command_array, - (1 + user_command_array_len) * - sizeof (COMMAND *)); + (1 + user_command_array_len) * + sizeof (COMMAND *)); user_command_array[slot] = (COMMAND *) xmalloc (sizeof (COMMAND)); - user_command_array[slot]->name = strdup (name); + user_command_array[slot]->name = xstrdup (name); user_command_array[slot]->proc = proc; user_command_array[slot]->argument_in_braces = needs_braces_p; } - -/* Set the paragraph indentation variable to the value specified in STRING. - Values can be: - `asis': Don't change existing indentation. - `none': Remove existing indentation. - NUM: Indent NUM spaces at the starts of paragraphs. - Note that if NUM is zero, we assume `none'. - - Returns 0 if successful, or non-zero if STRING isn't one of the above. */ -int -set_paragraph_indent (string) - char *string; -{ - if (strcmp (string, "asis") == 0) - paragraph_start_indent = 0; - else if (strcmp (string, "none") == 0) - paragraph_start_indent = -1; - else - { - if (sscanf (string, "%d", ¶graph_start_indent) != 1) - return (-1); - else - { - if (paragraph_start_indent == 0) - paragraph_start_indent = -1; - } - } - return (0); -} - -void -cm_paragraphindent () -{ - char *arg; - - get_rest_of_line (&arg); - if (set_paragraph_indent (arg) != 0) - line_error ("Bad argument to %c%s", COMMAND_PREFIX, command); - - free (arg); -} - + /* Some support for footnotes. */ /* Footnotes are a new construct in Info. We don't know the best method of implementing them for sure, so we present two possiblities. SeparateNode: - Make them look like followed references, with the reference - destinations in a makeinfo manufactured node or, + Make them look like followed references, with the reference + destinations in a makeinfo manufactured node or, EndNode: - Make them appear at the bottom of the node that they originally - appeared in. */ + Make them appear at the bottom of the node that they originally + appeared in. */ #define SeparateNode 0 #define EndNode 1 @@ -8179,7 +8387,7 @@ set_footnote_style (string) (strcasecmp (string, "MN") == 0)) footnote_style = SeparateNode; else if ((strcasecmp (string, "end") == 0) || - (strcasecmp (string, "EN") == 0)) + (strcasecmp (string, "EN") == 0)) footnote_style = EndNode; else return (-1); @@ -8218,8 +8426,8 @@ remember_note (marker, note) { FN *temp = (FN *) xmalloc (sizeof (FN)); - temp->marker = strdup (marker); - temp->note = strdup (note); + temp->marker = xstrdup (marker); + temp->note = xstrdup (note); temp->next = pending_notes; pending_notes = temp; footnote_count++; @@ -8246,58 +8454,77 @@ free_pending_notes () /* Handle a "footnote". footnote *{this is a footnote} - where "*" is the marker character for this note. */ + where "*" is the (optional) marker character for this note. */ void cm_footnote () { char *marker; char *note; + if (macro_expansion_output_stream) + append_to_expansion_output (input_text_offset + 1); /* include the { */ + get_until ("{", &marker); canon_white (marker); /* Read the argument in braces. */ if (curchar () != '{') { - line_error ("`%c%s' expected more than just `%s'. It needs something in `{...}'", - COMMAND_PREFIX, command, marker); + line_error (_("`%c%s' needs an argument `{...}', not just `%s'"), + COMMAND_PREFIX, command, marker); free (marker); return; } else { - int braces = 1; - int temp = ++input_text_offset; int len; + int braces = 1; + int loc = ++input_text_offset; while (braces) - { - if (temp == size_of_input_text) - { - line_error ("No closing brace for footnote `%s'", marker); - return; - } - - if (input_text[temp] == '{') - braces++; - else if (input_text[temp] == '}') - braces--; - else if (input_text[temp] == '\n') - line_number ++; - - temp++; - } - - len = (temp - input_text_offset) - 1; + { + if (loc == size_of_input_text) + { + line_error (_("No closing brace for footnote `%s'"), marker); + return; + } + + if (input_text[loc] == '{') + braces++; + else if (input_text[loc] == '}') + braces--; + else if (input_text[loc] == '\n') + line_number++; + + loc++; + } + + len = (loc - input_text_offset) - 1; note = (char *)xmalloc (len + 1); strncpy (note, &input_text[input_text_offset], len); - note[len] = '\0'; - input_text_offset = temp; + note[len] = 0; + input_text_offset = loc; + } + + /* Must write the macro-expanded argument to the macro expansion + output stream. This is like the case in index_add_arg. */ + if (macro_expansion_output_stream) + { + int op_orig; + + remember_itext (input_text, input_text_offset); + op_orig = output_paragraph_offset; + me_execute_string (note); + /* Calling me_execute_string on a lone } provokes an error, since + as far as the reader knows there is no matching {. We wrote + the { above in the call to append_to_expansion_output. */ + write_region_to_macro_output ("}", 0, 1); + output_paragraph_offset = op_orig; } if (!current_node || !*current_node) { - line_error ("Footnote defined without parent node"); + line_error (_("Footnote defined without parent node")); free (marker); free (note); return; @@ -8308,13 +8535,13 @@ cm_footnote () free (marker); if (number_footnotes) - { - marker = (char *)xmalloc (10); - sprintf (marker, "%d", current_footnote_number); - current_footnote_number++; - } + { + marker = (char *)xmalloc (10); + sprintf (marker, "%d", current_footnote_number); + current_footnote_number++; + } else - marker = strdup ("*"); + marker = xstrdup ("*"); } remember_note (marker, note); @@ -8325,19 +8552,19 @@ cm_footnote () case SeparateNode: add_word_args ("(%s)", marker); if (first_footnote_this_node) - { - char *temp_string; - - temp_string = (char *) - xmalloc ((strlen (current_node)) + (strlen ("-Footnotes")) + 1); - - add_word_args (" (*note %s-Footnotes::)", current_node); - strcpy (temp_string, current_node); - strcat (temp_string, "-Footnotes"); - remember_node_reference (temp_string, line_number, followed_reference); - free (temp_string); - first_footnote_this_node = 0; - } + { + char *temp_string; + + temp_string = (char *) + xmalloc ((strlen (current_node)) + (strlen (_("-Footnotes"))) + 1); + + add_word_args (" (*note %s-Footnotes::)", current_node); + strcpy (temp_string, current_node); + strcat (temp_string, "-Footnotes"); + remember_node_reference (temp_string, line_number, followed_reference); + free (temp_string); + first_footnote_this_node = 0; + } break; case EndNode: @@ -8351,7 +8578,7 @@ cm_footnote () free (note); } -/* Non-zero means that we are currently in the process of outputting +/* Nonzero means that we are currently in the process of outputting footnotes. */ int already_outputting_pending_notes = 0; @@ -8368,23 +8595,23 @@ output_pending_notes () { case SeparateNode: { - char *old_current_node = current_node; - char *old_command = strdup (command); - - already_outputting_pending_notes++; - execute_string ("%cnode %s-Footnotes,,,%s\n", - COMMAND_PREFIX, current_node, current_node); - already_outputting_pending_notes--; - current_node = old_current_node; - free (command); - command = old_command; + char *old_current_node = current_node; + char *old_command = xstrdup (command); + + already_outputting_pending_notes++; + execute_string ("%cnode %s-Footnotes,,,%s\n", + COMMAND_PREFIX, current_node, current_node); + already_outputting_pending_notes--; + current_node = old_current_node; + free (command); + command = old_command; } break; case EndNode: close_paragraph (); in_fixed_width_font++; - execute_string ("---------- Footnotes ----------\n\n"); + execute_string (_("---------- Footnotes ----------\n\n")); in_fixed_width_font--; break; } @@ -8397,24 +8624,17 @@ output_pending_notes () while (--footnote_count > -1) { - array[footnote_count] = footnote; - footnote = footnote->next; + array[footnote_count] = footnote; + footnote = footnote->next; } filling_enabled = 1; indented_fill = 1; - while (footnote = array[++footnote_count]) + while ((footnote = array[++footnote_count])) { - - switch (footnote_style) - { - case SeparateNode: - case EndNode: - execute_string ("(%s) %s", footnote->marker, footnote->note); - close_paragraph (); - break; - } + execute_string ("(%s) %s", footnote->marker, footnote->note); + close_paragraph (); } close_paragraph (); free (array); @@ -8423,7 +8643,7 @@ output_pending_notes () /* **************************************************************** */ /* */ -/* User definable Macros (text substitution) */ +/* User definable Macros (text substitution) */ /* */ /* **************************************************************** */ @@ -8432,8 +8652,8 @@ output_pending_notes () /* Array of macros and definitions. */ MACRO_DEF **macro_list = (MACRO_DEF **)NULL; -int macro_list_len = 0; /* Number of elements. */ -int macro_list_size = 0; /* Number of slots in total. */ +int macro_list_len = 0; /* Number of elements. */ +int macro_list_size = 0; /* Number of slots in total. */ /* Return the macro definition of NAME or NULL if NAME is not defined. */ MACRO_DEF * @@ -8447,7 +8667,7 @@ find_macro (name) for (i = 0; macro_list && (def = macro_list[i]); i++) { if ((!def->inhibited) && (strcmp (def->name, name) == 0)) - break; + break; } return (def); } @@ -8472,8 +8692,8 @@ add_macro (name, arglist, body, source_file, source_lineno, flags) if (!def) { if (macro_list_len + 2 >= macro_list_size) - macro_list = (MACRO_DEF **)xrealloc - (macro_list, ((macro_list_size += 10) * sizeof (MACRO_DEF *))); + macro_list = (MACRO_DEF **)xrealloc + (macro_list, ((macro_list_size += 10) * sizeof (MACRO_DEF *))); macro_list[macro_list_len] = (MACRO_DEF *)xmalloc (sizeof (MACRO_DEF)); macro_list[macro_list_len + 1] = (MACRO_DEF *)NULL; @@ -8487,30 +8707,29 @@ add_macro (name, arglist, body, source_file, source_lineno, flags) char *temp_filename = input_filename; int temp_line = line_number; - warning ("The macro `%s' is previously defined", name); + warning (_("macro `%s' previously defined"), name); input_filename = def->source_file; line_number = def->source_lineno; - - warning ("Here is the previous definition of `%s'", name); + warning (_("here is the previous definition of `%s'"), name); input_filename = temp_filename; line_number = temp_line; if (def->arglist) - { - register int i; + { + register int i; - for (i = 0; def->arglist[i]; i++) - free (def->arglist[i]); + for (i = 0; def->arglist[i]; i++) + free (def->arglist[i]); - free (def->arglist); - } + free (def->arglist); + } free (def->source_file); free (def->body); } - def->source_file = strdup (source_file); + def->source_file = xstrdup (source_file); def->source_lineno = source_lineno; def->body = body; def->arglist = arglist; @@ -8533,9 +8752,10 @@ delete_macro (name) for (i = 0; macro_list && (def = macro_list[i]); i++) if (strcmp (def->name, name) == 0) { - memmove (macro_list + i, macro_list + i + 1, - ((macro_list_len + 1) - i) * sizeof (MACRO_DEF *)); - break; + memmove (macro_list + i, macro_list + i + 1, + ((macro_list_len + 1) - i) * sizeof (MACRO_DEF *)); + macro_list_len--; + break; } return (def); } @@ -8546,7 +8766,7 @@ int braces_required_for_macro_args = 0; char ** get_macro_args (def) - MACRO_DEF *def; + MACRO_DEF *def; { register int i; char *word; @@ -8560,35 +8780,38 @@ get_macro_args (def) if (input_text[i] != '{') { if (braces_required_for_macro_args) - { - return ((char **)NULL); - } + { + return ((char **)NULL); + } else - { - /* Braces are not required to fill out the macro arguments. If - this macro takes one argument, it is considered to be the - remainder of the line, sans whitespace. */ - if (def->arglist && def->arglist[0] && !def->arglist[1]) - { - char **arglist; - - get_rest_of_line (&word); - if (input_text[input_text_offset - 1] == '\n') - input_text_offset--; - /* canon_white (word); */ - arglist = (char **)xmalloc (2 * sizeof (char *)); - arglist[0] = word; - arglist[1] = (char *)NULL; - return (arglist); - } - else - { - /* The macro either took no arguments, or took more than - one argument. In that case, it must be invoked with - arguments surrounded by braces. */ - return ((char **)NULL); - } - } + { + /* Braces are not required to fill out the macro arguments. If + this macro takes one argument, it is considered to be the + remainder of the line, sans whitespace. */ + if (def->arglist && def->arglist[0] && !def->arglist[1]) + { + char **arglist; + + get_rest_of_line (&word); + if (input_text[input_text_offset - 1] == '\n') + { + input_text_offset--; + line_number--; + } + /* canon_white (word); */ + arglist = (char **)xmalloc (2 * sizeof (char *)); + arglist[0] = word; + arglist[1] = (char *)NULL; + return (arglist); + } + else + { + /* The macro either took no arguments, or took more than + one argument. In that case, it must be invoked with + arguments surrounded by braces. */ + return ((char **)NULL); + } + } } return (get_brace_args (def->flags & ME_QUOTE_ARG)); } @@ -8615,66 +8838,69 @@ apply (named, actuals, body) while (1) { if (!body[i]) - break; + break; if (body[i] != '\\') - new_body[new_body_index++] = body[i++]; + new_body[new_body_index++] = body[i++]; else - { - /* Snarf parameter name, check against named parameters. */ - char *param; - int param_start, which, len; - - param_start = ++i; - while ((body[i]) && (body[i] != '\\')) - i++; - - len = i - param_start; - param = (char *)xmalloc (1 + len); - memcpy (param, body + param_start, len); - param[len] = '\0'; - - if (body[i]) - i++; - - /* Now check against named parameters. */ - for (which = 0; named && named[which]; which++) - if (strcmp (named[which], param) == 0) - break; - - if (named[which]) - { - if (which < length_of_actuals) - text = actuals[which]; - else - text = (char *)NULL; - - if (!text) - text = ""; - - len = strlen (text); - } - else - { - len += 2; - text = (char *)xmalloc (1 + len); - sprintf (text, "\\%s\\", param); - } - - if ((2 + strlen (param)) < len) - new_body = (char *)xrealloc - (new_body, new_body_size += (1 + len)); - - free (param); - - strcpy (new_body + new_body_index, text); - new_body_index += len; - - if (!named[which]) - free (text); - } - } - new_body[new_body_index] = '\0'; + { + /* Snarf parameter name, check against named parameters. */ + char *param; + int param_start, which, len; + + param_start = ++i; + while ((body[i]) && (body[i] != '\\')) + i++; + + len = i - param_start; + param = (char *)xmalloc (1 + len); + memcpy (param, body + param_start, len); + param[len] = 0; + + if (body[i]) /* move past \ */ + i++; + + /* Now check against named parameters. */ + for (which = 0; named && named[which]; which++) + if (strcmp (named[which], param) == 0) + break; + + if (named && named[which]) + { + if (which < length_of_actuals) + text = actuals[which]; + else + text = (char *)NULL; + + if (!text) + text = ""; + + len = strlen (text); + } + else + { /* not a parameter, restore \'s */ + char *trailer = body[i] ? "/" : ""; + len += 1 + strlen (trailer); + text = (char *)xmalloc (1 + len); + sprintf (text, "\\%s%s", param, trailer); + } + + if ((2 + strlen (param)) < len) + { + new_body_size += len + 1; + new_body = xrealloc (new_body, new_body_size); + } + + free (param); + + strcpy (new_body + new_body_index, text); + new_body_index += len; + + if (!named || !named[which]) + free (text); + } + } + new_body[new_body_index] = 0; return (new_body); } @@ -8683,7 +8909,6 @@ void execute_macro (def) MACRO_DEF *def; { - register int i; char **arglist; int num_args; char *execution_string = (char *)NULL; @@ -8700,7 +8925,7 @@ execute_macro (def) if (num_args < array_len (arglist)) { free_array (arglist); - line_error ("Macro `%s' called with too many args", def->name); + line_error (_("Macro `%s' called with too many args"), def->name); return; } @@ -8712,12 +8937,12 @@ execute_macro (def) if (def->body) { if (macro_expansion_output_stream && !me_inhibit_expansion) - { - remember_itext (input_text, input_text_offset); - me_execute_string (execution_string); - } + { + remember_itext (input_text, input_text_offset); + me_execute_string (execution_string); + } else - execute_string ("%s", execution_string); + execute_string ("%s", execution_string); free (execution_string); } @@ -8751,15 +8976,15 @@ cm_macro () int len; for (i = start; - (i < size_of_input_text) && - (input_text[i] != '{') && - (!cr_or_whitespace (input_text[i])); - i++); + (i < size_of_input_text) && + (input_text[i] != '{') && + (!cr_or_whitespace (input_text[i])); + i++); len = i - start; name = (char *)xmalloc (1 + len); strncpy (name, input_text + start, len); - name[len] = '\0'; + name[len] = 0; input_text_offset = i; } @@ -8775,71 +9000,71 @@ cm_macro () int character; /* Read the words inside of the braces which determine the arglist. - These words will be replaced within the body of the macro at - execution time. */ + These words will be replaced within the body of the macro at + execution time. */ input_text_offset++; skip_whitespace_and_newlines (); while (gathering_words) - { - int len; - - for (i = input_text_offset; - character = input_text[i]; - i++) - { - switch (character) - { - case '\n': - line_number++; - case ' ': - case '\t': - case ',': - case '}': - /* Found the end of the current arglist word. Save it. */ - len = i - input_text_offset; - word = (char *)xmalloc (1 + len); - strncpy (word, input_text + input_text_offset, len); - word[len] = '\0'; - input_text_offset = i; - - /* Advance to the comma or close-brace that signified - the end of the argument. */ - while ((character = curchar ()) - && character != ',' - && character != '}') - { - input_text_offset++; - if (character == '\n') - line_number++; - } - - /* Add the word to our list of words. */ - if ((arglist_index + 2) >= arglist_size) - arglist = (char **)xrealloc - (arglist, (arglist_size += 10) * sizeof (char *)); - - arglist[arglist_index++] = word; - arglist[arglist_index] = (char *)NULL; - break; - } - - if (character == '}') - { - input_text_offset++; - gathering_words = 0; - break; - } - - if (character == ',') - { - input_text_offset++; - skip_whitespace_and_newlines (); - i = input_text_offset - 1; - } - } - } + { + int len; + + for (i = input_text_offset; + (character = input_text[i]); + i++) + { + switch (character) + { + case '\n': + line_number++; + case ' ': + case '\t': + case ',': + case '}': + /* Found the end of the current arglist word. Save it. */ + len = i - input_text_offset; + word = (char *)xmalloc (1 + len); + strncpy (word, input_text + input_text_offset, len); + word[len] = 0; + input_text_offset = i; + + /* Advance to the comma or close-brace that signified + the end of the argument. */ + while ((character = curchar ()) + && character != ',' + && character != '}') + { + input_text_offset++; + if (character == '\n') + line_number++; + } + + /* Add the word to our list of words. */ + if ((arglist_index + 2) >= arglist_size) + arglist = (char **)xrealloc + (arglist, (arglist_size += 10) * sizeof (char *)); + + arglist[arglist_index++] = word; + arglist[arglist_index] = (char *)NULL; + break; + } + + if (character == '}') + { + input_text_offset++; + gathering_words = 0; + break; + } + + if (character == ',') + { + input_text_offset++; + skip_whitespace_and_newlines (); + i = input_text_offset - 1; + } + } + } } /* Read the text carefully until we find an "@end macro" which @@ -8849,80 +9074,90 @@ cm_macro () while (depth) { if ((input_text_offset + 9) > size_of_input_text) - { - int temp_line = line_number; - line_number = defining_line; - line_error ("%cend macro not found", COMMAND_PREFIX); - line_number = temp_line; - return; - } + { + int temp_line = line_number; + line_number = defining_line; + line_error (_("%cend macro not found"), COMMAND_PREFIX); + line_number = temp_line; + return; + } get_rest_of_line (&line); /* Handle commands only meaningful within a macro. */ if ((*line == COMMAND_PREFIX) && (depth == 1) && - (strncmp (line + 1, "allow-recursion", 15) == 0) && - (line[16] == '\0' || whitespace (line[16]))) - { - for (i = 16; whitespace (line[i]); i++); - strcpy (line, line + i); - flags |= ME_RECURSE; - if (!*line) - { - free (line); - continue; - } - } + (strncmp (line + 1, "allow-recursion", 15) == 0) && + (line[16] == 0 || whitespace (line[16]))) + { + for (i = 16; whitespace (line[i]); i++); + strcpy (line, line + i); + flags |= ME_RECURSE; + if (!*line) + { + free (line); + continue; + } + } if ((*line == COMMAND_PREFIX) && (depth == 1) && - (strncmp (line + 1, "quote-arg", 9) == 0) && - (line[10] == '\0' || whitespace (line[10]))) - { - for (i = 10; whitespace (line[i]); i++); - strcpy (line, line + i); - - if (arglist && arglist[0] && !arglist[1]) - { - flags |= ME_QUOTE_ARG; - if (!*line) - { - free (line); - continue; - } - } - else - { - line_error ("%cquote-arg only useful when the macro takes a single argument", - COMMAND_PREFIX); - } - } + (strncmp (line + 1, "quote-arg", 9) == 0) && + (line[10] == 0 || whitespace (line[10]))) + { + for (i = 10; whitespace (line[i]); i++); + strcpy (line, line + i); + + if (arglist && arglist[0] && !arglist[1]) + { + flags |= ME_QUOTE_ARG; + if (!*line) + { + free (line); + continue; + } + } + else + { + line_error (_("%cquote-arg only useful when the macro takes a single argument"), + COMMAND_PREFIX); + } + } if ((*line == COMMAND_PREFIX) && - (strncmp (line + 1, "macro ", 6) == 0)) - depth++; + (strncmp (line + 1, "macro ", 6) == 0)) + depth++; if ((*line == COMMAND_PREFIX) && - (strncmp (line + 1, "end macro", 9) == 0)) - depth--; + (strncmp (line + 1, "end macro", 9) == 0)) + depth--; if (depth) - { - if ((body_index + strlen (line) + 3) >= body_size) - body = (char *)xrealloc - (body, body_size += 3 + strlen (line)); - strcpy (body + body_index, line); - body_index += strlen (line); - body[body_index++] = '\n'; - body[body_index] = '\0'; - } + { + if ((body_index + strlen (line) + 3) >= body_size) + body = (char *)xrealloc + (body, body_size += 3 + strlen (line)); + strcpy (body + body_index, line); + body_index += strlen (line); + body[body_index++] = '\n'; + body[body_index] = 0; + } free (line); } + /* If it was an empty macro like + @macro foo + @end macro + create an empty body. (Otherwise, the macro is not expanded.) */ + if (!body) + { + body = (char *)malloc(1); + *body = 0; + } + /* We now have the name, the arglist, and the body. However, BODY includes the final newline which preceded the `@end macro' text. Delete it. */ if (body && strlen (body)) - body[strlen (body) - 1] = '\0'; + body[strlen (body) - 1] = 0; add_macro (name, arglist, body, input_filename, defining_line, flags); @@ -8941,12 +9176,11 @@ cm_unmacro () me_append_before_this_command (); get_rest_of_line (&line); - canon_white (line); for (i = 0; line[i] && !whitespace (line[i]); i++); - name = (char *)xmalloc (i); + name = (char *)xmalloc (i + 1); strncpy (name, line, i); - name[i] = '\0'; + name[i] = 0; def = delete_macro (name); @@ -8957,14 +9191,14 @@ cm_unmacro () free (def->body); if (def->arglist) - { - register int i; + { + register int i; - for (i = 0; def->arglist[i]; i++) - free (def->arglist[i]); + for (i = 0; def->arglist[i]; i++) + free (def->arglist[i]); - free (def->arglist); - } + free (def->arglist); + } free (def); } @@ -8992,38 +9226,38 @@ remember_itext (pointer, offset) { itext_info = (ITEXT **)xmalloc ((itext_size = 10) * sizeof (ITEXT *)); for (i = 0; i < itext_size; i++) - itext_info[i] = (ITEXT *)NULL; + itext_info[i] = (ITEXT *)NULL; } /* If the pointer is already present in the list, then set the offset. */ for (i = 0; i < itext_size; i++) if ((itext_info[i] != (ITEXT *)NULL) && - (itext_info[i]->pointer == pointer)) + (itext_info[i]->pointer == pointer)) { - itext = itext_info[i]; - itext_info[i]->offset = offset; - break; + itext = itext_info[i]; + itext_info[i]->offset = offset; + break; } if (i == itext_size) { - /* Find a blank slot, (or create a new one), and remember the - pointer and offset. */ + /* Find a blank slot (or create a new one), and remember the + pointer and offset. */ for (i = 0; i < itext_size; i++) - if (itext_info[i] == (ITEXT *)NULL) - break; + if (itext_info[i] == (ITEXT *)NULL) + break; /* If not found, then add some slots. */ if (i == itext_size) - { - register int j; + { + register int j; - itext_info = (ITEXT **)xrealloc - (itext_info, (itext_size += 10) * sizeof (ITEXT *)); + itext_info = (ITEXT **)xrealloc + (itext_info, (itext_size += 10) * sizeof (ITEXT *)); - for (j = i; j < itext_size; j++) - itext_info[j] = (ITEXT *)NULL; - } + for (j = i; j < itext_size; j++) + itext_info[j] = (ITEXT *)NULL; + } /* Now add the pointer and the offset. */ itext_info[i] = (ITEXT *)xmalloc (sizeof (ITEXT)); @@ -9044,9 +9278,9 @@ forget_itext (pointer) for (i = 0; i < itext_size; i++) if (itext_info[i] && (itext_info[i]->pointer == pointer)) { - free (itext_info[i]); - itext_info[i] = (ITEXT *)NULL; - break; + free (itext_info[i]); + itext_info[i] = (ITEXT *)NULL; + break; } } @@ -9070,7 +9304,7 @@ me_execute_string (execution_string) pushfile (); input_text_offset = 0; input_text = execution_string; - input_filename = strdup (input_filename); + input_filename = xstrdup (input_filename); size_of_input_text = strlen (execution_string); remember_itext (execution_string, 0); @@ -9093,8 +9327,8 @@ append_to_expansion_output (offset) for (i = 0; i < itext_size; i++) if (itext_info[i] && itext_info[i]->pointer == input_text) { - itext = itext_info[i]; - break; + itext = itext_info[i]; + break; } if (!itext) @@ -9103,7 +9337,7 @@ append_to_expansion_output (offset) if (offset > itext->offset) { write_region_to_macro_output - (input_text, itext->offset, offset); + (input_text, itext->offset, offset); remember_itext (input_text, offset); } } @@ -9120,8 +9354,8 @@ maybe_write_itext (pointer, offset) for (i = 0; i < itext_size; i++) if (itext_info[i] && (itext_info[i]->pointer == pointer)) { - itext = itext_info[i]; - break; + itext = itext_info[i]; + break; } if (itext && (itext->offset < offset)) @@ -9164,7 +9398,7 @@ free_array (array) register int i; for (i = 0; array[i] != (char *)NULL; i++) - free (array[i]); + free (array[i]); free (array); } @@ -9193,64 +9427,64 @@ get_brace_args (quote_single) start = input_text_offset; escape_seen = 0; - while (character = curchar ()) + while ((character = curchar ())) { if (character == '\\') - { - input_text_offset += 2; - escape_seen = 1; - } + { + input_text_offset += 2; + escape_seen = 1; + } else if (character == '{') - { - depth++; - input_text_offset++; - } + { + depth++; + input_text_offset++; + } else if ((character == ',' && !quote_single) || - ((character == '}') && depth == 1)) - { - int len = input_text_offset - start; - - if (len || (character != '}')) - { - word = (char *)xmalloc (1 + len); - strncpy (word, input_text + start, len); - word[len] = '\0'; - - /* Clean up escaped characters. */ - if (escape_seen) - { - register int i; - - for (i = 0; word[i]; i++) - if (word[i] == '\\') - memmove (word + i, word + i + 1, - 1 + strlen (word + i + 1)); - } - - if (arglist_index + 2 >= arglist_size) - arglist = (char **)xrealloc - (arglist, (arglist_size += 10) * sizeof (char *)); - - arglist[arglist_index++] = word; - arglist[arglist_index] = (char *)NULL; - } - - input_text_offset++; - if (character == '}') - break; - else - goto get_arg; - } + ((character == '}') && depth == 1)) + { + int len = input_text_offset - start; + + if (len || (character != '}')) + { + word = (char *)xmalloc (1 + len); + strncpy (word, input_text + start, len); + word[len] = 0; + + /* Clean up escaped characters. */ + if (escape_seen) + { + register int i; + + for (i = 0; word[i]; i++) + if (word[i] == '\\') + memmove (word + i, word + i + 1, + 1 + strlen (word + i + 1)); + } + + if (arglist_index + 2 >= arglist_size) + arglist = (char **)xrealloc + (arglist, (arglist_size += 10) * sizeof (char *)); + + arglist[arglist_index++] = word; + arglist[arglist_index] = (char *)NULL; + } + + input_text_offset++; + if (character == '}') + break; + else + goto get_arg; + } else if (character == '}') - { - depth--; - input_text_offset++; - } + { + depth--; + input_text_offset++; + } else - { - input_text_offset++; - if (character == '\n') line_number++; - } + { + input_text_offset++; + if (character == '\n') line_number++; + } } return (arglist); } @@ -9293,10 +9527,10 @@ extract_colon_unit (string, index) if (i == start) { if (string[i]) - (*index)++; + (*index)++; /* Return "" in the case of a trailing `:'. */ - return (strdup ("")); + return (xstrdup ("")); } else { @@ -9304,7 +9538,7 @@ extract_colon_unit (string, index) value = (char *)xmalloc (1 + (i - start)); strncpy (value, &string[start], (i - start)); - value [i - start] = '\0'; + value [i - start] = 0; return (value); } @@ -9329,23 +9563,29 @@ get_file_info_in_path (filename, path, finfo) if (*filename == '/' || (*filename == '.' && (filename[1] == '/' || - (filename[1] == '.' && filename[2] == '/')))) + (filename[1] == '.' && filename[2] == '/'))) +#ifdef WIN32 + /* Handle names that look like "d:/foo/bar" */ + || (isalpha (*filename) && filename [1] == ':' + && (filename [2] == '/' || filename [2] == '\\')) +#endif + ) { if (stat (filename, finfo) == 0) - return (strdup (filename)); + return (xstrdup (filename)); else - return ((char *)NULL); + return ((char *)NULL); } - while (dir = extract_colon_unit (path, &index)) + while ((dir = extract_colon_unit (path, &index))) { char *fullpath; if (!*dir) - { - free (dir); - dir = strdup ("."); - } + { + free (dir); + dir = xstrdup ("."); + } fullpath = (char *)xmalloc (2 + strlen (dir) + strlen (filename)); sprintf (fullpath, "%s/%s", dir, filename); @@ -9354,9 +9594,9 @@ get_file_info_in_path (filename, path, finfo) result = stat (fullpath, finfo); if (result == 0) - return (fullpath); + return (fullpath); else - free (fullpath); + free (fullpath); } - return ((char *)NULL); + return NULL; } diff --git a/texinfo/util/install-info.c b/texinfo/util/install-info.c index e0289a76450..6007a3cbd31 100644 --- a/texinfo/util/install-info.c +++ b/texinfo/util/install-info.c @@ -1,56 +1,30 @@ /* install-info -- create Info directory entry(ies) for an Info file. - Copyright (C) 1996 Free Software Foundation, Inc. + $Id: install-info.c,v 1.5 1998/03/24 18:08:44 law Exp $ -$Id: install-info.c,v 1.3 1997/09/18 05:54:18 law Exp $ + Copyright (C) 1996, 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 -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*/ -#define INSTALL_INFO_VERSION_STRING "GNU install-info (Texinfo 3.9) 1.2" - -#include <stdio.h> -#include <errno.h> +#include "system.h" #include <getopt.h> -#include <sys/types.h> - -#if defined (HAVE_STRING_H) -#include <string.h> -#else -#include <strings.h> -#endif /* !HAVE_STRING_H */ - -#if !defined (HAVE_STRCHR) -char *strrchr (); -#endif /* !HAVE_STRCHR */ - - -/* Get O_RDONLY. */ -#ifdef HAVE_SYS_FCNTL_H -#include <sys/fcntl.h> -#else -#include <fcntl.h> -#endif /* !HAVE_SYS_FCNTL_H */ -#ifdef HAVE_SYS_FILE_H -#include <sys/file.h> -#endif /* Name this program was invoked with. */ char *progname; char *readfile (); struct line_data *findlines (); -char *my_strerror (); void fatal (); void insert_entry_here (); int compare_section_names (); @@ -59,9 +33,8 @@ struct spec_entry; /* Data structures. */ -/* Record info about a single line from a file - as read into core. */ +/* Record info about a single line from a file as read into core. */ struct line_data { /* The start of the line. */ @@ -78,9 +51,9 @@ struct line_data int delete; }; + /* This is used for a list of the specified menu section names in which entries should be added. */ - struct spec_section { struct spec_section *next; @@ -90,16 +63,16 @@ struct spec_section int missing; }; -/* This is used for a list of the entries specified to be added. */ +/* This is used for a list of the entries specified to be added. */ struct spec_entry { struct spec_entry *next; char *text; }; - -/* This is used for a list of nodes found by parsing the dir file. */ + +/* This is used for a list of nodes found by parsing the dir file. */ struct node { struct node *next; @@ -120,9 +93,9 @@ struct node struct menu_section *last_section; }; + /* This is used for a list of sections found in a node's menu. Each struct node has such a list in the sections field. */ - struct menu_section { struct menu_section *next; @@ -136,7 +109,6 @@ struct menu_section /* Memory allocation and string operations. */ /* Like malloc but get fatal error if memory is exhausted. */ - void * xmalloc (size) unsigned int size; @@ -144,12 +116,11 @@ xmalloc (size) extern void *malloc (); void *result = malloc (size); if (result == NULL) - fatal ("virtual memory exhausted", 0); + fatal (_("virtual memory exhausted"), 0); return result; } -/* Like malloc but get fatal error if memory is exhausted. */ - +/* Like realloc but get fatal error if memory is exhausted. */ void * xrealloc (obj, size) void *obj; @@ -158,12 +129,12 @@ xrealloc (obj, size) extern void *realloc (); void *result = realloc (obj, size); if (result == NULL) - fatal ("virtual memory exhausted", 0); + fatal (_("virtual memory exhausted"), 0); return result; } -/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */ - +/* Return a newly-allocated string + whose contents concatenate those of S1, S2, S3. */ char * concat (s1, s2, s3) char *s1, *s2, *s3; @@ -197,7 +168,7 @@ copy_string (string, size) /* Error message functions. */ -/* Print error message. `s1' is printf control string, `s2' is arg for it. */ +/* Print error message. S1 is printf control string, S2 and S3 args for it. */ /* VARARGS1 */ void @@ -206,7 +177,7 @@ error (s1, s2, s3) { fprintf (stderr, "%s: ", progname); fprintf (stderr, s1, s2, s3); - fprintf (stderr, "\n"); + putc ('\n', stderr); } /* VARARGS1 */ @@ -214,9 +185,9 @@ void warning (s1, s2, s3) char *s1, *s2, *s3; { - fprintf (stderr, "%s: Warning: ", progname); + fprintf (stderr, _("%s: warning: "), progname); fprintf (stderr, s1, s2, s3); - fprintf (stderr, "\n"); + putc ('\n', stderr); } /* Print error message and exit. */ @@ -235,7 +206,7 @@ void pfatal_with_name (name) char *name; { - char *s = concat ("", my_strerror (errno), " for %s"); + char *s = concat ("", strerror (errno), _(" for %s")); fatal (s, name); } @@ -304,7 +275,7 @@ extract_menu_file_name (item_text) void suggest_asking_for_help () { - fprintf (stderr, "\tTry `%s --help' for a complete list of options.\n", + fprintf (stderr, _("\tTry `%s --help' for a complete list of options.\n"), progname); exit (1); } @@ -312,7 +283,7 @@ suggest_asking_for_help () void print_help () { - printf ("%s [OPTION]... [INFO-FILE [DIR-FILE]]\n\ + printf (_("%s [OPTION]... [INFO-FILE [DIR-FILE]]\n\ Install INFO-FILE in the Info directory file DIR-FILE.\n\ \n\ Options:\n\ @@ -342,27 +313,54 @@ Options:\n\ --version Display version information and exit.\n\ \n\ Email bug reports to bug-texinfo@prep.ai.mit.edu.\n\ -", progname); +"), progname); } - -/* Convert an errno value into a string describing the error. - We define this function here rather than using strerror - because not all systems have strerror. */ - -char * -my_strerror (errnum) - int errnum; + +/* If DIRFILE does not exist, create a minimal one (or abort). If it + already exists, do nothing. */ +void +ensure_dirfile_exists (dirfile) + char *dirfile; { -#ifdef HAVE_STRERROR - return strerror(errnum); -#else - extern char *sys_errlist[]; - extern int sys_nerr; - - if (errnum >= 0 && errnum < sys_nerr) - return sys_errlist[errnum]; - return (char *) "Unknown error"; -#endif + int desc = open (dirfile, O_RDONLY); + if (desc < 0 && errno == ENOENT) + { + FILE *f; + char *readerr = strerror (errno); + close (desc); + f = fopen (dirfile, "w"); + if (f) + { + fputs (_("This is the file .../info/dir, which contains the\n\ +topmost node of the Info hierarchy, called (dir)Top.\n\ +The first time you invoke Info you start off looking at this node.\n\ +\n\ +File: dir Node: Top This is the top of the INFO tree\n\ +\n\ + This (the Directory node) gives a menu of major topics.\n\ + Typing \"q\" exits, \"?\" lists all Info commands, \"d\" returns here,\n\ + \"h\" gives a primer for first-timers,\n\ + \"mEmacs<Return>\" visits the Emacs manual, etc.\n\ +\n\ + In Emacs, you can click mouse button 2 on a menu item or cross reference\n\ + to select it.\n\ +\n\ +* Menu:\n\ +"), f); + if (fclose (f) < 0) + pfatal_with_name (dirfile); + } + else + { + /* Didn't exist, but couldn't open for writing. */ + fprintf (stderr, + _("%s: could not read (%s) and could not create (%s)\n"), + dirfile, readerr, strerror (errno)); + exit (1); + } + } + else + close (desc); /* It already existed, so fine. */ } /* This table defines all the long-named options, says whether they @@ -384,6 +382,7 @@ struct option longopts[] = { 0 } }; +int main (argc, argv) int argc; char **argv; @@ -425,6 +424,15 @@ main (argc, argv) progname = 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 opt = getopt_long (argc, argv, "i:d:e:s:hHr", longopts, 0); @@ -445,7 +453,7 @@ main (argc, argv) case 'd': if (dirfile) { - fprintf (stderr, "%s: Specify the Info directory only once.\n", + fprintf (stderr, _("%s: Specify the Info directory only once.\n"), progname); suggest_asking_for_help (); } @@ -455,7 +463,7 @@ main (argc, argv) case 'D': if (dirfile) { - fprintf (stderr, "%s: Specify the Info directory only once.\n", + fprintf (stderr, _("%s: Specify the Info directory only once.\n"), progname); suggest_asking_for_help (); } @@ -483,7 +491,7 @@ main (argc, argv) case 'i': if (infile) { - fprintf (stderr, "%s: Specify the Info file only once.\n", + fprintf (stderr, _("%s: Specify the Info file only once.\n"), progname); suggest_asking_for_help (); } @@ -510,12 +518,12 @@ main (argc, argv) break; case 'V': - puts (INSTALL_INFO_VERSION_STRING); -puts ("Copyright (C) 1996 Free Software Foundation, Inc.\n\ + printf (_("install-info (GNU %s) %s\n"), PACKAGE, VERSION); +puts (_("Copyright (C) 1996 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."); - exit (0); +For more information about these matters, see the files named COPYING.")); + exit (0); default: suggest_asking_for_help (); @@ -530,13 +538,13 @@ For more information about these matters, see the files named COPYING."); else if (dirfile == 0) dirfile = argv[optind]; else - error ("excess command line argument `%s'", argv[optind]); + error (_("excess command line argument `%s'"), argv[optind]); } if (!infile) - fatal ("No input file specified"); + fatal (_("No input file specified; try --help for more information.")); if (!dirfile) - fatal ("No dir file specified"); + fatal (_("No dir file specified; try --help for more information.")); /* Read the Info file and parse it into lines. */ @@ -588,7 +596,7 @@ For more information about these matters, see the files named COPYING."); && sizeof ("START-INFO-DIR-ENTRY") - 1 == input_lines[i].size) { if (start_of_this_entry != 0) - fatal ("START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY"); + fatal (_("START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY")); start_of_this_entry = input_lines[i + 1].start; } if (!strncmp ("END-INFO-DIR-ENTRY", input_lines[i].start, @@ -607,18 +615,26 @@ For more information about these matters, see the files named COPYING."); start_of_this_entry = 0; } else - fatal ("END-INFO-DIR-ENTRY without matching START-INFO-DIR-ENTRY"); + fatal (_("END-INFO-DIR-ENTRY without matching START-INFO-DIR-ENTRY")); } } if (start_of_this_entry != 0) - fatal ("START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY"); + fatal (_("START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY")); } if (!delete_flag) if (entries_to_add == 0) - fatal ("no info dir entry in `%s'", infile); + { /* No need to abort here, the original info file may not have + the requisite Texinfo commands. This is not something an + installer should have to correct (it's a problem for the + maintainer), and there's no need to cause subsequent parts of + `make install' to fail. */ + warning (_("no info dir entry in `%s'"), infile); + exit (0); + } /* Now read in the Info dir file. */ + ensure_dirfile_exists (dirfile); dir_data = readfile (dirfile, &dir_size); dir_lines = findlines (dir_data, dir_size, &dir_nlines); @@ -747,8 +763,12 @@ For more information about these matters, see the files named COPYING."); if ((dir_lines[i].size > (p - dir_lines[i].start + infilelen_sans_info)) && !strncmp (p, infile_sans_info, infilelen_sans_info) - && p[infilelen_sans_info] == ')') - dir_lines[i].delete = 1; + && (p[infilelen_sans_info] == ')' + || !strncmp (p + infilelen_sans_info, ".info)", 6))) + { + dir_lines[i].delete = 1; + something_deleted = 1; + } } } /* Treat lines that start with whitespace @@ -820,7 +840,7 @@ For more information about these matters, see the files named COPYING."); dir_lines[i].start, dir_lines[i].size) && !dir_lines[i].delete) - fatal ("menu item `%s' already exists, for file `%s'", + fatal (_("menu item `%s' already exists, for file `%s'"), extract_menu_item_name (entry->text), extract_menu_file_name (dir_lines[i].start)); if (dir_lines[i].start[0] == '*' @@ -843,7 +863,7 @@ For more information about these matters, see the files named COPYING."); } if (delete_flag && !something_deleted && !quiet_flag) - warning ("no entries found for `%s'; nothing deleted", infile); + warning (_("no entries found for `%s'; nothing deleted"), infile); /* Output the old dir file, interpolating the new sections and/or new entries where appropriate. */ @@ -941,7 +961,6 @@ readfile (filename, sizep) int nread = 0; int desc = open (filename, O_RDONLY); - if (desc < 0) pfatal_with_name (filename); |