date format modified for the 'Go To' command

This commit is contained in:
Frederic Culot 2006-12-10 14:51:41 +00:00
parent 68de892ad9
commit 650ac9dfe7

View File

@ -1,4 +1,4 @@
/* $calcurse: calendar.c,v 1.3 2006/11/02 13:42:48 culot Exp $ */ /* $calcurse: calendar.c,v 1.4 2006/12/10 14:51:41 culot Exp $ */
/* /*
* Calcurse - text-based organizer * Calcurse - text-based organizer
@ -191,36 +191,40 @@ goto_day(int colr, int day, int month, int year,
int wrong_day = 0; int wrong_day = 0;
char *mesg_line1 = _("The day you entered is not valid"); char *mesg_line1 = _("The day you entered is not valid");
char *mesg_line2 = _("Press [ENTER] to continue"); char *mesg_line2 = _("Press [ENTER] to continue");
char *request_date = _("Enter the day to go to [ENTER for today] : dd/mm/yyyy"); char *request_date = _("Enter the day to go to [ENTER for today] : mm/dd/yyyy");
while (wrong_day != 1) { while (wrong_day != 1) {
status_mesg(request_date, ""); status_mesg(request_date, "");
if (getstring(swin, colr, selected_day, LDAY, 0, 1) == 0) { if (getstring(swin, colr, selected_day, LDAY, 0, 1) == 1)
// go to today return;
*sel_day = day; else {
*sel_month = month; if (strlen(selected_day) == 0) {
*sel_year = year; // go to today
break; *sel_day = day;
} else { *sel_month = month;
sscanf(selected_day, "%u/%u/%u", &dday, &dmonth, *sel_year = year;
&dyear); break;
//check if the entered day is correct
if ((dday <= 0) | (dday >= 32))
wrong_day = 1;
if ((dmonth <= 0) | (dmonth >= 13))
wrong_day = 1;
if ((dyear <= 0) | (dyear >= 3000))
wrong_day = 1;
//go to chosen day
if (wrong_day != 1) {
*sel_day = dday;
*sel_month = dmonth;
*sel_year = dyear;
} else { } else {
status_mesg(mesg_line1, mesg_line2); sscanf(selected_day, "%u/%u/%u",
wgetch(swin); &dmonth, &dday, &dyear);
//check if the entered day is correct
if ((dday <= 0) | (dday >= 32))
wrong_day = 1;
if ((dmonth <= 0) | (dmonth >= 13))
wrong_day = 1;
if ((dyear <= 0) | (dyear >= 3000))
wrong_day = 1;
//go to chosen day
if (wrong_day != 1) {
*sel_day = dday;
*sel_month = dmonth;
*sel_year = dyear;
} else {
status_mesg(mesg_line1, mesg_line2);
wgetch(swin);
}
break;
} }
break;
} }
} }
return; return;