summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-26 09:58:33 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-08-26 09:58:33 +0800
commitbe41f994d9d68f8dac92bdb8bc1bcfb548069472 (patch)
tree2ff88c166a4a079986531d4c5569150ee4ba3597 /util
parent2f3e8d3cb0c654b676c5bb9f00f9107187864a6d (diff)
downloadpttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar.gz
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar.bz2
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar.lz
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar.xz
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.tar.zst
pttbbs-be41f994d9d68f8dac92bdb8bc1bcfb548069472.zip
* remove numlogin from topusr
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4776 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/topusr.c34
1 files changed, 17 insertions, 17 deletions
diff --git a/util/topusr.c b/util/topusr.c
index 58f3d86b..e7e868b8 100644
--- a/util/topusr.c
+++ b/util/topusr.c
@@ -3,35 +3,37 @@
#define _UTIL_C_
#include "bbs.h"
+#define TYPE_POST 0
+#define TYPE_MONEY 1
+
+#define TYPE_COUNT 2
+
#define REAL_INFO
struct manrec
{
char userid[IDLEN + 1];
char nickname[23];
- int values[3];
+ int values[TYPE_COUNT];
};
typedef struct manrec manrec;
-struct manrec *allman[3];
+struct manrec *allman[TYPE_COUNT];
userec_t aman;
manrec theman;
int num;
FILE *fp;
-#define TYPE_POST 0
-#define TYPE_LOGIN 1
-#define TYPE_MONEY 2
-
void
top(type)
{
- static char *str_type[3] =
- {"發表次數", "進站次數", " 大富翁 "};
+ static char *str_type[TYPE_COUNT] =
+ {"發表次數", " 大富翁 "};
int i, j, rows = (num + 1) / 2;
char buf1[80], buf2[80];
- if (type != 2)
+ assert(type < TYPE_COUNT);
+ if (type != TYPE_COUNT-1)
fprintf(fp, "\n\n");
fprintf(fp, "\
@@ -111,11 +113,11 @@ int main(int argc, char **argv)
printf("Sorry, the data is not ready.\n");
exit(0);
}
- for(i=0; i<3; i++)
- {
- allman[i]=malloc(sizeof(manrec) * num);
- memset(allman[i],0,sizeof(manrec) * num);
- }
+ for(i=0; i<TYPE_COUNT; i++)
+ {
+ allman[i]=malloc(sizeof(manrec) * num);
+ memset(allman[i],0,sizeof(manrec) * num);
+ }
for(j = 1; j <= MAX_USERS; j++) {
passwd_query(j, &aman);
aman.userid[IDLEN]=0;
@@ -129,10 +131,9 @@ int main(int argc, char **argv)
else {
strcpy(theman.userid, aman.userid);
strcpy(theman.nickname, aman.nickname);
- theman.values[TYPE_LOGIN] = aman.numlogins;
theman.values[TYPE_POST] = aman.numposts;
theman.values[TYPE_MONEY] = aman.money;
- for(i=0; i<3; i++)
+ for(i=0; i<TYPE_COUNT; i++)
{
int k,l;
for(k=num-1; k>=0 && allman[i][k].values[i]<theman.values[i];
@@ -158,7 +159,6 @@ int main(int argc, char **argv)
top(TYPE_MONEY);
top(TYPE_POST);
- top(TYPE_LOGIN);
fclose(fp);
return 0;