Fix handling of OPTIND
Feature: add ability to report leaky variables

 * This is functionally a proof of concept that needs to be migrated
   into an internal sighandler, unfortunately we do not currently have
   an good sighandler interface in shlib.