summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo/info
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/texinfo/info')
-rw-r--r--contrib/texinfo/info/display.c47
-rw-r--r--contrib/texinfo/info/filesys.c4
-rw-r--r--contrib/texinfo/info/indices.c6
-rw-r--r--contrib/texinfo/info/info-utils.c8
-rw-r--r--contrib/texinfo/info/info.c54
-rw-r--r--contrib/texinfo/info/infokey.c19
-rw-r--r--contrib/texinfo/info/infokey.h4
-rw-r--r--contrib/texinfo/info/search.c4
-rw-r--r--contrib/texinfo/info/window.c72
9 files changed, 158 insertions, 60 deletions
diff --git a/contrib/texinfo/info/display.c b/contrib/texinfo/info/display.c
index 3f2abe3..b6b55ff 100644
--- a/contrib/texinfo/info/display.c
+++ b/contrib/texinfo/info/display.c
@@ -1,5 +1,5 @@
/* display.c -- How to display Info windows.
- $Id: display.c,v 1.6 1997/07/24 21:13:27 karl Exp $
+ $Id: display.c,v 1.7 2002/03/08 21:41:44 karl Exp $
Copyright (C) 1993, 97 Free Software Foundation, Inc.
@@ -103,6 +103,8 @@ display_update_one_window (win)
char *printed_line; /* Buffer for a printed line. */
int pl_index = 0; /* Index into PRINTED_LINE. */
int line_index = 0; /* Number of lines done so far. */
+ int pl_ignore = 0; /* How many chars use zero width on screen. */
+ int allocated_win_width;
DISPLAY_LINE **display = the_display;
/* If display is inhibited, that counts as an interrupted display. */
@@ -123,7 +125,8 @@ display_update_one_window (win)
/* Print each line in the window into our local buffer, and then
check the contents of that buffer against the display. If they
differ, update the display. */
- printed_line = (char *)xmalloc (1 + win->width);
+ allocated_win_width = win->width + 1;
+ printed_line = (char *)xmalloc (allocated_win_width);
if (!win->node || !win->line_starts)
goto done_with_node_display;
@@ -147,7 +150,7 @@ display_update_one_window (win)
{
if (*nodetext == '\r' || *nodetext == '\n')
{
- replen = win->width - pl_index;
+ replen = win->width - pl_index + pl_ignore;
}
else
{
@@ -156,9 +159,26 @@ display_update_one_window (win)
}
}
+ /* Support ANSI escape sequences under -R. */
+ if (raw_escapes_p
+ && *nodetext == '\033'
+ && nodetext[1] == '['
+ && isdigit (nodetext[2]))
+ {
+ if (nodetext[3] == 'm')
+ pl_ignore += 4;
+ else if (isdigit (nodetext[3]) && nodetext[4] == 'm')
+ pl_ignore += 5;
+ }
+ while (pl_index + 2 >= allocated_win_width - 1)
+ {
+ allocated_win_width *= 2;
+ printed_line = (char *)xrealloc (printed_line, allocated_win_width);
+ }
+
/* If this character can be printed without passing the width of
the line, then stuff it into the line. */
- if (replen + pl_index < win->width)
+ if (replen + pl_index < win->width + pl_ignore)
{
/* Optimize if possible. */
if (replen == 1)
@@ -189,7 +209,7 @@ display_update_one_window (win)
the next line. Remember the offset of the last character
printed out of REP so that we can carry the character over
to the next line. */
- for (i = 0; pl_index < (win->width - 1);)
+ for (i = 0; pl_index < (win->width + pl_ignore - 1);)
printed_line[pl_index++] = rep[i++];
rep_carried_over = rep + i;
@@ -214,7 +234,9 @@ display_update_one_window (win)
/* If the screen line is inversed, then we have to clear
the line from the screen first. Why, I don't know. */
- if (entry->inverse)
+ if (entry->inverse
+ /* Need to erase the line if it has escape sequences. */
+ || (raw_escapes_p && strchr (entry->text, '\033') != 0))
{
terminal_goto_xy (0, line_index + win->first_row);
terminal_clear_to_eol ();
@@ -242,13 +264,21 @@ display_update_one_window (win)
/* If the printed text didn't extend all the way to the edge
of the window, and text was appearing between here and the
edge of the window, clear from here to the end of the line. */
- if ((pl_index < win->width && pl_index < entry->textlen) ||
- (entry->inverse))
+ if ((pl_index < win->width + pl_ignore
+ && pl_index < entry->textlen)
+ || (entry->inverse))
terminal_clear_to_eol ();
fflush (stdout);
/* Update the display text buffer. */
+ if (strlen (printed_line) > screenwidth)
+ /* printed_line[] can include more than screenwidth
+ characters if we are under -R and there are escape
+ sequences in it. However, entry->text was
+ allocated (in display_initialize_display) for
+ screenwidth characters only. */
+ entry->text = xrealloc (entry->text, strlen (printed_line)+1);
strcpy (entry->text + i, printed_line + i);
entry->textlen = pl_index;
@@ -274,6 +304,7 @@ display_update_one_window (win)
/* Reset PL_INDEX to the start of the line. */
pl_index = 0;
+ pl_ignore = 0; /* this is computed per line */
/* If there are characters from REP left to print, stuff them
into the buffer now. */
diff --git a/contrib/texinfo/info/filesys.c b/contrib/texinfo/info/filesys.c
index cdf1365..7ce6017 100644
--- a/contrib/texinfo/info/filesys.c
+++ b/contrib/texinfo/info/filesys.c
@@ -1,5 +1,5 @@
/* filesys.c -- filesystem specific functions.
- $Id: filesys.c,v 1.14 2002/03/02 15:05:04 karl Exp $
+ $Id: filesys.c,v 1.15 2002/03/23 20:45:24 karl Exp $
Copyright (C) 1993, 97, 98, 2000 Free Software Foundation, Inc.
@@ -510,6 +510,7 @@ filesys_read_info_file (pathname, filesize, finfo, is_compressed)
want to waste storage. */
if (*filesize < st_size)
contents = (char *)xrealloc (contents, 1 + *filesize);
+ contents[*filesize] = '\0';
return (contents);
}
@@ -596,6 +597,7 @@ filesys_read_compressed (pathname, filesize, finfo)
{
*filesize = convert_eols (contents, offset);
contents = (char *)xrealloc (contents, 1 + *filesize);
+ contents[*filesize] = '\0';
}
}
else
diff --git a/contrib/texinfo/info/indices.c b/contrib/texinfo/info/indices.c
index 6583da1..9123c46 100644
--- a/contrib/texinfo/info/indices.c
+++ b/contrib/texinfo/info/indices.c
@@ -1,7 +1,7 @@
/* indices.c -- deal with an Info file index.
- $Id: indices.c,v 1.14 1999/09/25 16:10:04 karl Exp $
+ $Id: indices.c,v 1.15 2002/03/11 13:43:52 karl Exp $
- Copyright (C) 1993, 97, 98, 99 Free Software Foundation, Inc.
+ Copyright (C) 1993, 97, 98, 99, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -61,7 +61,7 @@ add_index_to_index_nodenames (array, node)
register int i, last;
INDEX_NAME_ASSOC *assoc;
- for (last = 0; array[last]; last++);
+ for (last = 0; array[last + 1]; last++);
assoc = (INDEX_NAME_ASSOC *)xmalloc (sizeof (INDEX_NAME_ASSOC));
assoc->name = xstrdup (node->nodename);
diff --git a/contrib/texinfo/info/info-utils.c b/contrib/texinfo/info/info-utils.c
index a19c950..73a8081 100644
--- a/contrib/texinfo/info/info-utils.c
+++ b/contrib/texinfo/info/info-utils.c
@@ -1,5 +1,5 @@
/* info-utils.c -- miscellanous.
- $Id: info-utils.c,v 1.7 1998/08/10 18:07:47 karl Exp $
+ $Id: info-utils.c,v 1.8 2002/03/08 21:41:44 karl Exp $
Copyright (C) 1993, 98 Free Software Foundation, Inc.
@@ -443,9 +443,11 @@ printed_representation (character, hpos)
{
register int i = 0;
int printable_limit = ISO_Latin_p ? 255 : 127;
-
+
+ if (raw_escapes_p && character == '\033')
+ the_rep[i++] = character;
/* Show CTRL-x as ^X. */
- if (iscntrl (character) && character < 127)
+ else if (iscntrl (character) && character < 127)
{
switch (character)
{
diff --git a/contrib/texinfo/info/info.c b/contrib/texinfo/info/info.c
index 33aacdf..4533507 100644
--- a/contrib/texinfo/info/info.c
+++ b/contrib/texinfo/info/info.c
@@ -1,5 +1,5 @@
/* info.c -- Display nodes of Info files in multiple windows.
- $Id: info.c,v 1.53 2002/03/02 15:18:58 karl Exp $
+ $Id: info.c,v 1.60 2002/03/11 19:54:29 karl Exp $
Copyright (C) 1993, 96, 97, 98, 99, 2000, 01, 02
Free Software Foundation, Inc.
@@ -99,22 +99,22 @@ int speech_friendly = 0;
static struct option long_options[] = {
{ "apropos", 1, 0, APROPOS_OPTION },
{ "directory", 1, 0, 'd' },
- { "node", 1, 0, 'n' },
+ { "dribble", 1, 0, DRIBBLE_OPTION },
{ "file", 1, 0, 'f' },
- { "subnodes", 0, &dump_subnodes, 1 },
+ { "help", 0, &print_help_p, 1 },
+ { "index-search", 1, 0, IDXSRCH_OPTION },
+ { "node", 1, 0, 'n' },
{ "output", 1, 0, 'o' },
{ "raw-escapes", 0, &raw_escapes_p, 1 },
+ { "restore", 1, 0, RESTORE_OPTION },
{ "show-options", 0, 0, 'O' },
+ { "subnodes", 0, &dump_subnodes, 1 },
{ "usage", 0, 0, 'O' },
- { "vi-keys", 0, &vi_keys_p, 1 },
- { "help", 0, &print_help_p, 1 },
{ "version", 0, &print_version_p, 1 },
- { "dribble", 1, 0, DRIBBLE_OPTION },
- { "restore", 1, 0, RESTORE_OPTION },
+ { "vi-keys", 0, &vi_keys_p, 1 },
#ifdef __MSDOS__
{ "speech-friendly", 0, &speech_friendly, 1 },
#endif
- { "index-search", 1, 0, IDXSRCH_OPTION },
{NULL, 0, NULL, 0}
};
@@ -553,7 +553,7 @@ info_short_help ()
{
#ifdef __MSDOS__
static const char speech_friendly_string[] = N_("\
- --speech-friendly be friendly to speech synthesizers.\n");
+ -b, --speech-friendly be friendly to speech synthesizers.\n");
#else
static const char speech_friendly_string[] = "";
#endif
@@ -565,20 +565,20 @@ Usage: %s [OPTION]... [MENU-ITEM...]\n\
Read documentation in Info format.\n\
\n\
Options:\n\
- --apropos=SUBJECT look up SUBJECT in all indices of all manuals.\n\
- --directory=DIR add DIR to INFOPATH.\n\
- --dribble=FILENAME remember user keystrokes in FILENAME.\n\
- --file=FILENAME specify Info file to visit.\n\
- --help display this help and exit.\n\
- --index-search=STRING go to node pointed by index entry STRING.\n\
- --node=NODENAME specify nodes in first visited Info file.\n\
- --output=FILENAME output selected nodes to FILENAME.\n\
- --raw-escapes don't remove ANSI escapes from man pages.\n\
- --restore=FILENAME read initial keystrokes from FILENAME.\n\
- --show-options, --usage go to command-line options node.\n%s\
- --subnodes recursively output menu items.\n\
- --vi-keys use vi-like and less-like key bindings.\n\
- --version display version information and exit.\n\
+ --apropos=STRING look up STRING in all indices of all manuals.\n\
+ -d, --directory=DIR add DIR to INFOPATH.\n\
+ --dribble=FILENAME remember user keystrokes in FILENAME.\n\
+ -f, --file=FILENAME specify Info file to visit.\n\
+ -h, --help display this help and exit.\n\
+ --index-search=STRING go to node pointed by index entry STRING.\n\
+ -n, --node=NODENAME specify nodes in first visited Info file.\n\
+ -o, --output=FILENAME output selected nodes to FILENAME.\n\
+ -R, --raw-escapes don't remove ANSI escapes from man pages.\n\
+ --restore=FILENAME read initial keystrokes from FILENAME.\n\
+ -O, --show-options, --usage go to command-line options node.\n%s\
+ --subnodes recursively output menu items.\n\
+ --vi-keys use vi-like and less-like key bindings.\n\
+ --version display version information and exit.\n\
\n\
The first non-option argument, if present, is the menu entry to start from;\n\
it is searched for in all `dir' files along INFOPATH.\n\
@@ -592,12 +592,14 @@ Examples:\n\
info emacs buffers start at buffers node within emacs manual\n\
info --show-options emacs start at node with emacs' command line options\n\
info -f ./foo.info show file ./foo.info, not searching dir\n\
-\n\
-Email bug reports to bug-texinfo@gnu.org,\n\
-general questions and discussion to help-texinfo@gnu.org.\n\
"),
program_name, speech_friendly_string);
+ puts (_("\n\
+Email bug reports to bug-texinfo@gnu.org,\n\
+general questions and discussion to help-texinfo@gnu.org.\n\
+Texinfo home page: http://www.gnu.org/software/texinfo/"));
+
xexit (0);
}
diff --git a/contrib/texinfo/info/infokey.c b/contrib/texinfo/info/infokey.c
index e84a2d7..cd05aeb 100644
--- a/contrib/texinfo/info/infokey.c
+++ b/contrib/texinfo/info/infokey.c
@@ -1,5 +1,5 @@
/* infokey.c -- compile ~/.infokey to ~/.info.
- $Id: infokey.c,v 1.5 2002/02/26 16:17:57 karl Exp $
+ $Id: infokey.c,v 1.10 2002/03/19 14:36:49 karl Exp $
Copyright (C) 1999, 2001, 02 Free Software Foundation, Inc.
@@ -60,7 +60,7 @@ enum sect_e
{
info = 0,
ea = 1,
- var = 2,
+ var = 2
};
struct sect
{
@@ -400,7 +400,7 @@ compile (fp, filename, sections)
got_varname,
get_equals,
got_equals,
- get_value,
+ get_value
}
state = start_of_line;
enum sect_e section = info;
@@ -410,7 +410,7 @@ compile (fp, filename, sections)
slosh,
control,
octal,
- special_key,
+ special_key
}
seqstate; /* used if state == get_keyseq */
char meta = 0;
@@ -888,7 +888,7 @@ suggest_help ()
static void
short_help ()
{
- printf (_ ("\
+ printf (_("\
Usage: %s [OPTION]... [INPUT-FILE]\n\
\n\
Compile infokey source file to infokey file. Reads INPUT-FILE (default\n\
@@ -898,11 +898,12 @@ Options:\n\
--output FILE output to FILE instead of $HOME/.info\n\
--help display this help and exit.\n\
--version display version information and exit.\n\
-\n\
+"), program_name);
+
+ puts (_("\n\
Email bug reports to bug-texinfo@gnu.org,\n\
general questions and discussion to help-texinfo@gnu.org.\n\
-"),
- program_name
- );
+Texinfo home page: http://www.gnu.org/software/texinfo/"));
+
xexit (0);
}
diff --git a/contrib/texinfo/info/infokey.h b/contrib/texinfo/info/infokey.h
index 0babea9..df3749f 100644
--- a/contrib/texinfo/info/infokey.h
+++ b/contrib/texinfo/info/infokey.h
@@ -1,7 +1,7 @@
/* infokey.h -- Custom keystroke definition support.
- $Id: $
+ $Id: infokey.h,v 1.1 2002/03/20 16:03:22 karl Exp $
- Copyright (C) 1999 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2002 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
diff --git a/contrib/texinfo/info/search.c b/contrib/texinfo/info/search.c
index 2866704..0e48cea 100644
--- a/contrib/texinfo/info/search.c
+++ b/contrib/texinfo/info/search.c
@@ -1,5 +1,5 @@
/* search.c -- searching large bodies of text.
- $Id: search.c,v 1.5 1999/03/05 19:56:59 karl Exp $
+ $Id: search.c,v 1.6 2002/03/23 20:45:24 karl Exp $
Copyright (C) 1993, 97, 98 Free Software Foundation, Inc.
@@ -301,7 +301,7 @@ skip_non_whitespace (string)
{
register int i;
- for (i = 0; string && !whitespace (string[i]); i++);
+ for (i = 0; string && string[i] && !whitespace (string[i]); i++);
return (i);
}
diff --git a/contrib/texinfo/info/window.c b/contrib/texinfo/info/window.c
index faa0784..4acd5e5 100644
--- a/contrib/texinfo/info/window.c
+++ b/contrib/texinfo/info/window.c
@@ -1,5 +1,5 @@
/* window.c -- windows in Info.
- $Id: window.c,v 1.15 2002/01/19 01:08:20 karl Exp $
+ $Id: window.c,v 1.16 2002/03/08 21:41:44 karl Exp $
Copyright (C) 1993, 97, 98, 2001, 02 Free Software Foundation, Inc.
@@ -758,7 +758,20 @@ string_width (string, hpos)
for (width = 0, i = 0; string[i]; i++)
{
- this_char_width = character_width (string[i], hpos);
+ /* Support ANSI escape sequences for -R. */
+ if (raw_escapes_p
+ && string[i] == '\033'
+ && string[i+1] == '['
+ && isdigit (string[i+2])
+ && (string[i+3] == 'm'
+ || (isdigit (string[i+3]) && string[i+4] == 'm')))
+ {
+ while (string[i] != 'm')
+ i++;
+ this_char_width = 0;
+ }
+ else
+ this_char_width = character_width (string[i], hpos);
width += this_char_width;
hpos += this_char_width;
}
@@ -830,7 +843,29 @@ calculate_line_starts (window)
could be passed as negative integers to character_width
and wreak havoc on some naive implementations of iscntrl. */
c = (unsigned char) node->contents[i];
- cwidth = character_width (c, hpos);
+
+ /* Support ANSI escape sequences for -R. */
+ if (raw_escapes_p
+ && c == '\033'
+ && node->contents[i+1] == '['
+ && isdigit (node->contents[i+2]))
+ {
+ if (node->contents[i+3] == 'm')
+ {
+ i += 3;
+ cwidth = 0;
+ }
+ else if (isdigit (node->contents[i+3])
+ && node->contents[i+4] == 'm')
+ {
+ i += 4;
+ cwidth = 0;
+ }
+ else
+ cwidth = character_width (c, hpos);
+ }
+ else
+ cwidth = character_width (c, hpos);
/* If this character fits within this line, just do the next one. */
if ((hpos + cwidth) < window->width)
@@ -1009,7 +1044,23 @@ window_get_cursor_column (window)
end = window->point - (line - window->node->contents);
for (hpos = 0, i = 0; i < end; i++)
- hpos += character_width (line[i], hpos);
+ {
+ /* Support ANSI escape sequences for -R. */
+ if (raw_escapes_p
+ && line[i] == '\033'
+ && line[i+1] == '['
+ && isdigit (line[i+2]))
+ {
+ if (line[i+3] == 'm')
+ i += 3;
+ else if (isdigit (line[i+3]) && line[i+4] == 'm')
+ i += 4;
+ else
+ hpos += character_width (line[i], hpos);
+ }
+ else
+ hpos += character_width (line[i], hpos);
+ }
return (hpos);
}
@@ -1025,8 +1076,17 @@ window_chars_to_goal (line, goal)
for (hpos = 0, i = 0; line[i] != '\n'; i++)
{
-
- check = hpos + character_width (line[i], hpos);
+ /* Support ANSI escape sequences for -R. */
+ if (raw_escapes_p
+ && line[i] == '\033'
+ && line[i+1] == '['
+ && isdigit (line[i+2])
+ && (line[i+3] == 'm'
+ || (isdigit (line[i+3]) && line[i+4] == 'm')))
+ while (line[i] != 'm')
+ i++;
+ else
+ check = hpos + character_width (line[i], hpos);
if (check > goal)
break;
OpenPOWER on IntegriCloud