Rob Landley | bcfad87 | 2007-01-31 14:18:05 -0500 | [diff] [blame] | 1 | /* 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 Landley | edee7dd | 2007-01-31 15:23:21 -0500 | [diff] [blame] | 11 | #define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, flags}, |
Rob Landley | bcfad87 | 2007-01-31 14:18:05 -0500 | [diff] [blame] | 12 | |
| 13 | // Populate toy_list[]. |
| 14 | |
| 15 | struct toy_list toy_list[] = { |
Rob Landley | b1aaba1 | 2008-01-20 17:25:44 -0600 | [diff] [blame] | 16 | #include "generated/newtoys.h" |
Rob Landley | bcfad87 | 2007-01-31 14:18:05 -0500 | [diff] [blame] | 17 | }; |
| 18 | |
| 19 | #define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list)) |
| 20 | |
| 21 | int main(int argc, char *argv[]) |
| 22 | { |
Rob Landley | 7aa651a | 2012-11-13 17:14:08 -0600 | [diff] [blame] | 23 | static char *toy_paths[]={"usr/","bin/","sbin/",0}; |
| 24 | int i, len = 0; |
Rob Landley | bcfad87 | 2007-01-31 14:18:05 -0500 | [diff] [blame] | 25 | |
Rob Landley | 7aa651a | 2012-11-13 17:14:08 -0600 | [diff] [blame] | 26 | // 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 Landley | bcfad87 | 2007-01-31 14:18:05 -0500 | [diff] [blame] | 39 | } |