diff options
author | Andreas Fenkart <andreas.fenkart@digitalstrom.com> | 2015-12-09 12:13:24 (GMT) |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2016-02-08 15:10:31 (GMT) |
commit | 371ee13760b9e70d1a931afc643de3f4057b4a28 (patch) | |
tree | 3356168d73044c1c3ed383a1bcdb7b566ef98514 /tools/env/fw_env_main.c | |
parent | 07ce9440213f17893ff2438491d8395c26eb0ccd (diff) | |
download | u-boot-371ee13760b9e70d1a931afc643de3f4057b4a28.tar.xz |
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>
Diffstat (limited to 'tools/env/fw_env_main.c')
-rw-r--r-- | tools/env/fw_env_main.c | 31 |
1 files changed, 26 insertions, 5 deletions
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 @@ static struct option long_options[] = { {NULL, 0, NULL, 0} }; +struct common_args common_args; struct printenv_args printenv_args; struct setenv_args setenv_args; @@ -84,17 +85,27 @@ int parse_printenv_args(int argc, char *argv[]) { 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 parse_setenv_args(int argc, char *argv[]) { 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; |