[ros-diffs] [greatlrd] 17614: revers brandon change to prompt.c they are incorrect. Add a check if prompt env are set or not. if it is not set cmd set the prompt value. in cmd.c brandon forget that.

greatlrd at svn.reactos.com greatlrd at svn.reactos.com
Sat Sep 3 11:46:50 CEST 2005


revers brandon change to prompt.c they are incorrect. Add a check if
prompt env are set or not. if it is not set cmd set the prompt value. in
cmd.c brandon forget that.
Modified: trunk/reactos/subsys/system/cmd/cmd.c
Modified: trunk/reactos/subsys/system/cmd/prompt.c
  _____  

Modified: trunk/reactos/subsys/system/cmd/cmd.c
--- trunk/reactos/subsys/system/cmd/cmd.c	2005-09-03 01:34:40 UTC
(rev 17613)
+++ trunk/reactos/subsys/system/cmd/cmd.c	2005-09-03 09:46:46 UTC
(rev 17614)
@@ -1311,6 +1311,7 @@

 	TCHAR commandline[CMDLINE_LENGTH];
 	TCHAR ModuleName[_MAX_PATH + 1];
 	INT i;
+	TCHAR lpBuffer[2];
 
 	//INT len;
 	//TCHAR *ptr, *cmdLine;
@@ -1358,7 +1359,12 @@
 	hOut = GetStdHandle (STD_OUTPUT_HANDLE);
 	hIn  = GetStdHandle (STD_INPUT_HANDLE);
 
-	SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
+	/* Set EnvironmentVariable PROMPT if it does not exists any env
value. 
+	   for you can change the EnvirommentVariable for prompt before
cmd start 
+	   this patch are not 100% right, if it does not exists a PROMPT
value cmd should use
+	   $P$G as defualt not set EnvirommentVariable PROMPT to $P$G if
it does not exists */
+	if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, 2 *
sizeof(TCHAR)) == 0) 
+	    SetEnvironmentVariable (_T("PROMPT"), _T("$P$G"));
 
 
 	if (argc >= 2 && !_tcsncmp (argv[1], _T("/?"), 2))
  _____  

Modified: trunk/reactos/subsys/system/cmd/prompt.c
--- trunk/reactos/subsys/system/cmd/prompt.c	2005-09-03 01:34:40 UTC
(rev 17613)
+++ trunk/reactos/subsys/system/cmd/prompt.c	2005-09-03 09:46:46 UTC
(rev 17614)
@@ -192,8 +192,7 @@

 #ifdef INCLUDE_CMD_PROMPT
 
 INT cmd_prompt (LPTSTR cmd, LPTSTR param)
-{
-	TCHAR szParam[512];
+{	
 	if (!_tcsncmp (param, _T("/?"), 2))
 	{
 		ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
@@ -204,15 +203,14 @@
 		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"), szParam))
-		return 1;
-
+	if (param[0] != _T('\0'))
+	{
+		if (!SetEnvironmentVariable (_T("PROMPT"), param))
+		    return 1;		
+	}
+			
 	return 0;
 }
 #endif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050903/057c9bc9/attachment.html


More information about the Ros-diffs mailing list