commit - e7f87828317c48464a971a6e5c0aee717a4c8aa3
commit + e618041168d77852ceec5060ec285127354cb6f5
blob - 368185f6e3be86f78aa204a8311a0dd44adf3b88
blob + 2f657f271fdcd911971e8023c1116c6e25730bb4
--- src/ngircd/irc-mode.c
+++ src/ngircd/irc-mode.c
#include "portab.h"
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.37 2005/03/02 16:35:11 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.38 2005/03/05 11:44:01 alex Exp $";
#include "imp.h"
#include <assert.h>
CHAR the_modes[COMMAND_LEN], x[2], *mode_ptr;
BOOLEAN ok, set;
INT mode_arg;
+ size_t len;
/* Is the client allowed to request or change the modes? */
if( Client_Type( Client ) == CLIENT_USER )
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
{
/* Action modifier ("+"/"-") must be changed ... */
- if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
+ len = strlen( the_modes ) - 1;
+ if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' ))
{
/* Adjust last action modifier in result */
- the_modes[strlen( the_modes ) - 1] = *mode_ptr;
+ the_modes[len] = *mode_ptr;
}
else
{
if( the_modes[1] )
{
/* Remoce needless action modifier characters */
- if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
+ len = strlen( the_modes ) - 1;
+ if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' )) the_modes[len] = '\0';
if( Client_Type( Client ) == CLIENT_SERVER )
{
INT mode_arg, arg_arg;
CLIENT *client;
LONG l;
+ size_t len;
/* Mode request: let's answer it :-) */
if( Req->argc == 1 )
if((( *mode_ptr == '+' ) && ( ! set )) || (( *mode_ptr == '-' ) && ( set )))
{
/* Action modifier ("+"/"-") must be changed ... */
- if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' ))
+ len = strlen( the_modes ) - 1;
+ if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' ))
{
/* Adjust last action modifier in result */
- the_modes[strlen( the_modes ) - 1] = *mode_ptr;
+ the_modes[len] = *mode_ptr;
}
else
{
/* Are there additional arguments to add? */
if( argadd[0] )
{
- if( the_args[strlen( the_args ) - 1] != ' ' ) strlcat( the_args, " ", sizeof( the_args ));
+ len = strlen( the_args ) - 1;
+ if( the_args[len] != ' ' ) strlcat( the_args, " ", sizeof( the_args ));
strlcat( the_args, argadd, sizeof( the_args ));
}
}
if( the_modes[1] )
{
/* Clean up mode string */
- if(( the_modes[strlen( the_modes ) - 1] == '+' ) || ( the_modes[strlen( the_modes ) - 1] == '-' )) the_modes[strlen( the_modes ) - 1] = '\0';
+ len = strlen( the_modes ) - 1;
+ if(( the_modes[len] == '+' ) || ( the_modes[len] == '-' )) the_modes[len] = '\0';
/* Clean up argument string if there are none */
if( ! the_args[1] ) the_args[0] = '\0';