summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-04 21:08:35 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-04 21:08:35 +0800
commit9e81baf8352b3d525c9a1459f28dae6b540988e3 (patch)
treea558e73187b9d45b59280a79c927e7f8bb315623 /util
parente42291049072cfee02408394850b33b3580dbd83 (diff)
downloadpttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar.gz
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar.bz2
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar.lz
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar.xz
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.tar.zst
pttbbs-9e81baf8352b3d525c9a1459f28dae6b540988e3.zip
global variable move to var.c
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@280 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/parsevar.pl23
-rw-r--r--util/shmctl.c16
2 files changed, 31 insertions, 8 deletions
diff --git a/util/parsevar.pl b/util/parsevar.pl
new file mode 100644
index 00000000..60063608
--- /dev/null
+++ b/util/parsevar.pl
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+print << '.';
+/*
+ * This header file is auto-generated from pttbbs/mbbsd/var.c .
+ * Please do NOT edit this file directly.
+ */
+
+#ifndef INCLUDE_VAR_H
+#define INCLUDE_VAR_H
+#include "bbs.h"
+.
+while( <> ){
+ if( /^\w/ ){
+ chomp;
+ $_ = substr($_, 0, index($_, '=') - 1) if( index($_, '=') != -1 );
+ $_ .= ';' if( index($_, ';') == -1 );
+ print "extern $_\n";
+ } elsif( /^\#/ && !/include/ ){
+ print;
+ }
+}
+print "#endif /* INCLUDE_VAR_H */\n";
+
diff --git a/util/shmctl.c b/util/shmctl.c
index f2ed2973..7f2aae98 100644
--- a/util/shmctl.c
+++ b/util/shmctl.c
@@ -270,26 +270,26 @@ int utmpnum(int argc, char **argv)
return 0;
}
-int showglobe(int argc, char **argv)
+int showglobal(int argc, char **argv)
{
int i;
for( i = 0 ; i < 10 ; ++i )
- printf("GLOBE[%d] = %d\n", i, ptt->GLOBE[i]);
+ printf("GLOBALVAR[%d] = %d\n", i, ptt->GLOBALVAR[i]);
return 0;
}
-int setglobe(int argc, char **argv)
+int setglobal(int argc, char **argv)
{
int where;
if( argc != 3 )
return 1;
where = atoi(argv[1]);
if( !(0 <= where && where <= 9) ){
- puts("only GLOBE[0] ~ GLOBE[9]");
+ puts("only GLOBALVAR[0] ~ GLOBALVAR[9]");
return 1;
}
- printf("GLOBE[%d] = %d -> ", where, ptt->GLOBE[where]);
- printf("%d\n", ptt->GLOBE[where] = atoi(argv[2]));
+ printf("GLOBALVAR[%d] = %d -> ", where, ptt->GLOBALVAR[where]);
+ printf("%d\n", ptt->GLOBALVAR[where] = atoi(argv[2]));
return 0;
}
@@ -323,8 +323,8 @@ struct {
{utmpsort, "utmpsort", "sort ulist"},
{utmpwatch, "utmpwatch", "to see if busystate is always 1 then fix it"},
{utmpnum, "utmpnum", "print utmpshm->number for snmpd"},
- {showglobe, "showglobe", "show GLOBE"},
- {setglobe, "setglobe", "set GLOBE"},
+ {showglobal, "showglobal", "show GLOBALVAR[]"},
+ {setglobal, "setglobal", "set GLOBALVAR[]"},
{fixbfriend, "fixbfriend", "recount numbers of board friends"},
{NULL, NULL, NULL} };