diff options
author | landley <landley@driftwood> | 2006-10-18 18:38:16 -0400 |
---|---|---|
committer | landley <landley@driftwood> | 2006-10-18 18:38:16 -0400 |
commit | cd9dfc3b7b73715840b63180e2e4bfdb6e7ca9a4 (patch) | |
tree | a4e4932ecc15140ed48761ca8d32d5a0edc53bf7 /main.c | |
parent | 4f344e356d2c36c4b1df46917eaef25f82ca79a9 (diff) | |
download | toybox-cd9dfc3b7b73715840b63180e2e4bfdb6e7ca9a4.tar.gz |
Next drop of toysh, plus more infratructure.
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 18 |
1 files changed, 12 insertions, 6 deletions
@@ -17,6 +17,7 @@ struct toy_list toy_list[] = { {"cd", cd_main, TOYFLAG_NOFORK}, {"df", df_main, TOYFLAG_USR|TOYFLAG_SBIN}, {"exit", exit_main, TOYFLAG_NOFORK}, + {"sh", toysh_main, TOYFLAG_BIN}, {"toysh", toysh_main, TOYFLAG_BIN} }; @@ -51,6 +52,16 @@ struct toy_list *toy_find(char *name) } } +void toy_init(struct toy_list *which, char *argv[]) +{ + // Free old toys contents here? + + toys.which = which; + toys.argv = argv; + for (toys.argc = 0; argv[toys.argc]; toys.argc++); + toys.exitval = 1; +} + // Run a toy. void toy_exec(char *argv[]) { @@ -59,12 +70,7 @@ void toy_exec(char *argv[]) which = toy_find(argv[0]); if (!which) return; - // Free old toys contents here? - - toys.which = which; - toys.argv = argv; - for (toys.argc = 0; argv[toys.argc]; toys.argc++); - toys.exitval = 1; + toy_init(which, argv); exit(toys.which->toy_main()); } |