https://git.reactos.org/?p=reactos.git;a=commitdiff;h=aab632644f7bd4538158d…
commit aab632644f7bd4538158d4c0167bc224f242b70a
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Jul 26 20:31:12 2020 +0200
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Wed Aug 19 20:36:09 2020 +0200
[CMD] Some code style and formatting fixes
---
base/shell/cmd/date.c | 71 +++++++++++++++++++++++++++------------------------
base/shell/cmd/time.c | 53 ++++++++++++++++++--------------------
2 files changed, 62 insertions(+), 62 deletions(-)
diff --git a/base/shell/cmd/date.c b/base/shell/cmd/date.c
index 7704cde50a7..97cb4221411 100644
--- a/base/shell/cmd/date.c
+++ b/base/shell/cmd/date.c
@@ -173,30 +173,32 @@ ParseDate (LPTSTR s)
}
-INT cmd_date (LPTSTR param)
+INT cmd_date(LPTSTR param)
{
- LPTSTR *arg;
- INT argc;
- INT i;
- BOOL bPrompt = TRUE;
- INT nDateString = -1;
-
- if (!_tcsncmp (param, _T("/?"), 2))
+ LPTSTR* arg;
+ INT argc;
+ INT i;
+ BOOL bPrompt = TRUE;
+ INT nDateString = -1;
+ TCHAR szDate[40];
+
+ if (!_tcsncmp(param, _T("/?"), 2))
{
- ConOutResPaging(TRUE,STRING_DATE_HELP4);
+ ConOutResPaging(TRUE, STRING_DATE_HELP4);
return 0;
}
nErrorLevel = 0;
- /* build parameter array */
- arg = split (param, &argc, FALSE, FALSE);
+ /* Build the parameter array */
+ arg = split(param, &argc, FALSE, FALSE);
- /* check for options */
+ /* Check for options */
for (i = 0; i < argc; i++)
{
- if (_tcsicmp (arg[i], _T("/t")) == 0)
+ if (_tcsicmp(arg[i], _T("/t")) == 0)
bPrompt = FALSE;
+
if ((*arg[i] != _T('/')) && (nDateString == -1))
nDateString = i;
}
@@ -206,24 +208,25 @@ INT cmd_date (LPTSTR param)
if (!bPrompt)
{
- freep (arg);
+ freep(arg);
return 0;
}
if (nDateString == -1)
{
- while (TRUE) /* forever loop */
+ while (TRUE)
{
- TCHAR s[40];
-
- PrintDateString ();
- ConInString (s, 40);
- TRACE ("\'%s\'\n", debugstr_aw(s));
- while (*s && s[_tcslen (s) - 1] < _T(' '))
- s[_tcslen (s) - 1] = _T('\0');
- if (ParseDate (s))
+ PrintDateString();
+ ConInString(szDate, ARRAYSIZE(szDate));
+
+ TRACE("\'%s\'\n", debugstr_aw(szDate));
+
+ while (*szDate && szDate[_tcslen(szDate) - 1] < _T(' '))
+ szDate[_tcslen(szDate) - 1] = _T('\0');
+
+ if (ParseDate(szDate))
{
- freep (arg);
+ freep(arg);
return 0;
}
ConErrResPuts(STRING_DATE_ERROR);
@@ -231,28 +234,28 @@ INT cmd_date (LPTSTR param)
}
else
{
- if (!ParseDate (arg[nDateString]))
+ if (!ParseDate(arg[nDateString]))
{
- while (TRUE) /* forever loop */
+ while (TRUE)
{
- TCHAR s[40];
ConErrResPuts(STRING_DATE_ERROR);
- PrintDateString ();
- ConInString (s, 40);
+ PrintDateString();
+ ConInString(szDate, ARRAYSIZE(szDate));
+
+ while (*szDate && szDate[_tcslen(szDate) - 1] < _T('
'))
+ szDate[_tcslen(szDate) - 1] = _T('\0');
- while (*s && s[_tcslen (s) - 1] < _T(' '))
- s[_tcslen (s) - 1] = _T('\0');
- if (ParseDate (s))
+ if (ParseDate(szDate))
{
- freep (arg);
+ freep(arg);
return 0;
}
}
}
}
- freep (arg);
+ freep(arg);
return 0;
}
#endif /* INCLUDE_CMD_DATE */
diff --git a/base/shell/cmd/time.c b/base/shell/cmd/time.c
index 9ce3cc26ce4..16bb9aae58b 100644
--- a/base/shell/cmd/time.c
+++ b/base/shell/cmd/time.c
@@ -129,32 +129,33 @@ static BOOL ParseTime (LPTSTR s)
}
-INT cmd_time (LPTSTR param)
+INT cmd_time(LPTSTR param)
{
- LPTSTR *arg;
- INT argc;
- INT i;
- INT nTimeString = -1;
-
- if (!_tcsncmp (param, _T("/?"), 2))
+ LPTSTR* arg;
+ INT argc;
+ INT i;
+ INT nTimeString = -1;
+ TCHAR szTime[20];
+ TCHAR s[40];
+
+ if (!_tcsncmp(param, _T("/?"), 2))
{
- ConOutResPaging(TRUE,STRING_TIME_HELP1);
+ ConOutResPaging(TRUE, STRING_TIME_HELP1);
return 0;
}
nErrorLevel = 0;
- /* build parameter array */
- arg = split (param, &argc, FALSE, FALSE);
+ /* Build the parameter array */
+ arg = split(param, &argc, FALSE, FALSE);
- /* check for options */
+ /* Check for options */
for (i = 0; i < argc; i++)
{
- if (_tcsicmp (arg[i], _T("/t")) == 0)
+ if (_tcsicmp(arg[i], _T("/t")) == 0)
{
/* Display current time in short format */
SYSTEMTIME st;
- TCHAR szTime[20];
GetLocalTime(&st);
FormatTime(szTime, &st);
ConOutPuts(szTime);
@@ -172,45 +173,41 @@ INT cmd_time (LPTSTR param)
ConOutPrintf(_T(": %s\n"), GetTimeString());
}
- while (1)
+ while (TRUE)
{
if (nTimeString == -1)
{
- TCHAR s[40];
-
ConOutResPuts(STRING_TIME_HELP2);
+ ConInString(s, ARRAYSIZE(s));
- ConInString (s, 40);
+ TRACE("\'%s\'\n", debugstr_aw(s));
- TRACE ("\'%s\'\n", debugstr_aw(s));
-
- while (*s && s[_tcslen (s) - 1] < _T(' '))
+ while (*s && s[_tcslen(s) - 1] < _T(' '))
s[_tcslen(s) - 1] = _T('\0');
- if (ParseTime (s))
+ if (ParseTime(s))
{
- freep (arg);
+ freep(arg);
return 0;
}
}
else
{
- if (ParseTime (arg[nTimeString]))
+ if (ParseTime(arg[nTimeString]))
{
- freep (arg);
+ freep(arg);
return 0;
}
- /* force input the next time around. */
+ /* Force input the next time around */
nTimeString = -1;
}
ConErrResPuts(STRING_TIME_ERROR1);
- nErrorLevel = 1;
+ nErrorLevel = 1;
}
- freep (arg);
-
+ freep(arg);
return 0;
}