blob: cda8fc229aa88ab6cf5f77a111ffbee0f7ac3c83 [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
10#define NEWTOY(name, opts, flags) {#name, 0, opts, flags},
Rob Landleyedee7dd2007-01-31 15:23:21 -050011#define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, 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}