1
0
Fork 0
mirror of https://repo.or.cz/socat.git synced 2025-07-27 04:57:51 +00:00

reworked so-type, so-prototype

This commit is contained in:
Gerhard Rieger 2008-09-20 23:47:06 +02:00
parent b6c2d46008
commit 376b9d50c3
22 changed files with 293 additions and 253 deletions

View file

@ -2333,7 +2333,15 @@ int retropt_int(struct opt *opts, int optcode, int *result) {
while (opt->desc != ODESC_END) {
if (opt->desc != ODESC_DONE && opt->desc->optcode == optcode) {
*result = opt->value.u_int;
switch (opt->desc->type) {
case TYPE_INT: *result = opt->value.u_int; break;
case TYPE_STRING: *result = strtol(opt->value.u_string, NULL, 0);
break;
default: Error2("cannot convert type %d of option %s to int",
opt->desc->type, opt->desc->defname);
opt->desc = ODESC_ERROR;
return -1;
}
opt->desc = ODESC_DONE;
return 0;
}
@ -2515,7 +2523,7 @@ int retropt_bind(struct opt *opts,
{
bool tight = false;
struct sockaddr_un *s_un = (struct sockaddr_un *)sa;
*salen = xiosetunix(s_un, bindname, false, tight);
*salen = xiosetunix(af, s_un, bindname, false, tight);
}
break;
#endif /* WITH_UNIX */