Correctly assign %propmt%.
[reactos.git] / reactos / subsys / system / cmd / prompt.c
index adf4851..34cad00 100644 (file)
  *        Fixed Win32 environment handling.
  *
  *    30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
- *        Remove all hardcode string to En.rc  
+ *        Remove all hardcode string to En.rc
  */
-#include "precomp.h"
+#include <precomp.h>
 #include "resource.h"
 
 /*
  * print the command-line prompt
- *
  */
 VOID PrintPrompt(VOID)
 {
@@ -106,6 +105,8 @@ VOID PrintPrompt(VOID)
 
                                case _T('H'):
                                        ConOutChar (_T('\x08'));
+          ConOutChar (_T(' '));
+          ConOutChar (_T('\x08'));
                                        break;
 
                                case _T('L'):
@@ -132,10 +133,19 @@ VOID PrintPrompt(VOID)
                                        ConOutChar (_T('='));
                                        break;
 
-                               case _T('T'):
-                                       PrintTime ();
+        case _T('S'):
+                                       ConOutChar (_T(' '));
                                        break;
 
+                               case _T('T'):                                   
+          {          
+          SYSTEMTIME t;
+          GetSystemTime(&t); 
+          ConOutPrintf(_T("%02d%c%02d%c%02d%c%02d\n"),t.wHour, cTimeSeparator,t.wMinute , cTimeSeparator,
+                     t.wSecond , cDecimalSeparator, t.wMilliseconds );
+          }
+                                       break;
+          
                                case _T('V'):
                                        switch (osvi.dwPlatformId)
                                        {
@@ -147,6 +157,7 @@ VOID PrintPrompt(VOID)
                                                                ConOutPrintf (_T("Windows 95"));
                                                        break;
 
+
                                                case VER_PLATFORM_WIN32_NT:
                                                        ConOutPrintf (_T("Windows NT Version %lu.%lu"),
                                                                                  osvi.dwMajorVersion, osvi.dwMinorVersion);
@@ -182,26 +193,28 @@ VOID PrintPrompt(VOID)
 
 INT cmd_prompt (LPTSTR cmd, LPTSTR param)
 {
-       TCHAR szMsg[RC_STRING_MAX_SIZE];
-
+       TCHAR szParam[512];
        if (!_tcsncmp (param, _T("/?"), 2))
        {
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP1, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);
+               ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
 
 #ifdef FEATURE_DIRECTORY_STACK
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP2, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);             
+               ConOutResPaging(FALSE,STRING_PROMPT_HELP2);
 #endif
-               LoadString( GetModuleHandle(NULL), STRING_PROMPT_HELP3, szMsg,sizeof(szMsg)/sizeof(TCHAR));    
-               ConOutPuts (szMsg);     
+               ConOutResPaging(FALSE,STRING_PROMPT_HELP3);
                return 0;
        }
+       if (param[0] != _T('\0'))
+               _tcscpy(szParam,param);
+       else
+               _tcscpy(szParam,_T("$P$G"));
 
        /* set PROMPT environment variable */
-       if (!SetEnvironmentVariable (_T("PROMPT"), param))
+       if (!SetEnvironmentVariable (_T("PROMPT"), szParam))
                return 1;
 
        return 0;
 }
 #endif
+
+/* EOF */