home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff294.lzh / DNet / amiga / lib / dlisten.c < prev    next >
C/C++ Source or Header  |  1989-12-11  |  420b  |  24 lines

  1.  
  2. /*
  3.  *  DListen.c
  4.  */
  5.  
  6. #include "lib.h"
  7.  
  8. PORT *
  9. DListen(portnum)
  10. uword portnum;
  11. {
  12.     PORT *port = NULL;
  13.     char *ptr;
  14.  
  15.     ptr = AllocMem(NAMELEN, MEMF_PUBLIC);   /*  memory the the name     */
  16.     sprintf(ptr, NAMEPAT, portnum);
  17.     Forbid();                               /*  task-atomic operation   */
  18.     if (FindPort(ptr) || !(port = CreatePort(ptr,0)))
  19.     FreeMem(ptr, NAMELEN);
  20.     Permit();
  21.     return(port);
  22. }
  23.  
  24.