2 * CALL.C - call internal batch command.
7 * 16 Jul 1998 (Hans B Pufal)
10 * 16 Jul 1998 (John P Price)
11 * Seperated commands into individual files.
13 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
14 * added config.h include
16 * 04-Aug-1998 (Hans B Pufal)
17 * added lines to initialize for pointers (HBP004) This fixed the
18 * lock-up that happened sometimes when calling a batch file from
21 * 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
22 * Added help text ("call /?") and cleaned up.
24 * 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
25 * Unicode and redirection safe!
27 * 02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
28 * Remove all hardcode string to En.rc
36 * Perform CALL command.
38 * Allocate a new batch context and add it to the current chain.
39 * Call parsecommandline passing in our param string
40 * If No batch file was opened then remove our newly allocted
44 INT
cmd_call (LPTSTR cmd
, LPTSTR param
)
46 TCHAR szMsg
[RC_STRING_MAX_SIZE
];
47 LPBATCH_CONTEXT n
= NULL
;
50 DebugPrintf (_T("cmd_call: (\'%s\',\'%s\')\n"), cmd
, param
);
52 if (!_tcsncmp (param
, _T("/?"), 2))
54 LoadString(GetModuleHandle(NULL
), STRING_CALL_HELP
, szMsg
, RC_STRING_MAX_SIZE
);
59 n
= (LPBATCH_CONTEXT
)malloc (sizeof (BATCH_CONTEXT
));
63 error_out_of_memory ();
70 bc
->hBatchFile
= INVALID_HANDLE_VALUE
;
73 bc
->forvar
= 0; /* HBP004 */
74 bc
->forproto
= NULL
; /* HBP004 */
76 ParseCommandLine (param
);
78 /* Wasn't a batch file so remove conext */
79 if (bc
->hBatchFile
== INVALID_HANDLE_VALUE
)