summaryrefslogtreecommitdiffstats
path: root/hunt/hunt/connect.c
diff options
context:
space:
mode:
authormrg <mrg@NetBSD.org>1997-10-04 09:00:13 +0000
committermrg <mrg@NetBSD.org>1997-10-04 09:00:13 +0000
commite9152f6d21d5a8b1e02922e0fc95b71fc21cbd92 (patch)
tree3e1b32f0c0c61414ebd853c92584cd9d95a99acc /hunt/hunt/connect.c
parent6f367f8f8be268d527e585867c1c42ffbb07668c (diff)
downloadbsdgames-darwin-e9152f6d21d5a8b1e02922e0fc95b71fc21cbd92.tar.gz
bsdgames-darwin-e9152f6d21d5a8b1e02922e0fc95b71fc21cbd92.tar.zst
bsdgames-darwin-e9152f6d21d5a8b1e02922e0fc95b71fc21cbd92.zip
hunt version 1993-07-17
Diffstat (limited to 'hunt/hunt/connect.c')
-rw-r--r--hunt/hunt/connect.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/hunt/hunt/connect.c b/hunt/hunt/connect.c
new file mode 100644
index 00000000..587f8b40
--- /dev/null
+++ b/hunt/hunt/connect.c
@@ -0,0 +1,41 @@
+/*
+ * Hunt
+ * Copyright (c) 1985 Conrad C. Huang, Gregory S. Couch, Kenneth C.R.C. Arnold
+ * San Francisco, California
+ */
+
+# include "hunt.h"
+# include <signal.h>
+
+do_connect(name, team, enter_status)
+char *name;
+char team;
+long enter_status;
+{
+ static long uid;
+ static long mode;
+ extern char *ttyname();
+
+ if (uid == 0)
+ uid = htonl(getuid());
+ (void) write(Socket, (char *) &uid, LONGLEN);
+ (void) write(Socket, name, NAMELEN);
+ (void) write(Socket, &team, 1);
+ enter_status = htonl(enter_status);
+ (void) write(Socket, (char *) &enter_status, LONGLEN);
+ (void) strcpy(Buf, ttyname(fileno(stderr)));
+ (void) write(Socket, Buf, NAMELEN);
+# ifdef INTERNET
+ if (Send_message != NULL)
+ mode = C_MESSAGE;
+ else
+# endif
+# ifdef MONITOR
+ if (Am_monitor)
+ mode = C_MONITOR;
+ else
+# endif
+ mode = C_PLAYER;
+ mode = htonl(mode);
+ (void) write(Socket, (char *) &mode, sizeof mode);
+}