Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/games/hunt/huntd Use setproctitle() instead of handrolled ve...
details: https://anonhg.NetBSD.org/src/rev/cf3f82e54167
branches: trunk
changeset: 328234:cf3f82e54167
user: dholland <dholland%NetBSD.org@localhost>
date: Sat Mar 29 20:12:12 2014 +0000
description:
Use setproctitle() instead of handrolled version.
diffstat:
games/hunt/huntd/driver.c | 16 +++-------------
games/hunt/huntd/faketalk.c | 17 ++++-------------
2 files changed, 7 insertions(+), 26 deletions(-)
diffs (117 lines):
diff -r 44f82c609dc9 -r cf3f82e54167 games/hunt/huntd/driver.c
--- a/games/hunt/huntd/driver.c Sat Mar 29 20:10:10 2014 +0000
+++ b/games/hunt/huntd/driver.c Sat Mar 29 20:12:12 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: driver.c,v 1.25 2014/03/29 20:10:10 dholland Exp $ */
+/* $NetBSD: driver.c,v 1.26 2014/03/29 20:12:12 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: driver.c,v 1.25 2014/03/29 20:10:10 dholland Exp $");
+__RCSID("$NetBSD: driver.c,v 1.26 2014/03/29 20:12:12 dholland Exp $");
#endif /* not lint */
#include <sys/ioctl.h>
@@ -47,8 +47,6 @@
static SOCKET Daemon;
-char *First_arg; /* pointer to argv[0] */
-char *Last_arg; /* pointer to end of argv/environ */
#ifdef INTERNET
static int Test_socket; /* test socket to answer datagrams */
@@ -64,7 +62,6 @@
static void clear_scores(void);
static bool havechar(PLAYER *, int);
static void init(void);
-int main(int, char *[], char *[]);
static void makeboots(void);
static void send_stats(void);
static void zap(PLAYER *, bool, int);
@@ -75,7 +72,7 @@
* The main program.
*/
int
-main(int ac, char **av, char **ep)
+main(int ac, char **av)
{
PLAYER *pp;
#ifdef INTERNET
@@ -89,13 +86,6 @@
int c, i;
const int linger = 90 * 1000;
- First_arg = av[0];
- if (ep == NULL || *ep == NULL)
- ep = av + ac;
- while (*ep)
- ep++;
- Last_arg = ep[-1] + strlen(ep[-1]);
-
while ((c = getopt(ac, av, "sp:")) != -1) {
switch (c) {
case 's':
diff -r 44f82c609dc9 -r cf3f82e54167 games/hunt/huntd/faketalk.c
--- a/games/hunt/huntd/faketalk.c Sat Mar 29 20:10:10 2014 +0000
+++ b/games/hunt/huntd/faketalk.c Sat Mar 29 20:12:12 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: faketalk.c,v 1.21 2014/03/29 20:10:10 dholland Exp $ */
+/* $NetBSD: faketalk.c,v 1.22 2014/03/29 20:12:12 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: faketalk.c,v 1.21 2014/03/29 20:10:10 dholland Exp $");
+__RCSID("$NetBSD: faketalk.c,v 1.22 2014/03/29 20:12:12 dholland Exp $");
#endif /* not lint */
#include "bsd.h"
@@ -46,6 +46,7 @@
#include <netdb.h>
#include <signal.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "talk_ctl.h"
@@ -60,8 +61,6 @@
#define ARGV0 "HUNT-ANNOUNCE"
extern char *my_machine_name;
-extern char *First_arg, *Last_arg;
-extern char **environ;
static void do_announce(char *);
void exorcise(int);
@@ -89,8 +88,6 @@
FILE *f;
int service; /* socket of service */
struct sockaddr_in des; /* address of destination */
- char *a;
- const char *b;
(void) signal(SIGCHLD, exorcise);
@@ -103,13 +100,7 @@
/*
* change argv so that a ps shows ARGV0
*/
- *environ = NULL;
- for (a = First_arg, b = ARGV0; a < Last_arg; a++) {
- if (*b)
- *a = *b++;
- else
- *a = ' ';
- }
+ setproctitle("%s", ARGV0);
/*
* initialize "talk"
Home |
Main Index |
Thread Index |
Old Index