Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenpath.c
Go to the documentation of this file.
00001 /* 00002 * PATH.C - path internal command. 00003 * 00004 * 00005 * History: 00006 * 00007 * 17 Jul 1998 (John P Price) 00008 * Separated commands into individual files. 00009 * 00010 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>) 00011 * added config.h include 00012 * 00013 * 09-Dec-1998 (Eric Kohl) 00014 * Added help text ("/?"). 00015 * 00016 * 18-Jan-1999 (Eric Kohl) 00017 * Unicode ready! 00018 * 00019 * 18-Jan-1999 (Eric Kohl) 00020 * Redirection safe! 00021 * 00022 * 24-Jan-1999 (Eric Kohl) 00023 * Fixed Win32 environment handling. 00024 * 00025 * 30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>) 00026 * Remove all hardcode string to En.rc 00027 */ 00028 #include <precomp.h> 00029 00030 #ifdef INCLUDE_CMD_PATH 00031 00032 /* size of environment variable buffer */ 00033 #define ENV_BUFFER_SIZE 1024 00034 00035 00036 INT cmd_path (LPTSTR param) 00037 { 00038 00039 if (!_tcsncmp (param, _T("/?"), 2)) 00040 { 00041 ConOutResPaging(TRUE,STRING_PATH_HELP1); 00042 return 0; 00043 } 00044 00045 nErrorLevel = 0; 00046 00047 /* if param is empty, display the PATH environment variable */ 00048 if (!param || !*param) 00049 { 00050 DWORD dwBuffer; 00051 LPTSTR pszBuffer; 00052 00053 pszBuffer = (LPTSTR)cmd_alloc (ENV_BUFFER_SIZE * sizeof(TCHAR)); 00054 dwBuffer = GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE); 00055 if (dwBuffer == 0) 00056 { 00057 ConOutResPrintf(STRING_VOL_HELP2, _T("PATH")); 00058 return 0; 00059 } 00060 else if (dwBuffer > ENV_BUFFER_SIZE) 00061 { 00062 pszBuffer = (LPTSTR)cmd_realloc (pszBuffer, dwBuffer * sizeof (TCHAR)); 00063 GetEnvironmentVariable (_T("PATH"), pszBuffer, ENV_BUFFER_SIZE); 00064 } 00065 00066 ConOutPrintf (_T("PATH=%s\n"), pszBuffer); 00067 cmd_free (pszBuffer); 00068 00069 return 0; 00070 } 00071 00072 /* skip leading '=' */ 00073 if (*param == _T('=')) 00074 param++; 00075 00076 /* set PATH environment variable */ 00077 if (!SetEnvironmentVariable (_T("PATH"), param)) 00078 { 00079 nErrorLevel = 1; 00080 return 1; 00081 } 00082 00083 return 0; 00084 } 00085 00086 #endif 00087 00088 /* EOF */ Generated on Sun May 27 2012 04:18:13 for ReactOS by
1.7.6.1
|