bsd type getopt work

Signed-off-by: Mahmut Bulut <mahmutbulut0@gmail.com>