libc: basic, incomplete implementation of freopen