src/console_switch.{c,h}: change error handling to use errno