(main): Flush stdout and and check for errors prior to termination; end with call to exit rather than return from main, as with gen*.c. From-SVN: r6078
From-SVN: r5609
(xmalloc): New function. From-SVN: r5520
From-SVN: r5389