summaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'main.c')
-rw-r--r--main.c31
1 files changed, 31 insertions, 0 deletions
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 <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <err.h>
+
+#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;
+}