summaryrefslogtreecommitdiffstats
path: root/mbbsd/user.c
diff options
context:
space:
mode:
authorvictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-04 14:35:06 +0800
committervictor <victor@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2006-05-04 14:35:06 +0800
commit0764d07f9886b2645b6649201495762adc5af96e (patch)
tree488b19ba172f2ecbdfb5f57e4c6b130fc94393b9 /mbbsd/user.c
parentd146af9094828a4a0acf6a3da40d7401808e95e6 (diff)
downloadpttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar.gz
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar.bz2
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar.lz
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar.xz
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.tar.zst
pttbbs-0764d07f9886b2645b6649201495762adc5af96e.zip
add a simple help page to calendar
take the format of 19XX instead of XX git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@3353 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'mbbsd/user.c')
-rw-r--r--mbbsd/user.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/mbbsd/user.c b/mbbsd/user.c
index f3e85c55..2dbd638e 100644
--- a/mbbsd/user.c
+++ b/mbbsd/user.c
@@ -675,26 +675,21 @@ uinfo_query(userec_t *u, int adminmode, int unum)
x.sex = u->sex % 8;
while (1) {
- int len;
-
- snprintf(genbuf, sizeof(genbuf), "%02i/%02i/%02i",
- u->month, u->day, u->year % 100);
- len = getdata_str(i, 0, "¥Í¤é ¤ë¤ë/¤é¤é/¦è¤¸¡G", buf, 9,
- DOECHO, genbuf);
- if (len && len != 8)
- continue;
- if (!len) {
+ snprintf(genbuf, sizeof(genbuf), "%04i/%02i/%02i",
+ u->year + 1900, u->month, u->day);
+ if (getdata_str(i, 0, "¥Í¤é ¦è¤¸/¤ë¤ë/¤é¤é¡G", buf, 11, DOECHO, genbuf) == 0) {
x.month = u->month;
x.day = u->day;
x.year = u->year;
- } else if (len == 8) {
- x.month = (buf[0] - '0') * 10 + (buf[1] - '0');
- x.day = (buf[3] - '0') * 10 + (buf[4] - '0');
- x.year = (buf[6] - '0') * 10 + (buf[7] - '0');
- } else
- continue;
- if (!adminmode && (x.month > 12 || x.month < 1 || x.day > 31 ||
- x.day < 1 || x.year < 40))
+ } else {
+ int y, m, d;
+ if (ParseDate(buf, &y, &m, &d))
+ continue;
+ x.month = (unsigned char)m;
+ x.day = (unsigned char)d;
+ x.year = (unsigned char)y;
+ }
+ if (!adminmode && x.year < 40)
continue;
i++;
break;
@@ -1260,7 +1255,7 @@ u_editcalendar(void)
{
char genbuf[200];
- getdata(b_lines - 1, 0, "¦æ¨Æ¾ä (D)§R°£ (E)½s¿è [Q]¨ú®ø¡H[Q] ",
+ getdata(b_lines - 1, 0, "¦æ¨Æ¾ä (D)§R°£ (E)½s¿è (H)»¡©ú [Q]¨ú®ø¡H[Q] ",
genbuf, 3, LCECHO);
if (genbuf[0] == 'e') {
@@ -1276,6 +1271,12 @@ u_editcalendar(void)
sethomefile(genbuf, cuser.userid, "calendar");
unlink(genbuf);
vmsg("¦æ¨Æ¾ä§R°£§¹²¦");
+ } else if (genbuf[0] == 'h') {
+ move(1, 0);
+ clrtoline(b_lines);
+ move(3, 0);
+ prints("¦æ¨Æ¾ä®æ¦¡»¡©ú:\n½s¿è®É¥H¤@¦æ¬°³æ¦ì¡A¦p:\n\n# ¤«¸¹¶}ÀYªº¬Oµù¸Ñ\n2006/05/04 red ¤W§å½ð½ð!\n\n¨ä¤¤ªº red ¬O«üªí¥ÜªºÃC¦â¡C");
+ pressanykey();
}
return 0;
}
@@ -1560,8 +1561,8 @@ u_register(void)
#ifdef FOREIGN_REG
char fore[2];
#endif
- char phone[20], career[40], email[50], birthday[9], sex_is[2],
- year, mon, day;
+ char phone[20], career[40], email[50], birthday[11], sex_is[2];
+ unsigned char year, mon, day;
char inregcode[14], regcode[50];
char ans[3], *ptr, *errcode;
char genbuf[200];
@@ -1611,8 +1612,8 @@ u_register(void)
if (cuser.month == 0 && cuser.day && cuser.year == 0)
birthday[0] = 0;
else
- snprintf(birthday, sizeof(birthday), "%02i/%02i/%02i",
- cuser.month, cuser.day, cuser.year % 100);
+ snprintf(birthday, sizeof(birthday), "%04i/%02i/%02i",
+ 1900 + cuser.year, cuser.month, cuser.day);
sex_is[0] = (cuser.sex % 8) + '1';
sex_is[1] = 0;
career[0] = phone[0] = '\0';
@@ -1779,26 +1780,24 @@ u_register(void)
getfield(15, "¥u¿é¤J¼Æ¦r ¦p:0912345678 (¥i¤£¶ñ)",
"¤â¾÷¸¹½X", mobile, 20);
while (1) {
- int len;
-
- getfield(17, "¤ë¤ë/¤é¤é/¦è¤¸ ¦p:09/27/76", "¥Í¤é", birthday, 9);
- len = strlen(birthday);
- if (!len) {
- snprintf(birthday, 9, "%02i/%02i/%02i",
- cuser.month, cuser.day, cuser.year % 100);
+ getfield(17, "¦è¤¸/¤ë¤ë/¤é¤é ¦p:1984/02/29", "¥Í¤é", birthday, sizeof(birthday));
+ if (birthday[0] == 0) {
+ snprintf(birthday, sizeof(birthday), "%04i/%02i/%02i",
+ 1900 + cuser.year, cuser.month, cuser.day);
mon = cuser.month;
day = cuser.day;
year = cuser.year;
- } else if (len == 8) {
- mon = (birthday[0] - '0') * 10 + (birthday[1] - '0');
- day = (birthday[3] - '0') * 10 + (birthday[4] - '0');
- year = (birthday[6] - '0') * 10 + (birthday[7] - '0');
- } else{
- vmsg("±zªº¿é¤J¤£¥¿½T");
- continue;
+ } else {
+ int y, m, d;
+ if (ParseDate(birthday, &y, &m, &d)) {
+ vmsg("±zªº¿é¤J¤£¥¿½T");
+ continue;
+ }
+ mon = (unsigned char)m;
+ day = (unsigned char)d;
+ year = (unsigned char)(y - 1900);
}
- if (mon > 12 || mon < 1 || day > 31 || day < 1 ||
- year < 40){
+ if (year < 40) {
vmsg("±zªº¿é¤J¤£¥¿½T");
continue;
}