Add buffered low-level input/output streams

This hFILE can be used inside htsFile etc to abstract away local files
vs. ftp/http URLs, etc, and also eventually gzip compression of text
files and potentially also BGZF.  By funnelling all I/O through our
own functions (the various hFILE backends) we have a chance to ensure
we handle I/O errors correctly.  This interface also provides hpeek(),
which enables us to sniff file formats even on pipes and similar.

Eventually hfile_net.c could be rewritten to use libcurl or its own code
instead of knetfile.  Other backends (such as one for iRODS) could also
be of interest.
Warn if hFILE function return statuses are ignored

Ignoring the return codes from hread()/hwrite() etc leads to reliability
problems as failures in writing data will not be reported to the user.
Especially because this is internal code, use attributes to cause
compilation warnings if the error returns from these functions are
not checked.

Eventually we may have a thin hts_types.h or hts_utils.h header or
similar, to which the definition of HTS_RESULT_USED should migrate.

For now, ignoring errors from hgetc(), hputc(), and hputs() is permitted
as one may like to batch up the error checking up for these, but this
may be revisited later.
Refactoring [minor]

Move hinit_buffer() and hclose() to be alongside related buffer-using
functions, and factor out the fd_backend's fstat(2)s into a new function.
Add hseek() and htell() test cases

Test the interaction between buffering and seeking (which requires
flushing or discarding buffers), and that htell()'s reported position
is kept in sync in spite of buffering.

It remains to add tests for interleaved reading and writing on files
opened for update, but at present no htslib code uses that anyway.
Flush or discard the buffer in hseek()

The hseek() function must flush the write buffer before seeking, and
discard the previous read buffer after a successful seek.  It must then
leave an empty buffer suitable for either reading or writing (in the
case of files opened for update).

So that the same buffer value can represent both an empty read buffer
and an empty write buffer, we've replaced capacity by limit and changed
the available write space from [begin,end) to [begin,limit).

Also added hclearerr() function.  Possibly this should also clear at_eof,
although that doesn't exactly play the role of a stdio-style EOF indicator.
Maintain our own hFILE offset within the stream

Code using htell() expects to be able to call it a lot, so causing an
lseek(2) system call each time is not ideal.  Further, lseek(2) gives the
file position of the end/start of the read/write buffer (respectively),
so needs correcting to get the proper logical file position anyway.

With this change, hFILE_backend::tell() is no longer needed.
Add hdestroy_buffer() for use in hopen_*() cleaning up
BGZF worker threads do no I/O themselves

Replace worker_t::fp with just the needed item (compress_level), to
ensure that worker threads continue to not do I/O on the BGZF file
themselves.  The upcoming hFILE is (currently) not thread-safe for
multiple threads working on the same hFILE.

Also make BGZF::mt a pointer to the correct incomplete struct rather
than a void*, so casts are no longer needed with it.
Use hFILE underneath BGZF, and add bgzf_hopen()

Replace the _bgzf_open/etc macros (which may be either knet_open/etc
or fopen/etc depending on _USE_KNETFILE) for reading, and fopen/etc
for writing, with direct use of hopen/etc functions.

When reading, all opening functions bgzf_open(), bgzf_dopen(), and
bgzf_hopen() now simply peek at the first two bytes of the input file
to determine whether it is GZIP-compressed.
Add hfile*.[ch] to $(HTSLIB_ALL)
Merge branch 'io' into develop

Adds hFILE, and changes bgzf.c to use it as its underlying file stream.
Fix vcf_sweep.h dependencies

Also test-vcf-sweep is a built target to be ignored and cleaned.
Also run our tests