From daeb68b5cc86c84512b5347f2a92771ca5271105 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 21 Jul 2005 17:24:15 +0000 Subject: [PATCH] fix bug in date if the input arg are not right dateformat, it should prom after new date svn path=/trunk/; revision=16682 --- reactos/subsys/system/cmd/date.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/reactos/subsys/system/cmd/date.c b/reactos/subsys/system/cmd/date.c index 5b4f9c0bb9a..3c71a4b6329 100644 --- a/reactos/subsys/system/cmd/date.c +++ b/reactos/subsys/system/cmd/date.c @@ -243,13 +243,25 @@ INT cmd_date (LPTSTR cmd, LPTSTR param) } else { - if (ParseDate (arg[nDateString])) - { - freep (arg); - return 0; - } - - ConErrResPuts(STRING_DATE_ERROR); + if (!ParseDate (arg[nDateString])) + { + while (TRUE) /* forever loop */ + { + TCHAR s[40]; + ConErrResPuts(STRING_DATE_ERROR); + + PrintDateString (); + ConInString (s, 40); + + while (*s && s[_tcslen (s) - 1] < _T(' ')) + s[_tcslen (s) - 1] = _T('\0'); + if (ParseDate (s)) + { + freep (arg); + return 0; + } + } + } } freep (arg);