int rc;
ykp_errno = 0;
- optind = 0; /* getopt reinit */
+
+/* getopt reinit (BSD systems use optreset and a different optind value) */
+#if defined(__GLIBC__) || defined(_WIN32)
+ optind = 0;
+#else
+ optind = optreset = 1;
+#endif
/* copy version number from st into cfg */
assert(ykp_configure_for(cfg, 1, st) == 1);
int argc = 7;
ykp_errno = 0;
- optind = 0; /* getopt reinit */
+
+/* getopt reinit (BSD systems use optreset and a different optind value) */
+#if defined(__GLIBC__) || defined(_WIN32)
+ optind = 0;
+#else
+ optind = optreset = 1;
+#endif
/* copy version number from st into cfg */
ykp_configure_version(cfg, st);