aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbru <bru@texto-plano.xyz>2022-02-06 19:48:53 +0000
committerbru <bru@texto-plano.xyz>2022-02-06 19:48:53 +0000
commitce4706a4c92a762fe6e5c4fed29fdd8ab1ba6651 (patch)
treed79840bbdb09b70465f7eaf99d4366d87ad2b557
parent0d52befde1344ad5b0a7238b6b9098d03c4c3590 (diff)
downloadajedrez-ce4706a4c92a762fe6e5c4fed29fdd8ab1ba6651.tar.gz
Primeros pasos en la texto-plan/FreeBSDización
-rw-r--r--.gitignore2
-rw-r--r--Makefile8
-rw-r--r--sakkom.c6
3 files changed, 14 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bd47f90
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+sakkom
+tags
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..9cb5493
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,8 @@
+CC=cc
+LIBS=-lpthread
+all:
+ $(CC) -o sakkom sakkom.c $(LIBS)
+
+clean:
+ rm sakkom
+
diff --git a/sakkom.c b/sakkom.c
index 5dbcea0..3a7980c 100644
--- a/sakkom.c
+++ b/sakkom.c
@@ -12,6 +12,8 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
+#include <netinet/in.h>
+#include <sys/socket.h>
#include <time.h>
#include <unistd.h>
@@ -634,11 +636,11 @@ int main() {
struct sockaddr_in listen_addr = {0}, client_addr = {0};
struct sockaddr_in6 listen6_addr = {0};
- if ((listen_fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
+ if ((listen_fd = socket(PF_INET, SOCK_STREAM, 0)) == -1) {
perror("IPv4 socket");
exit(EXIT_FAILURE);
}
- if ((listen6_fd = socket(AF_INET6, SOCK_STREAM, 0)) == -1) {
+ if ((listen6_fd = socket(PF_INET6, SOCK_STREAM, 0)) == -1) {
perror("IPv6 socket");
exit(EXIT_FAILURE);
}
Un proyecto texto-plano.xyz