core: fix getopt(3) usage