summaryrefslogtreecommitdiffstats
path: root/toolbox/toolbox.c
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:29:04 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-03-03 18:29:04 -0800
commite54eebbf1a908d65ee8cf80bab62821c05666d70 (patch)
tree4b825dc642cb6eb9a060e54bf8d69288fbee4904 /toolbox/toolbox.c
parenta1e1c1b106423de09bc918502e7a51d4ffe5a4ae (diff)
downloadsystem_core-e54eebbf1a908d65ee8cf80bab62821c05666d70.tar.gz
system_core-e54eebbf1a908d65ee8cf80bab62821c05666d70.tar.bz2
system_core-e54eebbf1a908d65ee8cf80bab62821c05666d70.zip
auto import from //depot/cupcake/@135843
Diffstat (limited to 'toolbox/toolbox.c')
-rw-r--r--toolbox/toolbox.c57
1 files changed, 0 insertions, 57 deletions
diff --git a/toolbox/toolbox.c b/toolbox/toolbox.c
deleted file mode 100644
index 0eac390e4..000000000
--- a/toolbox/toolbox.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-int main(int, char **);
-
-static int toolbox_main(int argc, char **argv)
-{
- // "toolbox foo ..." is equivalent to "foo ..."
- if (argc > 1) {
- return main(argc - 1, argv + 1);
- } else {
- printf("Toolbox!\n");
- return 0;
- }
-}
-
-#define TOOL(name) int name##_main(int, char**);
-#include "tools.h"
-#undef TOOL
-
-static struct
-{
- const char *name;
- int (*func)(int, char**);
-} tools[] = {
- { "toolbox", toolbox_main },
-#define TOOL(name) { #name, name##_main },
-#include "tools.h"
-#undef TOOL
- { 0, 0 },
-};
-
-int main(int argc, char **argv)
-{
- int i;
- char *name = argv[0];
-
- if((argc > 1) && (argv[1][0] == '@')) {
- name = argv[1] + 1;
- argc--;
- argv++;
- } else {
- char *cmd = strrchr(argv[0], '/');
- if (cmd)
- name = cmd + 1;
- }
-
- for(i = 0; tools[i].name; i++){
- if(!strcmp(tools[i].name, name)){
- return tools[i].func(argc, argv);
- }
- }
-
- printf("%s: no such tool\n", argv[0]);
- return -1;
-}