| 1 | .TH fd_move 3 |
| 2 | .SH NAME |
| 3 | fd_move \- renumber a descriptor |
| 4 | .SH SYNTAX |
| 5 | .B #include <fd.h> |
| 6 | |
| 7 | int \fBfd_move\fP(\fIto\fR,\fIfrom\fR); |
| 8 | |
| 9 | int \fIto\fR; |
| 10 | .br |
| 11 | int \fIfrom\fR; |
| 12 | .SH DESCRIPTION |
| 13 | .B fd_move |
| 14 | moves |
| 15 | descriptor |
| 16 | .I from |
| 17 | to descriptor |
| 18 | .IR to . |
| 19 | If |
| 20 | .I to |
| 21 | was already open, |
| 22 | .B fd_move |
| 23 | closes it. |
| 24 | If the move is successful, |
| 25 | .B fd_move |
| 26 | closes |
| 27 | .IR from . |
| 28 | Exception: |
| 29 | if |
| 30 | .I to |
| 31 | and |
| 32 | .I from |
| 33 | are the same number, |
| 34 | .B fd_move |
| 35 | does nothing. |
| 36 | |
| 37 | .B fd_move |
| 38 | returns 0 on success, -1 on error. |
| 39 | .SH "SEE ALSO" |
| 40 | dup(2), |
| 41 | fd_copy(3) |