Mercurial > hg > toybox
annotate lib/net.c @ 1566:62a7d617e1ce draft 0.5.1
Make md5sum and sha1sum work on big endian systems.
author | Rob Landley <rob@landley.net> |
---|---|
date | Wed, 19 Nov 2014 21:38:00 -0600 |
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 } |