From: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 08/10] util: drop "long" from usage helpers
Date: Mon, 15 Apr 2013 22:13:15 -0400 [thread overview]
Message-ID: <1366078397-14889-9-git-send-email-vapier@gentoo.org> (raw)
In-Reply-To: <1366078397-14889-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
Now that all utils have converted to the new usage framework, we can
rename to just plain "usage()" and avoid naming conflicts.
Signed-off-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
---
convert-dtsv0-lexer.l | 2 +-
dtc.c | 6 +++---
fdtdump.c | 2 +-
fdtget.c | 6 +++---
fdtput.c | 8 ++++----
util.c | 6 +++---
util.h | 18 +++++++++---------
7 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/convert-dtsv0-lexer.l b/convert-dtsv0-lexer.l
index e62d27a..8902648 100644
--- a/convert-dtsv0-lexer.l
+++ b/convert-dtsv0-lexer.l
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
}
}
if (argc < 2)
- long_usage("missing filename");
+ usage("missing filename");
for (i = 1; i < argc; i++) {
fprintf(stderr, "Converting %s from dts v0 to dts v1\n", argv[i]);
diff --git a/dtc.c b/dtc.c
index d0a1f2d..e3c9653 100644
--- a/dtc.c
+++ b/dtc.c
@@ -186,14 +186,14 @@ int main(int argc, char *argv[])
break;
case 'h':
- long_usage(NULL);
+ usage(NULL);
default:
- long_usage("unknown option");
+ usage("unknown option");
}
}
if (argc > (optind+1))
- long_usage("missing files");
+ usage("missing files");
else if (argc < (optind+1))
arg = "-";
else
diff --git a/fdtdump.c b/fdtdump.c
index c8a3ee7..c2f16ea 100644
--- a/fdtdump.c
+++ b/fdtdump.c
@@ -149,7 +149,7 @@ int main(int argc, char *argv[])
}
}
if (optind != argc - 1)
- long_usage("missing input filename");
+ usage("missing input filename");
file = argv[optind];
buf = utilfdt_read_len(file, &len);
diff --git a/fdtget.c b/fdtget.c
index 5008cc1..4377419 100644
--- a/fdtget.c
+++ b/fdtget.c
@@ -319,7 +319,7 @@ int main(int argc, char *argv[])
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
- long_usage("invalid type string");
+ usage("invalid type string");
break;
case 'p':
@@ -341,7 +341,7 @@ int main(int argc, char *argv[])
if (optind < argc)
filename = argv[optind++];
if (!filename)
- long_usage("missing filename");
+ usage("missing filename");
argv += optind;
argc -= optind;
@@ -352,7 +352,7 @@ int main(int argc, char *argv[])
/* Check for node, property arguments */
if (args_per_step == 2 && (argc % 2))
- long_usage("must have an even number of arguments");
+ usage("must have an even number of arguments");
if (do_fdtget(&disp, filename, argv, argc, args_per_step))
return 1;
diff --git a/fdtput.c b/fdtput.c
index f7bf56e..ac1d98c 100644
--- a/fdtput.c
+++ b/fdtput.c
@@ -327,7 +327,7 @@ int main(int argc, char *argv[])
case 't':
if (utilfdt_decode_type(optarg, &disp.type,
&disp.size))
- long_usage("invalid type string");
+ usage("invalid type string");
break;
case 'v':
@@ -339,16 +339,16 @@ int main(int argc, char *argv[])
if (optind < argc)
filename = argv[optind++];
if (!filename)
- long_usage("missing filename");
+ usage("missing filename");
argv += optind;
argc -= optind;
if (disp.oper == OPER_WRITE_PROP) {
if (argc < 1)
- long_usage("missing node");
+ usage("missing node");
if (argc < 2)
- long_usage("missing property");
+ usage("missing property");
}
if (do_fdtput(&disp, filename, argv, argc))
diff --git a/util.c b/util.c
index d9a823a..3055c16 100644
--- a/util.c
+++ b/util.c
@@ -393,9 +393,9 @@ void util_version(void)
exit(0);
}
-void util_long_usage(const char *errmsg, const char *synopsis,
- const char *short_opts, struct option const long_opts[],
- const char * const opts_help[])
+void util_usage(const char *errmsg, const char *synopsis,
+ const char *short_opts, struct option const long_opts[],
+ const char * const opts_help[])
{
FILE *fp = errmsg ? stderr : stdout;
const char a_arg[] = "<arg>";
diff --git a/util.h b/util.h
index 439b2b3..7b9a840 100644
--- a/util.h
+++ b/util.h
@@ -189,7 +189,7 @@ void util_version(void) __attribute__((noreturn));
* Show usage and exit
*
* This helps standardize the output of various utils. You most likely want
- * to use the long_usage() helper below rather than call this.
+ * to use the usage() helper below rather than call this.
*
* @param errmsg If non-NULL, an error message to display
* @param synopsis The initial example usage text (and possible examples)
@@ -197,9 +197,9 @@ void util_version(void) __attribute__((noreturn));
* @param long_opts The structure of long options
* @param opts_help An array of help strings (should align with long_opts)
*/
-void util_long_usage(const char *errmsg, const char *synopsis,
- const char *short_opts, struct option const long_opts[],
- const char * const opts_help[]) __attribute__((noreturn));
+void util_usage(const char *errmsg, const char *synopsis,
+ const char *short_opts, struct option const long_opts[],
+ const char * const opts_help[]) __attribute__((noreturn));
/**
* Show usage and exit
@@ -209,9 +209,9 @@ void util_long_usage(const char *errmsg, const char *synopsis,
*
* @param errmsg If non-NULL, an error message to display
*/
-#define long_usage(errmsg) \
- util_long_usage(errmsg, usage_synopsis, usage_short_opts, \
- usage_long_opts, usage_opts_help)
+#define usage(errmsg) \
+ util_usage(errmsg, usage_synopsis, usage_short_opts, \
+ usage_long_opts, usage_opts_help)
/**
* Call getopt_long() with standard options
@@ -241,8 +241,8 @@ void util_long_usage(const char *errmsg, const char *synopsis,
/* Helper for getopt case statements */
#define case_USAGE_COMMON_FLAGS \
- case 'h': long_usage(NULL); \
+ case 'h': usage(NULL); \
case 'V': util_version(); \
- case '?': long_usage("unknown option");
+ case '?': usage("unknown option");
#endif /* _UTIL_H */
--
1.8.1.2
next prev parent reply other threads:[~2013-04-16 2:13 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-16 2:13 [PATCH 00/10 v3] usage()/--help clean up & unification, and extend fdtdump Mike Frysinger
[not found] ` <1366078397-14889-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-16 2:13 ` [PATCH 01/10] utilfdt_read_err: use xmalloc funcs Mike Frysinger
2013-04-16 2:13 ` [PATCH 02/10] utilfdt_read: pass back up the length of data read Mike Frysinger
[not found] ` <1366078397-14889-3-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-19 0:49 ` David Gibson
2013-04-16 2:13 ` [PATCH 03/10] die: constify format string arg Mike Frysinger
2013-04-16 2:13 ` [PATCH 04/10] util_version: new helper for displaying version info Mike Frysinger
[not found] ` <1366078397-14889-5-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-19 0:50 ` David Gibson
[not found] ` <20130419005046.GL16400-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
2013-04-21 19:26 ` Jon Loeliger
[not found] ` <E1UTztj-0006SA-F8-CYoMK+44s/E@public.gmane.org>
2013-04-22 0:25 ` Mike Frysinger
[not found] ` <201304212025.47665.vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-22 15:37 ` Jon Loeliger
[not found] ` <E1UUIno-0004Ox-Dd-CYoMK+44s/E@public.gmane.org>
2013-04-22 15:54 ` Mike Frysinger
[not found] ` <201304221154.08100.vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-22 20:44 ` Jon Loeliger
[not found] ` <E1UUNba-0005oJ-Ur-CYoMK+44s/E@public.gmane.org>
2013-04-22 21:16 ` Mike Frysinger
2013-04-22 21:19 ` Mike Frysinger
[not found] ` <201304221719.42982.vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-29 10:55 ` David Gibson
2013-04-16 2:13 ` [PATCH 05/10] fdtdump: make usage a bit more friendly Mike Frysinger
[not found] ` <1366078397-14889-6-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-30 8:12 ` David Gibson
[not found] ` <20130430081219.GF20202-W9XWwYn+TF0XU02nzanrWNbf9cGiqdzd@public.gmane.org>
2013-05-13 1:45 ` David Gibson
2013-04-16 2:13 ` [PATCH 06/10] fdtdump: add a --scan option Mike Frysinger
[not found] ` <1366078397-14889-7-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-30 8:12 ` David Gibson
2013-04-16 2:13 ` [PATCH 07/10] dtc/fdt{get, put}/convert-dtsv0-lexer: convert to new usage helpers Mike Frysinger
[not found] ` <1366078397-14889-8-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-30 8:23 ` David Gibson
2013-04-16 2:13 ` Mike Frysinger [this message]
[not found] ` <1366078397-14889-9-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-30 8:12 ` [PATCH 08/10] util: drop "long" from " David Gibson
2013-04-16 2:13 ` [PATCH 09/10] util: add common ARRAY_SIZE define Mike Frysinger
[not found] ` <1366078397-14889-10-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-29 10:51 ` David Gibson
2013-04-16 2:13 ` [PATCH 10/10] fdtdump: add a debug mode Mike Frysinger
[not found] ` <1366078397-14889-11-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-30 8:13 ` David Gibson
-- strict thread matches above, loose matches on Subject: below --
2013-04-10 18:29 [PATCH 00/10 v2] usage()/--help clean up & unification Mike Frysinger
[not found] ` <1365618555-5893-1-git-send-email-vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-04-10 18:29 ` [PATCH 08/10] util: drop "long" from usage helpers Mike Frysinger
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=1366078397-14889-9-git-send-email-vapier@gentoo.org \
--to=vapier-abrp7r+bbdudnm+yrofe0a@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).