Changeset f1d38f2


Ignore:
Timestamp:
2006-01-21T22:23:58Z (18 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
54879ab, 87de505
Parents:
f73b969
Message:

Fixed counting of arguments in i[rp]c_exec(), made them a bit too simple.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ipc.c

    rf73b969 rf1d38f2  
    155155static void ipc_command_exec( void *data, char **cmd, const command_t *commands )
    156156{
    157         int i;
     157        int i, j;
    158158       
    159159        if( !cmd[0] )
     
    163163                if( g_strcasecmp( commands[i].command, cmd[0] ) == 0 )
    164164                {
     165                        /* There is no typo in this line: */
     166                        for( j = 1; cmd[j]; j ++ ); j --;
     167                       
     168                        if( j < commands[i].required_parameters )
     169                                break;
     170                       
    165171                        if( commands[i].flags & IPC_CMD_TO_CHILDREN )
    166172                                ipc_to_children( cmd );
     
    168174                                commands[i].execute( data, cmd );
    169175                       
    170                         return;
     176                        break;
    171177                }
    172178}
  • irc_commands.c

    rf73b969 rf1d38f2  
    579579void irc_exec( irc_t *irc, char *cmd[] )
    580580{       
    581         int i;
     581        int i, n_arg;
    582582       
    583583        if( !cmd[0] )
     
    587587                if( g_strcasecmp( irc_commands[i].command, cmd[0] ) == 0 )
    588588                {
     589                        /* There should be no typo in the next line: */
     590                        for( n_arg = 0; cmd[n_arg]; n_arg ++ ); n_arg --;
     591                       
    589592                        if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status >= USTATUS_LOGGED_IN )
    590593                        {
     
    599602                                irc_reply( irc, 481, ":Permission denied - You're not an IRC operator" );
    600603                        }
    601                         else if( !cmd[irc_commands[i].required_parameters] )
     604                        else if( n_arg < irc_commands[i].required_parameters )
    602605                        {
    603606                                irc_reply( irc, 461, "%s :Need more parameters", cmd[0] );
Note: See TracChangeset for help on using the changeset viewer.