Correct errors on Darwin.
Fix portability problems on Darwin.
Add some helpful debug code.
Other minor fixes (e.g. remove redundant newlines in debug messages).

Conflicts:
	chirp/test/TR_chirp_tickets.sh