blob: a9a05500a6c3e6fdffd59caea073fface4f8dbe7 [file] [log] [blame]
Rob Landleybcfad872007-01-31 14:18:05 -05001/* Wrapper to make installation easier with cross-compiling.
2 *
3 * Copyright 2006 Rob Landley <rob@landley.net>
4 */
5
6#include "toys.h"
7
8#undef NEWTOY
9#undef OLDTOY
Rob Landley4f534572015-01-02 00:44:27 -060010#define NEWTOY(name, opts, flags) {#name, 0, 0, flags},
11#define OLDTOY(name, oldname, flags) {#name, 0, 0, flags},
Rob Landleybcfad872007-01-31 14:18:05 -050012
13// Populate toy_list[].
14
15struct toy_list toy_list[] = {
Rob Landleyb1aaba12008-01-20 17:25:44 -060016#include "generated/newtoys.h"
Rob Landleybcfad872007-01-31 14:18:05 -050017};
18
19#define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list))
20
21int main(int argc, char *argv[])
22{
Rob Landley7aa651a2012-11-13 17:14:08 -060023 static char *toy_paths[]={"usr/","bin/","sbin/",0};
24 int i, len = 0;
Rob Landleybcfad872007-01-31 14:18:05 -050025
Rob Landley7aa651a2012-11-13 17:14:08 -060026 // Output list of applets.
27 for (i=1; i<TOY_LIST_LEN; i++) {
28 int fl = toy_list[i].flags;
29 if (fl & TOYMASK_LOCATION) {
30 if (argc>1) {
31 int j;
32 for (j=0; toy_paths[j]; j++)
33 if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
34 }
35 len += printf("%s\n",toy_list[i].name);
36 }
37 }
38 return 0;
Rob Landleybcfad872007-01-31 14:18:05 -050039}