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>
This commit is contained in:
Mike Frysinger 2013-05-24 18:02:35 +10:00 committed by David Gibson
parent fdc7387845
commit 03449b84c8
5 changed files with 131 additions and 127 deletions

View file

@ -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]);