Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygencall.c
Go to the documentation of this file.
00001 /* 00002 * CALL.C - call internal batch command. 00003 * 00004 * 00005 * History: 00006 * 00007 * 16 Jul 1998 (Hans B Pufal) 00008 * started. 00009 * 00010 * 16 Jul 1998 (John P Price) 00011 * Seperated commands into individual files. 00012 * 00013 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>) 00014 * added config.h include 00015 * 00016 * 04-Aug-1998 (Hans B Pufal) 00017 * added lines to initialize for pointers (HBP004) This fixed the 00018 * lock-up that happened sometimes when calling a batch file from 00019 * another batch file. 00020 * 00021 * 07-Jan-1999 (Eric Kohl) 00022 * Added help text ("call /?") and cleaned up. 00023 * 00024 * 20-Jan-1999 (Eric Kohl) 00025 * Unicode and redirection safe! 00026 * 00027 * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>) 00028 * Remove all hardcode string to En.rc 00029 */ 00030 00031 #include <precomp.h> 00032 00033 00034 /* 00035 * Perform CALL command. 00036 */ 00037 00038 INT cmd_call (LPTSTR param) 00039 { 00040 TCHAR line[CMDLINE_LENGTH + 1]; 00041 TCHAR *first; 00042 BOOL bInQuote = FALSE; 00043 00044 TRACE ("cmd_call: (\'%s\')\n", debugstr_aw(param)); 00045 if (!_tcsncmp (param, _T("/?"), 2)) 00046 { 00047 ConOutResPaging(TRUE,STRING_CALL_HELP); 00048 return 0; 00049 } 00050 00051 /* Do a second round of %-variable substitutions */ 00052 if (!SubstituteVars(param, line, _T('%'))) 00053 return nErrorLevel = 1; 00054 00055 /* Find start and end of first word */ 00056 first = line; 00057 while (_istspace(*first)) 00058 first++; 00059 00060 for (param = first; *param; param++) 00061 { 00062 if (!bInQuote && (_istspace(*param) || _tcschr(_T(",;="), *param))) 00063 break; 00064 bInQuote ^= (*param == _T('"')); 00065 } 00066 00067 /* Separate first word from rest of line */ 00068 memmove(param + 1, param, (_tcslen(param) + 1) * sizeof(TCHAR)); 00069 *param++ = _T('\0'); 00070 00071 if (*first == _T(':') && (bc)) 00072 { 00073 /* CALL :label - call a subroutine of the current batch file */ 00074 while (*param == _T(' ')) 00075 param++; 00076 nErrorLevel = Batch(bc->BatchFilePath, first, param, NULL); 00077 return nErrorLevel; 00078 } 00079 00080 nErrorLevel = DoCommand(first, param, NULL); 00081 return nErrorLevel; 00082 } 00083 00084 /* EOF */ Generated on Sun May 27 2012 04:18:10 for ReactOS by
1.7.6.1
|