From 650ac9dfe7d74187264d512a44f9aa3927e6b312 Mon Sep 17 00:00:00 2001
From: Frederic Culot <calcurse@culot.org>
Date: Sun, 10 Dec 2006 14:51:41 +0000
Subject: date format modified for the 'Go To' command

---
 src/calendar.c | 56 ++++++++++++++++++++++++++++++--------------------------
 1 file changed, 30 insertions(+), 26 deletions(-)

(limited to 'src')

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;
-- 
cgit v1.2.3-70-g09d2