# HG changeset patch # User Rob Landley # Date 1344926526 18000 # Node ID 3258d9233753139f94db8812778e3894337f3d19 # Parent fb546cc2a022d1b1304ac8fb17a0dcf63c5f1532 Replace TOY_LIST_LEN with more generic ARRAY_LEN() diff -r fb546cc2a022 -r 3258d9233753 main.c --- a/main.c Sun Aug 05 23:05:16 2012 -0500 +++ b/main.c Tue Aug 14 01:42:06 2012 -0500 @@ -17,8 +17,6 @@ #include "generated/newtoys.h" }; -#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list)) - // global context for this applet. struct toy_context toys; @@ -37,7 +35,7 @@ // Binary search to find this applet. - top = TOY_LIST_LEN-1; + top = ARRAY_LEN(toy_list)-1; for (;;) { int result; @@ -90,7 +88,8 @@ toys.argv = argv; if (NEED_OPTIONS && which->options) get_optflags(); else toys.optargs = argv+1; - if (which->flags & TOYFLAG_UMASK) toys.old_umask = umask(0); + toys.old_umask = umask(0); + if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask); } // Like exec() but runs an internal toybox command instead of another file. @@ -123,7 +122,7 @@ } // Output list of applets. - for (i=1; i