summaryrefslogtreecommitdiffstats
path: root/util/account.c
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 05:35:23 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 05:35:23 +0800
commite8fc08b9800ba86163e5bf43469cdc9f4b478b13 (patch)
treeeb2dcd75cad19ac57b7e9d9cc29c63a850d8ad86 /util/account.c
parentc0a6419aeceaeb93d5d9ccde393236d67ff8c72f (diff)
downloadpttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.gz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.bz2
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.lz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.xz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.zst
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.zip
only one shared memory
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@296 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util/account.c')
-rw-r--r--util/account.c52
1 files changed, 20 insertions, 32 deletions
diff --git a/util/account.c b/util/account.c
index 9d8f6a05..cfc9f911 100644
--- a/util/account.c
+++ b/util/account.c
@@ -1,43 +1,31 @@
-/* $Id: account.c,v 1.4 2002/03/28 04:03:55 in2 Exp $ */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include "config.h"
-#include "pttstruct.h"
-#include "util.h"
-#include "proto.h"
+/* $Id: account.c,v 1.5 2002/06/06 21:34:14 in2 Exp $ */
+#include "bbs.h"
#define MAX_LINE 16
#define ADJUST_M 6 /* adjust back 5 minutes */
-extern struct pttcache_t *ptt;
-
void
- reset_garbage()
+reset_garbage()
{
- if (ptt == NULL)
+ if (SHM == NULL)
{
- ptt = attach_shm(PTTSHM_KEY, sizeof(*ptt));
- if (ptt->touchtime == 0)
- ptt->touchtime = 1;
+ attach_SHM();
+ if (SHM->Ptouchtime == 0)
+ SHM->Ptouchtime = 1;
}
/* ぃ俱reload?
- for(n=0;n<=ptt->max_film;n++)
- printf("\n**%d**\n %s \n",n,ptt->notes[n]);
+ for(n=0;n<=SHM->max_film;n++)
+ printf("\n**%d**\n %s \n",n,SHM->notes[n]);
*/
- ptt->uptime = 0;
+ SHM->Puptime = 0;
reload_pttcache();
- printf("\n笆篈狾计[%d]\n", ptt->max_film);
+ printf("\n笆篈狾计[%d]\n", SHM->max_film);
/*
for(n=0; n<MAX_MOVIE_SECTION; n++)
- printf("sec%d=> 癬翴:%d Ω璶传:%d\n ",n,ptt->n_notes[n],
- ptt->next_refresh[n]);
+ printf("sec%d=> 癬翴:%d Ω璶传:%d\n ",n,SHM->n_notes[n],
+ SHM->next_refresh[n]);
printf("\n");
*/
}
@@ -230,11 +218,11 @@ int main() {
{
int a;
resolve_fcache();
- printf("琿程絬:%d 筁:%d\n", a = fcache->max_user, k);
+ printf("琿程絬:%d 筁:%d\n", a = SHM->max_user, k);
fclose(fp);
if (a > k)
{
- ptime = localtime(&fcache->max_time);
+ ptime = localtime(&SHM->max_time);
if((fp1 = fopen("etc/history", "a")))
{
fprintf(fp1,
@@ -292,7 +280,7 @@ int main() {
now = time(NULL) - ADJUST_M * 60; /* back to ancent */
ptime = localtime(&now);
- attach_uhash();
+ attach_SHM();
if((fp = fopen("etc/history.data", "r")))
{ /* 虫ら程ΩΩ,絬,爹 */
if (fscanf(fp, "%d %d %d %d", &max_login, &max, &max_reg, &k))
@@ -314,12 +302,12 @@ int main() {
max_login = total;
}
- if (uhash->number > max_reg + max_reg / 10)
+ if (SHM->number > max_reg + max_reg / 10)
{
fprintf(fp1, "」 %02d/%02d/%02d "
"羆爹计矗ど %d  \n"
- ,ptime->tm_mon + 1, ptime->tm_mday, ptime->tm_year % 100, uhash->number);
- max_reg = uhash->number;
+ ,ptime->tm_mon + 1, ptime->tm_mday, ptime->tm_year % 100, SHM->number);
+ max_reg = SHM->number;
}
fclose(fp1);
@@ -410,7 +398,7 @@ int main() {
/* Ptt reset Ptt's share memory */
printf("砞Pttcache 籔fcache\n");
- fcache->uptime = 0;
+ SHM->Puptime = 0;
resolve_fcache();
reset_garbage();
return 0;