mirror of
https://repo.or.cz/socat.git
synced 2024-12-22 23:42:34 +00:00
Internal: renamed xioopts_t to xioparms_t
This commit is contained in:
parent
eeabf31e04
commit
3e282ee7a0
14 changed files with 58 additions and 56 deletions
2
CHANGES
2
CHANGES
|
@ -39,6 +39,8 @@ Coding:
|
||||||
socketpair. SIGUSR1 is no longer used for internal synchronization.
|
socketpair. SIGUSR1 is no longer used for internal synchronization.
|
||||||
Tests: UDP4_FORK UDP6_FORK UNIX_FORK
|
Tests: UDP4_FORK UDP6_FORK UNIX_FORK
|
||||||
|
|
||||||
|
Renamed xioopts_t to xioparms_t to avoid confusion with xioopts module.
|
||||||
|
|
||||||
####################### V 1.7.4.5 (not released):
|
####################### V 1.7.4.5 (not released):
|
||||||
|
|
||||||
Corrections:
|
Corrections:
|
||||||
|
|
12
socat.c
12
socat.c
|
@ -325,13 +325,13 @@ int main(int argc, const char *argv[]) {
|
||||||
case '6':
|
case '6':
|
||||||
#endif
|
#endif
|
||||||
if (arg1[0][2]) { socat_opt_hint(stderr, arg1[0][1], arg1[0][2]); Exit(1); }
|
if (arg1[0][2]) { socat_opt_hint(stderr, arg1[0][1], arg1[0][2]); Exit(1); }
|
||||||
xioopts.default_ip = arg1[0][1];
|
xioparms.default_ip = arg1[0][1];
|
||||||
xioopts.preferred_ip = arg1[0][1];
|
xioparms.preferred_ip = arg1[0][1];
|
||||||
break;
|
break;
|
||||||
#endif /* WITH_IP4 || WITH_IP6 */
|
#endif /* WITH_IP4 || WITH_IP6 */
|
||||||
case '-':
|
case '-':
|
||||||
if (!strcmp("experimental", &arg1[0][2])) {
|
if (!strcmp("experimental", &arg1[0][2])) {
|
||||||
xioopts.experimental = true;
|
xioparms.experimental = true;
|
||||||
} else {
|
} else {
|
||||||
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
|
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
|
||||||
}
|
}
|
||||||
|
@ -431,8 +431,8 @@ void socat_usage(FILE *fd) {
|
||||||
fputs(" -hh like -h, plus a list of all common address option names\n", fd);
|
fputs(" -hh like -h, plus a list of all common address option names\n", fd);
|
||||||
fputs(" -hhh like -hh, plus a list of all available address option names\n", fd);
|
fputs(" -hhh like -hh, plus a list of all available address option names\n", fd);
|
||||||
#endif /* WITH_HELP */
|
#endif /* WITH_HELP */
|
||||||
fputs(" -d[ddd] increase verbosity (use up to 4 times; 2 are recommended)\n", fd);
|
fputs(" -d[ddd] increase verbosity (use up to 4 times; 2 are recommended)\n", fd);
|
||||||
fputs(" -d0|1|2|3|4 set verbosity level (0: Errors; 4 all including Debug)\n", fd);
|
fputs(" -d0|1|2|3|4 set verbosity level (0: Errors; 4 all including Debug)\n", fd);
|
||||||
#if WITH_FILAN
|
#if WITH_FILAN
|
||||||
fputs(" -D analyze file descriptors before loop\n", fd);
|
fputs(" -D analyze file descriptors before loop\n", fd);
|
||||||
#endif
|
#endif
|
||||||
|
@ -913,7 +913,7 @@ int _socat(void) {
|
||||||
|
|
||||||
if (socat_opts.logopt == 'm' && xioinqopt('l', NULL, 0) == 'm') {
|
if (socat_opts.logopt == 'm' && xioinqopt('l', NULL, 0) == 'm') {
|
||||||
Info("switching to syslog");
|
Info("switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac);
|
diag_set('y', xioparms.syslogfac);
|
||||||
xiosetopt('l', "\0");
|
xiosetopt('l', "\0");
|
||||||
}
|
}
|
||||||
total_timeout = socat_opts.total_timeout;
|
total_timeout = socat_opts.total_timeout;
|
||||||
|
|
8
xio-ip.c
8
xio-ip.c
|
@ -273,13 +273,13 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
service = NULL; /* do not resolve later again */
|
service = NULL; /* do not resolve later again */
|
||||||
|
|
||||||
record = res;
|
record = res;
|
||||||
if (family == PF_UNSPEC && xioopts.preferred_ip == '0') {
|
if (family == PF_UNSPEC && xioparms.preferred_ip == '0') {
|
||||||
/* we just take the first result */
|
/* we just take the first result */
|
||||||
family = res[0].ai_addr->sa_family;
|
family = res[0].ai_addr->sa_family;
|
||||||
}
|
}
|
||||||
if (family == PF_UNSPEC) {
|
if (family == PF_UNSPEC) {
|
||||||
int trypf;
|
int trypf;
|
||||||
trypf = (xioopts.preferred_ip=='6'?PF_INET6:PF_INET);
|
trypf = (xioparms.preferred_ip=='6'?PF_INET6:PF_INET);
|
||||||
/* we must look for a matching entry */
|
/* we must look for a matching entry */
|
||||||
while (record != NULL) {
|
while (record != NULL) {
|
||||||
if (record->ai_family == trypf) {
|
if (record->ai_family == trypf) {
|
||||||
|
@ -339,7 +339,7 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
/* first fallback is getipnodebyname() */
|
/* first fallback is getipnodebyname() */
|
||||||
if (family == PF_UNSPEC) {
|
if (family == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
family = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
family = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
family = PF_INET6;
|
family = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
@ -390,7 +390,7 @@ int xiogetaddrinfo(const char *node, const char *service,
|
||||||
be useful somewhere sometimes in a future even for IP6 */
|
be useful somewhere sometimes in a future even for IP6 */
|
||||||
if (family == PF_UNSPEC) {
|
if (family == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
family = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
family = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
family = PF_INET6;
|
family = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -61,9 +61,9 @@ int xioopen_ipapp_connect(int argc, const char *argv[], struct opt *opts,
|
||||||
xiosetchilddied(); /* set SIGCHLD handler */
|
xiosetchilddied(); /* set SIGCHLD handler */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioparms.logopt == 'm') {
|
||||||
Info("starting connect loop, switching to syslog");
|
Info("starting connect loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioparms.syslogfac); xioparms.logopt = 'y';
|
||||||
} else {
|
} else {
|
||||||
Info("starting connect loop");
|
Info("starting connect loop");
|
||||||
}
|
}
|
||||||
|
@ -271,7 +271,7 @@ int xioopen_ipapp_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -224,9 +224,9 @@ int _xioopen_listen(struct single *xfd, int xioflags, struct sockaddr *us, sockl
|
||||||
return STAT_RETRYLATER;
|
return STAT_RETRYLATER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioparms.logopt == 'm') {
|
||||||
Info("starting accept loop, switching to syslog");
|
Info("starting accept loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioparms.syslogfac); xioparms.logopt = 'y';
|
||||||
} else {
|
} else {
|
||||||
Info("starting accept loop");
|
Info("starting accept loop");
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,9 +301,9 @@ static int
|
||||||
&needbind, &lowport, socktype);
|
&needbind, &lowport, socktype);
|
||||||
if (result != STAT_OK) return STAT_NORETRY;
|
if (result != STAT_OK) return STAT_NORETRY;
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioparms.logopt == 'm') {
|
||||||
Info("starting connect loop, switching to syslog");
|
Info("starting connect loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioparms.syslogfac); xioparms.logopt = 'y';
|
||||||
} else {
|
} else {
|
||||||
Info("starting connect loop");
|
Info("starting connect loop");
|
||||||
}
|
}
|
||||||
|
@ -524,7 +524,7 @@ static int
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -226,7 +226,7 @@ int xioopen_rawip_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
@ -283,7 +283,7 @@ int xioopen_rawip_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -1171,9 +1171,9 @@ int _xioopen_dgram_recvfrom(struct single *xfd, int xioflags,
|
||||||
xio_retropt_tcpwrap(xfd, opts);
|
xio_retropt_tcpwrap(xfd, opts);
|
||||||
#endif /* && (WITH_TCP || WITH_UDP) && WITH_LIBWRAP */
|
#endif /* && (WITH_TCP || WITH_UDP) && WITH_LIBWRAP */
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioparms.logopt == 'm') {
|
||||||
Info("starting recvfrom loop, switching to syslog");
|
Info("starting recvfrom loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioparms.syslogfac); xioparms.logopt = 'y';
|
||||||
} else {
|
} else {
|
||||||
Info("starting recvfrom loop");
|
Info("starting recvfrom loop");
|
||||||
}
|
}
|
||||||
|
@ -1375,9 +1375,9 @@ int _xioopen_dgram_recv(struct single *xfd, int xioflags,
|
||||||
xio_retropt_tcpwrap(xfd, opts);
|
xio_retropt_tcpwrap(xfd, opts);
|
||||||
#endif /* && (WITH_TCP || WITH_UDP) && WITH_LIBWRAP */
|
#endif /* && (WITH_TCP || WITH_UDP) && WITH_LIBWRAP */
|
||||||
|
|
||||||
if (xioopts.logopt == 'm') {
|
if (xioparms.logopt == 'm') {
|
||||||
Info("starting recvfrom loop, switching to syslog");
|
Info("starting recvfrom loop, switching to syslog");
|
||||||
diag_set('y', xioopts.syslogfac); xioopts.logopt = 'y';
|
diag_set('y', xioparms.syslogfac); xioparms.logopt = 'y';
|
||||||
} else {
|
} else {
|
||||||
Info("starting recvfrom loop");
|
Info("starting recvfrom loop");
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,7 +290,7 @@ int xioopen_ipdgram_listen(int argc, const char *argv[], struct opt *opts,
|
||||||
|
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
@ -500,7 +500,7 @@ int xioopen_udp_recvfrom(int argc, const char *argv[], struct opt *opts,
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
@ -573,7 +573,7 @@ int xioopen_udp_recv(int argc, const char *argv[], struct opt *opts,
|
||||||
retropt_socket_pf(opts, &pf);
|
retropt_socket_pf(opts, &pf);
|
||||||
if (pf == PF_UNSPEC) {
|
if (pf == PF_UNSPEC) {
|
||||||
#if WITH_IP4 && WITH_IP6
|
#if WITH_IP4 && WITH_IP6
|
||||||
pf = xioopts.default_ip=='6'?PF_INET6:PF_INET;
|
pf = xioparms.default_ip=='6'?PF_INET6:PF_INET;
|
||||||
#elif WITH_IP6
|
#elif WITH_IP6
|
||||||
pf = PF_INET6;
|
pf = PF_INET6;
|
||||||
#else
|
#else
|
||||||
|
|
4
xio.h
4
xio.h
|
@ -112,7 +112,7 @@ typedef struct {
|
||||||
char preferred_ip; /* preferred prot.fam. for name resolution ('0' for
|
char preferred_ip; /* preferred prot.fam. for name resolution ('0' for
|
||||||
unspecified, '4', or '6') */
|
unspecified, '4', or '6') */
|
||||||
bool experimental; /* enable some features */
|
bool experimental; /* enable some features */
|
||||||
} xioopts_t;
|
} xioparms_t;
|
||||||
|
|
||||||
/* pack the description of a lock file */
|
/* pack the description of a lock file */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -121,7 +121,7 @@ typedef struct {
|
||||||
struct timespec intervall; /* polling intervall */
|
struct timespec intervall; /* polling intervall */
|
||||||
} xiolock_t;
|
} xiolock_t;
|
||||||
|
|
||||||
extern xioopts_t xioopts;
|
extern xioparms_t xioparms;
|
||||||
|
|
||||||
#define MAXARGV 8
|
#define MAXARGV 8
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ int xioinitialize(void) {
|
||||||
switch (default_ip[0]) {
|
switch (default_ip[0]) {
|
||||||
case '4':
|
case '4':
|
||||||
case '6':
|
case '6':
|
||||||
xioopts.default_ip = default_ip[0]; break;
|
xioparms.default_ip = default_ip[0]; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,9 +87,9 @@ int xioinitialize(void) {
|
||||||
switch (preferred_ip[0]) {
|
switch (preferred_ip[0]) {
|
||||||
case '4':
|
case '4':
|
||||||
case '6':
|
case '6':
|
||||||
xioopts.preferred_ip = preferred_ip[0]; break;
|
xioparms.preferred_ip = preferred_ip[0]; break;
|
||||||
default:
|
default:
|
||||||
xioopts.preferred_ip = '0'; break;
|
xioparms.preferred_ip = '0'; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
16
xioopen.c
16
xioopen.c
|
@ -421,9 +421,9 @@ static xiofile_t *xioparse_dual(const char **addr) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* and now we see if we reached a dual-address separator */
|
/* and now we see if we reached a dual-address separator */
|
||||||
if (!strncmp(*addr, xioopts.pipesep, strlen(xioopts.pipesep))) {
|
if (!strncmp(*addr, xioparms.pipesep, strlen(xioparms.pipesep))) {
|
||||||
/* yes we reached it, so we parse the second single address */
|
/* yes we reached it, so we parse the second single address */
|
||||||
*addr += strlen(xioopts.pipesep);
|
*addr += strlen(xioparms.pipesep);
|
||||||
|
|
||||||
if ((xfd = xioallocfd()) == NULL) {
|
if ((xfd = xioallocfd()) == NULL) {
|
||||||
free(sfd1); /*! and maybe have free some if its contents */
|
free(sfd1); /*! and maybe have free some if its contents */
|
||||||
|
@ -500,10 +500,10 @@ static xiosingle_t *xioparse_single(const char **addr) {
|
||||||
|
|
||||||
/* init */
|
/* init */
|
||||||
i = 0;
|
i = 0;
|
||||||
/*ends[i++] = xioopts.chainsep;*/ /* default: "|" */
|
/*ends[i++] = xioparms.chainsep;*/ /* default: "|" */
|
||||||
ends[i++] = xioopts.pipesep; /* default: "!!" */
|
ends[i++] = xioparms.pipesep; /* default: "!!" */
|
||||||
ends[i++] = ","/*xioopts.comma*/; /* default: "," */
|
ends[i++] = ","/*xioparms.comma*/; /* default: "," */
|
||||||
ends[i++] = ":"/*xioopts.colon*/; /* default: ":" */
|
ends[i++] = ":"/*xioparms.colon*/; /* default: ":" */
|
||||||
ends[i++] = NULL;
|
ends[i++] = NULL;
|
||||||
|
|
||||||
if ((xfd = xioallocfd()) == NULL) {
|
if ((xfd = xioallocfd()) == NULL) {
|
||||||
|
@ -567,8 +567,8 @@ static xiosingle_t *xioparse_single(const char **addr) {
|
||||||
sfd->tag = XIO_TAG_RDWR;
|
sfd->tag = XIO_TAG_RDWR;
|
||||||
sfd->addr = addrdesc;
|
sfd->addr = addrdesc;
|
||||||
|
|
||||||
while (!strncmp(*addr, xioopts.paramsep, strlen(xioopts.paramsep))) {
|
while (!strncmp(*addr, xioparms.paramsep, strlen(xioparms.paramsep))) {
|
||||||
*addr += strlen(xioopts.paramsep);
|
*addr += strlen(xioparms.paramsep);
|
||||||
len = sizeof(token); tokp = token;
|
len = sizeof(token); tokp = token;
|
||||||
result = nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests,
|
result = nestlex(addr, &tokp, &len, ends, hquotes, squotes, nests,
|
||||||
true, true, false);
|
true, true, false);
|
||||||
|
|
12
xioopts.c
12
xioopts.c
|
@ -1890,16 +1890,16 @@ int parseopts_table(const char **a, groups_t groups, struct opt **opts,
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
/*endkey[i++] = xioopts.chainsep;*/ /* default: "|" */
|
/*endkey[i++] = xioparms.chainsep;*/ /* default: "|" */
|
||||||
endkey[i++] = xioopts.pipesep; /* default: "!!" */
|
endkey[i++] = xioparms.pipesep; /* default: "!!" */
|
||||||
endkey[i++] = ","/*xioopts.comma*/; /* default: "," */
|
endkey[i++] = ","/*xioparms.comma*/; /* default: "," */
|
||||||
endkey[i++] = "=";
|
endkey[i++] = "=";
|
||||||
endkey[i++] = NULL;
|
endkey[i++] = NULL;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
/*endval[i++] = xioopts.chainsep;*/ /* default: "|" */
|
/*endval[i++] = xioparms.chainsep;*/ /* default: "|" */
|
||||||
endval[i++] = xioopts.pipesep; /* default: "!!" */
|
endval[i++] = xioparms.pipesep; /* default: "!!" */
|
||||||
endval[i++] = ","/*xioopts.comma*/; /* default: "," */
|
endval[i++] = ","/*xioparms.comma*/; /* default: "," */
|
||||||
endval[i++] = NULL;
|
endval[i++] = NULL;
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
20
xioparam.c
20
xioparam.c
|
@ -10,7 +10,7 @@
|
||||||
/*#include "xioparam.h" are all in xio.h */
|
/*#include "xioparam.h" are all in xio.h */
|
||||||
|
|
||||||
/* options that can be applied to this module */
|
/* options that can be applied to this module */
|
||||||
xioopts_t xioopts = {
|
xioparms_t xioparms = {
|
||||||
false, /* strictopts */
|
false, /* strictopts */
|
||||||
"!!", /* pipesep */
|
"!!", /* pipesep */
|
||||||
":", /* paramsep */
|
":", /* paramsep */
|
||||||
|
@ -28,21 +28,21 @@ xioopts_t xioopts = {
|
||||||
/* allow application to set xioopen options */
|
/* allow application to set xioopen options */
|
||||||
int xiosetopt(char what, const char *arg) {
|
int xiosetopt(char what, const char *arg) {
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 's': xioopts.strictopts = true; break;
|
case 's': xioparms.strictopts = true; break;
|
||||||
case 'p': if ((xioopts.pipesep = strdup(arg)) == NULL) {
|
case 'p': if ((xioparms.pipesep = strdup(arg)) == NULL) {
|
||||||
Error1("strdup("F_Zu"): out of memory", strlen(arg)+1);
|
Error1("strdup("F_Zu"): out of memory", strlen(arg)+1);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'o': xioopts.ip4portsep = arg[0];
|
case 'o': xioparms.ip4portsep = arg[0];
|
||||||
if (arg[1] != '\0') {
|
if (arg[1] != '\0') {
|
||||||
Error2("xiosetopt('%c', \"%s\"): port separator must be single character",
|
Error2("xiosetopt('%c', \"%s\"): port separator must be single character",
|
||||||
what, arg);
|
what, arg);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'l': xioopts.logopt = *arg; break;
|
case 'l': xioparms.logopt = *arg; break;
|
||||||
case 'y': xioopts.syslogfac = arg; break;
|
case 'y': xioparms.syslogfac = arg; break;
|
||||||
default:
|
default:
|
||||||
Error2("xiosetopt('%c', \"%s\"): unknown option",
|
Error2("xiosetopt('%c', \"%s\"): unknown option",
|
||||||
what, arg?arg:"NULL");
|
what, arg?arg:"NULL");
|
||||||
|
@ -54,12 +54,12 @@ int xiosetopt(char what, const char *arg) {
|
||||||
|
|
||||||
int xioinqopt(char what, char *arg, size_t n) {
|
int xioinqopt(char what, char *arg, size_t n) {
|
||||||
switch (what) {
|
switch (what) {
|
||||||
case 's': return xioopts.strictopts;
|
case 's': return xioparms.strictopts;
|
||||||
case 'p':
|
case 'p':
|
||||||
arg[0] = '\0'; strncat(arg, xioopts.pipesep, n-1);
|
arg[0] = '\0'; strncat(arg, xioparms.pipesep, n-1);
|
||||||
return 0;
|
return 0;
|
||||||
case 'o': return xioopts.ip4portsep;
|
case 'o': return xioparms.ip4portsep;
|
||||||
case 'l': return xioopts.logopt;
|
case 'l': return xioparms.logopt;
|
||||||
default:
|
default:
|
||||||
Error3("xioinqopt('%c', \"%s\", "F_Zu"): unknown option",
|
Error3("xioinqopt('%c', \"%s\", "F_Zu"): unknown option",
|
||||||
what, arg, n);
|
what, arg, n);
|
||||||
|
|
Loading…
Reference in a new issue