coproc.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1985 AT&T
* All Rights Reserved
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.18 */
#include <ctype.h>
#include <stdio.h>
#include <fcntl.h>
#include <string.h>
#include <signal.h>
#include <errno.h> /* EFT abs k16 */
#include "wish.h"
#include "terror.h"
#include "var_arrays.h"
#include "eval.h"
#include "moremacros.h"
#include "sizes.h"
typedef struct {
char *id;
char *w_path;
char *r_path;
char *expect;
char *send;
char **refs;
} COREC;
static int Cur_corec = -1;
int Coproc_active = 0;
extern char Semaphore[]; /* path of FIFO for process synchronization */
int
int argc;
char **argv;
{
register int i, blocking;
void (*osig)();
char *exp;
char **args;
args++;
}
else
return(NULL);
make_cur(i); /* make the coproc current */
if (i > 2)
}
}
if (blocking) { /* if blocking on a response from coproc */
}
else {
break;
}
}
}
return(SUCCESS);
}
char *str;
{
int i;
int lcv;
for (i = 0; i < lcv; i++)
return(i);
return(-1);
}
make_cur(i)
int i;
{
if (Cur_corec == i)
return;
if (Cur_corec != -1)
Cur_corec = i;
if (i == -1)
return;
if (!(Cotable[Cur_corec].writefp) && ((Cotable[Cur_corec].writefp = fopen(Cotable[Cur_corec].w_path, "w")) == NULL))
return;
}
int
int argc;
char **args;
{
int i, c;
char *ref;
extern int optind;
if (!Cotable)
optind = 1;
switch (c) {
case 'R':
break;
case 'i':
break;
case 'g':
break;
case 'e':
break;
case 'w':
break;
case 'r':
break;
case 's':
break;
default:
break;
}
make_cur(i);
register int j;
int lcv;
;
if (j >= lcv) {
}
}
return(SUCCESS);
}
else {
if (Coproc_active == 0) /* set up fifo for Semaphore */
}
if (ref) {
}
}
}
#ifdef _DEBUG4
#endif
;
#ifdef _DEBUG4
#endif
;
switch(fork()) {
case -1:
case 0: {
int fd;
#ifdef _DEBUG
#endif
close(0);
close(1);
#ifdef _DEBUG
#endif
}
default:
break;
}
if (gobble) {
}
return(SUCCESS);
}
int
int argc;
char **args;
{
int i;
int hold;
char *ref;
int lcv;
/* if ((i = findtab(args[ref ? 3 : 1])) == -1) amdahl compatibility.. */
if (ref)
else
if ( i == -1)
return(FAIL);
register int j;
;
if (j < lcv)
}
return(SUCCESS);
make_cur(-1);
array_delete(Cotable, i);
if (--Coproc_active == 0)
return(hold);
}
int
int argc;
char **argv;
{
register int i;
return(FAIL);
make_cur(i); /* make the coproc current */
return(FAIL); /* can't stat file */
return(SUCCESS);
else
return(FAIL);
}
int
int argc;
char **argv;
{
register int i;
register char *exp;
return(FAIL);
make_cur(i); /* make the coproc current */
return(FAIL);
}
else {
break;
}
}
return(SUCCESS);
}