Actually, that was what the first version did, and it didn't work to well either. Hence the fork/system calls. Same problem, but things seemd to move faster. Not necessarily such a good thing, but if I didn't generate any new problem, I'll keep it that way, for now.
My scratchpad has some of the code I'm trying to muddle through. Maybe that'll offer some ideas.