2013-01-13 09:45:59 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011-2013 Felix Fietkau <nbd@openwrt.org>
|
|
|
|
*
|
|
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
|
|
* copyright notice and this permission notice appear in all copies.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
|
|
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
|
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
|
|
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
*/
|
2013-03-05 01:30:51 +01:00
|
|
|
#ifdef JSONC
|
|
|
|
#include <json.h>
|
|
|
|
#else
|
|
|
|
#include <json/json.h>
|
|
|
|
#endif
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <ctype.h>
|
|
|
|
#include <getopt.h>
|
2018-01-18 21:21:09 +01:00
|
|
|
#include <sys/stat.h>
|
|
|
|
#include <fcntl.h>
|
2018-04-07 10:36:38 +02:00
|
|
|
#include <inttypes.h>
|
2011-08-12 19:12:50 +02:00
|
|
|
#include "list.h"
|
2011-05-23 22:21:27 +02:00
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
#include "avl.h"
|
2014-08-04 19:26:18 +02:00
|
|
|
#include "blob.h"
|
|
|
|
#include "blobmsg_json.h"
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
#define MAX_VARLEN 256
|
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
static struct avl_tree env_vars;
|
2014-08-04 19:26:18 +02:00
|
|
|
static struct blob_buf b = { 0 };
|
|
|
|
|
2012-12-16 17:46:02 +01:00
|
|
|
static const char *var_prefix = "";
|
|
|
|
static int var_prefix_len = 0;
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
static int add_json_element(const char *key, json_object *obj);
|
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
struct env_var {
|
|
|
|
struct avl_node avl;
|
|
|
|
char *val;
|
|
|
|
};
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
static int add_json_object(json_object *obj)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
json_object_object_foreach(obj, key, val) {
|
|
|
|
ret = add_json_element(key, val);
|
|
|
|
if (ret)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int add_json_array(struct array_list *a)
|
|
|
|
{
|
|
|
|
char seq[12];
|
|
|
|
int i, len;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
for (i = 0, len = array_list_length(a); i < len; i++) {
|
2020-01-14 08:55:34 +01:00
|
|
|
snprintf(seq, sizeof(seq), "%d", i);
|
2011-05-23 22:21:27 +02:00
|
|
|
ret = add_json_element(seq, array_list_get_idx(a, i));
|
|
|
|
if (ret)
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void add_json_string(const char *str)
|
|
|
|
{
|
|
|
|
char *ptr = (char *) str;
|
|
|
|
int len;
|
|
|
|
char *c;
|
|
|
|
|
|
|
|
while ((c = strchr(ptr, '\'')) != NULL) {
|
|
|
|
len = c - ptr;
|
|
|
|
if (len > 0)
|
|
|
|
fwrite(ptr, len, 1, stdout);
|
|
|
|
ptr = c + 1;
|
|
|
|
c = "'\\''";
|
|
|
|
fwrite(c, strlen(c), 1, stdout);
|
|
|
|
}
|
|
|
|
len = strlen(ptr);
|
|
|
|
if (len > 0)
|
|
|
|
fwrite(ptr, len, 1, stdout);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void write_key_string(const char *key)
|
|
|
|
{
|
|
|
|
while (*key) {
|
|
|
|
putc(isalnum(*key) ? *key : '_', stdout);
|
|
|
|
key++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static int add_json_element(const char *key, json_object *obj)
|
|
|
|
{
|
|
|
|
char *type;
|
|
|
|
|
|
|
|
switch (json_object_get_type(obj)) {
|
|
|
|
case json_type_object:
|
|
|
|
type = "object";
|
|
|
|
break;
|
|
|
|
case json_type_array:
|
|
|
|
type = "array";
|
|
|
|
break;
|
|
|
|
case json_type_string:
|
|
|
|
type = "string";
|
|
|
|
break;
|
|
|
|
case json_type_boolean:
|
|
|
|
type = "boolean";
|
|
|
|
break;
|
|
|
|
case json_type_int:
|
|
|
|
type = "int";
|
|
|
|
break;
|
2013-03-17 00:50:03 +01:00
|
|
|
case json_type_double:
|
|
|
|
type = "double";
|
|
|
|
break;
|
2018-01-07 15:46:31 +01:00
|
|
|
case json_type_null:
|
|
|
|
type = "null";
|
|
|
|
break;
|
2011-05-23 22:21:27 +02:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf(stdout, "json_add_%s '", type);
|
|
|
|
write_key_string(key);
|
|
|
|
|
|
|
|
switch (json_object_get_type(obj)) {
|
|
|
|
case json_type_object:
|
|
|
|
fprintf(stdout, "';\n");
|
|
|
|
add_json_object(obj);
|
|
|
|
fprintf(stdout, "json_close_object;\n");
|
|
|
|
break;
|
|
|
|
case json_type_array:
|
|
|
|
fprintf(stdout, "';\n");
|
|
|
|
add_json_array(json_object_get_array(obj));
|
|
|
|
fprintf(stdout, "json_close_array;\n");
|
|
|
|
break;
|
|
|
|
case json_type_string:
|
|
|
|
fprintf(stdout, "' '");
|
|
|
|
add_json_string(json_object_get_string(obj));
|
|
|
|
fprintf(stdout, "';\n");
|
|
|
|
break;
|
|
|
|
case json_type_boolean:
|
|
|
|
fprintf(stdout, "' %d;\n", json_object_get_boolean(obj));
|
|
|
|
break;
|
|
|
|
case json_type_int:
|
2018-04-07 10:36:38 +02:00
|
|
|
fprintf(stdout, "' %"PRId64";\n", json_object_get_int64(obj));
|
2011-05-23 22:21:27 +02:00
|
|
|
break;
|
2013-03-17 00:50:03 +01:00
|
|
|
case json_type_double:
|
|
|
|
fprintf(stdout, "' %lf;\n", json_object_get_double(obj));
|
|
|
|
break;
|
2018-01-07 15:46:31 +01:00
|
|
|
case json_type_null:
|
|
|
|
fprintf(stdout, "';\n");
|
|
|
|
break;
|
2011-05-23 22:21:27 +02:00
|
|
|
default:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int jshn_parse(const char *str)
|
|
|
|
{
|
|
|
|
json_object *obj;
|
|
|
|
|
|
|
|
obj = json_tokener_parse(str);
|
2014-09-23 12:02:31 +02:00
|
|
|
if (!obj || json_object_get_type(obj) != json_type_object) {
|
2019-11-19 14:09:43 +01:00
|
|
|
if (obj)
|
|
|
|
json_object_put(obj);
|
2011-05-23 22:21:27 +02:00
|
|
|
fprintf(stderr, "Failed to parse message data\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
fprintf(stdout, "json_init;\n");
|
|
|
|
add_json_object(obj);
|
|
|
|
fflush(stdout);
|
2019-11-19 14:09:43 +01:00
|
|
|
json_object_put(obj);
|
2011-05-23 22:21:27 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
static char *getenv_avl(const char *key)
|
|
|
|
{
|
|
|
|
struct env_var *var = avl_find_element(&env_vars, key, var, avl);
|
|
|
|
return var ? var->val : NULL;
|
|
|
|
}
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
static char *get_keys(const char *prefix)
|
|
|
|
{
|
|
|
|
char *keys;
|
2020-01-14 08:55:34 +01:00
|
|
|
size_t len = var_prefix_len + strlen(prefix) + sizeof("K_") + 1;
|
2011-05-23 22:21:27 +02:00
|
|
|
|
2020-01-14 08:55:34 +01:00
|
|
|
keys = alloca(len);
|
|
|
|
snprintf(keys, len, "%sK_%s", var_prefix, prefix);
|
2016-03-05 18:51:31 +01:00
|
|
|
return getenv_avl(keys);
|
2011-05-23 22:21:27 +02:00
|
|
|
}
|
|
|
|
|
2011-09-11 11:40:22 +02:00
|
|
|
static void get_var(const char *prefix, const char **name, char **var, char **type)
|
2011-05-23 22:21:27 +02:00
|
|
|
{
|
2011-09-11 11:40:22 +02:00
|
|
|
char *tmpname, *varname;
|
2020-01-14 08:55:34 +01:00
|
|
|
size_t len = var_prefix_len + strlen(prefix) + 1 + strlen(*name) + 1 + sizeof("T_");
|
2011-05-23 22:21:27 +02:00
|
|
|
|
2020-01-14 08:55:34 +01:00
|
|
|
tmpname = alloca(len);
|
2012-12-16 17:46:02 +01:00
|
|
|
|
2020-01-14 08:55:34 +01:00
|
|
|
snprintf(tmpname, len, "%s%s_%s", var_prefix, prefix, *name);
|
2016-03-05 18:51:31 +01:00
|
|
|
*var = getenv_avl(tmpname);
|
2012-12-16 17:46:02 +01:00
|
|
|
|
2020-01-14 08:55:34 +01:00
|
|
|
snprintf(tmpname, len, "%sT_%s_%s", var_prefix, prefix, *name);
|
2016-03-05 18:51:31 +01:00
|
|
|
*type = getenv_avl(tmpname);
|
2011-09-11 11:40:22 +02:00
|
|
|
|
2020-01-14 08:55:34 +01:00
|
|
|
snprintf(tmpname, len, "%sN_%s_%s", var_prefix, prefix, *name);
|
2016-03-05 18:51:31 +01:00
|
|
|
varname = getenv_avl(tmpname);
|
2011-09-11 11:40:22 +02:00
|
|
|
if (varname)
|
|
|
|
*name = varname;
|
2011-05-23 22:21:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static json_object *jshn_add_objects(json_object *obj, const char *prefix, bool array);
|
|
|
|
|
|
|
|
static void jshn_add_object_var(json_object *obj, bool array, const char *prefix, const char *name)
|
|
|
|
{
|
|
|
|
json_object *new;
|
|
|
|
char *var, *type;
|
|
|
|
|
2011-09-11 11:40:22 +02:00
|
|
|
get_var(prefix, &name, &var, &type);
|
2011-05-23 22:21:27 +02:00
|
|
|
if (!var || !type)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!strcmp(type, "array")) {
|
|
|
|
new = json_object_new_array();
|
|
|
|
jshn_add_objects(new, var, true);
|
|
|
|
} else if (!strcmp(type, "object")) {
|
|
|
|
new = json_object_new_object();
|
|
|
|
jshn_add_objects(new, var, false);
|
|
|
|
} else if (!strcmp(type, "string")) {
|
|
|
|
new = json_object_new_string(var);
|
|
|
|
} else if (!strcmp(type, "int")) {
|
2017-10-22 01:42:29 +02:00
|
|
|
new = json_object_new_int64(atoll(var));
|
2013-03-17 00:50:03 +01:00
|
|
|
} else if (!strcmp(type, "double")) {
|
|
|
|
new = json_object_new_double(strtod(var, NULL));
|
2011-05-23 22:21:27 +02:00
|
|
|
} else if (!strcmp(type, "boolean")) {
|
|
|
|
new = json_object_new_boolean(!!atoi(var));
|
2018-01-07 15:46:31 +01:00
|
|
|
} else if (!strcmp(type, "null")) {
|
|
|
|
new = NULL;
|
2011-05-23 22:21:27 +02:00
|
|
|
} else {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (array)
|
|
|
|
json_object_array_add(obj, new);
|
|
|
|
else
|
|
|
|
json_object_object_add(obj, name, new);
|
|
|
|
}
|
|
|
|
|
|
|
|
static json_object *jshn_add_objects(json_object *obj, const char *prefix, bool array)
|
|
|
|
{
|
|
|
|
char *keys, *key, *brk;
|
|
|
|
|
|
|
|
keys = get_keys(prefix);
|
|
|
|
if (!keys || !obj)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
for (key = strtok_r(keys, " ", &brk); key;
|
|
|
|
key = strtok_r(NULL, " ", &brk)) {
|
|
|
|
jshn_add_object_var(obj, array, prefix, key);
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:22:48 +02:00
|
|
|
static int jshn_format(bool no_newline, bool indent, FILE *stream)
|
2011-05-23 22:21:27 +02:00
|
|
|
{
|
|
|
|
json_object *obj;
|
2014-08-04 19:26:18 +02:00
|
|
|
const char *output;
|
2014-11-12 14:59:20 +01:00
|
|
|
char *blobmsg_output = NULL;
|
|
|
|
int ret = -1;
|
|
|
|
|
|
|
|
if (!(obj = json_object_new_object()))
|
|
|
|
return -1;
|
2011-05-23 22:21:27 +02:00
|
|
|
|
2014-11-23 20:21:14 +01:00
|
|
|
jshn_add_objects(obj, "J_V", false);
|
2014-11-12 14:59:20 +01:00
|
|
|
if (!(output = json_object_to_json_string(obj)))
|
|
|
|
goto out;
|
|
|
|
|
2014-08-04 19:26:18 +02:00
|
|
|
if (indent) {
|
|
|
|
blob_buf_init(&b, 0);
|
2014-11-12 14:59:20 +01:00
|
|
|
if (!blobmsg_add_json_from_string(&b, output))
|
|
|
|
goto out;
|
|
|
|
if (!(blobmsg_output = blobmsg_format_json_indent(b.head, 1, 0)))
|
|
|
|
goto out;
|
|
|
|
output = blobmsg_output;
|
2014-08-04 19:26:18 +02:00
|
|
|
}
|
2019-09-14 00:22:48 +02:00
|
|
|
fprintf(stream, "%s%s", output, no_newline ? "" : "\n");
|
2014-11-12 14:59:20 +01:00
|
|
|
free(blobmsg_output);
|
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
out:
|
2011-05-23 22:21:27 +02:00
|
|
|
json_object_put(obj);
|
2014-11-12 14:59:20 +01:00
|
|
|
return ret;
|
2011-05-23 22:21:27 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static int usage(const char *progname)
|
|
|
|
{
|
2019-11-23 23:40:48 +01:00
|
|
|
fprintf(stderr, "Usage: %s [-n] [-i] -r <message>|-R <file>|-o <file>|-p <prefix>|-w\n", progname);
|
2011-05-23 22:21:27 +02:00
|
|
|
return 2;
|
|
|
|
}
|
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
static int avl_strcmp_var(const void *k1, const void *k2, void *ptr)
|
|
|
|
{
|
|
|
|
const char *s1 = k1;
|
|
|
|
const char *s2 = k2;
|
|
|
|
char c1, c2;
|
|
|
|
|
|
|
|
while (*s1 && *s1 == *s2) {
|
|
|
|
s1++;
|
|
|
|
s2++;
|
|
|
|
}
|
|
|
|
|
|
|
|
c1 = *s1;
|
|
|
|
c2 = *s2;
|
|
|
|
if (c1 == '=')
|
|
|
|
c1 = 0;
|
|
|
|
if (c2 == '=')
|
|
|
|
c2 = 0;
|
|
|
|
|
|
|
|
return c1 - c2;
|
|
|
|
}
|
|
|
|
|
2019-11-23 22:27:46 +01:00
|
|
|
static int jshn_parse_file(const char *path)
|
|
|
|
{
|
|
|
|
struct stat sb;
|
|
|
|
int ret = 0;
|
|
|
|
char *fbuf;
|
|
|
|
int fd;
|
|
|
|
|
|
|
|
if ((fd = open(path, O_RDONLY)) == -1) {
|
|
|
|
fprintf(stderr, "Error opening %s\n", path);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fstat(fd, &sb) == -1) {
|
|
|
|
fprintf(stderr, "Error getting size of %s\n", path);
|
|
|
|
close(fd);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
2019-11-23 22:48:25 +01:00
|
|
|
if (!(fbuf = calloc(1, sb.st_size+1))) {
|
2019-11-23 22:27:46 +01:00
|
|
|
fprintf(stderr, "Error allocating memory for %s\n", path);
|
|
|
|
close(fd);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (read(fd, fbuf, sb.st_size) != sb.st_size) {
|
|
|
|
fprintf(stderr, "Error reading %s\n", path);
|
|
|
|
free(fbuf);
|
|
|
|
close(fd);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = jshn_parse(fbuf);
|
|
|
|
free(fbuf);
|
|
|
|
close(fd);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int jshn_format_file(const char *path, bool no_newline, bool indent)
|
|
|
|
{
|
|
|
|
FILE *fp = NULL;
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
fp = fopen(path, "w");
|
|
|
|
if (!fp) {
|
|
|
|
fprintf(stderr, "Error opening %s\n", path);
|
|
|
|
return 3;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = jshn_format(no_newline, indent, fp);
|
|
|
|
fclose(fp);
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2011-05-23 22:21:27 +02:00
|
|
|
int main(int argc, char **argv)
|
|
|
|
{
|
2016-03-05 18:51:31 +01:00
|
|
|
extern char **environ;
|
2011-05-31 15:41:19 +02:00
|
|
|
bool no_newline = false;
|
2014-08-04 19:26:18 +02:00
|
|
|
bool indent = false;
|
2016-03-05 18:51:31 +01:00
|
|
|
struct env_var *vars;
|
|
|
|
int i;
|
2019-11-23 22:27:46 +01:00
|
|
|
int ret = 0;
|
2011-05-23 22:21:27 +02:00
|
|
|
int ch;
|
|
|
|
|
2016-03-05 18:51:31 +01:00
|
|
|
avl_init(&env_vars, avl_strcmp_var, false, NULL);
|
|
|
|
for (i = 0; environ[i]; i++);
|
|
|
|
|
|
|
|
vars = calloc(i, sizeof(*vars));
|
2016-06-21 17:19:10 +02:00
|
|
|
if (!vars) {
|
|
|
|
fprintf(stderr, "%m\n");
|
|
|
|
return -1;
|
|
|
|
}
|
2016-03-05 18:51:31 +01:00
|
|
|
for (i = 0; environ[i]; i++) {
|
|
|
|
char *c;
|
|
|
|
|
|
|
|
vars[i].avl.key = environ[i];
|
|
|
|
c = strchr(environ[i], '=');
|
|
|
|
if (!c)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
vars[i].val = c + 1;
|
|
|
|
avl_insert(&env_vars, &vars[i].avl);
|
|
|
|
}
|
|
|
|
|
2019-09-14 00:22:48 +02:00
|
|
|
while ((ch = getopt(argc, argv, "p:nir:R:o:w")) != -1) {
|
2011-05-23 22:21:27 +02:00
|
|
|
switch(ch) {
|
2012-12-16 17:46:02 +01:00
|
|
|
case 'p':
|
|
|
|
var_prefix = optarg;
|
|
|
|
var_prefix_len = strlen(var_prefix);
|
|
|
|
break;
|
2011-05-23 22:21:27 +02:00
|
|
|
case 'r':
|
2019-11-23 22:27:46 +01:00
|
|
|
ret = jshn_parse(optarg);
|
|
|
|
goto exit;
|
2018-01-18 21:21:09 +01:00
|
|
|
case 'R':
|
2019-11-23 22:27:46 +01:00
|
|
|
ret = jshn_parse_file(optarg);
|
|
|
|
goto exit;
|
2011-05-23 22:21:27 +02:00
|
|
|
case 'w':
|
2019-11-23 22:27:46 +01:00
|
|
|
ret = jshn_format(no_newline, indent, stdout);
|
|
|
|
goto exit;
|
2019-09-14 00:22:48 +02:00
|
|
|
case 'o':
|
2019-11-23 22:27:46 +01:00
|
|
|
ret = jshn_format_file(optarg, no_newline, indent);
|
|
|
|
goto exit;
|
2011-05-31 15:41:19 +02:00
|
|
|
case 'n':
|
|
|
|
no_newline = true;
|
|
|
|
break;
|
2014-08-04 19:26:18 +02:00
|
|
|
case 'i':
|
|
|
|
indent = true;
|
|
|
|
break;
|
2011-05-23 22:21:27 +02:00
|
|
|
default:
|
2019-11-19 12:34:14 +01:00
|
|
|
free(vars);
|
2011-05-23 22:21:27 +02:00
|
|
|
return usage(argv[0]);
|
|
|
|
}
|
|
|
|
}
|
2019-11-23 22:27:46 +01:00
|
|
|
|
2019-11-19 12:34:14 +01:00
|
|
|
free(vars);
|
2011-05-23 22:21:27 +02:00
|
|
|
return usage(argv[0]);
|
2019-11-23 22:27:46 +01:00
|
|
|
|
|
|
|
exit:
|
2019-11-19 12:34:14 +01:00
|
|
|
free(vars);
|
2019-11-23 22:27:46 +01:00
|
|
|
return ret;
|
2011-05-23 22:21:27 +02:00
|
|
|
}
|