From 3c1c45a62b66ee5052a6fc4583cd5a22d67f193d Mon Sep 17 00:00:00 2001 From: wens Date: Mon, 28 Aug 2006 16:32:18 +0000 Subject: currpid not initialized. add option to specify broadcaster. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3401 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/broadcast.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'util/broadcast.c') diff --git a/util/broadcast.c b/util/broadcast.c index 13dab086..f270cf88 100644 --- a/util/broadcast.c +++ b/util/broadcast.c @@ -8,6 +8,7 @@ int main(int argc, char *argv[]) { int sleep_time = 5; int num_per_loop = 500; + char * owner = "系統廣播"; int i, j; userinfo_t *uentp; @@ -15,7 +16,7 @@ int main(int argc, char *argv[]) time_t now; int *sorted, UTMPnumber; // SHM snapshot - while ((i = getopt(argc, argv, "t:n:")) != -1) + while ((i = getopt(argc, argv, "t:n:o:")) != -1) switch (i) { case 't': sleep_time = atoi(optarg); @@ -23,6 +24,9 @@ int main(int argc, char *argv[]) case 'n': num_per_loop = atoi(optarg); break; + case 'o': + owner = optarg; + break; } if (optind == argc || strlen(argv[optind]) == 0) { @@ -39,8 +43,8 @@ int main(int argc, char *argv[]) memcpy(sorted, SHM->sorted[SHM->currsorted][0], sizeof(int) * USHM_SIZE); UTMPnumber = SHM->UTMPnumber; - msg.pid = currpid; - strlcpy(msg.userid, "系統廣播", sizeof(msg.userid)); + msg.pid = getpid(); + strlcpy(msg.userid, owner, sizeof(msg.userid)); snprintf(msg.last_call_in, sizeof(msg.last_call_in), "[廣播]%s", argv[optind]); now = time(NULL); -- cgit v1.2.3