From 48049f58fca08253facdfa66371b48ea046abcc9 Mon Sep 17 00:00:00 2001 From: victor Date: Mon, 16 Apr 2007 02:59:01 +0000 Subject: horoscope flavor birthday card git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3503 63ad8ddf-47c3-0310-b6dd-a9e9d9715204 --- util/birth.c | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) (limited to 'util') diff --git a/util/birth.c b/util/birth.c index f0d5626a..e9198ef5 100644 --- a/util/birth.c +++ b/util/birth.c @@ -59,31 +59,28 @@ int main(argc, argv) "¡¹¡¹¡¹¡¹¡¹¡¹ ¹Ø¬P¤jÆ[ " "¡¹¡¹¡¹¡¹¡¹¡¹ \n\n"); fprintf(fp1, "¡i¥»¤é¹Ø¬P¡j \n"); + int horoscope = getHoroscope(ptime->tm_mon + 1, ptime->tm_mday); for(j = 1; j <= MAX_USERS; j++) { passwd_query(j, &user); if (bad_user_id(NULL)) continue; - if (user.month == ptime->tm_mon + 1) - { - if (user.day == ptime->tm_mday) - { - char genbuf[200]; - sprintf(genbuf, BBSHOME "/home/%c/%s", user.userid[0], user.userid); - stampfile(genbuf, &mymail); - strcpy(mymail.owner, BBSNAME); - strcpy(mymail.title, "!! ¥Í¤é§Ö¼Ö !!"); - unlink(genbuf); - Link(BBSHOME "/etc/Welcome_birth", genbuf); - sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", user.userid[0], user.userid); - append_record(genbuf, &mymail, sizeof(mymail)); - if ((user.numlogins + user.numposts) < 20) - continue; + if (user.month == ptime->tm_mon + 1 && user.day == ptime->tm_mday) { + char genbuf[200]; + sprintf(genbuf, BBSHOME "/home/%c/%s", user.userid[0], user.userid); + stampfile(genbuf, &mymail); + strcpy(mymail.owner, BBSNAME); + strcpy(mymail.title, "!! ¥Í¤é§Ö¼Ö !!"); + unlink(genbuf); + Link(BBSHOME "/etc/Welcome_birth.%d", genbuf, horoscope); + sprintf(genbuf, BBSHOME "/home/%c/%s/.DIR", user.userid[0], user.userid); + append_record(genbuf, &mymail, sizeof(mymail)); + if ((user.numlogins + user.numposts) < 20) + continue; - fprintf(fp1, - " [%2d/%-2d] %-14s %-24s login:%-5d post:%-5d\n", + fprintf(fp1, + " [%2d/%-2d] %-14s %-24s login:%-5d post:%-5d\n", ptime->tm_mon + 1, ptime->tm_mday, user.userid, - user.nickname, user.numlogins, user.numposts); - } + user.nickname, user.numlogins, user.numposts); } } fclose(fp1); -- cgit v1.2.3