fd_copy.3 (571B)
1 .TH fd_copy 3 2 .SH NAME 3 fd_copy \- duplicate a descriptor 4 .SH SYNTAX 5 .B #include <fd.h> 6 7 int \fBfd_copy\fP(\fIto\fR,\fIfrom\fR); 8 9 int \fIto\fR; 10 .br 11 int \fIfrom\fR; 12 .SH DESCRIPTION 13 .B fd_copy 14 copies 15 descriptor 16 .I from 17 to descriptor 18 .IR to . 19 If 20 .I to 21 was already open, 22 .B fd_copy 23 closes it. 24 .B fd_copy 25 always leaves 26 .I from 27 intact; 28 if 29 .I to 30 and 31 .I from 32 are the same number, 33 .B fd_copy 34 does nothing. 35 36 .B fd_copy 37 returns 0 on success, -1 on error. 38 .B fd_copy 39 does not guarantee that 40 .I to 41 will remain open, if it was open, in case of error. 42 .SH "SEE ALSO" 43 dup(2), 44 fd_move(3)