What is it?
This is probably the silliest piece of code I've ever written, but
there's a story behind it, which you can also find on my blog. I'm
reproducing it here just because I can.
One day on IRC (irc.freenode.net/#osuoss), Kyle Boon was bitching,
whining and moaning about having to fork every time he wanted to exec a
process. After much back-and-forth between Kyle and a couple of us, I
decided to put an end to his bitching by writing up a function he could
use to replace his calls to fork and exec with one call. Probably the
hardest thing to decide on was the name. I contemplated such failed
ideas as "spoon", "foec" and "exork". Finally, on the suggestion of
Chris Anderson, I settled on "spork".
Honestly, I spent way too much time on this. And by "way to much" I mean
that, just by even contemplating this bit of code, I went over
what would be considered an acceptable amount of time to think about
this issue. Just goes to show how much free time I have on my
hands. Hell, I even wrote a man page for it. Pathetic, no?
How to Get it
You can get a tarball of the source code here. If you want to view the code, the links are here for spork.c (the implementation), spork.h (the header file), and spork.3 (the man page).
Installation Instructions
Installation is butt-simple. If you want to use the man page, copy it to section three of your manual library (usually somewhere like /usr/share/man/man3 or somesuch). Put the header file somewhere #include will find it. Lastly, link the implementation file into your program. Whee.