[med-svn] [htslib] 03/13: Use getopt.h's descriptive constants in long options array

Andreas Tille tille at debian.org
Sat Jan 30 13:23:56 UTC 2016


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

tille pushed a commit to branch master
in repository htslib.

commit 0382edf813e345e83133372b811a2d901590d061
Author: John Marshall <jm18 at sanger.ac.uk>
Date:   Sun Jan 3 09:31:21 2016 +1300

    Use getopt.h's descriptive constants in long options array
---
 bgzip.c | 24 ++++++++++++------------
 tabix.c | 36 ++++++++++++++++++------------------
 2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/bgzip.c b/bgzip.c
index 101d8d0..f90f1fc 100644
--- a/bgzip.c
+++ b/bgzip.c
@@ -91,19 +91,19 @@ int main(int argc, char **argv)
     char *index_fname = NULL;
     int threads = 1;
 
-    static struct option loptions[] =
+    static const struct option loptions[] =
     {
-        {"help",0,0,'h'},
-        {"offset",1,0,'b'},
-        {"stdout",0,0,'c'},
-        {"decompress",0,0,'d'},
-        {"force",0,0,'f'},
-        {"index",0,0,'i'},
-        {"index-name",1,0,'I'},
-        {"reindex",0,0,'r'},
-        {"size",1,0,'s'},
-        {"threads",1,0,'@'},
-        {0,0,0,0}
+        {"help", no_argument, NULL, 'h'},
+        {"offset", required_argument, NULL, 'b'},
+        {"stdout", no_argument, NULL, 'c'},
+        {"decompress", no_argument, NULL, 'd'},
+        {"force", no_argument, NULL, 'f'},
+        {"index", no_argument, NULL, 'i'},
+        {"index-name", required_argument, NULL, 'I'},
+        {"reindex", no_argument, NULL, 'r'},
+        {"size", required_argument, NULL, 's'},
+        {"threads", required_argument, NULL, '@'},
+        {NULL, 0, NULL, 0}
     };
 
     compress = 1; pstdout = 0; start = 0; size = -1; end = -1; is_forced = 0;
diff --git a/tabix.c b/tabix.c
index 6859068..63bf458 100644
--- a/tabix.c
+++ b/tabix.c
@@ -372,25 +372,25 @@ int main(int argc, char *argv[])
     args_t args;
     memset(&args,0,sizeof(args_t));
 
-    static struct option loptions[] =
+    static const struct option loptions[] =
     {
-        {"help",0,0,'h'},
-        {"regions",1,0,'R'},
-        {"targets",1,0,'T'},
-        {"csi",0,0,'C'},
-        {"zero-based",0,0,'0'},
-        {"print-header",0,0,'h'},
-        {"only-header",0,0,'H'},
-        {"begin",1,0,'b'},
-        {"comment",1,0,'c'},
-        {"end",1,0,'e'},
-        {"force",0,0,'f'},
-        {"preset",1,0,'p'},
-        {"sequence",1,0,'s'},
-        {"skip-lines",1,0,'S'},
-        {"list-chroms",0,0,'l'},
-        {"reheader",1,0,'r'},
-        {0,0,0,0}
+        {"help", no_argument, NULL, 'h'},
+        {"regions", required_argument, NULL, 'R'},
+        {"targets", required_argument, NULL, 'T'},
+        {"csi", no_argument, NULL, 'C'},
+        {"zero-based", no_argument, NULL, '0'},
+        {"print-header", no_argument, NULL, 'h'},
+        {"only-header", no_argument, NULL, 'H'},
+        {"begin", required_argument, NULL, 'b'},
+        {"comment", required_argument, NULL, 'c'},
+        {"end", required_argument, NULL, 'e'},
+        {"force", no_argument, NULL, 'f'},
+        {"preset", required_argument, NULL, 'p'},
+        {"sequence", required_argument, NULL, 's'},
+        {"skip-lines", required_argument, NULL, 'S'},
+        {"list-chroms", no_argument, NULL, 'l'},
+        {"reheader", required_argument, NULL, 'r'},
+        {NULL, 0, NULL, 0}
     };
 
     char *tmp;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/htslib.git



More information about the debian-med-commit mailing list