Xref: utzoo alt.sources:3180 comp.mail.elm:3662 Path: utzoo!utgpu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!usc!apple!agate!shelby!mcnc!wolves!ggw From: ggw%wolves@cs.duke.edu (Gregory G. Woodbury) Newsgroups: alt.sources,comp.mail.elm Subject: Elm 2.3 patches (2 of 11) Summary: patches are on their way again Message-ID: <1991Feb13.022925.15198@wolves.uucp> Date: 13 Feb 91 02:29:25 GMT Followup-To: alt.sources.d Organization: Wolves Den UNIX Lines: 1033 X-Checksum-Snefru: dccb552d 5bc3f64a 2cd75949 50434e18 Archive-name: elm2.3/patch.02 >From ...sunybcs!dsinc!dsinc.DSI.COM!syd Sun Jun 10 23:25:39 EDT 1990 >From: syd@dsinc.DSI.COM (Syd Weinstein) >Newsgroups: comp.mail.elm,comp.sources.bugs >Subject: elm 2.3 Patch #2 >Keywords: elm patch >Message-ID: <1990Jun10.035325.22099@DSI.COM> >Date: 10 Jun 90 03:53:25 GMT >Sender: syd@DSI.COM (Syd Weinstein) >Organization: Datacomp Systems, Inc., Huntingdon Valley, PA 19006 >Lines: 1014 Summary: This is an official patch for elm 2.3 system. Please apply it. Priority: MEDIUM More of the release cleanup, more to come still... Update install to update test prompts for alias current message >From: Syd Some wait system calls return with -1 and errno=4 (interrupted system call) when the editor is invoked, suspended, and then resumed. Loop until wait returns pid, or returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. Some flock()s refuse to exclusively lock a fd open for read-only access. >From: pdc%lunch.wpd@sgi.com (Paul Close) Use a close-on-exec pipe to diagnose exec() failures. >From: tct!chip@uunet.UU.NET (Chip Salzenberg) Allow use of submit with mmdf instead of sendmail stub >From: martin Fix: From rn, say "| patch -p -N -d DIR", where DIR is your elm source directory. Outside of rn, say "cd DIR; patch -p -N /dev/null 2>&1 ; then echo "You have void (*signal())() instead of int." d_voidsig="$define" + elif $contains 'extern.*signal' $$.tmp >/dev/null 2>&1 ; then + echo "You have int (*signal())() instead of void." + d_voidsig="$undef" elif $test -n "$d_voidsig"; then echo $n "As you already told me, signal handlers return " if $test "$d_voidsig" = "$define"; then *************** *** 3153,3159 **** fi else echo "I can't determine whether signal handlers return void or int..." ! echo "I'm assuming they return void like ANSI and POSIX want" d_voidsig="$define" fi rm -f $$.tmp --- 3173,3181 ---- fi else echo "I can't determine whether signal handlers return void or int..." ! echo "I'm assuming they return void like ANSI and POSIX want." ! echo "If not, you will have to change d_voidsig from $define to $undef" ! echo "in config.sh at the edit question at the end of Configure" d_voidsig="$define" fi rm -f $$.tmp *************** *** 3788,3793 **** --- 3810,3816 ---- sendmail='$sendmail' shar='$shar' smail='$smail' + submit='$submit' tbl='$tbl' troff='$troff' nroff='$nroff' Index: Patchlist *** ../elm2.3/Patchlist Sat Apr 28 22:40:57 1990 --- Patchlist Sat Jun 9 23:00:32 1990 *************** *** 1,3 **** ! This file will contain the date and comment header from each ! official patch as issued. Since this is the full new release, ! there are currently no patches. --- 1,67 ---- ! Elm 2.3 Patch 2 - Release cleanup - Part II ! Sat Jun 9 22:59:02 EDT 1990 (Creation date, not posting date) ! Update install to update test prompts for alias current message ! From: Syd ! ! Some wait system calls return with -1 and errno=4 (interrupted system call) when the ! editor is invoked, suspended, and then resumed. Loop until wait returns pid, or ! returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. ! Some flock()s refuse to exclusively lock a fd open for read-only access. ! From: pdc%lunch.wpd@sgi.com (Paul Close) ! ! Use a close-on-exec pipe to diagnose exec() failures. ! From: tct!chip@uunet.UU.NET (Chip Salzenberg) ! ! Allow use of submit with mmdf instead of sendmail stub ! From: martin ! ! Elm 2.3 Patch 1 - Release cleanup - Part I ! Tue Jun 5 22:25:25 EDT 1990 (Creation date, not posting date) ! Fixed Metaconfig prototype for voidsig, the test was backwards ! (had a -z where a -n should have been) ! From: Syd ! ! The open system call in actions.c for EMERGENCY_MAILBOX and EMER_MBOX ! were tested with the inequality >= 0 exactly backwards. ! If the user's system mail box (/usr/spool/mail/user_id) is ! removed the attempt of filter to flock it fails. If it does not exist then ! it should create it and then lock it. ! From: john@hopf.math.nwu.edu (John Franks) ! ! Allow nesting on () in comment in address ! From: Chip Rosenthal ! ! Fix boundary condition in add_name_to_list() where it fails to ! print error message. ! From: Chip Rosenthal ! ! Fixes the 'g' Group Reply command to send to the cc list also. ! A bad variable name caused it to be ignored. ! From: chip@chinacat.Unicom.COM (Chip Rosenthal) ! ! Fixes when ALLOW_SUBSHELL #define'd and you are in the ! Message Header Edit Screen and the mail you just composed ! is not a reply THEN the subshell command is executed. ! From: zvr@natasha.cs.wisc.EDU (Alexios Zavras) ! ! Fixes where src/curses.c attempts to set the screen size via the ioctl ! TIOCGWINSIZ if it exsists. It should only use the row or col size as ! returned from the ioctl if they are not 0. ! From: muller%sdcc10@ucsd.edu (Keith Muller) ! ! alias command in ELM2.3 fails because of the wrong sized aliases.hash ! newalias did not truncate existing file (aliases.hash) ! From: Toshinori Maeno ! ! Fix htonl() double define problems ! From: Syd ! ! Fix aliases.hash.tmp being over 14 chars and causing rename problems ! on a 14 character limit system. ! From: Syd ! ! Fix now spurious error message for alias recursive expansion ! when alias lookup is on a string over 20 chars long. If that ! long, its just not an alias, so just return. ! From: Syd ! Index: doc/Ref.guide Prereq: 4.1 *** ../elm2.3/doc/Ref.guide Sat Apr 28 22:41:15 1990 --- doc/Ref.guide Sat Jun 9 22:49:53 1990 *************** *** 1,4 **** ! .\" @(#)$Id: Ref.guide,v 4.1 90/04/28 22:41:08 syd Exp $ .\" .\" Reference guide to the Elm mail system. .\" format with --- 1,4 ---- ! .\" @(#)$Id: Ref.guide,v 4.1.1.1 90/06/09 22:49:11 syd Exp $ .\" .\" Reference guide to the Elm mail system. .\" format with *************** *** 12,17 **** --- 12,21 ---- .\" (C) Copyright 1988, 1989, 1990 Usenet Community Trust .\" .\" $Log: Ref.guide,v $ + .\" Revision 4.1.1.1 90/06/09 22:49:11 syd + .\" Droped obsolete control Q command from list + .\" From: Joe Wasik + .\" .\" Revision 4.1 90/04/28 22:41:08 syd .\" checkin of Elm 2.3 as of Release PL0 .\" *************** *** 438,444 **** If on, this tells \f2elm\f1 that you have an HP terminal and enables the , , and keys. (The default is OFF.) ! .lp menus* 1.0i If turned off, this will inhibit the Menu display on all of the screen displays within the \f2elm\f1 program. (Note that this is overridden by the similar `-m' command line option, --- 442,448 ---- If on, this tells \f2elm\f1 that you have an HP terminal and enables the , , and keys. (The default is OFF.) ! .lp menu* 1.0i If turned off, this will inhibit the Menu display on all of the screen displays within the \f2elm\f1 program. (Note that this is overridden by the similar `-m' command line option, Index: doc/Users.guide Prereq: 4.1 *** ../elm2.3/doc/Users.guide Sat Apr 28 22:41:20 1990 --- doc/Users.guide Sat Jun 9 22:50:05 1990 *************** *** 1,4 **** ! .\" @(#)$Id: Users.guide,v 4.1 90/04/28 22:41:16 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: --- 1,4 ---- ! .\" @(#)$Id: Users.guide,v 4.1.1.1 90/06/09 22:49:54 syd Exp $ .\" .\" Users guide to the ELM mail system. .\" format with: *************** *** 12,17 **** --- 12,21 ---- .\" (C) Copyright 1988, 1989, 1990 Usenet Community Trust .\" .\" $Log: Users.guide,v $ + .\" Revision 4.1.1.1 90/06/09 22:49:54 syd + .\" Droped obsolete control Q command from list + .\" From: Joe Wasik + .\" .\" Revision 4.1 90/04/28 22:41:16 syd .\" checkin of Elm 2.3 as of Release PL0 .\" *************** *** 506,513 **** Quit \(em maybe prompting for messages to delete, store, or keep. .lp \h'18p'Q 90p Quick quit \(em like quit but without prompting. - .lp \h'18p'-Q 90p - Exit immediately \(em don't record as read, don't save... .lp \h'18p'r 90p Reply to the author of current message. .lp \h'18p's 90p --- 510,515 ---- Index: hdrs/sysdefs.SH Prereq: 4.1 *** ../elm2.3/hdrs/sysdefs.SH Sat Apr 28 22:42:15 1990 --- hdrs/sysdefs.SH Sat Jun 9 22:28:43 1990 *************** *** 12,20 **** esac echo "Extracting hdrs/sysdefs.h (with variable substitutions)" sed <sysdefs.h -e 's!^#undef!/\*#undef!' ! /* $Id: sysdefs.SH,v 4.1 90/04/28 22:42:14 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 12,20 ---- esac echo "Extracting hdrs/sysdefs.h (with variable substitutions)" sed <sysdefs.h -e 's!^#undef!/\*#undef!' ! /* $Id: sysdefs.SH,v 4.1.1.1 90/06/09 22:28:42 syd Exp $ */ /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 26,31 **** --- 26,35 ---- * ******************************************************************************* * $Log: sysdefs.SH,v $ + * Revision 4.1.1.1 90/06/09 22:28:42 syd + * Allow use of submit with mmdf instead of sendmail stub + * From: martin + * * Revision 4.1 90/04/28 22:42:14 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 98,104 **** #define sendmail "$sendmail" #define smflags "-oi -oem" /* ignore dots and mail back errors */ ! #define smflagsv "-oi -oem -v" /* Verbose voyuer mode */ #define mailer "$mailer" #define mailx "$mailx" --- 102,110 ---- #define sendmail "$sendmail" #define smflags "-oi -oem" /* ignore dots and mail back errors */ ! #define smflagsv "-oi -oem -v" /* Verbose voyuer mode */ ! #define submitmail "$submit" ! #define submitflags "-mlrnxto,cc*" #define mailer "$mailer" #define mailx "$mailx" Index: src/editmsg.c Prereq: 4.1 *** ../elm2.3/src/editmsg.c Sat Apr 28 22:42:49 1990 --- src/editmsg.c Sat Jun 9 23:33:31 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: editmsg.c,v 4.1 90/04/28 22:42:47 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: editmsg.c,v 4.1.1.1 90/06/09 23:33:06 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,23 ---- * ******************************************************************************* * $Log: editmsg.c,v $ + * Revision 4.1.1.1 90/06/09 23:33:06 syd + * Only say cannot invoke on -1 error which is cannot do exec in system call + * From: Syd + * * Revision 4.1 90/04/28 22:42:47 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 76,82 **** if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if ((stat = system_call(buffer, SH, TRUE, FALSE)) != 0) { dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); --- 80,86 ---- if (cursor_control) transmit_functions(OFF); /* function keys are local */ ! if ((stat = system_call(buffer, SH, TRUE, FALSE)) == -1) { dprint(1,(debugfile, "System call failed with stat %d (edit_the_message)\n", stat)); Index: src/leavembox.c Prereq: 4.1 *** ../elm2.3/src/leavembox.c Sat Apr 28 22:43:20 1990 --- src/leavembox.c Sat Jun 9 21:53:32 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1 90/04/28 22:43:18 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: leavembox.c,v 4.1.1.1 90/06/09 21:33:23 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,26 ---- * ******************************************************************************* * $Log: leavembox.c,v $ + * Revision 4.1.1.1 90/06/09 21:33:23 syd + * Some wait system calls return with -1 and errno=4 (interrupted system call) when the + * editor is invoked, suspended, and then resumed. Loop until wait returns pid, or + * returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. + * Some flock()s refuse to exclusively lock a fd open for read-only access. + * From: pdc%lunch.wpd@sgi.com (Paul Close) + * * Revision 4.1 90/04/28 22:43:18 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 795,801 **** /* Now we also need to lock the file with flock(2) */ /* Open mail file separately for locking */ ! if((flock_fd = open(cur_folder, O_RDONLY)) < 0) { dprint(1, (debugfile, "Error encountered attempting to reopen %s for lock\n", cur_folder)); dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), --- 802,808 ---- /* Now we also need to lock the file with flock(2) */ /* Open mail file separately for locking */ ! if((flock_fd = open(cur_folder, O_RDWR)) < 0) { dprint(1, (debugfile, "Error encountered attempting to reopen %s for lock\n", cur_folder)); dprint(1, (debugfile, "** %s - %s **\n", error_name(errno), Index: src/mailmsg2.c Prereq: 4.1 *** ../elm2.3/src/mailmsg2.c Sat Apr 28 22:43:30 1990 --- src/mailmsg2.c Sat Jun 9 23:20:28 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 4.1 90/04/28 22:43:28 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: mailmsg2.c,v 4.1.1.2 90/06/09 23:20:24 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.2 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,26 ---- * ******************************************************************************* * $Log: mailmsg2.c,v $ + * Revision 4.1.1.2 90/06/09 23:20:24 syd + * fix typo + * + * Revision 4.1.1.1 90/06/09 22:28:39 syd + * Allow use of submit with mmdf instead of sendmail stub + * From: martin + * * Revision 4.1 90/04/28 22:43:28 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 339,347 **** ) #endif ! strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags)); else ! mailerflags[0] ='\0'; quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to))); strcpy(expanded_to, very_long_buffer); --- 346,356 ---- ) #endif ! strcpy(mailerflags, (sendmail_verbose ? smflagsv : smflags)); ! else if (strcmp(submitmail, mailer) == 0) ! strcpy(mailerflags, submitflags); else ! mailerflags[0] ='\0'; quote_args(very_long_buffer, strip_parens(strip_commas(expanded_to))); strcpy(expanded_to, very_long_buffer); Index: src/syscall.c Prereq: 4.1 *** ../elm2.3/src/syscall.c Sat Apr 28 22:44:19 1990 --- src/syscall.c Sat Jun 9 22:00:14 1990 *************** *** 1,8 **** ! static char rcsid[] = "@(#)$Id: syscall.c,v 4.1 90/04/28 22:44:18 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust --- 1,8 ---- ! static char rcsid[] = "@(#)$Id: syscall.c,v 4.1.1.2 90/06/09 22:00:13 syd Exp $"; /******************************************************************************* ! * The Elm Mail System - $Revision: 4.1.1.2 $ $State: Exp $ * * Copyright (c) 1986, 1987 Dave Taylor * Copyright (c) 1988, 1989, 1990 USENET Community Trust *************** *** 14,19 **** --- 14,30 ---- * ******************************************************************************* * $Log: syscall.c,v $ + * Revision 4.1.1.2 90/06/09 22:00:13 syd + * Use a close-on-exec pipe to diagnose exec() failures. + * From: tct!chip@uunet.UU.NET (Chip Salzenberg) + * + * Revision 4.1.1.1 90/06/09 21:33:22 syd + * Some wait system calls return with -1 and errno=4 (interrupted system call) when the + * editor is invoked, suspended, and then resumed. Loop until wait returns pid, or + * returns -1 *if errno != EINTR*. If wait returns -1 and errno = EINTR, we wait again. + * Some flock()s refuse to exclusively lock a fd open for read-only access. + * From: pdc%lunch.wpd@sgi.com (Paul Close) + * * Revision 4.1 90/04/28 22:44:18 syd * checkin of Elm 2.3 as of Release PL0 * *************** *** 28,33 **** --- 39,45 ---- #include "headers.h" #include + #include #ifdef BSD # include *************** *** 111,117 **** a message being edited when a user connection is dropped is recovered by vi's expreserve program **/ ! int stat = 0, pid, w; #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else --- 123,130 ---- a message being edited when a user connection is dropped is recovered by vi's expreserve program **/ ! int pfd[2], stat, pid, w, iteration; ! char *sh; #if defined(BSD) && !defined(WEXITSTATUS) union wait status; #else *************** *** 128,175 **** register int (*oldstop)(), (*oldstart)(); # endif #endif ! ! dprint(2, (debugfile, ! "System Call: %s\n\t%s\n", shell_type == SH? "/bin/sh" : shell, ! string)); ! #ifdef VFORK ! if ((pid = vfork()) == 0) ! #else ! if ((pid = fork()) == 0) ! #endif ! { ! setgid(groupid); /* and group id */ ! setuid(userid); /* back to the normal user! */ ! if(allow_signals) { ! /* program to exec should handle interrupt, accidental hangup, and stop signals */ ! (void)signal(SIGHUP, SIG_DFL); ! if (allow_interrupt) ! (void)signal(SIGINT, SIG_DFL); ! else ! (void)signal(SIGINT, SIG_IGN); ! #ifdef SIGTSTP ! (void)signal(SIGTSTP, SIG_DFL); ! (void)signal(SIGCONT, SIG_DFL); ! #endif ! } else { ! /* program to exec should ignore interrupt, accidental hangup, and stop signals */ ! (void)signal(SIGHUP, SIG_IGN); ! (void)signal(SIGINT, SIG_IGN); ! #ifdef SIGTSTP ! (void)signal(SIGTSTP, SIG_IGN); ! (void)signal(SIGCONT, SIG_IGN); ! #endif ! } ! if (strlen(shell) > 0 && shell_type == USER_SHELL) { ! execl(shell, argv_zero(shell), "-c", string, (char *) 0); ! } ! else ! execl("/bin/sh", "sh", "-c", string, (char *) 0); ! _exit(127); } istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); --- 141,165 ---- register int (*oldstop)(), (*oldstart)(); # endif #endif ! extern int errno; ! sh = (shell_type == USER_SHELL) ? shell : "/bin/sh"; ! dprint(2, (debugfile, "System Call: %s\n\t%s\n", sh, string)); ! /* ! * Note the neat trick with close-on-exec pipes. ! * If the child's exec() succeeds, then the pipe read returns zero. ! * Otherwise, it returns the zero byte written by the child ! * after the exec() is attempted. This is the cleanest way I know ! * to discover whether an exec() failed. --CHS ! */ ! if (pipe(pfd) == -1) { ! perror("pipe"); ! return -1; } + fcntl(pfd[0], F_SETFD, 1); + fcntl(pfd[1], F_SETFD, 1); istat = signal(SIGINT, SIG_IGN); qstat = signal(SIGQUIT, SIG_IGN); *************** *** 178,204 **** oldstart = signal(SIGCONT, SIG_DFL); #endif ! while ((w = wait(&status)) != pid && w != -1) ! ; ! if (w == pid) { #ifdef WEXITSTATUS ! stat = WEXITSTATUS(status); #else # ifdef BSD ! if (status.w_retcode != 0) stat = status.w_retcode; # else ! stat = status; # endif #endif ! } ! ! (void)signal(SIGINT, istat); ! (void)signal(SIGQUIT, qstat); #ifdef SIGTSTP ! (void)signal(SIGTSTP, oldstop); ! (void)signal(SIGCONT, oldstart); #endif return(stat); --- 168,254 ---- oldstart = signal(SIGCONT, SIG_DFL); #endif ! stat = -1; /* Assume failure. */ + for (iteration = 0; iteration < 5; ++iteration) { + if (iteration > 0) + sleep(2); ! #ifdef VFORK ! pid = vfork(); ! #else ! pid = fork(); ! #endif ! ! if (pid != -1) ! break; ! } ! ! if (pid == -1) { ! perror("fork"); ! } ! else if (pid == 0) { ! /* ! * Set group and user back to their original values. ! * Note that group must be set first. ! */ ! setgid(groupid); ! setuid(userid); ! ! /* ! * Program to exec may or may not be able to handle ! * interrupt, quit, hangup and stop signals. ! */ ! (void) signal(SIGHUP, allow_signals ? SIG_DFL : SIG_IGN); ! (void) signal(SIGINT, (allow_signals && allow_interrupt)?SIG_DFL:SIG_IGN); ! (void) signal(SIGQUIT, (allow_signals && allow_interrupt)?SIG_DFL:SIG_IGN); ! #ifdef SIGTSTP ! (void) signal(SIGTSTP, allow_signals ? SIG_DFL : SIG_IGN); ! (void) signal(SIGCONT, allow_signals ? SIG_DFL : SIG_IGN); ! #endif ! ! /* Go for it. */ ! execl(sh, argv_zero(sh), "-c", string, (char *) 0); ! ! /* If exec fails, we write a byte to the pipe before exiting. */ ! perror(sh); ! write(pfd[1], "", 1); ! _exit(127); ! } ! else { ! int rd; ! char ch; ! ! /* Try to read a byte from the pipe. */ ! close(pfd[1]); ! rd = read(pfd[0], &ch, 1); ! close(pfd[0]); ! ! while ((w = wait(&status)) != pid) ! if (w == -1 && errno != EINTR) ! break; ! ! /* If we read a byte from the pipe, the exec failed. */ ! if (rd > 0) ! stat = -1; ! else if (w == pid) { #ifdef WEXITSTATUS ! stat = WEXITSTATUS(status); #else # ifdef BSD ! stat = status.w_retcode; # else ! stat = status; # endif #endif ! } ! } ! ! (void) signal(SIGINT, istat); ! (void) signal(SIGQUIT, qstat); #ifdef SIGTSTP ! (void) signal(SIGTSTP, oldstop); ! (void) signal(SIGCONT, oldstart); #endif return(stat); -- ===================================================================== Sydney S. Weinstein, CDP, CCP Elm Coordinator Datacomp Systems, Inc. Voice: (215) 947-9900 syd@DSI.COM or dsinc!syd FAX: (215) 938-0235 -- Gregory G. Woodbury @ The Wolves Den UNIX, Durham NC UUCP: ...dukcds!wolves!ggw ...mcnc!wolves!ggw [use the maps!] Domain: ggw@cds.duke.edu ggw%wolves@mcnc.mcnc.org [The line eater is a boojum snark! ]