Use return instead of exit() in main().