On Tue, Jul 30, 2019 at 09:08:38AM +0100, Joseph Koshy wrote:
> Mark,
> 
> On Fri, Jul 26, 2019 at 9:36 PM Mark Johnston <ma...@freebsd.org> wrote:
> >
> > This marginally simplifies the code.  Writing argc--; argv++; after the
> > option parsing loop is a common idiom anyway.
> 
> The option handling code in elfcopy(1) seems
> patterned after the getopt(3) usage example in
> the POSIX standard:
> 
> https://pubs.opengroup.org/onlinepubs/9699919799/functions/getopt.html.

I noted that most of the other ELFToolchain utilities adjust argc and
argv by optind immediately after the getopt loop: addr2line, ar,
cxxfilt, elfdump, readelf, size, and strings.

> I'm curious -- would there be a drawback to
> using 'optind' to index the argv[] array?

There is no drawback, it just seemed odd to me to use it.  (And for
Capsicum I will need to add some more uses.)  If you prefer to keep
the existing code I will adjust my patches accordingly.


_______________________________________________
Elftoolchain-developers mailing list
Elftoolchain-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/elftoolchain-developers

Reply via email to