summaryrefslogtreecommitdiffstats
path: root/package/network/services/hostapd/files/multicall.c
blob: c8e814bb5ca8d39fd25be3e152f7a340251b8b39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <string.h>
#include <stdbool.h>

extern int hostapd_main(int argc, char **argv);
extern int wpa_supplicant_main(int argc, char **argv);

int main(int argc, char **argv)
{
	bool restart = false;
	const char *prog = argv[0];

restart:
	if (strstr(argv[0], "hostapd"))
		return hostapd_main(argc, argv);
	else if (strstr(argv[0], "wpa_supplicant"))
		return wpa_supplicant_main(argc, argv);

	if (!restart && argc > 1) {
		argv++;
		argc--;
		restart = true;
		goto restart;
	}

	fprintf(stderr, "Invalid command.\nUsage: %s wpa_supplicant|hostapd [<arguments>]\n", prog);
	return 255;
}