[BusyBox] tar and getopt (again)
Matt Kraai
kraai at alumni.carnegiemellon.edu
Mon Jan 22 19:01:49 UTC 2001
On Sun, Jan 21, 2001 at 11:52:27PM -0700, Erik Andersen wrote:
> On Sun Jan 21, 2001 at 10:19:27PM -0800, Matt Kraai wrote:
> > The attached patch makes tar use getopt. It does so by using a
> > cheap trick I learned from reading GNU tar. That is, if the first
> > parameter is missing a leading -, add it. Hehe. The patch is
> > large since most of the option parsing was reindented. It saves
> > 16 bytes. OK to commit?
>
[snip request not to use getopt_long]
Though avoiding getopt_long is possible, it is so gross that I'd
rather write getopt_long for uC-libc than be stuck without it. In
order for things to work (as far as I can tell), you'd need to
check for the argument (which getopt_long would handle for you),
and then need to do some major hackery with argv and argc to skip
the rest of the exclude...if it is even possible. I guess I'll
take a look at writing a getopt_long replacement, unless someone
convinces me otherwise.
Matt
More information about the busybox
mailing list