home *** CD-ROM | disk | FTP | other *** search
/ ftp.ncftp.com / ftp.ncftp.com.zip / ftp.ncftp.com / ncftp / older_versions / ncftp-3.2.2-src.tar.bz2 / ncftp-3.2.2-src.tar / ncftp-3.2.2 / libncftp / u_shutdownci.c < prev    next >
C/C++ Source or Header  |  2005-01-01  |  931b  |  45 lines

  1. /* u_shutdownci.c
  2.  *
  3.  * Copyright (c) 1996-2005 Mike Gleason, NcFTP Software.
  4.  * All rights reserved.
  5.  *
  6.  */
  7.  
  8. #include "syshdrs.h"
  9. #ifdef PRAGMA_HDRSTOP
  10. #    pragma hdrstop
  11. #endif
  12.  
  13.  
  14.  
  15. void
  16. FTPShutdownHost(const FTPCIPtr cip)
  17. {
  18. #if defined(SIGPIPE) && !defined(NO_SIGNALS)
  19.     FTPSigProc osigpipe;
  20. #endif
  21.  
  22.     if (cip == NULL)
  23.         return;
  24.     if (strcmp(cip->magic, kLibraryMagic))
  25.         return;
  26.  
  27. #if defined(SIGPIPE) && !defined(NO_SIGNALS)
  28.     osigpipe = signal(SIGPIPE, (FTPSigProc) SIG_IGN);
  29. #endif
  30.  
  31.     /* Linger could cause close to block, so unset it. */
  32.     if (cip->dataSocket != kClosedFileDescriptor)
  33.         (void) SetSocketLinger(cip->dataSocket, 0, 0);
  34.     CloseDataConnection(cip);    /* Shouldn't be open normally. */
  35.  
  36.     /* Linger should already be turned off for this. */
  37.     FTPCloseControlConnection(cip);
  38.  
  39.     FTPDeallocateHost(cip);
  40.  
  41. #if defined(SIGPIPE) && !defined(NO_SIGNALS)
  42.     (void) signal(SIGPIPE, (FTPSigProc) osigpipe);
  43. #endif
  44. }    /* FTPShutdownHost */
  45.