Gitweb: http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=1478c07d649... Commit: 1478c07d6490490ddb10be606760208243cb0bbd Parent: b6fa8428884dcdc33a84bb880ee7dad85a42040c Author: Andrew Price anprice@redhat.com AuthorDate: Sat May 18 22:36:10 2013 +0100 Committer: Andrew Price anprice@redhat.com CommitterDate: Sat May 18 22:36:10 2013 +0100
gfs2l: Read from stdin by default
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 files 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");
cluster-commits@lists.fedorahosted.org