From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: barebox@lists.infradead.org
Subject: [PATCH 3/8] command: allow runtime usage
Date: Mon, 16 Mar 2015 10:19:00 +0100 [thread overview]
Message-ID: <1426497545-24175-3-git-send-email-plagnioj@jcrosoft.com> (raw)
In-Reply-To: <1426497545-24175-1-git-send-email-plagnioj@jcrosoft.com>
This will allow as example to list the currently supported digest.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
common/command.c | 2 ++
include/command.h | 3 +++
2 files changed, 5 insertions(+)
diff --git a/common/command.c b/common/command.c
index 61191c2..dc2cb88 100644
--- a/common/command.c
+++ b/common/command.c
@@ -47,6 +47,8 @@ void barebox_cmd_usage(struct command *cmdtp)
puts(cmdtp->help);
putchar('\n');
}
+ if (cmdtp->usage)
+ cmdtp->usage();
#endif
}
EXPORT_SYMBOL(barebox_cmd_usage);
diff --git a/include/command.h b/include/command.h
index 5d5bf53..3aca1a9 100644
--- a/include/command.h
+++ b/include/command.h
@@ -54,6 +54,7 @@ struct command {
uint32_t group;
#ifdef CONFIG_LONGHELP
const char *help; /* Help message (long) */
+ void (*usage)(void);
#endif
}
#ifdef __x86_64__
@@ -115,8 +116,10 @@ static const __maybe_unused char cmd_##_name##_help[] =
#ifdef CONFIG_LONGHELP
#define BAREBOX_CMD_HELP(text) .help = text,
+#define BAREBOX_CMD_USAGE(fn) .usage = fn,
#else
#define BAREBOX_CMD_HELP(text)
+#define BAREBOX_CMD_USAGE(fn)
#endif
#define BAREBOX_CMD_GROUP(grp) .group = grp,
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2015-03-16 9:19 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-16 9:17 [PATCH 0/8 v2] prepare for rsa support Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:18 ` [PATCH 1/8] digest: add verify callback Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:18 ` [PATCH 2/8] command: rename digest.c to hashsum.c Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:19 ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2015-03-16 9:19 ` [PATCH 4/8] command: add generic digest command Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:19 ` [PATCH 5/8] digest: add digest callback Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:19 ` [PATCH 6/8] crypto: add pbkdf2 hmac key generator Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:19 ` [PATCH 7/8] password: add pbkdf2 support Jean-Christophe PLAGNIOL-VILLARD
2015-03-16 9:19 ` [PATCH 8/8] digest: allow algo to specify their length at runtime Jean-Christophe PLAGNIOL-VILLARD
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426497545-24175-3-git-send-email-plagnioj@jcrosoft.com \
--to=plagnioj@jcrosoft.com \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox