Mercurial > hg > toybox
annotate lib/net.c @ 1239:9a13e6637d7b draft
Decided not to go with the sflate implementation of deflate/inflate. The decompression side's already reimplemented in compress, and I'm working on compression side.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 02 Apr 2014 06:37:14 -0500 |
parents | e11684e3bbc5 |
children |
rev | line source |
---|---|
883
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
1 #include "toys.h" |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
2 |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
3 int xsocket(int domain, int type, int protocol) |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
4 { |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
5 int fd = socket(domain, type, protocol); |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
6 |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
7 if (fd < 0) perror_exit("socket %x %x", type, protocol); |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
8 return fd; |
aca8323e2690
Add posix headers to toynet.h, move xioctl() to lib.c, introduce lib/net.c and move xsocket() to it.
Rob Landley <rob@landley.net>
parents:
diff
changeset
|
9 } |