+Thu Apr 27 12:26:26 1995 Ezra Peisach <epeisach@kangaroo.mit.edu>
+
+ * pager.c: Use posix signals.
+
+ * listen.c: Use posix signals.
+
+ * list_rqs.c: Use posix signals.
+
+ * help.c: Call wait with proper casting (int * vs. union wait *)
+
+ * configure.in: Add AC_PROG_ARCHIVE_ADD and CHECK_SIGNALS.
+
+ * Makefile.in (all): Use ARADD for incremental changes to library
+
Tue Mar 28 18:51:08 1995 John Gilmore (gnu at toad.com)
* Makefile.in (all): Run all-$(WHAT).
all:: libss.a
libss.a: $(OBJS)
- $(ARCHIVE) $@ $(OBJS)
+ $(ARADD) $@ $(OBJS)
$(RANLIB) $@
clean::
AC_PROG_YACC
AC_PROG_AWK
AC_PROG_ARCHIVE
+AC_PROG_ARCHIVE_ADD
AC_PROG_RANLIB
HAVE_YYLINENO
AC_FUNC_CHECK(strdup,AC_DEFINE(HAS_STRDUP))
CHECK_DIRENT
CHECK_FCNTL
CHECK_WAIT_TYPE
+CHECK_SIGNALS
CHECK_SIGPROCMASK
AC_RETSIGTYPE
AC_CHECK_HEADERS(stdarg.h)
ss_page_stdin();
default:
(void) close(fd); /* what can we do if it fails? */
+#ifdef WAIT_USES_INT
+ while (wait((int *)NULL) != child) {
+#else
while (wait((union wait *)NULL) != child) {
+#endif
/* do nothing if wrong pid */
};
}
FILE *output;
int fd;
int mask;
+#ifdef POSIX_SIGNALS
+ struct sigaction nsig, osig;
+ sigset_t nmask, omask;
+#else
RETSIGTYPE (*func)();
+#endif
#ifndef WAIT_USES_INT
union wait waitb;
#else
DONT_USE(argc);
DONT_USE(argv);
+#ifdef POSIX_SIGNALS
+ sigemptyset(&nmask);
+ sigaddset(&nmask, SIGINT);
+ sigprocmask(SIG_BLOCK, &nmask, &omask);
+
+ nsig.sa_handler = SIG_IGN;
+ sigemptyset(&nsig.sa_mask);
+ nsig.sa_flags = 0;
+ sigaction(SIGINT, &nsig, &osig);
+#else
mask = sigblock(sigmask(SIGINT));
func = signal(SIGINT, SIG_IGN);
+#endif
+
fd = ss_pager_create();
output = fdopen(fd, "w");
+
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+#else
sigsetmask(mask);
+#endif
fprintf (output, "Available %s requests:\n\n",
ss_info (sci_idx) -> subsystem_name);
#ifndef NO_FORK
wait(&waitb);
#endif
+#ifdef POSIX_SIGNALS
+ sigaction(SIGINT, &osig, (struct sigaction *)0);
+#else
(void) signal(SIGINT, func);
+#endif
}
int sci_idx;
{
register char *cp;
- register RETSIGTYPE (*sig_cont)();
register ss_data *info;
- RETSIGTYPE (*sig_int)(), (*old_sig_cont)();
char input[BUFSIZ];
char buffer[BUFSIZ];
char *end = buffer;
- int mask;
int code;
jmp_buf old_jmpb;
ss_data *old_info = current_info;
+#ifdef POSIX_SIGNALS
+ struct sigaction isig, csig, nsig, osig;
+ sigset_t nmask, omask;
+#else
+ register RETSIGTYPE (*sig_cont)();
+ RETSIGTYPE (*sig_int)(), (*old_sig_cont)();
+ int mask;
+#endif
current_info = info = ss_info(sci_idx);
- sig_cont = (RETSIGTYPE (*)())0;
info->abort = 0;
+
+#ifdef POSIX_SIGNALS
+ csig.sa_handler = (RETSIGTYPE (*)())0;
+ sigemptyset(&nmask);
+ sigaddset(&nmask, SIGINT);
+ sigprocmask(SIG_BLOCK, &nmask, &omask);
+#else
+ sig_cont = (RETSIGTYPE (*)())0;
mask = sigblock(sigmask(SIGINT));
+#endif
+
memcpy(old_jmpb, listen_jmpb, sizeof(jmp_buf));
+
+#ifdef POSIX_SIGNALS
+ nsig.sa_handler = listen_int_handler;
+ sigemptyset(&nsig.sa_mask);
+ nsig.sa_flags = 0;
+ sigaction(SIGINT, &nsig, &isig);
+#else
sig_int = signal(SIGINT, listen_int_handler);
+#endif
+
setjmp(listen_jmpb);
+
+#ifdef POSIX_SIGNALS
+ sigprocmask(SIG_SETMASK, &omask, (sigset_t *)0);
+#else
(void) sigsetmask(mask);
+#endif
while(!info->abort) {
print_prompt();
*end = '\0';
+#ifdef POSIX_SIGNALS
+ nsig.sa_handler = listen_int_handler; /* fgets is not signal-safe */
+ osig = csig;
+ sigaction(SIGCONT, &nsig, &csig);
+ if ((RETSIGTYPE (*)())csig.sa_handler==(RETSIGTYPE (*)())listen_int_handler)
+ csig = osig;
+#else
old_sig_cont = sig_cont;
sig_cont = signal(SIGCONT, print_prompt);
if (sig_cont == print_prompt)
sig_cont = old_sig_cont;
+#endif
if (fgets(input, BUFSIZ, stdin) != input) {
code = SS_ET_EOF;
goto egress;
if (cp == input)
continue;
}
+#ifdef POSIX_SIGNALS
+ sigaction(SIGCONT, &csig, (struct sigaction *)0);
+#else
(void) signal(SIGCONT, sig_cont);
+#endif
for (end = input; *end; end++)
;
}
code = 0;
egress:
+#ifdef POSIX_SIGNALS
+ sigaction(SIGINT, &isig, (struct sigaction *)0);
+#else
(void) signal(SIGINT, sig_int);
+#endif
memcpy(listen_jmpb, old_jmpb, sizeof(jmp_buf));
current_info = old_info;
return code;
void ss_page_stdin()
{
int i;
+#ifdef POSIX_SIGNALS
+ struct sigaction sa;
+ sigset_t mask;
+#endif
for (i = 3; i < 32; i++)
(void) close(i);
+#ifdef POSIX_SIGNALS
+ sa.sa_handler = SIG_DFL;
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = 0;
+ sigaction(SIGINT, &sa, (struct sigaction *)0);
+#else
(void) signal(SIGINT, SIG_DFL);
+#endif
{
+#ifdef POSIX_SIGNALS
+ sigemptyset(&mask);
+ sigaddset(&mask, SIGINT);
+ sigprocmask(SIG_UNBLOCK, &mask, (sigset_t *)0);
+#else
int mask = sigblock(0);
mask &= ~sigmask(SIGINT);
sigsetmask(mask);
+#endif
}
if (_ss_pager_name == (char *)NULL) {
if ((_ss_pager_name = getenv("PAGER")) == (char *)NULL)