home *** CD-ROM | disk | FTP | other *** search
/ Gold Fish 3 / goldfish_volume_3.bin / files / comm / tcp / amitcp / src / l / inet-handler / cleanup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-04-05  |  1.2 KB  |  65 lines

  1. /*
  2.  * cleanup.c
  3.  *
  4.  * Author: Tomi Ollila <too@cs.hut.fi>
  5.  *
  6.  *     Copyright (c) 1993 Tomi Ollila
  7.  *         All rights reserved
  8.  *
  9.  * Created: Thu Nov  4 21:17:14 1993 too
  10.  * Last modified: Sun Nov 14 17:42:26 1993 too
  11.  *
  12.  * HISTORY
  13.  * $Log: cleanup.c,v $
  14.  * Revision 1.1  1993/11/17  11:47:44  too
  15.  * Initial revision
  16.  *
  17.  */
  18.  
  19. #if 0 && (__GNUC__ < 2) && (__SASC < 6) || !defined (AMIGA)
  20. #error this program compiles only with amiga, gcc v2.x or sas/c version 6.x
  21. #endif
  22.  
  23. #include <exec/types.h>
  24. #include <exec/nodes.h>
  25. #include <exec/ports.h>
  26. #include <dos/dos.h>
  27. #include <dos/dosextens.h>
  28.  
  29. #include "global.h"
  30.  
  31. #define BSDSOCKET_H /* defining BSDSOCKET_H inhibitis automatic inline incl.*/
  32. #include <sys/types.h>
  33. #include <sys/socket.h>
  34. #include <sys/ioctl.h>
  35.  
  36. #include "system_includes.h"
  37. #include "applport.h"
  38. #include "handler.h"
  39. #include "cleanup.h"
  40.  
  41. #define RFI ->
  42.  
  43. int clean(struct CleanUp * CU, int retval)
  44. {
  45.   if (SocketBase)
  46.     CloseLibrary(SocketBase);
  47.   
  48.   CloseLibrary((struct Library *)DOSBase);
  49.  
  50.   if (applsigbit != -1)
  51.     FreeSignal(applsigbit);
  52.  
  53.   if (timermsgport)
  54.     DeleteMsgPort(timermsgport);
  55.  
  56.   /*
  57.    * itr structure holds information of timer.device.
  58.    */
  59.   if (itr) {
  60.     CloseDevice(itr);
  61.     FreeMem(itr, sizeof *itr);
  62.   }
  63.   return retval;
  64. }
  65.