home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1996 May / PCOnline_05_1996.bin / linux / source / y / bsdgames / bsd-game.000 / bsd-game / games / hunt / connect.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-09-21  |  885 b   |  42 lines

  1. /*
  2.  *  Hunt
  3.  *  Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
  4.  *  San Francisco, California
  5.  */
  6.  
  7. # include    "hunt.h"
  8. # include    <signal.h>
  9.  
  10. do_connect(name, team, enter_status)
  11. char    *name;
  12. char    team;
  13. long    enter_status;
  14. {
  15.     static long    uid;
  16.     static long    mode;
  17.     extern char    *ttyname();
  18.  
  19.     if (uid == 0)
  20.         uid = htonl(getuid());
  21.     (void) write(Socket, (char *) &uid, LONGLEN);
  22.     (void) write(Socket, name, NAMELEN);
  23.     (void) write(Socket, &team, 1);
  24.     enter_status = htonl(enter_status);
  25.     (void) write(Socket, (char *) &enter_status, LONGLEN);
  26.     (void) strcpy(Buf, ttyname(fileno(stderr)));
  27.     (void) write(Socket, Buf, NAMELEN);
  28. # ifdef INTERNET
  29.     if (Send_message != NULL)
  30.         mode = C_MESSAGE;
  31.     else
  32. # endif
  33. # ifdef MONITOR
  34.     if (Am_monitor)
  35.         mode = C_MONITOR;
  36.     else
  37. # endif
  38.         mode = C_PLAYER;
  39.     mode = htonl(mode);
  40.     (void) write(Socket, (char *) &mode, sizeof mode);
  41. }
  42.