summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjack <jack@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-24 12:50:40 +0800
committerjack <jack@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2004-04-24 12:50:40 +0800
commit5aeba397cdc49d740d90a8a239a0c784c549dd0d (patch)
tree98b29760704ebd529cc015eb9360d785caed0c53
parentb117dde9ba6212b64bee572aac622fd8a578dfe0 (diff)
downloadpttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar.gz
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar.bz2
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar.lz
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar.xz
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.tar.zst
pttbbs-5aeba397cdc49d740d90a8a239a0c784c549dd0d.zip
modified the festival function
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@1845 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/account.c34
1 files changed, 27 insertions, 7 deletions
diff --git a/util/account.c b/util/account.c
index bb1b1bc4..6c05b569 100644
--- a/util/account.c
+++ b/util/account.c
@@ -1,6 +1,7 @@
/* $Id$ */
#include "bbs.h"
+//test
#define ACCOUNT_MAX_LINE 16
#define ADJUST_M 6 /* adjust back 5 minutes */
@@ -90,9 +91,10 @@ void gzip(source, target, stamp)
int main(int argc, char **argv)
{
int hour, max, item, total, i, j, mo, da, max_user = 0, max_login = 0,
- max_reg = 0, mahour = 0, k;
+ max_reg = 0, mahour = 0, k, wday;
char *act_file = ".act";
char *log_file = "usies";
+ char *wday_str = "UMTWRFS";
char buf[256], buf1[256], *p;
FILE *fp, *fp1;
int act[27]; /* 次數/累計時間/pointer */
@@ -328,11 +330,29 @@ int main(int argc, char **argv)
if((fp = fopen("etc/feast", "r"))) {
while(fgets(buf1, sizeof(buf1), fp)) {
if(buf[0] != '#' &&
- sscanf(buf1, "%d %d ", &mo, &da) == 2) {
- if(ptime->tm_mday == da && ptime->tm_mon + 1 == mo) {
- i = 1;
- fprintf(fp1, "%-14.14s", &buf1[6]);
- }
+ sscanf(buf1, "%d %c%c", &mo, buf, buf+1) == 3) {
+ if (isdigit(buf[0])) {
+ if (isdigit(buf[1])) {
+ da = 10 * (buf[0] - '0') + (buf[1] - '0');
+ if(ptime->tm_mday == da && ptime->tm_mon + 1 == mo) {
+ i = 1;
+ fprintf(fp1, "%-14.14s", &buf1[6]);
+ }
+ }
+ else {
+ if (buf[0] - '0' <= 4) {
+ wday = 0;
+ buf[1] = toupper(buf[1]);
+ while(wday < 7 && buf[1] != *(wday_str + wday))
+ wday++;
+ if (ptime->tm_mon + 1 == mo && ptime->tm_wday == wday &&
+ (ptime->tm_mday - 1)/7 + 1 == (buf[0] - '0')) {
+ i = 1;
+ fprintf(fp1, "%-14.14s", &buf1[6]);
+ }
+ }
+ }
+ }
}
}
fclose(fp);
@@ -341,7 +361,7 @@ int main(int argc, char **argv)
if(i == 0) {
if((fp = fopen("etc/today_boring", "r"))) {
while(fgets(buf1, sizeof(buf1), fp))
- if(strlen(buf) > 3)
+ if(strlen(buf1) > 3)
fprintf(fp1, "%s", buf1);
fclose(fp);
} else