2012-02-05 11:35:58 -05:00
|
|
|
/****************************************************************
|
|
|
|
* *
|
2024-07-19 11:43:27 -04:00
|
|
|
* Copyright 2001, 2013 Fidelity Information Services, Inc *
|
2012-02-05 11:35:58 -05:00
|
|
|
* *
|
|
|
|
* This source code contains the intellectual property *
|
|
|
|
* of its copyright holder(s), and is made available *
|
|
|
|
* under a license. If you do not know the terms of *
|
|
|
|
* the license, please stop and do not read further. *
|
|
|
|
* *
|
|
|
|
****************************************************************/
|
|
|
|
#include "mdef.h"
|
|
|
|
|
|
|
|
#include "gtm_stdlib.h"
|
|
|
|
#include "cli.h"
|
|
|
|
#include "util_spawn.h"
|
|
|
|
|
|
|
|
void util_spawn(void)
|
|
|
|
{
|
|
|
|
char *cmd;
|
2024-07-19 11:43:27 -04:00
|
|
|
int rc;
|
2012-02-05 11:35:58 -05:00
|
|
|
DCL_THREADGBL_ACCESS;
|
|
|
|
|
|
|
|
SETUP_THREADGBL_ACCESS;
|
|
|
|
assert(1 >= TREF(parms_cnt));
|
|
|
|
if (0 == TREF(parms_cnt))
|
|
|
|
{
|
|
|
|
cmd = GETENV("SHELL");
|
|
|
|
if (!cmd)
|
|
|
|
cmd = "/bin/sh";
|
2024-07-19 11:43:27 -04:00
|
|
|
rc = SYSTEM(cmd);
|
|
|
|
if (-1 == rc)
|
2012-02-05 11:35:58 -05:00
|
|
|
PERROR("system : ");
|
|
|
|
} else
|
|
|
|
{
|
|
|
|
assert(TAREF1(parm_ary, TREF(parms_cnt) - 1));
|
|
|
|
assert((char *)-1L != (TAREF1(parm_ary, TREF(parms_cnt) - 1)));
|
2024-07-19 11:43:27 -04:00
|
|
|
rc = SYSTEM((TAREF1(parm_ary, TREF(parms_cnt) - 1)));
|
|
|
|
if (-1 == rc)
|
2012-02-05 11:35:58 -05:00
|
|
|
PERROR("system : ");
|
|
|
|
}
|
|
|
|
}
|