From 3b00c7be0e8834402ed93eb42b3a93302076c5ff Mon Sep 17 00:00:00 2001 From: Mikhail Osipov Date: Fri, 18 Oct 2019 17:43:38 +0300 Subject: skel --- main.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 main.c (limited to 'main.c') diff --git a/main.c b/main.c new file mode 100644 index 0000000..5a43f51 --- /dev/null +++ b/main.c @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +#include "tunnel.h" +#include "macro.h" + +int main(int argc __unused, char *argv[] __unused) +{ +#if 0 + if (geteuid() != 0) + errx(EXIT_FAILURE, "running as root required"); +#endif + + int sock = tunnel_client(); + if (sock < 0) + errx(EXIT_FAILURE, "tunnel_connect failed"); + + char buf[512]; + + int n = read(sock, buf, sizeof(buf)); + if (n < 0) + err(EXIT_FAILURE, "read"); + + printf("%.*s\n", n, buf); + + close(sock); + + return 0; +} -- cgit v1.2.3-70-g09d2