annotate lib/net.c @ 931:011df43e35d5

Option type @ counts number of occurrences, it doesn't take an argument.
author Rob Landley <rob@landley.net>
date Sat, 22 Jun 2013 15:36:25 -0500
parents aca8323e2690
children e11684e3bbc5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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 }