multicall.c 613 B

12345678910111213141516171819202122232425262728
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdbool.h>
  4. extern int hostapd_main(int argc, char **argv);
  5. extern int wpa_supplicant_main(int argc, char **argv);
  6. int main(int argc, char **argv)
  7. {
  8. bool restart = false;
  9. const char *prog = argv[0];
  10. restart:
  11. if (strstr(argv[0], "hostapd"))
  12. return hostapd_main(argc, argv);
  13. else if (strstr(argv[0], "wpa_supplicant"))
  14. return wpa_supplicant_main(argc, argv);
  15. if (!restart && argc > 1) {
  16. argv++;
  17. argc--;
  18. restart = true;
  19. goto restart;
  20. }
  21. fprintf(stderr, "Invalid command.\nUsage: %s wpa_supplicant|hostapd [<arguments>]\n", prog);
  22. return 255;
  23. }