UNIX pipes on C block on read
- by Toni Cárdenas
I'm struggling to implement a shell with pipelines for class.
typedef struct {
char** cmd;
int in[2];
int out[2];
} cmdio;
cmdio cmds[MAX_PIPE + 1];
Commands in the pipeline are read and stored in cmds.
cmdio[i].in is the pair of file descriptors of the input pipe returned by pipe(). For the first command, which reads from terminal…