/* Temporary */
/*
#define emsg printf
#define fmsg printf
#define filemsg printf
*/
#define BFSZ 600

#define pipe_read read
#define pipe_write write

#define CMD_SIZE 300
#define PIPE_BIG 60000
void db_fixlength(char *s);
void pi_end(void);
int my_file_length(int f, int fl);
int mynexth(void);
int myread(int handle, void *buffer, unsigned int count);
int myopenr(const char *fname, int oflag, int pmode);
int mywrite(int handle, char *buffer, unsigned int count, int flen);
long mylseek(int handle, long offset, int origin);
int myopen(const char *fname, int oflag, int pmode, int gid, int num);
int myclose(int handle);
void myfreeh(int h);
int mysync(int gid, int fg);

void pi_sync_all(void);
int pi_init(int n);
int pcreate(int *r, int *w);
int pi_nexth(void);
int pi_open(const char *fname, int isnew, int gid, int num);
int pi_close(int h);
int pi_write(int h, char *bf, int len, int flen);
int pi_sync(int gid);
char *pi_status(void);


void pipe_child(int hread, int hwrite);
void do_write(int hread, char *cmd);
void do_sync(int h);
void sendback(char *s);
