From 349909ff47acb27784ea8e8200a87873083f600e Mon Sep 17 00:00:00 2001 From: Quentin Dufour Date: Tue, 19 Feb 2019 10:38:01 +0100 Subject: [PATCH] Add missing files --- src/url.c | 12 ++++++++++++ src/url.h | 5 +++++ 2 files changed, 17 insertions(+) create mode 100644 src/url.c create mode 100644 src/url.h diff --git a/src/url.c b/src/url.c new file mode 100644 index 0000000..3f1bfed --- /dev/null +++ b/src/url.c @@ -0,0 +1,12 @@ +#include "url.h" + +char* url_get_port(char* out, char* in) { + sscanf(in, "%*[a-z]:%*[a-z]:%*[a-zA-Z0-9.]:%[0-9]", out); + return out; +} + +int url_get_port_int(char* in) { + int out; + sscanf(in, "%*[a-z]:%*[a-z]:%*[a-zA-Z0-9.]:%d", &out); + return out; +} diff --git a/src/url.h b/src/url.h new file mode 100644 index 0000000..8ac086c --- /dev/null +++ b/src/url.h @@ -0,0 +1,5 @@ +#pragma once +#include + +char* url_get_port(char* out, char* in); +int url_get_port_int(char* in);