dup_bio_* and bio_open_* are utility functions and belong in apps.c