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