Add sam_open_mode() API function

Aids in parsing options like -Ocram.  Requires documentation, but we'll
add that when we're sure the API is stable (in particular, having the
caller pre-supply the "w" is perhaps not ideal).
Remove val_unused -- use HTS_UNUSED instead

This macro is in the HTS namespace, so less collision-prone.