#include "fw_env.h"
+struct env_opts default_opts = {
+#ifdef CONFIG_FILE
+ .config_file = CONFIG_FILE
+#endif
+};
+
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define min(x, y) ({ \
char *env, *nxt;
int i, rc = 0;
+ if (!opts)
+ opts = &default_opts;
+
if (fw_env_open(opts))
return -1;
{
int ret;
+ if (!opts)
+ opts = &default_opts;
+
if (opts->aes_flag) {
ret = env_aes_cbc_crypt(environment.data, 1,
opts->aes_key);
char *value = NULL;
int valc;
+ if (!opts)
+ opts = &default_opts;
+
if (argc < 1) {
fprintf(stderr, "## Error: variable name missing\n");
errno = EINVAL;
int len;
int ret = 0;
+ if (!opts)
+ opts = &default_opts;
+
if (fw_env_open(opts)) {
fprintf(stderr, "Error: environment not initialized\n");
return -1;
struct env_image_single *single;
struct env_image_redundant *redundant;
+ if (!opts)
+ opts = &default_opts;
+
if (parse_config(opts)) /* should fill envdevices */
return -1;
{
struct stat st;
-#if defined(CONFIG_FILE)
- if (!common_args.config_file)
- common_args.config_file = CONFIG_FILE;
+ if (!opts)
+ opts = &default_opts;
+#if defined(CONFIG_FILE)
/* Fills in DEVNAME(), ENVSIZE(), DEVESIZE(). Or don't. */
if (get_config(opts->config_file)) {
fprintf(stderr, "Cannot parse config file '%s': %m\n",