aboutsummaryrefslogtreecommitdiff
path: root/scripts/install.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2007-01-31 14:18:05 -0500
committerRob Landley <rob@landley.net>2007-01-31 14:18:05 -0500
commitbcfad872188d993efc8d1da4b79058b69e43f019 (patch)
treeefb18570074a6b423ae6a9e41687a2d405b9a06f /scripts/install.c
parenta6d696b74adb08d83b21f8299b5443f31a5f43ec (diff)
downloadtoybox-bcfad872188d993efc8d1da4b79058b69e43f019.tar.gz
Add make install_flat.
Diffstat (limited to 'scripts/install.c')
-rw-r--r--scripts/install.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/scripts/install.c b/scripts/install.c
new file mode 100644
index 00000000..b5744868
--- /dev/null
+++ b/scripts/install.c
@@ -0,0 +1,40 @@
+/* vi: set ts=4 :*/
+/* Wrapper to make installation easier with cross-compiling.
+ *
+ * Copyright 2006 Rob Landley <rob@landley.net>
+ */
+
+#include "toys.h"
+
+#undef NEWTOY
+#undef OLDTOY
+#define NEWTOY(name, opts, flags) {#name, 0, opts, flags},
+#define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, flags}
+
+// Populate toy_list[].
+
+struct toy_list toy_list[] = {
+#include "toys/toylist.h"
+};
+
+#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list))
+
+int main(int argc, char *argv[])
+{
+ static char *toy_paths[]={"usr/","bin/","sbin/",0};
+ int i, len = 0;
+
+ // Output list of applets.
+ for (i=1; i<TOY_LIST_LEN; i++) {
+ int fl = toy_list[i].flags;
+ if (fl & TOYMASK_LOCATION) {
+ if (argc>1) {
+ int j;
+ for (j=0; toy_paths[j]; j++)
+ if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
+ }
+ len += printf("%s\n",toy_list[i].name);
+ }
+ }
+ return 0;
+}