Change config file

This commit is contained in:
PolynomialDivision 2017-07-31 19:59:20 +02:00
parent 64aa9d6629
commit 63a1432652
11 changed files with 154 additions and 25 deletions

View file

@ -1,6 +1,17 @@
config 'settings' 'dawn'
config settings network
option broadcast_ip '10.0.0.255'
option broadcast_port '1025'
option sort_order 'csfb'
config settings ordering
option sort_order 'csfb'
config settings hostapd
option hostapd_dir '/var/run/hostapd'
option background '0'
config settings metric
option ht_support '10'
option vht_support '10'
option vht_support '10'
option rssi '10'
option freq '10'

View file

@ -18,10 +18,10 @@ start_service()
local hostapd_dir
config_load "${NAME}"
config_get broadcast_ip dawn broadcast_ip
config_get broadcast_port dawn broadcast_port
config_get sort_order dawn sort_order
config_get hostapd_dir dawn hostapd_dir
config_get broadcast_ip network broadcast_ip
config_get broadcast_port network broadcast_port
config_get sort_order ordering sort_order
config_get hostapd_dir hostapd hostapd_dir
procd_open_instance

BIN
files/main Executable file

Binary file not shown.

33
files/main.c Normal file
View file

@ -0,0 +1,33 @@
#include <stdio.h>
#include <stdlib.h>
#include <libconfig.h>
int main(int argc, char **argv)
{
config_t cfg;
config_setting_t *root, *setting, *movie;
config_init(&cfg);
/* Read the file. If there is an error, report it and exit. */
if(! config_read_file(&cfg, "dawn.config"))
{
fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg),
config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg);
return(EXIT_FAILURE);
}
printf("READ CONFIG!!!\n");
root = config_root_setting(&cfg);
int ht_support;
if (config_lookup_int(&cfg, "ht_support", &ht_support))
printf("Broadcast Port: %d\n\n", ht_support);
else
fprintf(stderr, "No 'name' setting in configuration file.\n");
}