[CMD] Code style and formatting fixes for assoc.c and path.c

This commit is contained in:
Hermès Bélusca-Maïto 2020-07-26 20:29:34 +02:00
parent 69258973e0
commit a5d7a2cd61
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
2 changed files with 116 additions and 113 deletions

View file

@ -29,34 +29,34 @@
#ifdef INCLUDE_CMD_PATH
/* size of environment variable buffer */
/* Size of environment variable buffer */
#define ENV_BUFFER_SIZE 1024
INT cmd_path (LPTSTR param)
INT cmd_path(LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
if (!_tcsncmp(param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_PATH_HELP1);
ConOutResPaging(TRUE, STRING_PATH_HELP1);
return 0;
}
nErrorLevel = 0;
/* if param is empty, display the PATH environment variable */
/* If param is empty, display the PATH environment variable */
if (!param || !*param)
{
DWORD dwBuffer;
LPTSTR pszBuffer;
pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR));
pszBuffer = (LPTSTR)cmd_alloc(ENV_BUFFER_SIZE * sizeof(TCHAR));
if (!pszBuffer)
{
WARN("Cannot allocate memory for pszBuffer!\n");
return 1;
}
dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
dwBuffer = GetEnvironmentVariable(_T("PATH"), pszBuffer, ENV_BUFFER_SIZE);
if (dwBuffer == 0)
{
cmd_free(pszBuffer);
@ -66,28 +66,28 @@ INT cmd_path (LPTSTR param)
else if (dwBuffer > ENV_BUFFER_SIZE)
{
LPTSTR pszOldBuffer = pszBuffer;
pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR));
pszBuffer = (LPTSTR)cmd_realloc(pszBuffer, dwBuffer * sizeof (TCHAR));
if (!pszBuffer)
{
WARN("Cannot reallocate memory for pszBuffer!\n");
cmd_free(pszOldBuffer);
return 1;
}
GetEnvironmentVariable (_T("PATH"), pszBuffer, dwBuffer);
GetEnvironmentVariable(_T("PATH"), pszBuffer, dwBuffer);
}
ConOutPrintf(_T("PATH=%s\n"), pszBuffer);
cmd_free (pszBuffer);
cmd_free(pszBuffer);
return 0;
}
/* skip leading '=' */
/* Skip leading '=' */
if (*param == _T('='))
param++;
/* set PATH environment variable */
if (!SetEnvironmentVariable (_T("PATH"), param))
/* Set PATH environment variable */
if (!SetEnvironmentVariable(_T("PATH"), param))
{
nErrorLevel = 1;
return 1;