[Toybox] Multiple features in one implementation

Elie De Brauwer eliedebrauwer at gmail.com
Thu May 10 06:42:05 PDT 2012


On 05/10/2012 03:14 PM, Ashwini Sharma wrote:
> Hi Rob,
>
> Is there any mechanism or framework in place to have multiple commands
> implemented in same source file.
>
> For example:
>
>      we can have the implementation for *grep, egrep, fgrep* in one file
> itself, as grep -E is equivalent to egrep and grep -F is fgrep.
> Currently I do not see any such mechanism, where in I can make all the
> binaries point to same place and then decide on what to run.
>
> Same will be applicable for *env* and *printenv* as printenv is similar
> to the env default behaviour.
>
> Doing this will help reduce the effort and code size.
>
> Whats your opinion on this.?
>

Hi,

Have you already taken a look at the OLDTOY() macro ? (Used for example 
in netcat.c to alias netcat and nc). I think that might get you on the 
way, haven't used it myself tough.

Hope this helps.
E.


-- 
Elie De Brauwer


 1336657325.0


More information about the Toybox mailing list