3 * _close.c - close a file (SAS/C)
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
14 #include <proto/dos.h>
16 #include <bsdsocket.h>
24 * Check for the break signals
31 if ((ufb
= __chkufb(fd
)) == NULL
) {
32 /* __chkufb sets the errno to EBADF */
37 * Check if close is not needed
39 if ((ufb
->ufbflg
& (UFB_NC
| UFB_CLO
)) != UFB_NC
) {
42 * Empty flags mean empty ufb
44 if (ufb
->ufbflg
== 0) {
52 if (!(ufb
->ufbflg
& UFB_SOCK
) && ufb
->ufbfh
!= NULL
) {
56 * Remove the file if it was temporary
58 if (ufb
->ufbflg
& UFB_TEMP
&& ufb
->ufbfn
!= NULL
)
67 if (ufb
->ufbfn
!= NULL
) {
73 * Clear the flags to free this ufb
76 ufb
->ufbfh
= NULL
; /* just in case */
79 * closes the socket OR the file mark