summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFrederic Culot <calcurse@culot.org>2006-12-10 14:51:41 +0000
committerFrederic Culot <calcurse@culot.org>2006-12-10 14:51:41 +0000
commit650ac9dfe7d74187264d512a44f9aa3927e6b312 (patch)
tree0dd439bf5f89e6389d4978b71f9dacdbd53825b4 /src
parent68de892ad9f8dce96058127322fb812410bd763c (diff)
downloadcalcurse-650ac9dfe7d74187264d512a44f9aa3927e6b312.zip
date format modified for the 'Go To' command
Diffstat (limited to 'src')
-rwxr-xr-xsrc/calendar.c56
1 files changed, 30 insertions, 26 deletions
diff --git a/src/calendar.c b/src/calendar.c
index 226281c..468a8c3 100755
--- a/src/calendar.c
+++ b/src/calendar.c
@@ -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
@@ -191,36 +191,40 @@ goto_day(int colr, int day, int month, int year,
int wrong_day = 0;
char *mesg_line1 = _("The day you entered is not valid");
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) {
status_mesg(request_date, "");
- if (getstring(swin, colr, selected_day, LDAY, 0, 1) == 0) {
- // go to today
- *sel_day = day;
- *sel_month = month;
- *sel_year = year;
- break;
- } else {
- sscanf(selected_day, "%u/%u/%u", &dday, &dmonth,
- &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;
+ if (getstring(swin, colr, selected_day, LDAY, 0, 1) == 1)
+ return;
+ else {
+ if (strlen(selected_day) == 0) {
+ // go to today
+ *sel_day = day;
+ *sel_month = month;
+ *sel_year = year;
+ break;
} else {
- status_mesg(mesg_line1, mesg_line2);
- wgetch(swin);
+ sscanf(selected_day, "%u/%u/%u",
+ &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;