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