10f66f451Sopenharmony_ci/* Wrapper to make installation easier with cross-compiling.
20f66f451Sopenharmony_ci *
30f66f451Sopenharmony_ci * Copyright 2006 Rob Landley <rob@landley.net>
40f66f451Sopenharmony_ci */
50f66f451Sopenharmony_ci
60f66f451Sopenharmony_ci#include <stdio.h>
70f66f451Sopenharmony_ci#include "generated/config.h"
80f66f451Sopenharmony_ci#include "lib/toyflags.h"
90f66f451Sopenharmony_ci
100f66f451Sopenharmony_ci#define NEWTOY(name, opts, flags) {#name, flags},
110f66f451Sopenharmony_ci#define OLDTOY(name, oldname, flags) {#name, flags},
120f66f451Sopenharmony_ci
130f66f451Sopenharmony_ci// Populate toy_list[].
140f66f451Sopenharmony_ci
150f66f451Sopenharmony_cistruct {char *name; int flags;} toy_list[] = {
160f66f451Sopenharmony_ci#include "generated/newtoys.h"
170f66f451Sopenharmony_ci};
180f66f451Sopenharmony_ci
190f66f451Sopenharmony_ciint main(int argc, char *argv[])
200f66f451Sopenharmony_ci{
210f66f451Sopenharmony_ci  static char *toy_paths[]={"usr/","bin/","sbin/",0};
220f66f451Sopenharmony_ci  int i, len = 0;
230f66f451Sopenharmony_ci
240f66f451Sopenharmony_ci  // Output list of applets.
250f66f451Sopenharmony_ci  for (i=1; i<sizeof(toy_list)/sizeof(*toy_list); i++) {
260f66f451Sopenharmony_ci    int fl = toy_list[i].flags;
270f66f451Sopenharmony_ci    if (fl & TOYMASK_LOCATION) {
280f66f451Sopenharmony_ci      if (argc>1) {
290f66f451Sopenharmony_ci        int j;
300f66f451Sopenharmony_ci        for (j=0; toy_paths[j]; j++)
310f66f451Sopenharmony_ci          if (fl & (1<<j)) len += printf("%s", toy_paths[j]);
320f66f451Sopenharmony_ci      }
330f66f451Sopenharmony_ci      len += printf("%s\n",toy_list[i].name);
340f66f451Sopenharmony_ci    }
350f66f451Sopenharmony_ci  }
360f66f451Sopenharmony_ci  return 0;
370f66f451Sopenharmony_ci}
38