blob: 0cd3b131eadf8b7a8baa0be11a4a05e1df9add26 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#include "irc.h"
#include "unix.h"
#include <stdio.h>
int
main()
{
/* if (irc_connect()) { fputs("falure in irc_connect\n",stderr); return 1; }
if (irc_handshake()) { fputs("failure in irc_handshake\n",stderr); return 1; }
*/
int unixfd;
if ((unixfd = unix_setup("bees2.sock")) == -1) {
fputs("failure in unix_setup\n",stderr); return -1;
}
char buf[128];
ssize_t amt;
for (;;) {
if ((amt = recv(unixfd,buf,sizeof buf - 1,0)) == -1) {
perror("recv");
return 1;
} else if (amt == 0) {
puts("unix eof");
return 0;
} else {
buf[amt] = 0;
printf("got: %s\n",buf);
}
}
int x;
do {
x = irc_recv();
} while (!x);
return 0;
}
|