diff options
author | Jeff Law <law@cygnus.com> | 1998-03-22 21:47:59 +0000 |
---|---|---|
committer | Jeff Law <law@cygnus.com> | 1998-03-22 21:47:59 +0000 |
commit | 0f7ea20f1252e7517e04ee4205003c8c5dd26aaf (patch) | |
tree | 87e2b2b74f7d097a6b65a3f5d90b032f669ab723 /texinfo/info | |
parent | 875e3bc946d2d2ee88b930488150d2bfd4d032eb (diff) |
Merge in texinfo-3.11.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@18767 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'texinfo/info')
-rw-r--r-- | texinfo/info/man.c | 267 | ||||
-rw-r--r-- | texinfo/info/termdep.h | 49 | ||||
-rw-r--r-- | texinfo/info/terminal.c | 225 |
3 files changed, 281 insertions, 260 deletions
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 */ |