summaryrefslogtreecommitdiffstats
path: root/mbbsd
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-04-16 10:59:01 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2007-04-16 10:59:01 +0800
commit48049f58fca08253facdfa66371b48ea046abcc9 (patch)
treeae91c8ca340b4ccfdf355291472ca97fd74d7f73 /mbbsd
parent54ab3b0886feb9faa8ead846c2bd1e2b688023e5 (diff)
downloadpttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar.gz
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar.bz2
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar.lz
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar.xz
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.tar.zst
pttbbs-48049f58fca08253facdfa66371b48ea046abcc9.zip
horoscope flavor birthday card
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3503 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd')
-rw-r--r--mbbsd/admin.c13
-rw-r--r--mbbsd/calendar.c16
-rw-r--r--mbbsd/mbbsd.c4
3 files changed, 29 insertions, 4 deletions
diff --git a/mbbsd/admin.c b/mbbsd/admin.c
index 766ecab0..161dd851 100644
--- a/mbbsd/admin.c
+++ b/mbbsd/admin.c
@@ -679,8 +679,8 @@ m_board(void)
int
x_file(void)
{
- int aborted;
- char ans[4], *fpath;
+ int aborted, num;
+ char ans[4], *fpath, buf[256];
move(b_lines - 7, 0);
/* Ptt */
@@ -786,7 +786,14 @@ x_file(void)
fpath = "etc/Logout";
break;
case 'k':
- fpath = "etc/Welcome_birth";
+ mouts(b_lines - 3, 0, "1.摩羯 2.水瓶 3.雙魚 4.白羊 5.金牛 6.雙子");
+ mouts(b_lines - 2, 0, "7.巨蟹 8.獅子 9.處女 10.天秤 11.天蠍 12.射手");
+ getdata(b_lines - 1, 0, "請選擇 [1-12]", ans, sizeof(ans), LCECHO);
+ num = atoi(ans);
+ if (num <= 0 || num > 12)
+ return FULLUPDATE;
+ snprintf(buf, sizeof(buf), "etc/Welcome_birth.%d\n", num);
+ fpath = buf;
break;
case 'l':
fpath = "etc/feast";
diff --git a/mbbsd/calendar.c b/mbbsd/calendar.c
index ba0fb45a..2f2e5af6 100644
--- a/mbbsd/calendar.c
+++ b/mbbsd/calendar.c
@@ -323,3 +323,19 @@ calendar(void)
pressanykey();
return 0;
}
+
+int getHoroscope(int m, int d)
+{
+ // 摩羯 水瓶 雙魚 白羊 金牛 雙子 巨蟹 獅子 處女 天秤 天蠍 射手
+ const int firstday[12] = {
+ /* Dec. */ 22, /* Jan. */ 20, 19, 21, 20, 21, 21, 23, 23, 23, 23, 22
+ };
+ if (d >= firstday[m]) {
+ if (m == 12)
+ return 1;
+ else
+ return m - 1;
+ }
+ else
+ return m;
+}
diff --git a/mbbsd/mbbsd.c b/mbbsd/mbbsd.c
index eadcc622..979d76dc 100644
--- a/mbbsd/mbbsd.c
+++ b/mbbsd/mbbsd.c
@@ -1114,7 +1114,9 @@ user_login(void)
/* show welcome_login */
if( (ifbirth = (ptime->tm_mday == cuser.day &&
ptime->tm_mon + 1 == cuser.month)) ){
- more("etc/Welcome_birth", NA);
+ char buf[PATHLEN];
+ snprintf(buf, sizeof(buf), "etc/Welcome_birth.%d", getHoroscope(cuser.month, cuser.day));
+ more(buf, NA);
}
else {
#ifndef MULTI_WELCOME_LOGIN