Mercurial > hg > toybox
annotate scripts/install.c @ 239:4f1ca01db000
Fluff out hello.c to supply more example code as a skeleton for new commands,
and update a chunk of code.html (much more to do there).
author | Rob Landley <rob@landley.net> |
---|---|
date | Sun, 20 Jan 2008 19:00:16 -0600 |
parents | 7cb15eae1664 |
children | 786841fdb1e0 |
rev | line source |
---|---|
89 | 1 /* 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}, | |
91
b596b9b3b2af
Missing comma, and slight simplification in defconfig sed invocation.
Rob Landley <rob@landley.net>
parents:
89
diff
changeset
|
12 #define OLDTOY(name, oldname, opts, flags) {#name, 0, opts, flags}, |
89 | 13 |
14 // Populate toy_list[]. | |
15 | |
16 struct toy_list toy_list[] = { | |
237
7cb15eae1664
Zap toylist.h, moving contents of global structures into DEFINE_GLOBALS()
Rob Landley <rob@landley.net>
parents:
91
diff
changeset
|
17 #include "generated/newtoys.h" |
89 | 18 }; |
19 | |
20 #define TOY_LIST_LEN (sizeof(toy_list)/sizeof(struct toy_list)) | |
21 | |
22 int 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 } |