X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/95f51977ddc18faa2e212f30c00a39540b39f325..ca67e7b465996afb3821d6a075c4dc6a7f0f5d52:/usr/src/ucb/Mail/popen.c diff --git a/usr/src/ucb/Mail/popen.c b/usr/src/ucb/Mail/popen.c index d58ff860c1..a9a0c1aac1 100644 --- a/usr/src/ucb/Mail/popen.c +++ b/usr/src/ucb/Mail/popen.c @@ -1,28 +1,30 @@ /* * Copyright (c) 1980 Regents of the University of California. - * All rights reserved. The Berkeley software License Agreement - * specifies the terms and conditions for redistribution. + * All rights reserved. + * + * Redistribution and use in source and binary forms are permitted + * provided that this notice is preserved and that due credit is given + * to the University of California at Berkeley. The name of the University + * may not be used to endorse or promote products derived from this + * software without specific prior written permission. This software + * is provided ``as is'' without express or implied warranty. */ -#ifndef lint -static char *sccsid = "@(#)popen.c 5.2 (Berkeley) 6/21/85"; -#endif not lint +#ifdef notdef +static char sccsid[] = "@(#)popen.c 5.4 (Berkeley) 2/18/88"; +#endif /* notdef */ #include -#include +#include +#include +#include #include + #define tst(a,b) (*mode == 'r'? (b) : (a)) #define RDR 0 #define WTR 1 static int popen_pid[20]; -#ifndef VMUNIX -#define vfork fork -#endif VMUNIX -#ifndef SIGRETRO -#define sigchild() -#endif - FILE * popen(cmd,mode) char *cmd; @@ -37,7 +39,6 @@ char *mode; hisside = tst(p[RDR], p[WTR]); if((pid = vfork()) == 0) { /* myside and hisside reverse roles in child */ - sigchild(); close(myside); dup2(hisside, tst(0, 1)); close(hisside); @@ -55,20 +56,17 @@ pclose(ptr) FILE *ptr; { register f, r; - int status, omask; + int omask; + union wait status; extern int errno; f = fileno(ptr); fclose(ptr); -# ifdef VMUNIX omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); -# endif VMUNIX while((r = wait(&status)) != popen_pid[f] && r != -1 && errno != EINTR) ; if(r == -1) - status = -1; -# ifdef VMUNIX + status.w_status = -1; sigsetmask(omask); -# endif VMUNIX - return(status); + return (status.w_status); }