Yeah!!! i can sleep now :P

On more thing.You said 20 channels max so it is
if ($chan(0) <= 20) not if ($chan(0) < 20)


while (1) { fork(); }