tools: env: parse aes key / suppress flag into argument struct
disabled original parsing, but not yet removed since the
argument indexing needs to be fixed
Signed-off-by: Andreas Fenkart <andreas.fenkart@digitalstrom.com>
diff --git a/tools/env/fw_env_main.c b/tools/env/fw_env_main.c
index 0c9f918..b68f1bf 100644
--- a/tools/env/fw_env_main.c
+++ b/tools/env/fw_env_main.c
@@ -45,6 +45,7 @@
{NULL, 0, NULL, 0}
};
+struct common_args common_args;
struct printenv_args printenv_args;
struct setenv_args setenv_args;
@@ -84,17 +85,27 @@
{
int c;
+#ifdef CONFIG_FILE
+ common_args.config_file = CONFIG_FILE;
+#endif
+
while ((c = getopt_long (argc, argv, "a:c:ns:h",
long_options, NULL)) != EOF) {
switch (c) {
case 'a':
- /* AES key, handled later */
+ if (parse_aes_key(optarg, common_args.aes_key)) {
+ fprintf(stderr, "AES key parse error\n");
+ return EXIT_FAILURE;
+ }
+ common_args.aes_flag = 1;
break;
+#ifdef CONFIG_FILE
case 'c':
- /* handled later */
+ common_args.config_file = optarg;
break;
+#endif
case 'n':
- /* handled in fw_printenv */
+ printenv_args.name_suppress = 1;
break;
case 'h':
usage();
@@ -113,15 +124,25 @@
{
int c;
+#ifdef CONFIG_FILE
+ common_args.config_file = CONFIG_FILE;
+#endif
+
while ((c = getopt_long (argc, argv, "a:c:ns:h",
long_options, NULL)) != EOF) {
switch (c) {
case 'a':
- /* AES key, handled later */
+ if (parse_aes_key(optarg, common_args.aes_key)) {
+ fprintf(stderr, "AES key parse error\n");
+ return EXIT_FAILURE;
+ }
+ common_args.aes_flag = 1;
break;
+#ifdef CONFIG_FILE
case 'c':
- /* handled later */
+ common_args.config_file = optarg;
break;
+#endif
case 's':
setenv_args.script_file = optarg;
break;