Move list_ports() implementations to OS-specific files.
Fix building on non OSX/linux/windows OS.