1 /* $Id: call.c,v 1.3 1999/10/03 22:20:33 ekohl Exp $
3 * CALL.C - call internal batch command.
8 * 16 Jul 1998 (Hans B Pufal)
11 * 16 Jul 1998 (John P Price)
12 * Seperated commands into individual files.
14 * 27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
15 * added config.h include
17 * 04-Aug-1998 (Hans B Pufal)
18 * added lines to initialize for pointers (HBP004) This fixed the
19 * lock-up that happened sometimes when calling a batch file from
22 * 07-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
23 * Added help text ("call /?") and cleaned up.
25 * 20-Jan-1999 (Eric Kohl <ekohl@abo.rhein-zeitung.de>)
26 * Unicode and redirection safe!
42 * Perform CALL command.
44 * Allocate a new batch context and add it to the current chain.
45 * Call parsecommandline passing in our param string
46 * If No batch file was opened then remove our newly allocted
50 INT
cmd_call (LPTSTR cmd
, LPTSTR param
)
52 LPBATCH_CONTEXT n
= NULL
;
55 DebugPrintf ("cmd_call: (\'%s\',\'%s\')\n", cmd
, param
);
57 if (!_tcsncmp (param
, _T("/?"), 2))
59 ConOutPuts (_T("Calls one batch program from another.\n\n"
60 "CALL [drive:][path]filename [batch-parameter]\n\n"
61 " batch-parameter Specifies any command-line information required by the\n"
66 n
= (LPBATCH_CONTEXT
)malloc (sizeof (BATCH_CONTEXT
));
70 error_out_of_memory ();
77 bc
->hBatchFile
= INVALID_HANDLE_VALUE
;
80 bc
->forvar
= 0; /* HBP004 */
81 bc
->forproto
= NULL
; /* HBP004 */
83 ParseCommandLine (param
);
85 /* Wasn't a batch file so remove conext */
86 if (bc
->hBatchFile
== INVALID_HANDLE_VALUE
)