From: Andrew Price <anprice@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [PATCH 6/7] gfs2l: Read from stdin by default
Date: Mon, 20 May 2013 12:37:15 +0100 [thread overview]
Message-ID: <1369049836-8204-6-git-send-email-anprice@redhat.com> (raw)
In-Reply-To: <1369049836-8204-1-git-send-email-anprice@redhat.com>
Instead of requiring -f - in order to read from stdin, do that by
default.
Signed-off-by: Andrew Price <anprice@redhat.com>
---
gfs2/libgfs2/gfs2l.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/gfs2/libgfs2/gfs2l.c b/gfs2/libgfs2/gfs2l.c
index 9fc647a..e58c827 100644
--- a/gfs2/libgfs2/gfs2l.c
+++ b/gfs2/libgfs2/gfs2l.c
@@ -9,7 +9,7 @@ static void usage(const char *cmd)
printf("Usage: %s [options] <fs_path>\n", cmd);
printf("Available options:\n");
printf(" -h Print this help message and exit\n");
- printf(" -f <script_path> Path to script file or '-' for stdin\n");
+ printf(" -f <script_path> Path to script file or '-' for stdin (the default)\n");
printf(" -T Print a list of gfs2 structure types and exit\n");
printf(" -F <type> Print a list of fields belonging to a type and exit\n");
}
@@ -55,12 +55,11 @@ static void print_fields(const char *name)
static int getopts(int argc, char *argv[], struct cmdopts *opts)
{
int opt;
+ opts->src = stdin;
while ((opt = getopt(argc, argv, "F:f:hT")) != -1) {
switch (opt) {
case 'f':
- if (!strcmp("-", optarg)) {
- opts->src = stdin;
- } else {
+ if (strcmp("-", optarg)) {
opts->src = fopen(optarg, "r");
if (opts->src == NULL) {
perror("Failed to open source file");
--
1.8.1.4
next prev parent reply other threads:[~2013-05-20 11:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-20 11:37 [Cluster-devel] [PATCH 1/7] gfs2-utils build: Fix reporting lack of check Andrew Price
2013-05-20 11:37 ` [Cluster-devel] [PATCH 2/7] gfs2l: Improve usage message and opt handling Andrew Price
2013-05-20 11:37 ` [Cluster-devel] [PATCH 3/7] gfs2l: Enable setting the type of a block Andrew Price
2013-05-20 11:37 ` [Cluster-devel] [PATCH 4/7] gfs2l: Add hash comments Andrew Price
2013-05-20 11:37 ` [Cluster-devel] [PATCH 5/7] gfs2l: Add options to print block types and fields Andrew Price
2013-05-20 11:37 ` Andrew Price [this message]
2013-05-20 11:37 ` [Cluster-devel] [PATCH 7/7] gfs2l: Improve grammar layout and path parsing Andrew Price
2013-05-20 12:08 ` [Cluster-devel] [PATCH 1/7] gfs2-utils build: Fix reporting lack of check Steven Whitehouse
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=1369049836-8204-6-git-send-email-anprice@redhat.com \
--to=anprice@redhat.com \
/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).