diff options
author | Mike Frysinger <vapier@gentoo.org> | 2013-05-24 18:02:35 +1000 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2013-05-24 18:20:53 +1000 |
commit | 03449b84c8f9aee2bf2f438bec2c2ec4606bea48 (patch) | |
tree | 1448207a54fe8f460429fa462291f0cb9c8de783 /convert-dtsv0-lexer.l | |
parent | fdc7387845420168ee5dd479fbe4391ff93bddab (diff) | |
download | dtc-03449b84c8f9aee2bf2f438bec2c2ec4606bea48.tar.gz |
dtc/fdt{get, put}/convert-dtsv0-lexer: convert to new usage helpers
This helps standardize the flag processing and the usage screens.
Only lightly tested; would be great if someone who uses these utils
could double check.
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'convert-dtsv0-lexer.l')
-rw-r--r-- | convert-dtsv0-lexer.l | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/convert-dtsv0-lexer.l b/convert-dtsv0-lexer.l index 89d540a..e62d27a 100644 --- a/convert-dtsv0-lexer.l +++ b/convert-dtsv0-lexer.l @@ -194,11 +194,15 @@ const struct { } %% -static void usage(void) -{ - fprintf(stderr, "convert-dtsv0 <v0 dts file>...\n"); - exit(3); -} +/* Usage related data. */ +static const char usage_synopsis[] = "convert-dtsv0 [options] <v0 dts file>..."; +static const char usage_short_opts[] = "" USAGE_COMMON_SHORT_OPTS; +static struct option const usage_long_opts[] = { + USAGE_COMMON_LONG_OPTS +}; +static const char * const usage_opts_help[] = { + USAGE_COMMON_OPTS_HELP +}; static void convert_file(const char *fname) { @@ -226,10 +230,16 @@ static void convert_file(const char *fname) int main(int argc, char *argv[]) { + int opt; int i; + while ((opt = util_getopt_long()) != EOF) { + switch (opt) { + case_USAGE_COMMON_FLAGS + } + } if (argc < 2) - usage(); + long_usage("missing filename"); for (i = 1; i < argc; i++) { fprintf(stderr, "Converting %s from dts v0 to dts v1\n", argv[i]); |