[Cluster-devel] [PATCH 6/7] gfs2l: Read from stdin by default
Andrew Price
anprice at redhat.com
Mon May 20 11:37:15 UTC 2013
Instead of requiring -f - in order to read from stdin, do that by
default.
Signed-off-by: Andrew Price <anprice at 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
More information about the Cluster-devel
mailing list