Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports-gnome
Path: blob/main/irc/icbirc/files/patch-icb.c
14237 views
1
--- icb.c.orig 2015-08-21 19:01:12 UTC
2
+++ icb.c
3
@@ -30,7 +30,9 @@
4
*
5
*/
6
7
+#if 0
8
static const char rcsid[] = "$Id: icb.c,v 1.3 2015/08/21 19:01:12 dhartmei Exp $";
9
+#endif
10
11
#include <stdio.h>
12
#include <stdlib.h>
13
@@ -40,8 +42,8 @@ static const char rcsid[] = "$Id: icb.c,v 1.3 2015/08/
14
15
extern int sync_write(int, const char *, int);
16
17
-static unsigned char icb_args(const char *, unsigned char, char [255][255]);
18
-static void icb_cmd(const char *, unsigned char, int, int);
19
+static unsigned char icb_args(const unsigned char *, unsigned char, char [255][255]);
20
+static void icb_cmd(const unsigned char *, unsigned char, int, int);
21
static void icb_ico(int, const char *);
22
static void icb_iwl(int, const char *, const char *, long,
23
long, const char *, const char *);
24
@@ -109,7 +111,7 @@ static unsigned off;
25
*/
26
27
void
28
-scan(const char **s, char *d, size_t siz, const char *skip, const char *term)
29
+scan(const unsigned char **s, char *d, size_t siz, const char *skip, const char *term)
30
{
31
while (**s && strchr(skip, **s) != NULL)
32
(*s)++;
33
@@ -164,7 +166,7 @@ icb_recv(const char *buf, unsigned len, int fd, int se
34
}
35
36
static unsigned char
37
-icb_args(const char *data, unsigned char len, char args[255][255])
38
+icb_args(const unsigned char *data, unsigned char len, char args[255][255])
39
{
40
unsigned char i = 0, j = 0, k = 0;
41
42
@@ -190,10 +192,10 @@ icb_args(const char *data, unsigned char len, char arg
43
}
44
45
static void
46
-icb_cmd(const char *cmd, unsigned char len, int fd, int server_fd)
47
+icb_cmd(const unsigned char *cmd, unsigned char len, int fd, int server_fd)
48
{
49
char args[255][255];
50
- const char *a = args[1];
51
+ const unsigned char *a = (unsigned char *)args[1];
52
unsigned char i, j;
53
char s[8192];
54
55
@@ -269,7 +271,7 @@ icb_cmd(const char *cmd, unsigned char len, int fd, in
56
char old_nick[256], new_nick[256];
57
58
scan(&a, old_nick, sizeof(old_nick), " ", " ");
59
- if (strncmp(a, " changed nickname to ", 21))
60
+ if (strncmp((const char *)a, " changed nickname to ", 21))
61
return;
62
a += 21;
63
scan(&a, new_nick, sizeof(new_nick), " ", " ");
64
@@ -283,7 +285,7 @@ icb_cmd(const char *cmd, unsigned char len, int fd, in
65
char nick[256], topic[256];
66
67
scan(&a, nick, sizeof(nick), " ", " ");
68
- if (strncmp(a, " changed the topic to \"", 23))
69
+ if (strncmp((const char *)a, " changed the topic to \"", 23))
70
return;
71
a += 23;
72
scan(&a, topic, sizeof(topic), "", "\"");
73
@@ -294,13 +296,13 @@ icb_cmd(const char *cmd, unsigned char len, int fd, in
74
char old_mod[256], new_mod[256];
75
76
scan(&a, old_mod, sizeof(old_mod), " ", " ");
77
- if (!strncmp(a, " has passed moderation to ", 26)) {
78
+ if (!strncmp((const char *)a, " has passed moderation to ", 26)) {
79
a += 26;
80
scan(&a, new_mod, sizeof(new_mod), " ", " ");
81
snprintf(s, sizeof(s),
82
":%s MODE %s -o+o %s %s\r\n",
83
old_mod, irc_channel, old_mod, new_mod);
84
- } else if (!strcmp(a, " is now mod.")) {
85
+ } else if (!strcmp((const char *)a, " is now mod.")) {
86
snprintf(s, sizeof(s),
87
":%s MODE %s +o %s\r\n",
88
icb_hostid, irc_channel, old_mod);
89
@@ -312,7 +314,7 @@ icb_cmd(const char *cmd, unsigned char len, int fd, in
90
char nick[256];
91
92
scan(&a, nick, sizeof(nick), " ", " ");
93
- if (strcmp(a, " was booted."))
94
+ if (strcmp((const char *)a, " was booted."))
95
return;
96
snprintf(s, sizeof(s), ":%s KICK %s %s :booted\r\n",
97
icb_moderator, irc_channel, nick);
98
@@ -523,7 +525,7 @@ icb_send_openmsg(int fd, const char *msg)
99
cmd[off++] = 0;
100
cmd[0] = off - 1;
101
/* cmd[0] <= MAX_MSG_SIZE */
102
- sync_write(fd, cmd, off);
103
+ sync_write(fd, (const char *)cmd, off);
104
}
105
}
106
107
@@ -548,7 +550,7 @@ icb_send_privmsg(int fd, const char *nick, const char
108
cmd[off++] = 0;
109
cmd[0] = off - 1;
110
/* cmd[0] <= MAX_MSG_SIZE */
111
- sync_write(fd, cmd, off);
112
+ sync_write(fd, (const char *)cmd, off);
113
}
114
}
115
116
117