summaryrefslogtreecommitdiffstats
path: root/contrib/texinfo
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2003-05-02 00:50:59 +0000
committerru <ru@FreeBSD.org>2003-05-02 00:50:59 +0000
commitb40fbbd2c63cff4ae8b5423e68ddd1ad45c20c79 (patch)
tree8b19493038ac4e0f080fe9ac26b4781fb7ccdf8d /contrib/texinfo
parenta25bb496d250dbb5f860b0d7cf19e227f83bb71b (diff)
downloadFreeBSD-src-b40fbbd2c63cff4ae8b5423e68ddd1ad45c20c79.zip
FreeBSD-src-b40fbbd2c63cff4ae8b5423e68ddd1ad45c20c79.tar.gz
Merge texinfo 4.5 changes onto the trunk.
Diffstat (limited to 'contrib/texinfo')
-rw-r--r--contrib/texinfo/info/signals.c173
-rw-r--r--contrib/texinfo/util/install-info.c46
2 files changed, 161 insertions, 58 deletions
diff --git a/contrib/texinfo/info/signals.c b/contrib/texinfo/info/signals.c
index 954a739..76c3b2e 100644
--- a/contrib/texinfo/info/signals.c
+++ b/contrib/texinfo/info/signals.c
@@ -1,8 +1,9 @@
/* signals.c -- install and maintain Info signal handlers.
- $Id: signals.c,v 1.6 1998/12/06 22:00:04 karl Exp $
+ $Id: signals.c,v 1.4 2003/01/29 19:23:22 karl Exp $
$FreeBSD$
- Copyright (C) 1993, 94, 95, 98 Free Software Foundation, Inc.
+ Copyright (C) 1993, 1994, 1995, 1998, 2002, 2003 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
@@ -29,9 +30,6 @@
/* */
/* **************************************************************** */
-/* Non-zero when our signal handler has been called to handle SIGWINCH. */
-static int in_sigwinch = 0;
-
#if !defined (HAVE_SIGPROCMASK) && defined (HAVE_SIGSETMASK)
/* Perform OPERATION on NEWSET, perhaps leaving information in OLDSET. */
static void
@@ -64,35 +62,89 @@ sigprocmask (operation, newset, oldset)
/* */
/* **************************************************************** */
-typedef RETSIGTYPE signal_handler ();
+#if defined (HAVE_SIGACTION) || defined (HAVE_SIGPROCMASK) ||\
+ defined (HAVE_SIGSETMASK)
+static void
+mask_termsig (set)
+ sigset_t *set;
+{
+# if defined (SIGTSTP)
+ sigaddset (set, SIGTSTP);
+ sigaddset (set, SIGTTOU);
+ sigaddset (set, SIGTTIN);
+# endif
+# if defined (SIGWINCH)
+ sigaddset (set, SIGWINCH);
+# endif
+#if defined (SIGINT)
+ sigaddset (set, SIGINT);
+#endif
+# if defined (SIGUSR1)
+ sigaddset (set, SIGUSR1);
+# endif
+}
+#endif /* HAVE_SIGACTION || HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
+
+static RETSIGTYPE info_signal_proc ();
+#if defined (HAVE_SIGACTION)
+typedef struct sigaction signal_info;
+signal_info info_signal_handler;
-static RETSIGTYPE info_signal_handler ();
-static signal_handler *old_TSTP, *old_TTOU, *old_TTIN;
-static signal_handler *old_WINCH, *old_INT, *old_USR1, *old_CONT;
+static void
+set_termsig (sig, old)
+ int sig;
+ signal_info *old;
+{
+ sigaction (sig, &info_signal_handler, old);
+}
+
+static void
+restore_termsig (sig, saved)
+ int sig;
+ const signal_info *saved;
+{
+ sigaction (sig, saved, NULL);
+}
+#else /* !HAVE_SIGACTION */
+typedef RETSIGTYPE (*signal_info) ();
+#define set_termsig(sig, old) (void)(*(old) = signal (sig, info_signal_proc))
+#define restore_termsig(sig, saved) (void)signal (sig, *(saved))
+#define info_signal_handler info_signal_proc
+static int term_conf_busy = 0;
+#endif /* !HAVE_SIGACTION */
+
+static signal_info old_TSTP, old_TTOU, old_TTIN;
+static signal_info old_WINCH, old_INT, old_USR1, old_CONT;
void
initialize_info_signal_handler ()
{
+#if defined (HAVE_SIGACTION)
+ info_signal_handler.sa_handler = info_signal_proc;
+ info_signal_handler.sa_flags = 0;
+ mask_termsig (&info_signal_handler.sa_mask);
+#endif /* HAVE_SIGACTION */
+
#if defined (SIGTSTP)
- old_TSTP = (signal_handler *) signal (SIGTSTP, info_signal_handler);
- old_TTOU = (signal_handler *) signal (SIGTTOU, info_signal_handler);
- old_TTIN = (signal_handler *) signal (SIGTTIN, info_signal_handler);
+ set_termsig (SIGTSTP, &old_TSTP);
+ set_termsig (SIGTTOU, &old_TTOU);
+ set_termsig (SIGTTIN, &old_TTIN);
#endif /* SIGTSTP */
#if defined (SIGWINCH)
- old_WINCH = (signal_handler *) signal (SIGWINCH, info_signal_handler);
+ set_termsig (SIGWINCH, &old_WINCH);
#if defined (SIGCONT)
- old_CONT = (signal_handler *) signal (SIGCONT, info_signal_handler);
+ set_termsig (SIGCONT, &old_CONT);
#endif
#endif
#if defined (SIGINT)
- old_INT = (signal_handler *) signal (SIGINT, info_signal_handler);
+ set_termsig (SIGINT, &old_INT);
#endif
#if defined (SIGUSR1)
/* Used by DJGPP to simulate SIGTSTP on Ctrl-Z. */
- old_USR1 = (signal_handler *) signal (SIGUSR1, info_signal_handler);
+ set_termsig (SIGUSR1, &old_USR1);
#endif
}
@@ -121,11 +173,25 @@ reset_info_window_sizes ()
}
static RETSIGTYPE
-info_signal_handler (sig)
+info_signal_proc (sig)
int sig;
{
- signal_handler **old_signal_handler;
+ signal_info *old_signal_handler;
+#if !defined (HAVE_SIGACTION)
+ /* best effort: first increment this counter and later block signals */
+ if (term_conf_busy)
+ return;
+ term_conf_busy++;
+#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
+ {
+ sigset_t nvar, ovar;
+ sigemptyset (&nvar);
+ mask_termsig (&nvar);
+ sigprocmask (SIG_BLOCK, &nvar, &ovar);
+ }
+#endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
+#endif /* !HAVE_SIGACTION */
switch (sig)
{
#if defined (SIGTSTP)
@@ -145,8 +211,10 @@ info_signal_handler (sig)
if (sig == SIGTTIN)
old_signal_handler = &old_TTIN;
#endif /* SIGTSTP */
+#if defined (SIGINT)
if (sig == SIGINT)
old_signal_handler = &old_INT;
+#endif /* SIGINT */
/* For stop signals, restore the terminal IO, leave the cursor
at the bottom of the window, and stop us. */
@@ -154,17 +222,17 @@ info_signal_handler (sig)
terminal_clear_to_eol ();
fflush (stdout);
terminal_unprep_terminal ();
- signal (sig, *old_signal_handler);
- UNBLOCK_SIGNAL (sig);
- kill (getpid (), sig);
+ restore_termsig (sig, old_signal_handler);
+ UNBLOCK_SIGNAL (sig);
+ kill (getpid (), sig);
/* The program is returning now. Restore our signal handler,
turn on terminal handling, redraw the screen, and place the
cursor where it belongs. */
terminal_prep_terminal ();
- *old_signal_handler = (signal_handler *) signal (sig, info_signal_handler);
- redisplay_after_signal ();
- fflush (stdout);
+ set_termsig (sig, old_signal_handler);
+ /* window size might be changed while sleeping */
+ reset_info_window_sizes ();
}
break;
@@ -182,39 +250,46 @@ info_signal_handler (sig)
case SIGUSR1:
#endif
{
- if (!in_sigwinch) {
- in_sigwinch++;
-
- /* Turn off terminal IO, tell our parent that the window has changed,
- then reinitialize the terminal and rebuild our windows. */
+ /* Turn off terminal IO, tell our parent that the window has changed,
+ then reinitialize the terminal and rebuild our windows. */
#ifdef SIGWINCH
- if (sig == SIGWINCH)
- old_signal_handler = &old_WINCH;
+ if (sig == SIGWINCH)
+ old_signal_handler = &old_WINCH;
#ifdef SIGCONT
- else if (sig == SIGCONT)
- old_signal_handler = &old_CONT;
+ else if (sig == SIGCONT)
+ old_signal_handler = &old_CONT;
#endif
#endif
#ifdef SIGUSR1
- if (sig == SIGUSR1)
- old_signal_handler = &old_USR1;
+ if (sig == SIGUSR1)
+ old_signal_handler = &old_USR1;
#endif
- terminal_goto_xy (0, 0);
- fflush (stdout);
- terminal_unprep_terminal ();
- signal (sig, *old_signal_handler);
- UNBLOCK_SIGNAL (sig);
- kill (getpid (), sig);
-
- /* After our old signal handler returns... */
- *old_signal_handler
- = (signal_handler *) signal (sig, info_signal_handler);
- terminal_prep_terminal ();
- reset_info_window_sizes ();
- in_sigwinch--;
- }
+ terminal_goto_xy (0, 0);
+ fflush (stdout);
+ terminal_unprep_terminal (); /* needless? */
+ restore_termsig (sig, old_signal_handler);
+ UNBLOCK_SIGNAL (sig);
+ kill (getpid (), sig);
+
+ /* After our old signal handler returns... */
+ set_termsig (sig, old_signal_handler); /* needless? */
+ terminal_prep_terminal ();
+ reset_info_window_sizes ();
}
break;
#endif /* SIGWINCH || SIGUSR1 */
}
+#if !defined (HAVE_SIGACTION)
+ /* at this time it is safer to perform unblock after decrement */
+ term_conf_busy--;
+#if defined (HAVE_SIGPROCMASK) || defined (HAVE_SIGSETMASK)
+ {
+ sigset_t nvar, ovar;
+ sigemptyset (&nvar);
+ mask_termsig (&nvar);
+ sigprocmask (SIG_UNBLOCK, &nvar, &ovar);
+ }
+#endif /* HAVE_SIGPROCMASK || HAVE_SIGSETMASK */
+#endif /* !HAVE_SIGACTION */
}
+/* vim: set sw=2 cino={1s>2sn-s^-se-s: */
diff --git a/contrib/texinfo/util/install-info.c b/contrib/texinfo/util/install-info.c
index dab15c6..7f538b6 100644
--- a/contrib/texinfo/util/install-info.c
+++ b/contrib/texinfo/util/install-info.c
@@ -1,8 +1,9 @@
/* $FreeBSD$ */
/* install-info -- create Info directory entry(ies) for an Info file.
- $Id: install-info.c,v 1.55 2002/03/11 19:55:23 karl Exp $
+ $Id: install-info.c,v 1.7 2003/01/19 18:46:51 karl Exp $
- Copyright (C) 1996, 97, 98, 99, 2000, 01, 02 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 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
@@ -123,6 +124,7 @@ struct option longopts[] =
{ "dir-file", required_argument, NULL, 'd' },
{ "entry", required_argument, NULL, 'e' },
{ "help", no_argument, NULL, 'h' },
+ { "infodir", required_argument, NULL, 'D' },
{ "info-dir", required_argument, NULL, 'D' },
{ "info-file", required_argument, NULL, 'i' },
{ "item", required_argument, NULL, 'e' },
@@ -315,6 +317,11 @@ strip_info_suffix (fname)
len -= 3;
ret[len] = 0;
}
+ else if (len > 4 && FILENAME_CMP (ret + len - 4, ".bz2") == 0)
+ {
+ len -= 4;
+ ret[len] = 0;
+ }
if (len > 5 && FILENAME_CMP (ret + len - 5, ".info") == 0)
{
@@ -463,8 +470,10 @@ The first time you invoke Info you start off looking at this node.\n\
In Emacs, you can click mouse button 2 on a menu item or cross reference\n\
to select it.\n\
\n\
-* Menu:\n\
-"), "File: dir,\tNode: Top"); /* This part must not be translated. */
+%s\n\
+"), "File: dir,\tNode: Top", /* These keywords must not be translated. */
+ "* Menu:"
+);
if (fclose (f) < 0)
pfatal_with_name (dirfile);
}
@@ -516,6 +525,13 @@ open_possibly_compressed_file (filename, create_callback,
{
*opened_filename = concat (filename, ".gz", "");
f = fopen (*opened_filename, FOPEN_RBIN);
+ if (!f)
+ {
+ free (*opened_filename);
+ *opened_filename = concat (filename, ".bz2", "");
+ f = fopen (*opened_filename, FOPEN_RBIN);
+ }
+
#ifdef __MSDOS__
if (!f)
{
@@ -571,6 +587,18 @@ open_possibly_compressed_file (filename, create_callback,
#else
*compression_program = "gzip";
#endif
+ else if(data[0] == 'B' && data[1] == 'Z' && data[2] == 'h')
+#ifndef STRIP_DOT_EXE
+ *compression_program = "bzip2.exe";
+#else
+ *compression_program = "bzip2";
+#endif
+ else if(data[0] == 'B' && data[1] == 'Z' && data[2] == '0')
+#ifndef STRIP_DOT_EXE
+ *compression_program = "bzip.exe";
+#else
+ *compression_program = "bzip";
+#endif
else
*compression_program = NULL;
@@ -913,7 +941,7 @@ parse_input (lines, nlines, sections, entries)
}
if (start_of_this_entry != 0)
fatal (_("START-INFO-DIR-ENTRY without matching END-INFO-DIR-ENTRY"),
- 0, 0);
+ 0, 0);
/* If we ignored the INFO-DIR-ENTRY directives, we need now go back
and plug the names of all the sections we found into every
@@ -1246,11 +1274,11 @@ main (argc, argv)
case 'V':
printf ("install-info (GNU %s) %s\n", PACKAGE, VERSION);
puts ("");
- printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
+ printf (_("Copyright (C) %s Free Software Foundation, Inc.\n\
There is NO warranty. You may redistribute this software\n\
under the terms of the GNU General Public License.\n\
For more information about these matters, see the files named COPYING.\n"),
- "2002");
+ "2003");
xexit (0);
default:
@@ -1271,7 +1299,7 @@ For more information about these matters, see the files named COPYING.\n"),
if (!infile)
fatal (_("No input file specified; try --help for more information."),
- 0, 0);
+ 0, 0);
if (!dirfile)
fatal (_("No dir file specified; try --help for more information."), 0, 0);
@@ -1344,7 +1372,7 @@ For more information about these matters, see the files named COPYING.\n"),
char *infile_basename = infile + strlen (infile);
if (HAVE_DRIVE (infile))
- infile += 2; /* get past the drive spec X: */
+ infile += 2; /* get past the drive spec X: */
while (infile_basename > infile && !IS_SLASH (infile_basename[-1]))
infile_basename--;
OpenPOWER on IntegriCloud