Module Name:    src
Committed By:   dholland
Date:           Sun Mar 30 02:58:25 UTC 2014

Modified Files:
        src/games/hunt/hunt: hunt.c hunt_private.h server.c

Log Message:
unexpose some globals that server.c previously required


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/games/hunt/hunt/hunt.c
cvs rdiff -u -r1.4 -r1.5 src/games/hunt/hunt/hunt_private.h
cvs rdiff -u -r1.3 -r1.4 src/games/hunt/hunt/server.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/games/hunt/hunt/hunt.c
diff -u src/games/hunt/hunt/hunt.c:1.48 src/games/hunt/hunt/hunt.c:1.49
--- src/games/hunt/hunt/hunt.c:1.48	Sun Mar 30 02:26:09 2014
+++ src/games/hunt/hunt/hunt.c	Sun Mar 30 02:58:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hunt.c,v 1.48 2014/03/30 02:26:09 dholland Exp $	*/
+/*	$NetBSD: hunt.c,v 1.49 2014/03/30 02:58:25 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -32,7 +32,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: hunt.c,v 1.48 2014/03/30 02:26:09 dholland Exp $");
+__RCSID("$NetBSD: hunt.c,v 1.49 2014/03/30 02:58:25 dholland Exp $");
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -81,9 +81,9 @@ char Buf[BUFSIZ];
 #ifdef INTERNET
 char *Sock_host;
 static char *use_port;
-bool Query_driver = false;
+static bool Query_driver = false;
 char *Send_message = NULL;
-bool Show_scores = false;
+static bool Show_scores = false;
 #endif
 
 SOCKET Daemon;
@@ -217,15 +217,17 @@ main(int ac, char **av)
 #ifdef INTERNET
 	if (Show_scores) {
 		SOCKET *hosts;
+		u_short msg = C_TESTMSG();
 
-		for (hosts = list_drivers(); hosts->sin_port != 0; hosts += 1)
+		for (hosts = list_drivers(msg); hosts->sin_port != 0; hosts += 1)
 			dump_scores(*hosts);
 		exit(0);
 	}
 	if (Query_driver) {
 		SOCKET *hosts;
+		u_short msg = C_TESTMSG();
 
-		for (hosts = list_drivers(); hosts->sin_port != 0; hosts += 1) {
+		for (hosts = list_drivers(msg); hosts->sin_port != 0; hosts += 1) {
 			struct hostent *hp;
 			int num_players;
 
@@ -349,8 +351,9 @@ static void
 find_driver(bool do_startup)
 {
 	SOCKET *hosts;
+	u_short msg = C_TESTMSG();
 
-	hosts = list_drivers();
+	hosts = list_drivers(msg);
 	if (hosts[0].sin_port != htons(0)) {
 		int i, c;
 

Index: src/games/hunt/hunt/hunt_private.h
diff -u src/games/hunt/hunt/hunt_private.h:1.4 src/games/hunt/hunt/hunt_private.h:1.5
--- src/games/hunt/hunt/hunt_private.h:1.4	Sun Mar 30 02:26:09 2014
+++ src/games/hunt/hunt/hunt_private.h	Sun Mar 30 02:58:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: hunt_private.h,v 1.4 2014/03/30 02:26:09 dholland Exp $	*/
+/*	$NetBSD: hunt_private.h,v 1.5 2014/03/30 02:58:25 dholland Exp $	*/
 
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
@@ -79,8 +79,6 @@ extern bool no_beep;
 extern SOCKET Daemon;
 extern uint16_t Test_port;
 extern char *Sock_host;
-extern bool Query_driver;
-extern bool Show_scores;
 #endif
 
 /*
@@ -108,5 +106,5 @@ void do_message(void);
 
 /* in server.c */
 #ifdef INTERNET
-SOCKET *list_drivers(void);
+SOCKET *list_drivers(unsigned short msg);
 #endif

Index: src/games/hunt/hunt/server.c
diff -u src/games/hunt/hunt/server.c:1.3 src/games/hunt/hunt/server.c:1.4
--- src/games/hunt/hunt/server.c:1.3	Sun Mar 30 02:53:11 2014
+++ src/games/hunt/hunt/server.c	Sun Mar 30 02:58:25 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: server.c,v 1.3 2014/03/30 02:53:11 dholland Exp $	*/
+/*	$NetBSD: server.c,v 1.4 2014/03/30 02:58:25 dholland Exp $	*/
 /*
  * Copyright (c) 1983-2003, Regents of the University of California.
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: server.c,v 1.3 2014/03/30 02:53:11 dholland Exp $");
+__RCSID("$NetBSD: server.c,v 1.4 2014/03/30 02:58:25 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/stat.h>
@@ -174,12 +174,12 @@ get_responses(int contactsock)
 }
 
 SOCKET *
-list_drivers(void)
+list_drivers(unsigned short msg)
 {
 	struct hostent *hp;
 	struct sockaddr_in contactaddr;
 	int option;
-	u_short msg;
+	uint16_t wiremsg;
 	int contactsock;
 	int i;
 
@@ -203,8 +203,8 @@ list_drivers(void)
 		}
 		memcpy(&contactaddr.sin_addr, hp->h_addr,
 		       sizeof(contactaddr.sin_addr));
-		msg = htons(C_TESTMSG());
-		(void) sendto(contactsock, &msg, sizeof msg, 0,
+		wiremsg = htons(msg);
+		(void) sendto(contactsock, &wiremsg, sizeof(wiremsg), 0,
 			      (struct sockaddr *)&contactaddr,
 			      sizeof(contactaddr));
 		get_responses(contactsock);
@@ -214,8 +214,8 @@ list_drivers(void)
 	if (!initial) {
 		/* favor host of previous session by broadcasting to it first */
 		contactaddr.sin_addr = Daemon.sin_addr;
-		msg = htons(C_PLAYER);		/* Must be playing! */
-		(void) sendto(contactsock, &msg, sizeof msg, 0,
+		wiremsg = htons(C_PLAYER);		/* Must be playing! */
+		(void) sendto(contactsock, &wiremsg, sizeof(wiremsg), 0,
 		    (struct sockaddr *)&contactaddr, sizeof(contactaddr));
 	}
 
@@ -233,7 +233,7 @@ list_drivers(void)
 #endif
 
 	/* send broadcast packets on all interfaces */
-	msg = htons(C_TESTMSG());
+	wiremsg = htons(msg);
 	for (i = 0; i < brdc; i++) {
 		contactaddr.sin_addr = brdv[i].sin_addr;
 		if (sendto(contactsock, &msg, sizeof msg, 0,

Reply via email to