aboutsummaryrefslogtreecommitdiffstats
path: root/fstools/fstools.cpp
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-11-10 14:18:38 +0100
committerTom Marshall <tdm@cyngn.com>2015-11-20 15:46:40 -0800
commit7eee7c2e8c653f41871b98e27b6fcbbed50e5bb8 (patch)
tree1158a4e25a426a78f572895e6ed52e11eb92f490 /fstools/fstools.cpp
parent9dc02b1f906832f2e741d7a73469e1f874dd52da (diff)
downloadbootable_recovery-7eee7c2e8c653f41871b98e27b6fcbbed50e5bb8.zip
bootable_recovery-7eee7c2e8c653f41871b98e27b6fcbbed50e5bb8.tar.gz
bootable_recovery-7eee7c2e8c653f41871b98e27b6fcbbed50e5bb8.tar.bz2
sr: Add fstools, update build configuration
* Make sure we create any dirs before trying to put symlinks in them * Create a new "fstools" target which aggregates all of our filesystem tools into a single multi-call binary. This reduces the overall recovery image size by a megabyte, and also removes GPL code from the main recovery binary. Change-Id: I5fc2a61d564915085071ccbbcb3136f45c640a60
Diffstat (limited to 'fstools/fstools.cpp')
-rw-r--r--fstools/fstools.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/fstools/fstools.cpp b/fstools/fstools.cpp
new file mode 100644
index 0000000..b1cc7ad
--- /dev/null
+++ b/fstools/fstools.cpp
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+
+extern "C" {
+#include "fstools.h"
+}
+
+
+int
+main(int argc, char **argv) {
+
+ // Handle alternative invocations
+ char* command = argv[0];
+ char* stripped = strrchr(argv[0], '/');
+ if (stripped)
+ command = stripped + 1;
+
+ if (strcmp(command, "fstools") != 0) {
+ struct fstools_cmd cmd = get_command(command);
+ if (cmd.name)
+ return cmd.main_func(argc, argv);
+ }
+ return -1;
+}