3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

core: Add command line option to provide SSID

This commit is contained in:
Marcel Holtmann 2014-08-08 22:19:47 -07:00
parent 1ab85bdbe5
commit c13d50fab9
3 changed files with 15 additions and 1 deletions

View File

@ -51,10 +51,12 @@ static void usage(void)
"Usage:\n");
printf("\tiwd [options]\n");
printf("Options:\n"
"\t-S, --ssid <ssid> SSID of network\n"
"\t-h, --help Show help options\n");
}
static const struct option main_options[] = {
{ "ssid", required_argument, NULL, 'S' },
{ "version", no_argument, NULL, 'v' },
{ "help", no_argument, NULL, 'h' },
{ }
@ -70,11 +72,14 @@ int main(int argc, char *argv[])
for (;;) {
int opt;
opt = getopt_long(argc, argv, "vh", main_options, NULL);
opt = getopt_long(argc, argv, "S:vh", main_options, NULL);
if (opt < 0)
break;
switch (opt) {
case 'S':
wiphy_set_ssid(optarg);
break;
case 'v':
printf("%s\n", VERSION);
return EXIT_SUCCESS;

View File

@ -33,6 +33,8 @@
#include "linux/nl80211.h"
#include "src/wiphy.h"
static const char *network_ssid = NULL;
static struct l_genl *genl = NULL;
static struct l_genl_family *nl80211 = NULL;
@ -542,3 +544,8 @@ void wiphy_notify_dellink(uint32_t index)
l_queue_foreach(wiphy_list, wiphy_check_dellink, L_UINT_TO_PTR(index));
}
void wiphy_set_ssid(const char *ssid)
{
network_ssid = ssid;
}

View File

@ -27,3 +27,5 @@ bool wiphy_init(void);
bool wiphy_exit(void);
void wiphy_notify_dellink(uint32_t index);
void wiphy_set_ssid(const char *ssid);