1 2 3 4 5 6 7 8 9 10 11 12
#ifndef F_DUPFD #include <fcntl.h> #endif int dup2 (old, new) int old, new; { (void) close(new); return fcntl(old, F_DUPFD, new); }