From 54cf74f0877f34dd6e666385ec1e67bec7ac8f5f Mon Sep 17 00:00:00 2001 From: Saveliy Tretiakov Date: Fri, 23 Feb 2007 20:05:39 +0000 Subject: [PATCH] Andrey Janzen (virus126): - Fix warning when using FEATURE_UNIX_FILENAME_COMPLETION. - Make unix-style completion work correctly. - Make %time% return milliseconds/10. svn path=/trunk/; revision=25896 --- reactos/base/shell/cmd/cmd.c | 2 +- reactos/base/shell/cmd/cmdinput.c | 4 +++- reactos/base/shell/cmd/filecomp.c | 16 ++++++++++++---- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/reactos/base/shell/cmd/cmd.c b/reactos/base/shell/cmd/cmd.c index 08b11e60b83..1aaa20675ca 100644 --- a/reactos/base/shell/cmd/cmd.c +++ b/reactos/base/shell/cmd/cmd.c @@ -1172,7 +1172,7 @@ GetEnvVarOrSpecial ( LPCTSTR varName ) GetSystemTime(&t); _sntprintf ( ret, retlen, _T("%02d%c%02d%c%02d%c%02d"), t.wHour, cTimeSeparator, t.wMinute, cTimeSeparator, - t.wSecond, cDecimalSeparator, t.wMilliseconds ); + t.wSecond, cDecimalSeparator, t.wMilliseconds / 10); return ret; } /* %DATE% */ diff --git a/reactos/base/shell/cmd/cmdinput.c b/reactos/base/shell/cmd/cmdinput.c index 7e88114cb33..f6d59ddb754 100644 --- a/reactos/base/shell/cmd/cmdinput.c +++ b/reactos/base/shell/cmd/cmdinput.c @@ -139,8 +139,10 @@ VOID ReadCommand (LPTSTR str, INT maxlen) TCHAR ch; BOOL bContinue=FALSE;/*is TRUE the second case will not be executed*/ BOOL bReturn = FALSE; - TCHAR szPath[MAX_PATH]; BOOL bCharInput; + #ifdef FEATURE_4NT_FILENAME_COMPLETION + TCHAR szPath[MAX_PATH]; + #endif /* get screen size */ GetScreenSize (&maxx, &maxy); diff --git a/reactos/base/shell/cmd/filecomp.c b/reactos/base/shell/cmd/filecomp.c index 5ef710147f5..6873e7b134f 100644 --- a/reactos/base/shell/cmd/filecomp.c +++ b/reactos/base/shell/cmd/filecomp.c @@ -43,7 +43,7 @@ VOID CompleteFilename (LPTSTR str, UINT charcount) LPCOMMAND cmds_ptr; /* expand current file name */ - count = charcount - 1; + count = charcount - 1; if (count < 0) count = 0; @@ -89,6 +89,7 @@ VOID CompleteFilename (LPTSTR str, UINT charcount) _tcscpy (path, directory); while (curplace >= 0 && directory[curplace] != _T('\\') && + directory[curplace] != _T('/') && directory[curplace] != _T(':')) { directory[curplace] = 0; @@ -205,7 +206,7 @@ BOOL ShowCompletionMatches (LPTSTR str, INT charcount) BOOL found_dot = FALSE; INT curplace = 0; INT start; - UINT count; + INT count; TCHAR path[MAX_PATH]; TCHAR fname[MAX_PATH]; TCHAR directory[MAX_PATH]; @@ -361,6 +362,7 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix) TCHAR * szSearch; TCHAR * szSearch1; TCHAR * szSearch2; + TCHAR * szSearch3; /* number of quotes in the string */ INT nQuotes = 0; /* used in for loops */ @@ -394,9 +396,12 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix) _tcscpy(szSuffix,szSearch); /* Find the one closest to end */ szSearch1 = _tcsrchr(str, _T('\"')); - szSearch2 = _tcsrchr(str, _T('\\')); + szSearch2 = _tcsrchr(str, _T('\\')); + szSearch3 = _tcsrchr(str, _T('.')); if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2)) szSearch = szSearch2; + else if(szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3)) + szSearch = szSearch3; else szSearch = szSearch1; /* Move one char past */ @@ -436,9 +441,12 @@ VOID FindPrefixAndSuffix(LPTSTR strIN, LPTSTR szPrefix, LPTSTR szSuffix) /* Find the closest to the end space or \ */ _tcscpy(str,strIN); szSearch1 = _tcsrchr(str, _T(' ')); - szSearch2 = _tcsrchr(str, _T('\\')); + szSearch2 = _tcsrchr(str, _T('\\')); + szSearch3 = _tcsrchr(str, _T('/')); if(szSearch2 != NULL && _tcslen(szSearch1) > _tcslen(szSearch2)) szSearch = szSearch2; + else if(szSearch3 != NULL && _tcslen(szSearch1) > _tcslen(szSearch3)) + szSearch = szSearch3; else szSearch = szSearch1; szSearch++;