mirror of
https://repo.or.cz/socat.git
synced 2025-07-08 21:36:34 +00:00
Internal: Reworked xioopts
This commit is contained in:
parent
1c1a91027a
commit
5eebca3a5b
37 changed files with 1380 additions and 1199 deletions
11
xio-exec.c
11
xio-exec.c
|
@ -26,13 +26,15 @@ const struct optdesc opt_dash = { "dash", "login", OPT_DASH, GROUP_EXEC, PH_PREE
|
|||
|
||||
static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
||||
int xioflags, /* XIO_RDONLY, XIO_MAYCHILD etc. */
|
||||
xiofile_t *fd,
|
||||
xiofile_t *xfd,
|
||||
groups_t groups,
|
||||
int dummy1, int dummy2, int dummy3
|
||||
) {
|
||||
struct single *sfd = &xfd->stream;
|
||||
int status;
|
||||
bool dash = false;
|
||||
int duptostderr;
|
||||
int numleft;
|
||||
|
||||
if (argc != 2) {
|
||||
Error2("\"%s\": wrong number of parameters (%d instead of 1)", argv[0], argc-1);
|
||||
|
@ -40,8 +42,9 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
|||
|
||||
retropt_bool(opts, OPT_DASH, &dash);
|
||||
|
||||
status = _xioopen_foxec(xioflags, &fd->stream, groups, &opts, &duptostderr);
|
||||
if (status < 0) return status;
|
||||
status = _xioopen_foxec(xioflags, sfd, groups, &opts, &duptostderr);
|
||||
if (status < 0)
|
||||
return status;
|
||||
if (status == 0) { /* child */
|
||||
const char *ends[] = { " ", NULL };
|
||||
const char *hquotes[] = { "'", NULL };
|
||||
|
@ -61,7 +64,6 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
|||
char *tokp;
|
||||
char *path = NULL;
|
||||
char *tmp;
|
||||
int numleft;
|
||||
|
||||
/*! Close(something) */
|
||||
/* parse command line */
|
||||
|
@ -143,6 +145,7 @@ static int xioopen_exec(int argc, const char *argv[], struct opt *opts,
|
|||
}
|
||||
|
||||
/* parent */
|
||||
_xio_openlate(sfd, opts);
|
||||
return 0;
|
||||
}
|
||||
#endif /* WITH_EXEC */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue