install.c 875 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* Wrapper to make installation easier with cross-compiling.
  2. *
  3. * Copyright 2006 Rob Landley <rob@landley.net>
  4. */
  5. #include <stdio.h>
  6. #include "generated/config.h"
  7. #include "lib/toyflags.h"
  8. #define NEWTOY(name, opts, flags) {#name, flags},
  9. #define OLDTOY(name, oldname, flags) {#name, flags},
  10. // Populate toy_list[].
  11. struct {char *name; int flags;} toy_list[] = {
  12. #include "generated/newtoys.h"
  13. };
  14. int main(int argc, char *argv[])
  15. {
  16. static char *toy_paths[]={"usr/","bin/","sbin/",0};
  17. int i, len = 0;
  18. // Output list of applets.
  19. for (i=1; i<sizeof(toy_list)/sizeof(*toy_list); i++) {
  20. int fl = toy_list[i].flags;
  21. if (fl & TOYMASK_LOCATION) {
  22. if (argc>1) {
  23. int j;
  24. for (j=0; toy_paths[j]; j++)
  25. if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
  26. }
  27. len += printf("%s\n",toy_list[i].name);
  28. }
  29. }
  30. return 0;
  31. }