[BusyBox] tar and getopt (again)

Erik Andersen andersen at lineo.com
Mon Jan 22 19:57:52 UTC 2001


On Mon Jan 22, 2001 at 11:01:49AM -0800, Matt Kraai wrote:
> 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.

k.  Ckeck it in as is.  uClibc already has a getopt_long -- the main reason I
was looking at it is that since so few busybox apps use it, I was hoping to
save space by not using it.  It saves space on a static compile, since the
getopt_long code wouldn't get linked in, and it saves a (admittedly tiny) bit
of space on a dynamic build, since the ELF vector code to fixup the external
symbol isn't needed.  Not that big a deal.  Just a thought.

 -Erik

--
Erik B. Andersen   email:  andersen at lineo.com
--This message was written using 73% post-consumer electrons--





More information about the busybox mailing list