[segyio] 348/376: Clarify catr documentation

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:56 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit a13510f6c71c07e9979530c2436c3317925a5fcd
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Wed Aug 16 13:51:47 2017 +0200

    Clarify catr documentation
---
 applications/segyio-catr.c | 46 ++++++++++++++++++++++------------------------
 man/segyio-catr.1          |  9 +++++----
 2 files changed, 27 insertions(+), 28 deletions(-)

diff --git a/applications/segyio-catr.c b/applications/segyio-catr.c
index 25f6f3a..b28115a 100644
--- a/applications/segyio-catr.c
+++ b/applications/segyio-catr.c
@@ -298,20 +298,20 @@ static int help() {
     puts( "Usage: segyio-catr [OPTION]... FILE\n"
           "Print specific trace headers from FILE\n"
           "\n"
-          "-t,  --trace=NUMBER      trace to print\n"
-          "-r,  --range=NUMBER      range of traces to print\n"
-          "-s,  --strict            fail on unreadable tracefields\n"
-          "-S,  --non-strict        don't fail on unreadable tracefields\n"
-          "                         this is the default behaviour\n"
-          "-n,  --segyio-names      print with segyio tracefield names\n"
-          "-v,  --verbose           increase verbosity\n"
-          "     --version           output version information and exit\n"
-          "     --help              display this help and exit\n"
+          "-t,  --trace=NUMBER          trace to print\n"
+          "-r,  --range START STOP STEP range of traces to print\n"
+          "-s,  --strict                fail on unreadable tracefields\n"
+          "-S,  --non-strict            don't fail on unreadable tracefields\n"
+          "                             this is the default behaviour\n"
+          "-n,  --segyio-names          print with segyio tracefield names\n"
+          "-v,  --verbose               increase verbosity\n"
+          "     --version               output version information and exit\n"
+          "     --help                  display this help and exit\n"
           "\n"
 
-          "The -r flag can takes up to three values; start, stop, step,\n"
+          "the -r flag can takes up to three values: start, stop, step\n"
           "where all values are defaulted to zero\n"
-          "Flags -r and -t can be called multiple times\n"
+          "flags -r and -t can be called multiple times\n"
         );
     return 0;
 }
@@ -355,10 +355,6 @@ static struct options parse_options( int argc, char** argv ){
     opts.strict = 0; opts.labels = su_labels;
     opts.errmsg = NULL;
 
-    struct options opthelp, optversion;
-    opthelp.help = 1; opthelp.errmsg = NULL;
-    optversion.version = 1, optversion.errmsg = NULL;
-
     static struct option long_options[] = {
         { "trace",          required_argument,  0, 't' },
         { "range",          required_argument,  0, 'r' },
@@ -385,8 +381,8 @@ static struct options parse_options( int argc, char** argv ){
        int ret;
        switch( c ) {
            case 0: break;
-           case 'h': return opthelp;
-           case 'V': return optversion;
+           case 'h': opts.help = 1;     return opts;
+           case 'V': opts.version = 1;  return opts;
            case 'v': ++opts.verbosity; break;
            case 's': opts.strict = 1; break;
            case 'S': opts.strict = 0; break;
@@ -425,16 +421,17 @@ static struct options parse_options( int argc, char** argv ){
                     return opts;
                }
 
-                // if sscanf found something it consumes 1 argument, and we won't have to rewind optind
+               // if sscanf found something it consumes 1 argument, and we
+               // won't have to rewind optind
                if( !ret ) optind--;
 
                for( int pos = ret; optind < argc && pos < 3; pos++, optind++ ) {
                     int val;
                     ret = parseint( argv[ optind ], &val );
-                    /* parseint returns 1 when the string contains more
-                     * than an int (or not an int at all)
-                     * we assume that the remaining range parameters
-                     * were defaulted and give control back to argument parsing
+                    /* parseint returns 1 when the string contains more than an
+                     * int (or not an int at all) we assume that the remaining
+                     * range parameters were defaulted and give control back to
+                     * argument parsing
                      *
                      * such invocations include:
                      *   segyio-catr -r 1 foo.sgy
@@ -450,13 +447,14 @@ static struct options parse_options( int argc, char** argv ){
 
                 done: ++opts.rsize; break;
 
-           default: return opthelp;
+           default: opts.help = 1; opts.errmsg = ""; return opts;
        }
     }
 
     if( argc - optind != 1 ) {
         errmsg( 0, "Wrong number of files" );
-        return opthelp;
+        opts.errmsg = "";
+        return opts;
     }
     opts.src = argv[ optind ];
 
diff --git a/man/segyio-catr.1 b/man/segyio-catr.1
index 3446187..9cd97d9 100644
--- a/man/segyio-catr.1
+++ b/man/segyio-catr.1
@@ -20,12 +20,13 @@ Mandatory arguments to long options are mandatory for short options too.
 
 .SH OPTIONS
 .TP
-.BR \-t ", " \-\-trace =\fINUMBER\fR
+.BR \-t ", " \-\-trace=\fINUMBER\fR
 trace(s) to print
 
 .TP
-.BR \-r ", " \-\-range=\fINUMBER\fR
-trace to print from
+.BR \-r ", " \-\-range \fISTART\fR [\fSTOP\fR \fISTEP\fR]
+range of trace(s) to print. \fISTOP\fR and \fISTEP\fR are optional, and
+defaults to \fISTART\fR and 1 respectively.
 
 .TP
 .BR \-s ", " \-\-strict
@@ -33,7 +34,7 @@ fail on unreadable tracefields
 
 .TP
 .BR \-S ", " \-\-non-strict
-don't fail on unreadable tracefields
+don't fail on unreadable fields
 this is the default behavior
 
 .TP

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list