Replace homegrown getopt implementation.