Makes -r and -R read group filtering options both use settings.rghash

Changes the option handling so -r and -R both use settings.rghash instead
or the -r option being stored in a string that then has to be checked
separately.  The code to add the hash entires is also moved into the
option handling loop, so it is possible to have more that one -r or -R
on the command line.  The set of read groups output will be the union of
all the groups requested.  As -r uses the hash, drop_rg now gets called
so unwanted groups are removed from the header.  This fixes issue #152.

Alter process_aln so that read group filtering will only make it return if
the alignment has been filtered out (previously it would return from the
read group filter at this point in either case).  This means other filters
still have a chance to run after the read group one, and fixes issue #153.
Ensures non-zero exit if -r / -R options fail to work.

Does so by explicitly setting ret = 1 rather than just dumping core by
trying to call sam_close on a NULL pointer.
Extant code in sam_view.c does not use Yoda conditions
Merge read group filtering changes (PR #164)

Fixes #152 (-r should filter out non-selected @RG headers).
Fixes #153 (-r/-R shouldn't deactivate subsequent filters).
Merge pull request #174 from mp15/stats

Convert samtools stats to htslib and add some tests
Fix compiler warning in stats

Change fileno((FILE *)stdin) to STDIN_FILENO.
Add include <unistd.h> for isatty(int) we lost it when I stopped
including sam.h

Signed-off-by: Martin O. Pollard <mp15@sanger.ac.uk>