commit 9814e6a376df853a88deb889d68f178c803ad8ca from: Christian Weisgerber date: Sun Sep 27 14:55:18 2020 UTC prefer the BSD extension to reset getopt over the GNU one Sadly there is no portable way to reset getopt(3). BSD: optind = 1; optreset = 1; GNU: optind = 0; ok stsp commit - 1367695b58142d73ad701f34f04fe45c4ad2782b commit + 9814e6a376df853a88deb889d68f178c803ad8ca blob - d493fceb5e36c0e2b7129cfa0950467e1fba2e30 blob + b8f662a112135fe0364e2a25eb0fe2976ba10cf1 --- got/got.c +++ got/got.c @@ -213,7 +213,8 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - optind = 0; + optind = 1; + optreset = 1; if (Vflag) { got_version_print_str(); blob - c85b72cb7d79be804da3d376cc54c65fee5d8dfd blob + 4d3c8ce6aa1ab5d45f4d36bede4d892708b96873 --- tog/tog.c +++ tog/tog.c @@ -5652,7 +5652,7 @@ main(int argc, char *argv[]) argc -= optind; argv += optind; - optind = 0; + optind = 1; optreset = 1; if (Vflag) {