#pragma prototyped
#ifndef _COSHELL_H
#define _COSHELL_H
#include <ast.h>
#if !_BLD_coshell
#undef procrun
#define procrun(a,b,c) coprocrun(a,b,c)
#undef system
#define system(a) cosystem(a)
#endif
struct Coshell_s; typedef struct Coshell_s Coshell_t;
struct Cojob_s; typedef struct Cojob_s Cojob_t;
#define COSHELL Coshell_t
#define COJOB Cojob_t
#define CO_ID "coshell"
#define CO_ENV_ATTRIBUTES "COATTRIBUTES"
#define CO_ENV_EXPORT "COEXPORT"
#define CO_ENV_HOST "HOSTNAME"
#define CO_ENV_MSGFD "_COSHELL_msgfd"
#define CO_ENV_OPTIONS "COSHELL_OPTIONS"
#define CO_ENV_PROC "NPROC"
#define CO_ENV_SHELL "COSHELL"
#define CO_ENV_TEMP "COTEMP"
#define CO_ENV_TYPE "HOSTTYPE"
#define CO_OPT_ACK "ack"
#define CO_OPT_INDIRECT "indirect"
#define CO_OPT_SERVER "server"
#define CO_QUANT 100
#define CO_ANY 0x000001
#define CO_DEBUG 0x000002
#define CO_EXPORT 0x000004
#define CO_IGNORE 0x000008
#define CO_LOCAL 0x000010
#define CO_NONBLOCK 0x000020
#define CO_SHELL 0x000040
#define CO_SILENT 0x000080
#define CO_KSH 0x000100
#define CO_SERVER 0x000200
#define CO_OSH 0x000400
#define CO_CROSS 0x000800
#define CO_DEVFD 0x001000
#define CO_SERIALIZE 0x002000
#define CO_SERVICE 0x004000
#define CO_APPEND 0x008000
#define CO_SEPARATE 0x010000
#define CO_ORPHAN 0x020000
#define CO_USER 0x100000
struct Cojob_s
{
Coshell_t* coshell;
int id;
int status;
int flags;
void* local;
unsigned long user;
unsigned long sys;
#ifdef _CO_JOB_PRIVATE_
_CO_JOB_PRIVATE_
#endif
};
struct Coshell_s
{
void* data;
int flags;
int outstanding;
int running;
int total;
unsigned long user;
unsigned long sys;
Sfio_t* msgfp;
#ifdef _CO_SHELL_PRIVATE_
_CO_SHELL_PRIVATE_
#endif
};
extern int coclose(Coshell_t*);
extern Cojob_t* coexec(Coshell_t*, const char*, int, const char*, const char*, const char*);
extern char* coinit(int);
extern int coexport(Coshell_t*, const char*, const char*);
extern int cokill(Coshell_t*, Cojob_t*, int);
extern Coshell_t* coopen(const char*, int, const char*);
extern void coquote(Sfio_t*, const char*, int);
extern int cosync(Coshell_t*, const char*, int, int);
extern Cojob_t* cowait(Coshell_t*, Cojob_t*, int);
extern int cojobs(Coshell_t*);
extern int copending(Coshell_t*);
extern int cozombie(Coshell_t*);
extern int coattr(Coshell_t*, const char*);
extern int coprocrun(const char*, char**, int);
extern int cosystem(const char*);
#endif