Allow wait() to accept extra patterns.
properly handle "eol" option in writeln().