summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-08-29 00:32:18 +0800
committerwens <wens@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-08-29 00:32:18 +0800
commit3c1c45a62b66ee5052a6fc4583cd5a22d67f193d (patch)
tree66c7c411f39c9b11c13c9ed4a854d74b3ea11178 /util
parent14aa84fc81f5e81ea593c0ab198219d1d269ba4b (diff)
downloadpttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar.gz
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar.bz2
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar.lz
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar.xz
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.tar.zst
pttbbs-3c1c45a62b66ee5052a6fc4583cd5a22d67f193d.zip
currpid not initialized.
add option to specify broadcaster. git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3401 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/broadcast.c10
1 files changed, 7 insertions, 3 deletions
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);