Skip to content

tools: env: simplify argument parsing

Andreas Fenkart u-boot 2 versions – New

Get series with b4
b4 am 1448535154-6350-1-git-send-email-andreas.fenkart@dev.digitalstrom.org

Versions newest first · linked by author and title

  1. v2 Latest7 patches 0 repliesNew
  2. v15 patches 0 repliesSuperseded

Changes in v2 from the cover letter

- rebased on top of current master

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7tools: env validate: pass values as 0-based arraycommon/env_flags.c include/env_flags.h tools/env/fw_env.c+15 -120 replies
2/7tools: env: make parse_aes_key statelesstools/env/fw_env.c+6 -60 replies
3/7tools: env: introduce setenv/printenv argument structstools/env/fw_env.h tools/env/fw_env_main.c+84 -380 replies
4/7tools: env: parse aes key / suppress flag into argument structtools/env/fw_env.c tools/env/fw_env.h tools/env/fw_env_main.c+51 -570 replies
5/7tools: env: shift optind arguments and fix argument indicestools/env/fw_env.c tools/env/fw_env_main.c+15 -430 replies
6/7tools: env: factor out parse_common_argstools/env/fw_env_main.c+38 -250 replies
7/7tools: env: update usage stringstools/env/fw_env_main.c+75 -420 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [U-Boot] [PATCH v2 0/7] tools: env: simplify argument parsing

In it's current state paramter parsing is quite hard to understand since it happens in two places. One is using getopt at the beginning of main, the second is using adhoc parsing where the order of arguments is important.
This patch will parse arguments only in one place using getopt and store the parsed flags in a global struct.

v2:
- rebased on top of current master

Andreas Fenkart (7):
tools: env validate: pass values as 0-based array
tools: env: make parse_aes_key stateless
tools: env: introduce setenv/printenv argument structs
tools: env: parse aes key / suppress flag into argument struct
tools: env: shift optind arguments and fix argument indices
tools: env: factor out parse_common_args
tools: env: update usage strings

 common/env_flags.c      |  14 +--
 include/env_flags.h     |   2 +-
 tools/env/fw_env.c      | 127 ++++++------------------
 tools/env/fw_env.h      |  22 +++++
 tools/env/fw_env_main.c | 250 ++++++++++++++++++++++++++++++++++--------------
 5 files changed, 238 insertions(+), 177 deletions(-)
Signature · 1 line
2.6.2