static const char *RCS ="$Id: _close.c,v 4.1 1994/09/29 23:09:02 jraja Exp $";
/*
 *	_close.c - close a file (SAS/C)
 *
 *	Copyright © 1994 AmiTCP/IP Group,
 *			 Network Solutions Development Inc.
 *			 All rights reserved.
 */
#define KERNEL
#define _INTERNAL_FILE	     /* to get a file definition */
#include <sys/types.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/file.h>
#include <bsdsocket.h>
#include <sys/syslog.h>

int __tcpclose(struct file *ufb)
{
  if (ufb->f_type != DTYPE_SOCKET) syslog(LOG_ERR,"__tcpclose found a nonsocket.");

  ufb->f_count--;

  if (ufb->f_count > 0) return 0;

  return CloseSocket((int)ufb->f_fh);
}

