Subversion Repositories Okuu

Rev

Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 13
Line 1... Line 1...
1
/* $Id: news.c 11 2024-09-11 10:24:20Z nishi $ */
1
/* $Id: news.c 13 2024-09-12 15:29:22Z nishi $ */
2
 
2
 
3
#define OK_NEWS_SRC
3
#define OK_NEWS_SRC
4
#include "ok_news.h"
4
#include "ok_news.h"
5
 
5
 
6
#include "ok_util.h"
6
#include "ok_util.h"
Line 9... Line 9...
9
#include <stdbool.h>
9
#include <stdbool.h>
10
#include <string.h>
10
#include <string.h>
11
#include <stdlib.h>
11
#include <stdlib.h>
12
#include <stdint.h>
12
#include <stdint.h>
13
#include <sys/stat.h>
13
#include <sys/stat.h>
-
 
14
#include <errno.h>
14
 
15
 
15
#include <sys/socket.h>
16
#include <sys/socket.h>
16
#include <netinet/tcp.h>
17
#include <netinet/tcp.h>
17
#include <arpa/inet.h>
18
#include <arpa/inet.h>
18
 
19
 
Line 248... Line 249...
248
 
249
 
249
int ok_news_write(const char* nick, const char* message) {
250
int ok_news_write(const char* nick, const char* message) {
250
	int nt_sock;
251
	int nt_sock;
251
	struct sockaddr_in nt_addr;
252
	struct sockaddr_in nt_addr;
252
	if((nt_sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
253
	if((nt_sock = socket(PF_INET, SOCK_STREAM, 0)) < 0) {
253
		fprintf(stderr, "Socket creation failure\n");
254
		fprintf(stderr, "Socket creation failure: %s\n", strerror(errno));
254
		return 1;
255
		return 1;
255
	}
256
	}
256
 
257
 
257
	bzero((char*)&nt_addr, sizeof(nt_addr));
258
	bzero((char*)&nt_addr, sizeof(nt_addr));
258
	nt_addr.sin_family = PF_INET;
259
	nt_addr.sin_family = PF_INET;