59c578f8a3461fdd887d4c7a74fa60d2d2e2e8db
larrym
  Thu Jan 5 15:05:54 2012 -0800
suppress too verbose messages in samtools >= 0.1.18; see redmine #6491
diff --git src/lib/bamFile.c src/lib/bamFile.c
index 15877bd..01356e5 100644
--- src/lib/bamFile.c
+++ src/lib/bamFile.c
@@ -55,30 +55,37 @@
 	return FALSE;
 	}
     free(idx); // Not freeMem, freez etc -- sam just uses malloc/calloc.
     return TRUE;
     }
 return FALSE;
 }
 
 samfile_t *bamOpen(char *fileOrUrl, char **retBamFileName)
 /* Return an open bam file, dealing with FUSE caching if need be. 
  * Return parameter if NON-null will return the file name after FUSing */
 {
 char *bamFileName = fileOrUrl;
 if (retBamFileName != NULL)
     *retBamFileName = bamFileName;
+
+#ifdef BAM_VERSION
+// suppress too verbose messages in samtools >= 0.1.18; see redmine #6491
+// This variable didn't exist in older versions of samtools (where BAM_VERSION wasn't defined).
+bam_verbose = 1;
+#endif
+
 samfile_t *fh = samopen(bamFileName, "rb", NULL);
 if (fh == NULL)
     {
     boolean usingUrl = (strstr(fileOrUrl, "tp://") || strstr(fileOrUrl, "https://"));
     struct dyString *urlWarning = dyStringNew(0);
     if (usingUrl)
 	{
 	dyStringAppend(urlWarning,
 		       ". If you are able to access the URL with your web browser, "
 		       "please try reloading this page.");
 	}
     errAbort("Failed to open %s%s", fileOrUrl, urlWarning->string);
     }
 return fh;
 }