3 * _dup2.c - duplicate a file descriptor (SAS/C)
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
14 #define USE_BUILTIN_MATH
18 #include <proto/dos.h>
20 #include <bsdsocket.h>
22 /****** net.lib/dup2 **********************************************************
25 *******************************************************************************
30 __dup2(int old_fd
, int new_fd
)
36 * Check if there is nothing to do
42 * Check for the break signals
49 * Find the ufb * for the old FD
51 if ((ufb
= __chkufb(old_fd
)) == NULL
) {
59 * The brain dead UFB system won't allow duplicating ordinary files
61 if ((ufbflg
& UFB_SOCK
) == UFB_SOCK
) {
62 return Dup2Socket(old_fd
, new_fd
);