[Toybox] [DESIGN] OLDTOY and command line arguments.

Rob Landley rob at landley.net
Thu Aug 1 16:09:32 PDT 2013


I'm torn on whether or not OLDTOY should have an option string.

One the one hand, there's a slot in the table for it and the option  
parser can happily use the provided string. Judicious use of OLDTOY  
lets commands share infrastructure without filling lib/*.c with stuff  
that's not widely applicable.

On the other: the FLAG_* macros are for NEWTOY (one per file), and for  
grep/egrep/fgrep I'm duplicating a long and complicated string that's  
just waiting to fall out of sync with its two other identical  
incarnations.

"grep -B 1 OLDTOY toys/*/*.c" says that the only users that DON'T  
duplicate the string right now are mv (which uses a strict subset of  
the cp flags so the FLAG_* macros match up), and groups (which has NULL  
optflags where id has a half dozen).

Possibly I should have OLDTOY() not take an option string and then do  
an OLDTOY_OPTS()?

Pondering...

Rob

P.S. Yeah, that implies grep needs -ABC. I should do one of those  
linux-ism config options for it like cp, df, ls, sort...
 1375398572.0


More information about the Toybox mailing list