@@ -857,7 +857,7 @@ static void handle_dcc(param p)
857
857
int slot = -1 ;
858
858
int file_fd ;
859
859
860
- if (!strncmp (message , "SEND" , sizeof ("SEND" ) - 1 )) {
860
+ if (!memcmp (message , "SEND" , sizeof ("SEND" ) - 1 )) {
861
861
while (++ slot < CON_MAX && dcc_sessions .slots [slot ].file_fd >= 0 );
862
862
863
863
if (slot == CON_MAX ) {
@@ -960,7 +960,7 @@ static void handle_dcc(param p)
960
960
return ;
961
961
}
962
962
963
- if (!strncmp (message , "ACCEPT" , sizeof ("ACCEPT" ) - 1 )) {
963
+ if (!memcmp (message , "ACCEPT" , sizeof ("ACCEPT" ) - 1 )) {
964
964
if (parse_dcc_accept_message (message , filename , & port , & file_size )) {
965
965
return ;
966
966
}
@@ -981,29 +981,29 @@ static void handle_dcc(param p)
981
981
982
982
static void handle_ctcp (param p )
983
983
{
984
- if (p -> message [0 ] != '\001' && strncmp (p -> message , "ACTION" , sizeof ("ACTION" ) - 1 )) {
984
+ if (p -> message [0 ] != '\001' && memcmp (p -> message , "ACTION" , sizeof ("ACTION" ) - 1 )) {
985
985
return ;
986
986
}
987
987
const char * message = p -> message + 1 ;
988
- if (!strncmp (message , "VERSION" , sizeof ("VERSION" ) - 1 )) {
988
+ if (!memcmp (message , "VERSION" , sizeof ("VERSION" ) - 1 )) {
989
989
raw ("NOTICE %s :\001VERSION kirc " VERSION "\001\r\n" , p -> nickname );
990
990
return ;
991
991
}
992
- if (!strncmp (message , "TIME" , sizeof ("TIME" ) - 1 )) {
992
+ if (!memcmp (message , "TIME" , sizeof ("TIME" ) - 1 )) {
993
993
char buf [26 ];
994
994
if (!ctime_now (buf )) {
995
995
raw ("NOTICE %s :\001TIME %s\001\r\n" , p -> nickname , buf );
996
996
}
997
997
return ;
998
998
}
999
- if (!strncmp (message , "CLIENTINFO" , sizeof ("CLIENTINFO" ) - 1 )) {
999
+ if (!memcmp (message , "CLIENTINFO" , sizeof ("CLIENTINFO" ) - 1 )) {
1000
1000
raw ("NOTICE %s :\001CLIENTINFO " CTCP_CMDS "\001\r\n" , p -> nickname );
1001
1001
return ;
1002
- }if (!strncmp (message , "PING" , sizeof ("PING" ) - 1 )) {
1002
+ }if (!memcmp (message , "PING" , sizeof ("PING" ) - 1 )) {
1003
1003
raw ("NOTICE %s :\001%s\r\n" , p -> nickname , message );
1004
1004
return ;
1005
1005
}
1006
- if (!strncmp (message , "DCC" , sizeof ("DCC" ) - 1 )) {
1006
+ if (!memcmp (message , "DCC" , sizeof ("DCC" ) - 1 )) {
1007
1007
handle_dcc (p );
1008
1008
return ;
1009
1009
}
@@ -1049,7 +1049,7 @@ static void param_print_private(param p)
1049
1049
} else {
1050
1050
printf ("%*s\x1b[33;1m%-.*s\x1b[0m " , s , "" , p -> nicklen , p -> nickname );
1051
1051
}
1052
- if (!strncmp (p -> message , "\x01" "ACTION" , sizeof ("ACTION" ))) {
1052
+ if (!memcmp (p -> message , "\x01" "ACTION" , sizeof ("\x01" " ACTION" ) - 1 )) {
1053
1053
p -> message += sizeof ("ACTION" );
1054
1054
p -> offset += sizeof ("[ACTION] " );
1055
1055
printf ("[ACTION] " );
@@ -1071,7 +1071,7 @@ static void param_print_channel(param p)
1071
1071
1072
1072
static void raw_parser (char * string )
1073
1073
{
1074
- if (!strncmp (string , "PING" , sizeof ("PING" ) - 1 )) {
1074
+ if (!memcmp (string , "PING" , sizeof ("PING" ) - 1 )) {
1075
1075
string [1 ] = 'O' ;
1076
1076
raw ("%s\r\n" , string );
1077
1077
return ;
@@ -1105,31 +1105,31 @@ static void raw_parser(char *string)
1105
1105
small_screen = 0 ;
1106
1106
p .nicklen = WRAP_LEN ;
1107
1107
}
1108
- if (!strncmp (p .command , "001" , sizeof ("001" ) - 1 ) && * chan != '\0' ) {
1108
+ if (!memcmp (p .command , "001" , sizeof ("001" ) - 1 ) && * chan != '\0' ) {
1109
1109
char * tok ;
1110
1110
for (tok = strtok (chan , ",|" ); tok != NULL ; tok = strtok (NULL , ",|" )) {
1111
1111
strcpy (chan , tok );
1112
1112
raw ("JOIN #%s\r\n" , tok );
1113
1113
}
1114
1114
return ;
1115
1115
}
1116
- if (!strncmp (p .command , "QUIT" , sizeof ("QUIT" ) - 1 )) {
1116
+ if (!memcmp (p .command , "QUIT" , sizeof ("QUIT" ) - 1 )) {
1117
1117
param_print_quit (& p );
1118
1118
printf ("\x1b[0m\r\n" );
1119
1119
return ;
1120
- }if (!strncmp (p .command , "PART" , sizeof ("PART" ) - 1 )) {
1120
+ }if (!memcmp (p .command , "PART" , sizeof ("PART" ) - 1 )) {
1121
1121
param_print_part (& p );
1122
1122
printf ("\x1b[0m\r\n" );
1123
1123
return ;
1124
- }if (!strncmp (p .command , "JOIN" , sizeof ("JOIN" ) - 1 )) {
1124
+ }if (!memcmp (p .command , "JOIN" , sizeof ("JOIN" ) - 1 )) {
1125
1125
param_print_join (& p );
1126
1126
printf ("\x1b[0m\r\n" );
1127
1127
return ;
1128
- }if (!strncmp (p .command , "NICK" , sizeof ("NICK" ) - 1 )) {
1128
+ }if (!memcmp (p .command , "NICK" , sizeof ("NICK" ) - 1 )) {
1129
1129
param_print_nick (& p );
1130
1130
printf ("\x1b[0m\r\n" );
1131
1131
return ;
1132
- }if ((!strncmp (p .command , "PRIVMSG" , sizeof ("PRIVMSG" ) - 1 )) || (!strncmp (p .command , "NOTICE" , sizeof ("NOTICE" ) - 1 ))) {
1132
+ }if ((!memcmp (p .command , "PRIVMSG" , sizeof ("PRIVMSG" ) - 1 )) || (!memcmp (p .command , "NOTICE" , sizeof ("NOTICE" ) - 1 ))) {
1133
1133
param_print_private (& p );
1134
1134
message_wrap (& p );
1135
1135
printf ("\x1b[0m\r\n" );
@@ -1231,7 +1231,7 @@ static void msg_command(state l)
1231
1231
offset ++ ;
1232
1232
}
1233
1233
raw ("PRIVMSG %s :%s\r\n" , l -> buf + sizeof ("msg" ) + offset , tok );
1234
- if (strncmp (l -> buf + sizeof ("msg" ) + offset , "NickServ" , sizeof ("NickServ" ) - 1 )) {
1234
+ if (memcmp (l -> buf + sizeof ("msg" ) + offset , "NickServ" , sizeof ("NickServ" ) - 1 )) {
1235
1235
printf ("\x1b[35mprivmsg %s :%s\x1b[0m\r\n" , l -> buf + sizeof ("msg" ) + offset , tok );
1236
1236
}
1237
1237
}
@@ -1563,11 +1563,11 @@ static void handle_user_input(state l)
1563
1563
printf ("\r\x1b[0K" );
1564
1564
switch (l -> buf [0 ]) {
1565
1565
case '/' : /* send system command */
1566
- if (!strncmp (l -> buf + 1 , "JOIN" , sizeof ("JOIN" ) - 1 ) || !strncmp (l -> buf + 1 , "join" , sizeof ("join" ) - 1 )) {
1566
+ if (!memcmp (l -> buf + 1 , "JOIN" , sizeof ("JOIN" ) - 1 ) || !memcmp (l -> buf + 1 , "join" , sizeof ("join" ) - 1 )) {
1567
1567
join_command (l );
1568
1568
return ;
1569
1569
}
1570
- if (!strncmp (l -> buf + 1 , "PART" , sizeof ("PART" ) - 1 ) || !strncmp (l -> buf + 1 , "part" , sizeof ("part" ) - 1 )) {
1570
+ if (!memcmp (l -> buf + 1 , "PART" , sizeof ("PART" ) - 1 ) || !memcmp (l -> buf + 1 , "part" , sizeof ("part" ) - 1 )) {
1571
1571
part_command (l );
1572
1572
return ;
1573
1573
}
@@ -1578,23 +1578,23 @@ static void handle_user_input(state l)
1578
1578
"\x1b[35mprivmsg #%s :%s\x1b[0m\r\n" , chan , l -> buf + 2 );
1579
1579
return ;
1580
1580
}
1581
- if (!strncmp (l -> buf + 1 , "MSG" , sizeof ("MSG" ) - 1 ) || !strncmp (l -> buf + 1 , "msg" , sizeof ("msg" ) - 1 )) {
1581
+ if (!memcmp (l -> buf + 1 , "MSG" , sizeof ("MSG" ) - 1 ) || !memcmp (l -> buf + 1 , "msg" , sizeof ("msg" ) - 1 )) {
1582
1582
msg_command (l );
1583
1583
return ;
1584
1584
}
1585
- if (!strncmp (l -> buf + 1 , "NICK" , sizeof ("NICK" ) - 1 ) || !strncmp (l -> buf + 1 , "nick" , sizeof ("nick" ) - 1 )) {
1585
+ if (!memcmp (l -> buf + 1 , "NICK" , sizeof ("NICK" ) - 1 ) || !memcmp (l -> buf + 1 , "nick" , sizeof ("nick" ) - 1 )) {
1586
1586
nick_command (l );
1587
1587
return ;
1588
1588
}
1589
- if (!strncmp (l -> buf + 1 , "ACTION" , sizeof ("ACTION" ) - 1 ) || !strncmp (l -> buf + 1 , "action" , sizeof ("action" ) - 1 )) {
1589
+ if (!memcmp (l -> buf + 1 , "ACTION" , sizeof ("ACTION" ) - 1 ) || !memcmp (l -> buf + 1 , "action" , sizeof ("action" ) - 1 )) {
1590
1590
action_command (l );
1591
1591
return ;
1592
1592
}
1593
- if (!strncmp (l -> buf + 1 , "QUERY" , sizeof ("QUERY" ) - 1 ) || !strncmp (l -> buf + 1 , "query" , sizeof ("query" ) - 1 )) {
1593
+ if (!memcmp (l -> buf + 1 , "QUERY" , sizeof ("QUERY" ) - 1 ) || !memcmp (l -> buf + 1 , "query" , sizeof ("query" ) - 1 )) {
1594
1594
query_command (l );
1595
1595
return ;
1596
1596
}
1597
- if (!strncmp (l -> buf + 1 , "DCC" , sizeof ("DCC" ) - 1 ) || !strncmp (l -> buf + 1 , "dcc" , sizeof ("dcc" ) - 1 )) {
1597
+ if (!memcmp (l -> buf + 1 , "DCC" , sizeof ("DCC" ) - 1 ) || !memcmp (l -> buf + 1 , "dcc" , sizeof ("dcc" ) - 1 )) {
1598
1598
dcc_command (l );
1599
1599
return ;
1600
1600
}
0 commit comments