GUI-FreeRDP/freerdp/client/X11/cli/arguments.c

62 lines
1.2 KiB
C
Raw Normal View History

/*
* arguments.c
*
* Created on: 6 июл. 2022 г.
* Author: alexander
*/
#include <stdlib.h>
#include "arguments.h"
#include "node_settings.h"
#include "concat.h"
#include "rxrandr.h"
#include "db.h"
#include "monitor.h"
void settingsLoad(char *pathDB)
{
getPathDB(pathDB);
dbLoadData();
Monitors *monitors = loadMonitors();
for (size_t i = 0; i < monitors->size; ++i)
{
addParameterValue(PARAMETER_MONITORS, i, monitors->monitor[i]->data[3], !i);
}
dbFreeMonitors(monitors);
}
void settingsFree()
{
freeSettings();
}
void buildArguments(Arguments *args)
{
args->argc = 0;
args->argv = (char **)malloc(sizeof(char *) * settings.countParameterSet);
for (NodeParameter *head = settings.parameter; head; head = head->next)
{
if (head->set)
{
if (head->value)
args->argv[(args->argc)++] = concat(head->key, getSetNodeValue(head)->current);
else
args->argv[(args->argc)++] = concat(head->key, NULL);
}
}
}
void freeArguments(Arguments *args)
{
for (int i = 0; i < args->argc; ++i)
{
free(args->argv[i]);
}
free(args->argv);
}