[Solved] Linux C language pipes, forks and signals


The proposal from comments, in pseudocode (turning into C is homework, so I’m not doing that):

make P-A pipe
make A-B pipe
make B-C pipe

if fork()
    // process A
    while (read can from P-A pipe)
        do something to can
        write can to A-B pipe
else if fork()
    // process B
    while (read can from A-B pipe)
        do something to can
        write can to B-C pipe
else if fork()
    // process C
    while (read can from B-C pipe)
        do something to can
        write can to final output
else
    // parent
    get can from input/file (or make a new can)
    write can to P-A pipe

solved Linux C language pipes, forks and signals