Mercurial > hg > toybox
annotate lib/net.c @ 983:c38c25282b88
Cleanup grep: help text, whitespace, add parentheses.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 01 Aug 2013 17:21:38 -0500 |
parents | aca8323e2690 |
children | e11684e3bbc5 |
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 #include "toynet.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
|
3 |
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 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
|
5 { |
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 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
|
7 |
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 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
|
9 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
|
10 } |