From 4350dabf2f524daabb03f26928742296310b456f Mon Sep 17 00:00:00 2001 From: GDR! Date: Mon, 12 Jan 2015 22:57:20 +0100 Subject: Allow using @ instead of : in port forward definitions Useful for SYSTEM in socat --- util.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'util.c') diff --git a/util.c b/util.c index 4b7aa26..8cffe64 100644 --- a/util.c +++ b/util.c @@ -89,6 +89,14 @@ int parse_local_port_forward(char *string, int *local_port, char **hostname, int char *lport; char *host; char *rport; + + /* First replace all @ with :, ':' is forbidden in some environments */ + char *p = string; + while(*p) + { + if(*p == '@') *p = ':'; + p++; + } lport = strtok(string, ":"); host = strtok(NULL, ":"); @@ -112,6 +120,14 @@ int parse_pipe_port_forward(char *string, char **hostname, int *remote_port) { char *host; char *rport; + + /* First replace all @ with :, ':' is forbidden in some environments */ + char *p = string; + while(*p) + { + if(*p == '@') *p = ':'; + p++; + } host = strtok(string, ":"); rport = strtok(NULL, ":"); -- cgit v1.2.3