bb7c5ab2e8
Someone may need to call rte_eal_init() with a fake argc/argv array in the middle of using getopt() to parse its own unrelated argc/argv parameters. So getopt lib shouldn't be reset by rte_eal_init(). Now eal will always save optind, optarg and optopt (and optreset on FreeBSD) at the beginning, initialize optind (and optreset on FreeBSD) to 1 before calling getopt_long(), then restore all values after. Suggested-by: Don Provan <dprovan@bivio.net> Suggested-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Tiwei Bie <btw@mail.ustc.edu.cn> Reviewed-by: Don Provan <dprovan@bivio.net> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: David Marchand <david.marchand@6wind.com>