commit 047847ce94d14bb964b4b2f5e59964caf38f9c5e
Author: John Marshall <jmarshall@hey.com>
Date:   Tue Jan 19 10:14:58 2021 +0000

    Minimal change to make htsutil a bedtools subcommand

diff --git a/Makefile b/Makefile
index a3b3baa4..c536a624 100644
--- a/Makefile
+++ b/Makefile
@@ -130,11 +130,11 @@ ALL_LDFLAGS  = $(BT_LDFLAGS) $(LDFLAGS)
 ALL_LIBS     = $(BT_LIBS) $(LIBS)
 
 
-all: print_banner $(BIN_DIR)/bedtools $(BIN_DIR)/intersectBed test/htsutil
+all: print_banner $(BIN_DIR)/bedtools $(BIN_DIR)/intersectBed
 
 static: print_banner $(BIN_DIR)/bedtools.static
 
-BUILT_OBJECTS = $(OBJ_DIR)/bedtools.o
+BUILT_OBJECTS = $(OBJ_DIR)/bedtools.o $(OBJ_DIR)/htsutil.o
 # Include all the Makefile fragments, which add to $(BUILT_OBJECTS)
 include $(patsubst %,%/Makefile.frag,$(SUBDIRS) $(UTIL_SUBDIRS))
 
diff --git a/src/bedtools.cpp b/src/bedtools.cpp
index 0bccebb7..a349cc64 100644
--- a/src/bedtools.cpp
+++ b/src/bedtools.cpp
@@ -86,6 +86,7 @@ int window_main(int argc, char* argv[]); //
 int windowmaker_main(int argc, char* argv[]); //
 int bedtools_help(void);
 int bedtools_faq(void);
+int htsutil_main(int argc, char **argv);
 
 const char* cram_reference = NULL;
 
@@ -174,6 +175,7 @@ int main(int argc, char *argv[])
     else if (subCmd == "links")       return links_main(argc-1, argv+1);
     else if (subCmd == "makewindows") return windowmaker_main(argc-1, argv+1);
     else if (subCmd == "expand")      return expand_main(argc-1, argv+1);
+    else if (subCmd == "htsutil")     return htsutil_main(argc-1, argv+1);
     else if (subCmd == "regresstest")  return regress_test_main(argc, argv); //this command does need all the orig args.
     // help
     else if (subCmd == "-h" || subCmd == "--help" ||
diff --git a/src/htsutil.cpp b/src/htsutil.cpp
index c1cbcf40..27711f89 100644
--- a/src/htsutil.cpp
+++ b/src/htsutil.cpp
@@ -127,7 +127,7 @@ int index(const char *fname, bool csi)
     return 0;
 }
 
-int main(int argc, char **argv)
+int htsutil_main(int argc, char **argv)
 {
     std::string cmd = (argc >= 2)? argv[1] : "--help";
     const char *src = (argc >= 3)? argv[2] : "-";
