OSDN Git Service

am 7e612cb8: (-s ours) am f41c7e0b: Merge remote-tracking branch \'toybox/master...
[android-x86/external-toybox.git] / scripts / install.c
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, 0, flags},
11 #define OLDTOY(name, oldname, flags) {#name, 0, 0, flags},
12
13 // Populate toy_list[].
14
15 struct toy_list toy_list[] = {
16 #include "generated/newtoys.h"
17 };
18
19 #define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list))
20
21 int main(int argc, char *argv[])
22 {
23   static char *toy_paths[]={"usr/","bin/","sbin/",0};
24   int i, len = 0;
25
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;
39 }