Home | History | Annotate | Download | only in toybox

Lines Matching refs:toys

6 #include "toys.h"
26 struct toy_context toys;
73 toys.which = which;
74 toys.argv = argv;
79 if (CFG_TOYBOX && toys.which == toy_list && toys.argv[2])
80 if (!(toys.which = toy_find(toys.argv[2]))) return;
87 toys.optargs = argv+1;
88 for (toys.optc = 0; toys.optargs[toys.optc]; toys.optc++);
90 toys.old_umask = umask(0);
91 if (!(which->flags & TOYFLAG_UMASK)) umask(toys.old_umask);
92 toys.signalfd--;
93 toys.toycount = ARRAY_LEN(toy_list);
99 void *oldwhich = toys.which;
104 if (!toys.which) toys.which = toy_list;
112 toys.wasroot++;
120 // Free old toys contents (to be reentrant), but leave rebound if any
122 if (argv<toys.optargs || argv>toys.optargs+toys.optc) free(toys.optargs);
123 memset(&toys, 0, offsetof(struct toy_context, rebound));
140 if (toys.stacktop && labs((char *)toys.stacktop-(char *)&which)>6000)
144 if (toys.which && (which->flags&TOYFLAG_ROOTONLY) && toys.wasroot) return;
148 if (toys.which) toys.which->toy_main();
160 // (Leave toys.which null to disable suid return logic.)
161 if (toys.argv[1]) toy_exec(toys.argv+1);
164 toys.which = toy_list;
166 if (toys.argv[1]) {
167 if (!strcmp("--version", toys.argv[1])) {
171 if (toys.argv[1][0] != '-') {
172 toys.exitval = 127;
173 error_exit("Unknown command %s", toys.argv[1]);
181 if (toys.argv[1]) {
203 toys.stacktop = &stack;
212 toys.stacktop = 0;
219 toys.argv = argv-1;