This changes the behavior of `get_free_unit` to simplify the handling of optional unit numbers.
This lays down the basis for the gray command-line interface. All options works but currently --units and -v/-q have no effect.