Using while(1) instead of exit.

The exit function can significantly increase code size, and adds
dependency on stdlibc.