Added the --experimental option

This commit is contained in:
Gerhard Rieger 2023-09-30 09:26:13 +02:00
parent f0ca732bd9
commit dc777a00bb
8 changed files with 33 additions and 16 deletions

View file

@ -1,5 +1,9 @@
 
####################### V 1.7.4.5: Features:
Added the --experimental option that enables use of features that might
change in the future.
####################### V 1.7.4.5 (not released):
Corrections: Corrections:
On connect() failure and in some other situations Socat tries to get On connect() failure and in some other situations Socat tries to get

View file

@ -1 +1 @@
"1.7.4.5" "1.7.4.5+"

View file

@ -118,6 +118,9 @@ dit(bf(tt(-d -d -d -d))) Prints fatal, error, warning, notice, info, and debug
messages. messages.
dit(bf(tt(-D))) dit(bf(tt(-D)))
Logs information about file descriptors before starting the transfer phase. Logs information about file descriptors before starting the transfer phase.
dit(bf(tt(--experimental)))
New features that are not well tested or are subject to change in the future
must me explicitely enabled using this option.
dit(bf(tt(-ly[<facility>]))) dit(bf(tt(-ly[<facility>])))
Writes messages to syslog instead of stderr; severity as defined with -d Writes messages to syslog instead of stderr; severity as defined with -d
option. With optional link(<facility>)(TYPE_FACILITY), the syslog type can option. With optional link(<facility>)(TYPE_FACILITY), the syslog type can

11
socat.c
View file

@ -264,8 +264,9 @@ int main(int argc, const char *argv[]) {
} }
} }
break; break;
case 'W': if (socat_opts.lock.lockfile) case 'W': if (socat_opts.lock.lockfile) {
Error("only one -L and -W option allowed"); Error("only one -L and -W option allowed");
}
if (arg1[0][2]) { if (arg1[0][2]) {
socat_opts.lock.lockfile = *arg1+2; socat_opts.lock.lockfile = *arg1+2;
} else { } else {
@ -291,6 +292,13 @@ int main(int argc, const char *argv[]) {
xioopts.preferred_ip = arg1[0][1]; xioopts.preferred_ip = arg1[0][1];
break; break;
#endif /* WITH_IP4 || WITH_IP6 */ #endif /* WITH_IP4 || WITH_IP6 */
case '-':
if (!strcmp("experimental", &arg1[0][2])) {
xioopts.experimental = true;
} else {
Error1("unknown option \"%s\"; use option \"-h\" for help", arg1[0]);
}
break;
case '\0': case '\0':
case ',': case ',':
case ':': case ':':
@ -389,6 +397,7 @@ void socat_usage(FILE *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
fputs(" --experimental enable experimental features\n", fd);
fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd); fputs(" -ly[facility] log to syslog, using facility (default is daemon)\n", fd);
fputs(" -lf<logfile> log to file\n", fd); fputs(" -lf<logfile> log to file\n", fd);
fputs(" -ls log to stderr (default if no other log)\n", fd); fputs(" -ls log to stderr (default if no other log)\n", fd);

View file

@ -30,8 +30,7 @@ static int xioopen_readline(int argc, const char *argv[], struct opt *opts,
int dummy1, int dummy2, int dummy3); int dummy1, int dummy2, int dummy3);
const struct addrdesc addr_readline = { const struct addrdesc addr_readline = { "readline", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) };
"readline", 3, xioopen_readline, GROUP_FD|GROUP_TERMIOS|GROUP_READLINE, 0, 0, 0 HELP(NULL) };
const struct optdesc opt_history_file = { "history-file", "history", OPT_HISTORY_FILE, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.history_file) }; const struct optdesc opt_history_file = { "history-file", "history", OPT_HISTORY_FILE, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.history_file) };
const struct optdesc opt_prompt = { "prompt", NULL, OPT_PROMPT, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.prompt) }; const struct optdesc opt_prompt = { "prompt", NULL, OPT_PROMPT, GROUP_READLINE, PH_LATE, TYPE_STRING, OFUNC_OFFSET, XIO_OFFSETOF(para.readline.prompt) };

1
xio.h
View file

@ -102,6 +102,7 @@ typedef struct {
char default_ip; /* default prot.fam for IP based listen ('4' or '6') */ char default_ip; /* default prot.fam for IP based listen ('4' or '6') */
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 */
} xioopts_t; } xioopts_t;
/* pack the description of a lock file */ /* pack the description of a lock file */

View file

@ -20,7 +20,8 @@ xioopts_t xioopts = {
'\0', /* logopt */ '\0', /* logopt */
NULL, /* syslogfac */ NULL, /* syslogfac */
'4', /* default_ip */ '4', /* default_ip */
'4' /* preferred_ip */ '4', /* preferred_ip */
false /* experimental */
} ; } ;