commit 8adff5922376676c2eeb49de1cbab86cc345b887 from: Florian Westphal date: Sat Mar 19 18:43:48 2005 UTC Remove INT, LONG, BOOLEAN, STATIC, CONST, CHAR datatypes. use stdbool.h / inttypes.h if available. commit - 27d93d7d8c1dacb3a9874084a67629df26f96bb1 commit + 8adff5922376676c2eeb49de1cbab86cc345b887 blob - 2dbaad7e283d0da94a6cc946f5efbdf5b0d85176 blob + 695a42ccfc8d976756dc850a08773cb5612d666b --- configure.in +++ configure.in @@ -8,7 +8,7 @@ # (at your option) any later version. # Please read the file COPYING, README and AUTHORS for more information. # -# $Id: configure.in,v 1.105 2005/03/19 14:09:32 alex Exp $ +# $Id: configure.in,v 1.106 2005/03/19 18:43:48 fw Exp $ # # -- Initialisation -- @@ -85,7 +85,7 @@ AC_CHECK_HEADERS([ \ strings.h sys/socket.h sys/time.h unistd.h \ ],,AC_MSG_ERROR([required C header missing!])) -AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdint.h varargs.h]) +AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdbool.h stddef.h varargs.h]) # -- Datatypes -- blob - c5dde86a99fb3117e1208c9a0a3e5760f826fd5f blob + 2642392c31886827f1072c1ad44c3f8b9619f485 --- src/ngircd/channel.c +++ src/ngircd/channel.c @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: channel.c,v 1.45 2004/03/11 22:16:31 alex Exp $"; +static char UNUSED id[] = "$Id: channel.c,v 1.46 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -54,28 +54,28 @@ LOCAL CL2CHAN *My_Cl2Chan; LOCAL CL2CHAN *Get_Cl2Chan PARAMS(( CHANNEL *Chan, CLIENT *Client )); LOCAL CL2CHAN *Add_Client PARAMS(( CHANNEL *Chan, CLIENT *Client )); -LOCAL BOOLEAN Remove_Client PARAMS(( INT Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN InformServer )); +LOCAL bool Remove_Client PARAMS(( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Reason, bool InformServer )); LOCAL CL2CHAN *Get_First_Cl2Chan PARAMS(( CLIENT *Client, CHANNEL *Chan )); LOCAL CL2CHAN *Get_Next_Cl2Chan PARAMS(( CL2CHAN *Start, CLIENT *Client, CHANNEL *Chan )); -LOCAL BOOLEAN Delete_Channel PARAMS(( CHANNEL *Chan )); +LOCAL bool Delete_Channel PARAMS(( CHANNEL *Chan )); -GLOBAL VOID -Channel_Init( VOID ) +GLOBAL void +Channel_Init( void ) { My_Channels = NULL; My_Cl2Chan = NULL; } /* Channel_Init */ -GLOBAL VOID -Channel_InitPredefined( VOID ) +GLOBAL void +Channel_InitPredefined( void ) { /* Vordefinierte persistente Channels erzeugen */ CHANNEL *chan; - CHAR *c; - INT i; + char *c; + int i; for( i = 0; i < Conf_Channel_Count; i++ ) { @@ -112,8 +112,8 @@ Channel_InitPredefined( VOID ) } /* Channel_InitPredefined */ -GLOBAL VOID -Channel_Exit( VOID ) +GLOBAL void +Channel_Exit( void ) { CHANNEL *c, *c_next; CL2CHAN *cl2chan, *cl2chan_next; @@ -138,8 +138,8 @@ Channel_Exit( VOID ) } /* Channel_Exit */ -GLOBAL BOOLEAN -Channel_Join( CLIENT *Client, CHAR *Name ) +GLOBAL bool +Channel_Join( CLIENT *Client, char *Name ) { CHANNEL *chan; @@ -150,7 +150,7 @@ Channel_Join( CLIENT *Client, CHAR *Name ) if( ! Channel_IsValidName( Name )) { IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name ); - return FALSE; + return false; } /* Channel suchen */ @@ -158,23 +158,23 @@ Channel_Join( CLIENT *Client, CHAR *Name ) if( chan ) { /* Ist der Client bereits Mitglied? */ - if( Get_Cl2Chan( chan, Client )) return FALSE; + if( Get_Cl2Chan( chan, Client )) return false; } else { /* Gibt es noch nicht? Dann neu anlegen: */ chan = Channel_Create( Name ); - if( ! chan ) return FALSE; + if( ! chan ) return false; } /* User dem Channel hinzufuegen */ - if( ! Add_Client( chan, Client )) return FALSE; - else return TRUE; + if( ! Add_Client( chan, Client )) return false; + else return true; } /* Channel_Join */ -GLOBAL BOOLEAN -Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ) +GLOBAL bool +Channel_Part( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason ) { CHANNEL *chan; @@ -187,17 +187,17 @@ Channel_Part( CLIENT *Client, CLIENT *Origin, CHAR *Na if(( ! chan ) || ( ! Get_Cl2Chan( chan, Client ))) { IRC_WriteStrClient( Client, ERR_NOSUCHCHANNEL_MSG, Client_ID( Client ), Name ); - return FALSE; + return false; } /* User aus Channel entfernen */ - if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, TRUE )) return FALSE; - else return TRUE; + if( ! Remove_Client( REMOVE_PART, chan, Client, Origin, Reason, true)) return false; + else return true; } /* Channel_Part */ -GLOBAL VOID -Channel_Kick( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason ) +GLOBAL void +Channel_Kick( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason ) { CHANNEL *chan; @@ -235,12 +235,12 @@ Channel_Kick( CLIENT *Client, CLIENT *Origin, CHAR *Na return; } - Remove_Client( REMOVE_KICK, chan, Client, Origin, Reason, TRUE ); + Remove_Client( REMOVE_KICK, chan, Client, Origin, Reason, true); } /* Channel_Kick */ -GLOBAL VOID -Channel_Quit( CLIENT *Client, CHAR *Reason ) +GLOBAL void +Channel_Quit( CLIENT *Client, char *Reason ) { CHANNEL *c, *next_c; @@ -251,19 +251,18 @@ Channel_Quit( CLIENT *Client, CHAR *Reason ) while( c ) { next_c = c->next; - Remove_Client( REMOVE_QUIT, c, Client, Client, Reason, FALSE ); + Remove_Client( REMOVE_QUIT, c, Client, Client, Reason, false ); c = next_c; } } /* Channel_Quit */ -GLOBAL LONG -Channel_Count( VOID ) +GLOBAL long +Channel_Count( void ) { CHANNEL *c; - LONG count; + long count = 0; - count = 0; c = My_Channels; while( c ) { @@ -274,15 +273,14 @@ Channel_Count( VOID ) } /* Channel_Count */ -GLOBAL LONG +GLOBAL long Channel_MemberCount( CHANNEL *Chan ) { CL2CHAN *cl2chan; - LONG count; + long count = 0; assert( Chan != NULL ); - count = 0; cl2chan = My_Cl2Chan; while( cl2chan ) { @@ -293,17 +291,16 @@ Channel_MemberCount( CHANNEL *Chan ) } /* Channel_MemberCount */ -GLOBAL INT +GLOBAL int Channel_CountForUser( CLIENT *Client ) { /* Count number of channels a user is member of. */ CL2CHAN *cl2chan; - INT count; + int count = 0; assert( Client != NULL ); - count = 0; cl2chan = My_Cl2Chan; while( cl2chan ) { @@ -315,15 +312,14 @@ Channel_CountForUser( CLIENT *Client ) } /* Channel_CountForUser */ -GLOBAL INT -Channel_PCount( VOID ) +GLOBAL int +Channel_PCount( void ) { /* Count the number of persistent (mode 'P') channels */ CHANNEL *chan; - INT count; + int count = 0; - count = 0; chan = My_Channels; while( chan ) { @@ -335,7 +331,7 @@ Channel_PCount( VOID ) } /* Channel_PCount */ -GLOBAL CHAR * +GLOBAL char * Channel_Name( CHANNEL *Chan ) { assert( Chan != NULL ); @@ -343,7 +339,7 @@ Channel_Name( CHANNEL *Chan ) } /* Channel_Name */ -GLOBAL CHAR * +GLOBAL char * Channel_Modes( CHANNEL *Chan ) { assert( Chan != NULL ); @@ -351,7 +347,7 @@ Channel_Modes( CHANNEL *Chan ) } /* Channel_Modes */ -GLOBAL CHAR * +GLOBAL char * Channel_Key( CHANNEL *Chan ) { assert( Chan != NULL ); @@ -359,7 +355,7 @@ Channel_Key( CHANNEL *Chan ) } /* Channel_Key */ -GLOBAL LONG +GLOBAL long Channel_MaxUsers( CHANNEL *Chan ) { assert( Chan != NULL ); @@ -368,7 +364,7 @@ Channel_MaxUsers( CHANNEL *Chan ) GLOBAL CHANNEL * -Channel_First( VOID ) +Channel_First( void ) { return My_Channels; } /* Channel_First */ @@ -383,7 +379,7 @@ Channel_Next( CHANNEL *Chan ) GLOBAL CHANNEL * -Channel_Search( CHAR *Name ) +Channel_Search( char *Name ) { /* Channel-Struktur suchen */ @@ -457,86 +453,88 @@ Channel_GetChannel( CL2CHAN *Cl2Chan ) } /* Channel_GetChannel */ -GLOBAL BOOLEAN -Channel_IsValidName( CHAR *Name ) +GLOBAL bool +Channel_IsValidName( char *Name ) { /* Pruefen, ob Name als Channelname gueltig */ - CHAR *ptr, badchars[10]; + char *ptr, badchars[10]; assert( Name != NULL ); - if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return FALSE; + if(( Name[0] != '#' ) || ( strlen( Name ) >= CHANNEL_NAME_LEN )) return false; ptr = Name; strcpy( badchars, " ,:\007" ); while( *ptr ) { - if( strchr( badchars, *ptr )) return FALSE; + if( strchr( badchars, *ptr )) return false; ptr++; } - return TRUE; + return true; } /* Channel_IsValidName */ -GLOBAL BOOLEAN -Channel_ModeAdd( CHANNEL *Chan, CHAR Mode ) +GLOBAL bool +Channel_ModeAdd( CHANNEL *Chan, char Mode ) { - /* Mode soll gesetzt werden. TRUE wird geliefert, wenn der - * Mode neu gesetzt wurde, FALSE, wenn der Channel den Mode - * bereits hatte. */ + /* set Mode. + * If the channel already had this mode, return false. + * If the channel mode was newly set return true. + */ - CHAR x[2]; + char x[2]; assert( Chan != NULL ); x[0] = Mode; x[1] = '\0'; if( ! strchr( Chan->modes, x[0] )) { - /* Client hat den Mode noch nicht -> setzen */ + /* Channel does not have this mode yet, set it */ strlcat( Chan->modes, x, sizeof( Chan->modes )); - return TRUE; + return true; } - else return FALSE; + else return false; } /* Channel_ModeAdd */ -GLOBAL BOOLEAN -Channel_ModeDel( CHANNEL *Chan, CHAR Mode ) +GLOBAL bool +Channel_ModeDel( CHANNEL *Chan, char Mode ) { - /* Mode soll geloescht werden. TRUE wird geliefert, wenn der - * Mode entfernt wurde, FALSE, wenn der Channel den Mode - * ueberhaupt nicht hatte. */ + /* Delete mode. + * if the mode was removed return true. + * if the channel did not have the mode, return false. + */ + char x[2], *p; - CHAR x[2], *p; - assert( Chan != NULL ); x[0] = Mode; x[1] = '\0'; p = strchr( Chan->modes, x[0] ); - if( ! p ) return FALSE; + if( ! p ) return false; - /* Client hat den Mode -> loeschen */ + /* Channel has mode -> delete */ while( *p ) { *p = *(p + 1); p++; } - return TRUE; + return true; } /* Channel_ModeDel */ -GLOBAL BOOLEAN -Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CHAR Mode ) +GLOBAL bool +Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, char Mode ) { - /* Channel-User-Mode soll gesetzt werden. TRUE wird geliefert, - * wenn der Mode neu gesetzt wurde, FALSE, wenn der User den - * Channel-Mode bereits hatte. */ + /* Set Channel-User-Mode. + * if mode was newly set, return true. + * if the User already had this channel-mode, return false. + */ CL2CHAN *cl2chan; - CHAR x[2]; + char x[2]; assert( Chan != NULL ); assert( Client != NULL ); @@ -547,23 +545,24 @@ Channel_UserModeAdd( CHANNEL *Chan, CLIENT *Client, CH x[0] = Mode; x[1] = '\0'; if( ! strchr( cl2chan->modes, x[0] )) { - /* Client hat den Mode noch nicht -> setzen */ + /* mode not set, -> set it */ strlcat( cl2chan->modes, x, sizeof( cl2chan->modes )); - return TRUE; + return true; } - else return FALSE; + else return false; } /* Channel_UserModeAdd */ -GLOBAL BOOLEAN -Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CHAR Mode ) +GLOBAL bool +Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, char Mode ) { - /* Channel-User-Mode soll geloescht werden. TRUE wird geliefert, - * wenn der Mode entfernt wurde, FALSE, wenn der User den Channel-Mode - * ueberhaupt nicht hatte. */ + /* Delete Channel-User-Mode. + * If Mode was removed, return true. + * If User did not have the Channel-Mode, return false. + */ CL2CHAN *cl2chan; - CHAR x[2], *p; + char x[2], *p; assert( Chan != NULL ); assert( Client != NULL ); @@ -574,22 +573,22 @@ Channel_UserModeDel( CHANNEL *Chan, CLIENT *Client, CH x[0] = Mode; x[1] = '\0'; p = strchr( cl2chan->modes, x[0] ); - if( ! p ) return FALSE; + if( ! p ) return false; - /* Client hat den Mode -> loeschen */ + /* Client has Mode -> delete */ while( *p ) { *p = *(p + 1); p++; } - return TRUE; + return true; } /* Channel_UserModeDel */ -GLOBAL CHAR * +GLOBAL char * Channel_UserModes( CHANNEL *Chan, CLIENT *Client ) { - /* Channel-Modes eines Users liefern */ + /* return Users' Channel-Modes */ CL2CHAN *cl2chan; @@ -603,20 +602,20 @@ Channel_UserModes( CHANNEL *Chan, CLIENT *Client ) } /* Channel_UserModes */ -GLOBAL BOOLEAN +GLOBAL bool Channel_IsMemberOf( CHANNEL *Chan, CLIENT *Client ) { - /* Pruefen, ob Client Mitglied in Channel ist */ + /* Test if Client is on Channel Chan */ assert( Chan != NULL ); assert( Client != NULL ); - if( Get_Cl2Chan( Chan, Client )) return TRUE; - else return FALSE; + if( Get_Cl2Chan( Chan, Client )) return true; + else return false; } /* Channel_IsMemberOf */ -GLOBAL CHAR * +GLOBAL char * Channel_Topic( CHANNEL *Chan ) { assert( Chan != NULL ); @@ -624,8 +623,8 @@ Channel_Topic( CHANNEL *Chan ) } /* Channel_Topic */ -GLOBAL VOID -Channel_SetTopic( CHANNEL *Chan, CHAR *Topic ) +GLOBAL void +Channel_SetTopic( CHANNEL *Chan, char *Topic ) { assert( Chan != NULL ); assert( Topic != NULL ); @@ -634,8 +633,8 @@ Channel_SetTopic( CHANNEL *Chan, CHAR *Topic ) } /* Channel_SetTopic */ -GLOBAL VOID -Channel_SetModes( CHANNEL *Chan, CHAR *Modes ) +GLOBAL void +Channel_SetModes( CHANNEL *Chan, char *Modes ) { assert( Chan != NULL ); assert( Modes != NULL ); @@ -644,8 +643,8 @@ Channel_SetModes( CHANNEL *Chan, CHAR *Modes ) } /* Channel_SetModes */ -GLOBAL VOID -Channel_SetKey( CHANNEL *Chan, CHAR *Key ) +GLOBAL void +Channel_SetKey( CHANNEL *Chan, char *Key ) { assert( Chan != NULL ); assert( Key != NULL ); @@ -655,8 +654,8 @@ Channel_SetKey( CHANNEL *Chan, CHAR *Key ) } /* Channel_SetKey */ -GLOBAL VOID -Channel_SetMaxUsers( CHANNEL *Chan, LONG Count ) +GLOBAL void +Channel_SetMaxUsers( CHANNEL *Chan, long Count ) { assert( Chan != NULL ); @@ -665,45 +664,44 @@ Channel_SetMaxUsers( CHANNEL *Chan, LONG Count ) } /* Channel_SetMaxUsers */ -GLOBAL BOOLEAN -Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text ) +GLOBAL bool +Channel_Write( CHANNEL *Chan, CLIENT *From, CLIENT *Client, char *Text ) { - BOOLEAN is_member, has_voice, is_op, ok; + bool is_member, has_voice, is_op, ok; /* Okay, target is a channel */ - is_member = has_voice = is_op = FALSE; + is_member = has_voice = is_op = false; if( Channel_IsMemberOf( Chan, From )) { - is_member = TRUE; - if( strchr( Channel_UserModes( Chan, From ), 'v' )) has_voice = TRUE; - if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = TRUE; + is_member = true; + if( strchr( Channel_UserModes( Chan, From ), 'v' )) has_voice = true; + if( strchr( Channel_UserModes( Chan, From ), 'o' )) is_op = true; } - /* Check weather client is allowed to write to channel */ - ok = TRUE; - if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = FALSE; - if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = FALSE; + /* Is the client allowed to write to channel? */ + ok = true; + if( strchr( Channel_Modes( Chan ), 'n' ) && ( ! is_member )) ok = false; + if( strchr( Channel_Modes( Chan ), 'm' ) && ( ! is_op ) && ( ! has_voice )) ok = false; /* Is the client banned? */ if( Lists_CheckBanned( From, Chan )) { /* Client is banned, bus is he channel operator or has voice? */ - if(( ! has_voice ) && ( ! is_op )) ok = FALSE; + if(( ! has_voice ) && ( ! is_op )) ok = false; } if( ! ok ) return IRC_WriteStrClient( From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID( From ), Channel_Name( Chan )); /* Send text */ if( Client_Conn( From ) > NONE ) Conn_UpdateIdle( Client_Conn( From )); - return IRC_WriteStrChannelPrefix( Client, Chan, From, TRUE, "PRIVMSG %s :%s", Channel_Name( Chan ), Text ); + return IRC_WriteStrChannelPrefix( Client, Chan, From, true, "PRIVMSG %s :%s", Channel_Name( Chan ), Text ); } /* Channel_Write */ GLOBAL CHANNEL * -Channel_Create( CHAR *Name ) +Channel_Create( char *Name ) { - /* Neue Channel-Struktur anlegen */ - + /* Create new CHANNEL structure and add it to linked list */ CHANNEL *c; assert( Name != NULL ); @@ -714,16 +712,9 @@ Channel_Create( CHAR *Name ) Log( LOG_EMERG, "Can't allocate memory! [New_Chan]" ); return NULL; } - c->next = NULL; + memset( c, 0, sizeof( CHANNEL )); strlcpy( c->name, Name, sizeof( c->name )); - c->name[CHANNEL_NAME_LEN - 1] = '\0'; - strcpy( c->modes, "" ); - strcpy( c->topic, "" ); c->hash = Hash( c->name ); - strcpy( c->key, "" ); - c->maxusers = 0; - - /* Verketten */ c->next = My_Channels; My_Channels = c; @@ -780,8 +771,8 @@ Add_Client( CHANNEL *Chan, CLIENT *Client ) } /* Add_Client */ -LOCAL BOOLEAN -Remove_Client( INT Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, CHAR *Reason, BOOLEAN InformServer ) +LOCAL bool +Remove_Client( int Type, CHANNEL *Chan, CLIENT *Client, CLIENT *Origin, char *Reason, bool InformServer ) { CL2CHAN *cl2chan, *last_cl2chan; CHANNEL *c; @@ -799,7 +790,7 @@ Remove_Client( INT Type, CHANNEL *Chan, CLIENT *Client last_cl2chan = cl2chan; cl2chan = cl2chan->next; } - if( ! cl2chan ) return FALSE; + if( ! cl2chan ) return false; c = cl2chan->channel; assert( c != NULL ); @@ -814,22 +805,22 @@ Remove_Client( INT Type, CHANNEL *Chan, CLIENT *Client case REMOVE_QUIT: /* QUIT: andere Server wurden bereits informiert, vgl. Client_Destroy(); * hier also "nur" noch alle User in betroffenen Channeln infomieren */ - assert( InformServer == FALSE ); - IRC_WriteStrChannelPrefix( Origin, c, Origin, FALSE, "QUIT :%s", Reason ); + assert( InformServer == false ); + IRC_WriteStrChannelPrefix( Origin, c, Origin, false, "QUIT :%s", Reason ); Log( LOG_DEBUG, "User \"%s\" left channel \"%s\" (%s).", Client_Mask( Client ), c->name, Reason ); break; case REMOVE_KICK: /* User wurde geKICKed: ggf. andere Server sowie alle betroffenen User * im entsprechenden Channel informieren */ if( InformServer ) IRC_WriteStrServersPrefix( Client_NextHop( Origin ), Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason ); - IRC_WriteStrChannelPrefix( Client, c, Origin, FALSE, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason ); + IRC_WriteStrChannelPrefix( Client, c, Origin, false, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason ); if(( Client_Conn( Client ) > NONE ) && ( Client_Type( Client ) == CLIENT_USER )) IRC_WriteStrClientPrefix( Client, Origin, "KICK %s %s :%s", c->name, Client_ID( Client ), Reason ); Log( LOG_DEBUG, "User \"%s\" has been kicked of \"%s\" by \"%s\": %s.", Client_Mask( Client ), c->name, Client_ID( Origin ), Reason ); break; default: /* PART */ if( InformServer ) IRC_WriteStrServersPrefix( Origin, Client, "PART %s :%s", c->name, Reason ); - IRC_WriteStrChannelPrefix( Origin, c, Client, FALSE, "PART %s :%s", c->name, Reason ); + IRC_WriteStrChannelPrefix( Origin, c, Client, false, "PART %s :%s", c->name, Reason ); if(( Client_Conn( Origin ) > NONE ) && ( Client_Type( Origin ) == CLIENT_USER )) IRC_WriteStrClientPrefix( Origin, Client, "PART %s :%s", c->name, Reason ); Log( LOG_DEBUG, "User \"%s\" left channel \"%s\" (%s).", Client_Mask( Client ), c->name, Reason ); } @@ -840,7 +831,7 @@ Remove_Client( INT Type, CHANNEL *Chan, CLIENT *Client if( ! Get_First_Cl2Chan( NULL, Chan )) Delete_Channel( Chan ); } - return TRUE; + return true; } /* Remove_Client */ @@ -869,7 +860,7 @@ Get_Next_Cl2Chan( CL2CHAN *Start, CLIENT *Client, CHAN } /* Get_Next_Cl2Chan */ -LOCAL BOOLEAN +LOCAL bool Delete_Channel( CHANNEL *Chan ) { /* Channel-Struktur loeschen */ @@ -884,7 +875,7 @@ Delete_Channel( CHANNEL *Chan ) last_chan = chan; chan = chan->next; } - if( ! chan ) return FALSE; + if( ! chan ) return false; Log( LOG_DEBUG, "Freed channel structure for \"%s\".", Chan->name ); @@ -896,7 +887,7 @@ Delete_Channel( CHANNEL *Chan ) else My_Channels = chan->next; free( chan ); - return TRUE; + return true; } /* Delete_Channel */ blob - 9c0971034f099609686a56641e1fda0bbc36b95b blob + 1bc185a9fa21d05350abccbcc66b6419f9f6ef58 --- src/ngircd/channel.h +++ src/ngircd/channel.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: channel.h,v 1.26 2002/12/16 23:05:24 alex Exp $ + * $Id: channel.h,v 1.27 2005/03/19 18:43:48 fw Exp $ * * Channel management (header) */ @@ -25,12 +25,12 @@ typedef struct _CHANNEL { struct _CHANNEL *next; - CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */ + char name[CHANNEL_NAME_LEN]; /* Name of the channel */ UINT32 hash; /* Hash of the (lowecase!) name */ - CHAR modes[CHANNEL_MODE_LEN]; /* Channel modes */ - CHAR topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */ - CHAR key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */ - LONG maxusers; /* Maximum number of members (mode "l") */ + char modes[CHANNEL_MODE_LEN]; /* Channel modes */ + char topic[CHANNEL_TOPIC_LEN]; /* Topic of the channel */ + char key[CLIENT_PASS_LEN]; /* Channel key ("password", mode "k" ) */ + long maxusers; /* Maximum number of members (mode "l") */ } CHANNEL; typedef struct _CLIENT2CHAN @@ -38,7 +38,7 @@ typedef struct _CLIENT2CHAN struct _CLIENT2CHAN *next; CLIENT *client; CHANNEL *channel; - CHAR modes[CHANNEL_MODE_LEN]; /* User-Modes in dem Channel */ + char modes[CHANNEL_MODE_LEN]; /* User-Modes in dem Channel */ } CL2CHAN; #else @@ -49,36 +49,36 @@ typedef POINTER CL2CHAN; #endif -GLOBAL VOID Channel_Init PARAMS(( VOID )); -GLOBAL VOID Channel_InitPredefined PARAMS(( VOID )); -GLOBAL VOID Channel_Exit PARAMS(( VOID )); +GLOBAL void Channel_Init PARAMS(( void )); +GLOBAL void Channel_InitPredefined PARAMS(( void )); +GLOBAL void Channel_Exit PARAMS(( void )); -GLOBAL BOOLEAN Channel_Join PARAMS(( CLIENT *Client, CHAR *Name )); -GLOBAL BOOLEAN Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )); +GLOBAL bool Channel_Join PARAMS(( CLIENT *Client, char *Name )); +GLOBAL bool Channel_Part PARAMS(( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )); -GLOBAL VOID Channel_Quit PARAMS(( CLIENT *Client, CHAR *Reason )); +GLOBAL void Channel_Quit PARAMS(( CLIENT *Client, char *Reason )); -GLOBAL VOID Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, CHAR *Name, CHAR *Reason )); +GLOBAL void Channel_Kick PARAMS(( CLIENT *Client, CLIENT *Origin, char *Name, char *Reason )); -GLOBAL LONG Channel_Count PARAMS(( VOID )); -GLOBAL LONG Channel_MemberCount PARAMS(( CHANNEL *Chan )); -GLOBAL INT Channel_CountForUser PARAMS(( CLIENT *Client )); -GLOBAL INT Channel_PCount PARAMS(( VOID )); +GLOBAL long Channel_Count PARAMS(( void )); +GLOBAL long Channel_MemberCount PARAMS(( CHANNEL *Chan )); +GLOBAL int Channel_CountForUser PARAMS(( CLIENT *Client )); +GLOBAL int Channel_PCount PARAMS(( void )); -GLOBAL CHAR *Channel_Name PARAMS(( CHANNEL *Chan )); -GLOBAL CHAR *Channel_Modes PARAMS(( CHANNEL *Chan )); -GLOBAL CHAR *Channel_Topic PARAMS(( CHANNEL *Chan )); -GLOBAL CHAR *Channel_Key PARAMS(( CHANNEL *Chan )); -GLOBAL LONG Channel_MaxUsers PARAMS(( CHANNEL *Chan )); +GLOBAL char *Channel_Name PARAMS(( CHANNEL *Chan )); +GLOBAL char *Channel_Modes PARAMS(( CHANNEL *Chan )); +GLOBAL char *Channel_Topic PARAMS(( CHANNEL *Chan )); +GLOBAL char *Channel_Key PARAMS(( CHANNEL *Chan )); +GLOBAL long Channel_MaxUsers PARAMS(( CHANNEL *Chan )); -GLOBAL VOID Channel_SetTopic PARAMS(( CHANNEL *Chan, CHAR *Topic )); -GLOBAL VOID Channel_SetModes PARAMS(( CHANNEL *Chan, CHAR *Modes )); -GLOBAL VOID Channel_SetKey PARAMS(( CHANNEL *Chan, CHAR *Key )); -GLOBAL VOID Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, LONG Count )); +GLOBAL void Channel_SetTopic PARAMS(( CHANNEL *Chan, char *Topic )); +GLOBAL void Channel_SetModes PARAMS(( CHANNEL *Chan, char *Modes )); +GLOBAL void Channel_SetKey PARAMS(( CHANNEL *Chan, char *Key )); +GLOBAL void Channel_SetMaxUsers PARAMS(( CHANNEL *Chan, long Count )); -GLOBAL CHANNEL *Channel_Search PARAMS(( CHAR *Name )); +GLOBAL CHANNEL *Channel_Search PARAMS(( char *Name )); -GLOBAL CHANNEL *Channel_First PARAMS(( VOID )); +GLOBAL CHANNEL *Channel_First PARAMS(( void )); GLOBAL CHANNEL *Channel_Next PARAMS(( CHANNEL *Chan )); GLOBAL CL2CHAN *Channel_FirstMember PARAMS(( CHANNEL *Chan )); @@ -89,20 +89,20 @@ GLOBAL CL2CHAN *Channel_NextChannelOf PARAMS(( CLIENT GLOBAL CLIENT *Channel_GetClient PARAMS(( CL2CHAN *Cl2Chan )); GLOBAL CHANNEL *Channel_GetChannel PARAMS(( CL2CHAN *Cl2Chan )); -GLOBAL BOOLEAN Channel_IsValidName PARAMS(( CHAR *Name )); +GLOBAL bool Channel_IsValidName PARAMS(( char *Name )); -GLOBAL BOOLEAN Channel_ModeAdd PARAMS(( CHANNEL *Chan, CHAR Mode )); -GLOBAL BOOLEAN Channel_ModeDel PARAMS(( CHANNEL *Chan, CHAR Mode )); +GLOBAL bool Channel_ModeAdd PARAMS(( CHANNEL *Chan, char Mode )); +GLOBAL bool Channel_ModeDel PARAMS(( CHANNEL *Chan, char Mode )); -GLOBAL BOOLEAN Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode )); -GLOBAL BOOLEAN Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, CHAR Mode )); -GLOBAL CHAR *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client )); +GLOBAL bool Channel_UserModeAdd PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode )); +GLOBAL bool Channel_UserModeDel PARAMS(( CHANNEL *Chan, CLIENT *Client, char Mode )); +GLOBAL char *Channel_UserModes PARAMS(( CHANNEL *Chan, CLIENT *Client )); -GLOBAL BOOLEAN Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client )); +GLOBAL bool Channel_IsMemberOf PARAMS(( CHANNEL *Chan, CLIENT *Client )); -GLOBAL BOOLEAN Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, CHAR *Text )); +GLOBAL bool Channel_Write PARAMS(( CHANNEL *Chan, CLIENT *From, CLIENT *Client, char *Text )); -GLOBAL CHANNEL *Channel_Create PARAMS(( CHAR *Name )); +GLOBAL CHANNEL *Channel_Create PARAMS(( char *Name )); #endif blob - f7664df69545cf723e73002248dc7710d9022ab6 blob + 52b71d285f2e9da530725904534d46b0fcbded74 --- src/ngircd/client.c +++ src/ngircd/client.c @@ -17,7 +17,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: client.c,v 1.77 2005/01/20 00:11:49 alex Exp $"; +static char UNUSED id[] = "$Id: client.c,v 1.78 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -50,26 +50,26 @@ static char UNUSED id[] = "$Id: client.c,v 1.77 2005/0 LOCAL CLIENT *This_Server, *My_Clients; -LOCAL CHAR GetID_Buffer[GETID_LEN]; +LOCAL char GetID_Buffer[GETID_LEN]; -LOCAL LONG Count PARAMS(( CLIENT_TYPE Type )); -LOCAL LONG MyCount PARAMS(( CLIENT_TYPE Type )); +LOCAL long Count PARAMS(( CLIENT_TYPE Type )); +LOCAL long MyCount PARAMS(( CLIENT_TYPE Type )); -LOCAL CLIENT *New_Client_Struct PARAMS(( VOID )); -LOCAL VOID Generate_MyToken PARAMS(( CLIENT *Client )); -LOCAL VOID Adjust_Counters PARAMS(( CLIENT *Client )); +LOCAL CLIENT *New_Client_Struct PARAMS(( void )); +LOCAL void Generate_MyToken PARAMS(( CLIENT *Client )); +LOCAL void Adjust_Counters PARAMS(( CLIENT *Client )); #ifndef Client_DestroyNow -GLOBAL VOID Client_DestroyNow PARAMS((CLIENT *Client )); +GLOBAL void Client_DestroyNow PARAMS((CLIENT *Client )); #endif -LONG Max_Users = 0, My_Max_Users = 0; +long Max_Users = 0, My_Max_Users = 0; -GLOBAL VOID -Client_Init( VOID ) +GLOBAL void +Client_Init( void ) { struct hostent *h; @@ -100,14 +100,14 @@ Client_Init( VOID ) } /* Client_Init */ -GLOBAL VOID -Client_Exit( VOID ) +GLOBAL void +Client_Exit( void ) { CLIENT *c, *next; - INT cnt; + int cnt; - if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, FALSE ); - else Client_Destroy( This_Server, "Server going down.", NULL, FALSE ); + if( NGIRCd_SignalRestart ) Client_Destroy( This_Server, "Server going down (restarting).", NULL, false ); + else Client_Destroy( This_Server, "Server going down.", NULL, false ); cnt = 0; c = My_Clients; @@ -123,14 +123,14 @@ Client_Exit( VOID ) GLOBAL CLIENT * -Client_ThisServer( VOID ) +Client_ThisServer( void ) { return This_Server; } /* Client_ThisServer */ GLOBAL CLIENT * -Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented ) +Client_NewLocal( CONN_ID Idx, char *Hostname, int Type, bool Idented ) { /* Neuen lokalen Client erzeugen: Wrapper-Funktion fuer Client_New(). */ return Client_New( Idx, This_Server, NULL, Type, NULL, NULL, Hostname, NULL, 0, 0, NULL, Idented ); @@ -138,7 +138,7 @@ Client_NewLocal( CONN_ID Idx, CHAR *Hostname, INT Type GLOBAL CLIENT * -Client_NewRemoteServer( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented ) +Client_NewRemoteServer( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented ) { /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */ return Client_New( NONE, Introducer, TopServer, CLIENT_SERVER, Hostname, NULL, Hostname, Info, Hops, Token, NULL, Idented ); @@ -146,7 +146,7 @@ Client_NewRemoteServer( CLIENT *Introducer, CHAR *Host GLOBAL CLIENT * -Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented ) +Client_NewRemoteUser( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented ) { /* Neuen Remote-Client erzeugen: Wrapper-Funktion fuer Client_New (). */ return Client_New( NONE, Introducer, NULL, CLIENT_USER, Nick, User, Hostname, Info, Hops, Token, Modes, Idented ); @@ -154,7 +154,7 @@ Client_NewRemoteUser( CLIENT *Introducer, CHAR *Nick, GLOBAL CLIENT * -Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented ) +Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented ) { CLIENT *client; @@ -193,13 +193,13 @@ Client_New( CONN_ID Idx, CLIENT *Introducer, CLIENT *T } /* Client_New */ -GLOBAL VOID -Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit ) +GLOBAL void +Client_Destroy( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit ) { /* Client entfernen. */ CLIENT *last, *c; - CHAR msg[LINE_LEN], *txt; + char msg[LINE_LEN], *txt; assert( Client != NULL ); @@ -218,7 +218,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *Fw { /* der Client, der geloescht wird ist ein Server. Der Client, den wir gerade * pruefen, ist ein Child von diesem und muss daher auch entfernt werden */ - Client_Destroy( c, NULL, msg, FALSE ); + Client_Destroy( c, NULL, msg, false ); last = NULL; c = My_Clients; continue; @@ -297,7 +297,7 @@ Client_Destroy( CLIENT *Client, CHAR *LogMsg, CHAR *Fw } /* Client_Destroy */ -GLOBAL VOID +GLOBAL void Client_DestroyNow( CLIENT *Client ) { /* Destroy client structure immediately. This function is only @@ -326,8 +326,8 @@ Client_DestroyNow( CLIENT *Client ) } /* Client_DestroyNow */ -GLOBAL VOID -Client_SetHostname( CLIENT *Client, CHAR *Hostname ) +GLOBAL void +Client_SetHostname( CLIENT *Client, char *Hostname ) { /* Hostname eines Clients setzen */ @@ -338,8 +338,8 @@ Client_SetHostname( CLIENT *Client, CHAR *Hostname ) } /* Client_SetHostname */ -GLOBAL VOID -Client_SetID( CLIENT *Client, CHAR *ID ) +GLOBAL void +Client_SetID( CLIENT *Client, char *ID ) { /* Hostname eines Clients setzen, Hash-Wert berechnen */ @@ -353,8 +353,8 @@ Client_SetID( CLIENT *Client, CHAR *ID ) } /* Client_SetID */ -GLOBAL VOID -Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Idented ) +GLOBAL void +Client_SetUser( CLIENT *Client, char *User, bool Idented ) { /* Username eines Clients setzen */ @@ -370,8 +370,8 @@ Client_SetUser( CLIENT *Client, CHAR *User, BOOLEAN Id } /* Client_SetUser */ -GLOBAL VOID -Client_SetInfo( CLIENT *Client, CHAR *Info ) +GLOBAL void +Client_SetInfo( CLIENT *Client, char *Info ) { /* Hostname eines Clients setzen */ @@ -382,8 +382,8 @@ Client_SetInfo( CLIENT *Client, CHAR *Info ) } /* Client_SetInfo */ -GLOBAL VOID -Client_SetModes( CLIENT *Client, CHAR *Modes ) +GLOBAL void +Client_SetModes( CLIENT *Client, char *Modes ) { /* Modes eines Clients setzen */ @@ -394,8 +394,8 @@ Client_SetModes( CLIENT *Client, CHAR *Modes ) } /* Client_SetModes */ -GLOBAL VOID -Client_SetFlags( CLIENT *Client, CHAR *Flags ) +GLOBAL void +Client_SetFlags( CLIENT *Client, char *Flags ) { /* Flags eines Clients setzen */ @@ -406,8 +406,8 @@ Client_SetFlags( CLIENT *Client, CHAR *Flags ) } /* Client_SetFlags */ -GLOBAL VOID -Client_SetPassword( CLIENT *Client, CHAR *Pwd ) +GLOBAL void +Client_SetPassword( CLIENT *Client, char *Pwd ) { /* Von einem Client geliefertes Passwort */ @@ -418,8 +418,8 @@ Client_SetPassword( CLIENT *Client, CHAR *Pwd ) } /* Client_SetPassword */ -GLOBAL VOID -Client_SetAway( CLIENT *Client, CHAR *Txt ) +GLOBAL void +Client_SetAway( CLIENT *Client, char *Txt ) { /* Set AWAY reason of client */ @@ -431,8 +431,8 @@ Client_SetAway( CLIENT *Client, CHAR *Txt ) } /* Client_SetAway */ -GLOBAL VOID -Client_SetType( CLIENT *Client, INT Type ) +GLOBAL void +Client_SetType( CLIENT *Client, int Type ) { assert( Client != NULL ); Client->type = Type; @@ -441,23 +441,23 @@ Client_SetType( CLIENT *Client, INT Type ) } /* Client_SetType */ -GLOBAL VOID -Client_SetHops( CLIENT *Client, INT Hops ) +GLOBAL void +Client_SetHops( CLIENT *Client, int Hops ) { assert( Client != NULL ); Client->hops = Hops; } /* Client_SetHops */ -GLOBAL VOID -Client_SetToken( CLIENT *Client, INT Token ) +GLOBAL void +Client_SetToken( CLIENT *Client, int Token ) { assert( Client != NULL ); Client->token = Token; } /* Client_SetToken */ -GLOBAL VOID +GLOBAL void Client_SetIntroducer( CLIENT *Client, CLIENT *Introducer ) { assert( Client != NULL ); @@ -466,22 +466,23 @@ Client_SetIntroducer( CLIENT *Client, CLIENT *Introduc } /* Client_SetIntroducer */ -GLOBAL VOID -Client_SetOperByMe( CLIENT *Client, BOOLEAN OperByMe ) +GLOBAL void +Client_SetOperByMe( CLIENT *Client, bool OperByMe ) { assert( Client != NULL ); Client->oper_by_me = OperByMe; } /* Client_SetOperByMe */ -GLOBAL BOOLEAN -Client_ModeAdd( CLIENT *Client, CHAR Mode ) +GLOBAL bool +Client_ModeAdd( CLIENT *Client, char Mode ) { - /* Mode soll gesetzt werden. TRUE wird geliefert, wenn der - * Mode neu gesetzt wurde, FALSE, wenn der Client den Mode - * bereits hatte. */ + /* Set Mode. + * If Client already alread had Mode, return false. + * If the Mode was newly set, return true. + */ - CHAR x[2]; + char x[2]; assert( Client != NULL ); @@ -490,43 +491,45 @@ Client_ModeAdd( CLIENT *Client, CHAR Mode ) { /* Client hat den Mode noch nicht -> setzen */ strlcat( Client->modes, x, sizeof( Client->modes )); - return TRUE; + return true; } - else return FALSE; + else return false; } /* Client_ModeAdd */ -GLOBAL BOOLEAN -Client_ModeDel( CLIENT *Client, CHAR Mode ) +GLOBAL bool +Client_ModeDel( CLIENT *Client, char Mode ) { - /* Mode soll geloescht werden. TRUE wird geliefert, wenn der - * Mode entfernt wurde, FALSE, wenn der Client den Mode - * ueberhaupt nicht hatte. */ + /* Delete Mode. + * If Mode was removed, return true. + * If Client did not have Mode, return false. + */ - CHAR x[2], *p; + char x[2], *p; assert( Client != NULL ); x[0] = Mode; x[1] = '\0'; p = strchr( Client->modes, x[0] ); - if( ! p ) return FALSE; + if( ! p ) return false; - /* Client hat den Mode -> loeschen */ + /* Client has Mode -> delete */ while( *p ) { *p = *(p + 1); p++; } - return TRUE; + return true; } /* Client_ModeDel */ GLOBAL CLIENT * Client_GetFromConn( CONN_ID Idx ) { - /* Client-Struktur, die zur lokalen Verbindung Idx gehoert, - * liefern. Wird keine gefunden, so wird NULL geliefert. */ + /* return Client-Structure that belongs to the local Connection Idx gehoert. + * If none is found, return NULL. + */ CLIENT *c; @@ -543,18 +546,19 @@ Client_GetFromConn( CONN_ID Idx ) GLOBAL CLIENT * -Client_Search( CHAR *Nick ) +Client_Search( char *Nick ) { - /* Client-Struktur, die den entsprechenden Nick hat, liefern. - * Wird keine gefunden, so wird NULL geliefert. */ + /* return Client-Structure that has the corresponding Nick. + * If none is found, return NULL. + */ - CHAR search_id[CLIENT_ID_LEN], *ptr; + char search_id[CLIENT_ID_LEN], *ptr; CLIENT *c = NULL; UINT32 search_hash; assert( Nick != NULL ); - /* Nick kopieren und ggf. Host-Mask abschneiden */ + /* copy Nick and truncate hostmask if necessary */ strlcpy( search_id, Nick, sizeof( search_id )); ptr = strchr( search_id, '!' ); if( ptr ) *ptr = '\0'; @@ -576,7 +580,7 @@ Client_Search( CHAR *Nick ) GLOBAL CLIENT * -Client_GetFromToken( CLIENT *Client, INT Token ) +Client_GetFromToken( CLIENT *Client, int Token ) { /* Client-Struktur, die den entsprechenden Introducer (=Client) * und das gegebene Token hat, liefern. Wird keine gefunden, @@ -597,7 +601,7 @@ Client_GetFromToken( CLIENT *Client, INT Token ) } /* Client_GetFromToken */ -GLOBAL INT +GLOBAL int Client_Type( CLIENT *Client ) { assert( Client != NULL ); @@ -613,7 +617,7 @@ Client_Conn( CLIENT *Client ) } /* Client_Conn */ -GLOBAL CHAR * +GLOBAL char * Client_ID( CLIENT *Client ) { assert( Client != NULL ); @@ -627,7 +631,7 @@ Client_ID( CLIENT *Client ) } /* Client_ID */ -GLOBAL CHAR * +GLOBAL char * Client_Info( CLIENT *Client ) { assert( Client != NULL ); @@ -635,7 +639,7 @@ Client_Info( CLIENT *Client ) } /* Client_Info */ -GLOBAL CHAR * +GLOBAL char * Client_User( CLIENT *Client ) { assert( Client != NULL ); @@ -644,7 +648,7 @@ Client_User( CLIENT *Client ) } /* Client_User */ -GLOBAL CHAR * +GLOBAL char * Client_Hostname( CLIENT *Client ) { assert( Client != NULL ); @@ -652,7 +656,7 @@ Client_Hostname( CLIENT *Client ) } /* Client_Hostname */ -GLOBAL CHAR * +GLOBAL char * Client_Password( CLIENT *Client ) { assert( Client != NULL ); @@ -660,7 +664,7 @@ Client_Password( CLIENT *Client ) } /* Client_Password */ -GLOBAL CHAR * +GLOBAL char * Client_Modes( CLIENT *Client ) { assert( Client != NULL ); @@ -668,7 +672,7 @@ Client_Modes( CLIENT *Client ) } /* Client_Modes */ -GLOBAL CHAR * +GLOBAL char * Client_Flags( CLIENT *Client ) { assert( Client != NULL ); @@ -676,7 +680,7 @@ Client_Flags( CLIENT *Client ) } /* Client_Flags */ -GLOBAL BOOLEAN +GLOBAL bool Client_OperByMe( CLIENT *Client ) { assert( Client != NULL ); @@ -684,7 +688,7 @@ Client_OperByMe( CLIENT *Client ) } /* Client_OperByMe */ -GLOBAL INT +GLOBAL int Client_Hops( CLIENT *Client ) { assert( Client != NULL ); @@ -692,7 +696,7 @@ Client_Hops( CLIENT *Client ) } /* Client_Hops */ -GLOBAL INT +GLOBAL int Client_Token( CLIENT *Client ) { assert( Client != NULL ); @@ -700,7 +704,7 @@ Client_Token( CLIENT *Client ) } /* Client_Token */ -GLOBAL INT +GLOBAL int Client_MyToken( CLIENT *Client ) { assert( Client != NULL ); @@ -721,7 +725,7 @@ Client_NextHop( CLIENT *Client ) } /* Client_NextHop */ -GLOBAL CHAR * +GLOBAL char * Client_Mask( CLIENT *Client ) { /* Client-"ID" liefern, wie sie z.B. fuer @@ -752,15 +756,15 @@ Client_TopServer( CLIENT *Client ) } /* Client_TopServer */ -GLOBAL BOOLEAN -Client_HasMode( CLIENT *Client, CHAR Mode ) +GLOBAL bool +Client_HasMode( CLIENT *Client, char Mode ) { assert( Client != NULL ); return strchr( Client->modes, Mode ) != NULL; } /* Client_HasMode */ -GLOBAL CHAR * +GLOBAL char * Client_Away( CLIENT *Client ) { /* AWAY-Text liefern */ @@ -770,8 +774,8 @@ Client_Away( CLIENT *Client ) } /* Client_Away */ -GLOBAL BOOLEAN -Client_CheckNick( CLIENT *Client, CHAR *Nick ) +GLOBAL bool +Client_CheckNick( CLIENT *Client, char *Nick ) { /* Nick ueberpruefen */ @@ -782,7 +786,7 @@ Client_CheckNick( CLIENT *Client, CHAR *Nick ) if( ! Client_IsValidNick( Nick )) { IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), Nick ); - return FALSE; + return false; } /* Nick bereits vergeben? */ @@ -790,19 +794,19 @@ Client_CheckNick( CLIENT *Client, CHAR *Nick ) { /* den Nick gibt es bereits */ IRC_WriteStrClient( Client, ERR_NICKNAMEINUSE_MSG, Client_ID( Client ), Nick ); - return FALSE; + return false; } - return TRUE; + return true; } /* Client_CheckNick */ -GLOBAL BOOLEAN -Client_CheckID( CLIENT *Client, CHAR *ID ) +GLOBAL bool +Client_CheckID( CLIENT *Client, char *ID ) { /* Nick ueberpruefen */ - CHAR str[COMMAND_LEN]; + char str[COMMAND_LEN]; CLIENT *c; assert( Client != NULL ); @@ -813,7 +817,7 @@ Client_CheckID( CLIENT *Client, CHAR *ID ) if( strlen( ID ) > CLIENT_ID_LEN ) { IRC_WriteStrClient( Client, ERR_ERRONEUSNICKNAME_MSG, Client_ID( Client ), ID ); - return FALSE; + return false; } /* ID bereits vergeben? */ @@ -826,18 +830,18 @@ Client_CheckID( CLIENT *Client, CHAR *ID ) snprintf( str, sizeof( str ), "ID \"%s\" already registered", ID ); if( Client->conn_id != c->conn_id ) Log( LOG_ERR, "%s (on connection %d)!", str, c->conn_id ); else Log( LOG_ERR, "%s (via network)!", str ); - Conn_Close( Client->conn_id, str, str, TRUE ); - return FALSE; + Conn_Close( Client->conn_id, str, str, true); + return false; } c = (CLIENT *)c->next; } - return TRUE; + return true; } /* Client_CheckID */ GLOBAL CLIENT * -Client_First( VOID ) +Client_First( void ) { /* Ersten Client liefern. */ @@ -856,46 +860,46 @@ Client_Next( CLIENT *c ) } /* Client_Next */ -GLOBAL LONG -Client_UserCount( VOID ) +GLOBAL long +Client_UserCount( void ) { return Count( CLIENT_USER ); } /* Client_UserCount */ -GLOBAL LONG -Client_ServiceCount( VOID ) +GLOBAL long +Client_ServiceCount( void ) { return Count( CLIENT_SERVICE );; } /* Client_ServiceCount */ -GLOBAL LONG -Client_ServerCount( VOID ) +GLOBAL long +Client_ServerCount( void ) { return Count( CLIENT_SERVER ); } /* Client_ServerCount */ -GLOBAL LONG -Client_MyUserCount( VOID ) +GLOBAL long +Client_MyUserCount( void ) { return MyCount( CLIENT_USER ); } /* Client_MyUserCount */ -GLOBAL LONG -Client_MyServiceCount( VOID ) +GLOBAL long +Client_MyServiceCount( void ) { return MyCount( CLIENT_SERVICE ); } /* Client_MyServiceCount */ -GLOBAL LONG -Client_MyServerCount( VOID ) +GLOBAL long +Client_MyServerCount( void ) { CLIENT *c; - LONG cnt; + long cnt; cnt = 0; c = My_Clients; @@ -908,11 +912,11 @@ Client_MyServerCount( VOID ) } /* Client_MyServerCount */ -GLOBAL LONG -Client_OperCount( VOID ) +GLOBAL long +Client_OperCount( void ) { CLIENT *c; - LONG cnt; + long cnt; cnt = 0; c = My_Clients; @@ -925,11 +929,11 @@ Client_OperCount( VOID ) } /* Client_OperCount */ -GLOBAL LONG -Client_UnknownCount( VOID ) +GLOBAL long +Client_UnknownCount( void ) { CLIENT *c; - LONG cnt; + long cnt; cnt = 0; c = My_Clients; @@ -942,52 +946,52 @@ Client_UnknownCount( VOID ) } /* Client_UnknownCount */ -GLOBAL LONG -Client_MaxUserCount( VOID ) +GLOBAL long +Client_MaxUserCount( void ) { return Max_Users; } /* Client_MaxUserCount */ -GLOBAL LONG -Client_MyMaxUserCount( VOID ) +GLOBAL long +Client_MyMaxUserCount( void ) { return My_Max_Users; } /* Client_MyMaxUserCount */ -GLOBAL BOOLEAN -Client_IsValidNick( CHAR *Nick ) +GLOBAL bool +Client_IsValidNick( char *Nick ) { /* Ist der Nick gueltig? */ - CHAR *ptr, goodchars[20]; + char *ptr, goodchars[20]; assert( Nick != NULL ); strcpy( goodchars, ";0123456789-" ); - if( Nick[0] == '#' ) return FALSE; - if( strchr( goodchars, Nick[0] )) return FALSE; - if( strlen( Nick ) >= CLIENT_NICK_LEN ) return FALSE; + if( Nick[0] == '#' ) return false; + if( strchr( goodchars, Nick[0] )) return false; + if( strlen( Nick ) >= CLIENT_NICK_LEN ) return false; ptr = Nick; while( *ptr ) { - if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return FALSE; - if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return FALSE; + if(( *ptr < 'A' ) && ( ! strchr( goodchars, *ptr ))) return false; + if(( *ptr > '}' ) && ( ! strchr( goodchars, *ptr ))) return false; ptr++; } - return TRUE; + return true; } /* Client_IsValidNick */ -LOCAL LONG +LOCAL long Count( CLIENT_TYPE Type ) { CLIENT *c; - LONG cnt; + long cnt; cnt = 0; c = My_Clients; @@ -1000,11 +1004,11 @@ Count( CLIENT_TYPE Type ) } /* Count */ -LOCAL LONG +LOCAL long MyCount( CLIENT_TYPE Type ) { CLIENT *c; - LONG cnt; + long cnt; cnt = 0; c = My_Clients; @@ -1018,7 +1022,7 @@ MyCount( CLIENT_TYPE Type ) LOCAL CLIENT * -New_Client_Struct( VOID ) +New_Client_Struct( void ) { /* Neue CLIENT-Struktur pre-initialisieren */ @@ -1035,7 +1039,7 @@ New_Client_Struct( VOID ) c->type = CLIENT_UNKNOWN; c->conn_id = NONE; - c->oper_by_me = FALSE; + c->oper_by_me = false; c->hops = -1; c->token = -1; c->mytoken = -1; @@ -1044,11 +1048,11 @@ New_Client_Struct( VOID ) } /* New_Client */ -LOCAL VOID +LOCAL void Generate_MyToken( CLIENT *Client ) { CLIENT *c; - INT token; + int token; c = My_Clients; token = 2; @@ -1068,10 +1072,10 @@ Generate_MyToken( CLIENT *Client ) } /* Generate_MyToken */ -LOCAL VOID +LOCAL void Adjust_Counters( CLIENT *Client ) { - LONG count; + long count; assert( Client != NULL ); blob - e47d605bf10c7c5046e0615bd6baa08f2a6633a2 blob + 370c5157e8a4313b1928e4ce950b922ab227b3c8 --- src/ngircd/client.h +++ src/ngircd/client.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: client.h,v 1.34 2003/01/15 14:28:25 alex Exp $ + * $Id: client.h,v 1.35 2005/03/19 18:43:48 fw Exp $ * * Client management (header) */ @@ -28,7 +28,7 @@ #define CLIENT_SERVER 128 /* client is a server */ #define CLIENT_SERVICE 256 /* client is a service */ -#define CLIENT_TYPE INT +#define CLIENT_TYPE int #if defined(__client_c__) | defined(S_SPLINT_S) @@ -37,22 +37,22 @@ typedef struct _CLIENT { - CHAR id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */ + char id[CLIENT_ID_LEN]; /* nick (user) / ID (server) */ UINT32 hash; /* hash of lower-case ID */ POINTER *next; /* pointer to next client structure */ CLIENT_TYPE type; /* type of client, see CLIENT_xxx */ CONN_ID conn_id; /* ID of the connection (if local) or NONE (remote) */ struct _CLIENT *introducer; /* ID of the servers which the client is connected to */ struct _CLIENT *topserver; /* toplevel servers (only valid if client is a server) */ - CHAR pwd[CLIENT_PASS_LEN]; /* password received of the client */ - CHAR host[CLIENT_HOST_LEN]; /* hostname of the client */ - CHAR user[CLIENT_USER_LEN]; /* user name ("login") */ - CHAR info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ - CHAR modes[CLIENT_MODE_LEN]; /* client modes */ - INT hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */ - BOOLEAN oper_by_me; /* client is local IRC operator on this server? */ - CHAR away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */ - CHAR flags[CLIENT_FLAGS_LEN]; /* flags of the client */ + char pwd[CLIENT_PASS_LEN]; /* password received of the client */ + char host[CLIENT_HOST_LEN]; /* hostname of the client */ + char user[CLIENT_USER_LEN]; /* user name ("login") */ + char info[CLIENT_INFO_LEN]; /* long user name (user) / info text (server) */ + char modes[CLIENT_MODE_LEN]; /* client modes */ + int hops, token, mytoken; /* "hops" and "Token" (see SERVER command) */ + bool oper_by_me; /* client is local IRC operator on this server? */ + char away[CLIENT_AWAY_LEN]; /* AWAY text (valid if mode 'a' is set) */ + char flags[CLIENT_FLAGS_LEN]; /* flags of the client */ } CLIENT; #else @@ -62,81 +62,81 @@ typedef POINTER CLIENT; #endif -GLOBAL VOID Client_Init PARAMS(( VOID )); -GLOBAL VOID Client_Exit PARAMS(( VOID )); +GLOBAL void Client_Init PARAMS(( void )); +GLOBAL void Client_Exit PARAMS(( void )); -GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, CHAR *Hostname, INT Type, BOOLEAN Idented )); -GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, CHAR *Hostname, CLIENT *TopServer, INT Hops, INT Token, CHAR *Info, BOOLEAN Idented )); -GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, CHAR *Nick, INT Hops, CHAR *User, CHAR *Hostname, INT Token, CHAR *Modes, CHAR *Info, BOOLEAN Idented )); -GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, INT Type, CHAR *ID, CHAR *User, CHAR *Hostname, CHAR *Info, INT Hops, INT Token, CHAR *Modes, BOOLEAN Idented )); +GLOBAL CLIENT *Client_NewLocal PARAMS(( CONN_ID Idx, char *Hostname, int Type, bool Idented )); +GLOBAL CLIENT *Client_NewRemoteServer PARAMS(( CLIENT *Introducer, char *Hostname, CLIENT *TopServer, int Hops, int Token, char *Info, bool Idented )); +GLOBAL CLIENT *Client_NewRemoteUser PARAMS(( CLIENT *Introducer, char *Nick, int Hops, char *User, char *Hostname, int Token, char *Modes, char *Info, bool Idented )); +GLOBAL CLIENT *Client_New PARAMS(( CONN_ID Idx, CLIENT *Introducer, CLIENT *TopServer, int Type, char *ID, char *User, char *Hostname, char *Info, int Hops, int Token, char *Modes, bool Idented )); -GLOBAL VOID Client_Destroy PARAMS(( CLIENT *Client, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN SendQuit )); +GLOBAL void Client_Destroy PARAMS(( CLIENT *Client, char *LogMsg, char *FwdMsg, bool SendQuit )); #ifdef CONN_MODULE -GLOBAL VOID Client_DestroyNow PARAMS(( CLIENT *Client )); +GLOBAL void Client_DestroyNow PARAMS(( CLIENT *Client )); #endif -GLOBAL CLIENT *Client_ThisServer PARAMS(( VOID )); +GLOBAL CLIENT *Client_ThisServer PARAMS(( void )); GLOBAL CLIENT *Client_GetFromConn PARAMS(( CONN_ID Idx )); -GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, INT Token )); +GLOBAL CLIENT *Client_GetFromToken PARAMS(( CLIENT *Client, int Token )); -GLOBAL CLIENT *Client_Search PARAMS(( CHAR *ID )); -GLOBAL CLIENT *Client_First PARAMS(( VOID )); +GLOBAL CLIENT *Client_Search PARAMS(( char *ID )); +GLOBAL CLIENT *Client_First PARAMS(( void )); GLOBAL CLIENT *Client_Next PARAMS(( CLIENT *c )); -GLOBAL INT Client_Type PARAMS(( CLIENT *Client )); +GLOBAL int Client_Type PARAMS(( CLIENT *Client )); GLOBAL CONN_ID Client_Conn PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_ID PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Mask PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Info PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_User PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Hostname PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Password PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Modes PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Flags PARAMS(( CLIENT *Client )); +GLOBAL char *Client_ID PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Mask PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Info PARAMS(( CLIENT *Client )); +GLOBAL char *Client_User PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Hostname PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Password PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Modes PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Flags PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_Introducer PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN Client_OperByMe PARAMS(( CLIENT *Client )); -GLOBAL INT Client_Hops PARAMS(( CLIENT *Client )); -GLOBAL INT Client_Token PARAMS(( CLIENT *Client )); -GLOBAL INT Client_MyToken PARAMS(( CLIENT *Client )); +GLOBAL bool Client_OperByMe PARAMS(( CLIENT *Client )); +GLOBAL int Client_Hops PARAMS(( CLIENT *Client )); +GLOBAL int Client_Token PARAMS(( CLIENT *Client )); +GLOBAL int Client_MyToken PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_TopServer PARAMS(( CLIENT *Client )); GLOBAL CLIENT *Client_NextHop PARAMS(( CLIENT *Client )); -GLOBAL CHAR *Client_Away PARAMS(( CLIENT *Client )); +GLOBAL char *Client_Away PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN Client_HasMode PARAMS(( CLIENT *Client, CHAR Mode )); +GLOBAL bool Client_HasMode PARAMS(( CLIENT *Client, char Mode )); -GLOBAL VOID Client_SetHostname PARAMS(( CLIENT *Client, CHAR *Hostname )); -GLOBAL VOID Client_SetID PARAMS(( CLIENT *Client, CHAR *Nick )); -GLOBAL VOID Client_SetUser PARAMS(( CLIENT *Client, CHAR *User, BOOLEAN Idented )); -GLOBAL VOID Client_SetInfo PARAMS(( CLIENT *Client, CHAR *Info )); -GLOBAL VOID Client_SetPassword PARAMS(( CLIENT *Client, CHAR *Pwd )); -GLOBAL VOID Client_SetType PARAMS(( CLIENT *Client, INT Type )); -GLOBAL VOID Client_SetHops PARAMS(( CLIENT *Client, INT Hops )); -GLOBAL VOID Client_SetToken PARAMS(( CLIENT *Client, INT Token )); -GLOBAL VOID Client_SetOperByMe PARAMS(( CLIENT *Client, BOOLEAN OperByMe )); -GLOBAL VOID Client_SetModes PARAMS(( CLIENT *Client, CHAR *Modes )); -GLOBAL VOID Client_SetFlags PARAMS(( CLIENT *Client, CHAR *Flags )); -GLOBAL VOID Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer )); -GLOBAL VOID Client_SetAway PARAMS(( CLIENT *Client, CHAR *Txt )); +GLOBAL void Client_SetHostname PARAMS(( CLIENT *Client, char *Hostname )); +GLOBAL void Client_SetID PARAMS(( CLIENT *Client, char *Nick )); +GLOBAL void Client_SetUser PARAMS(( CLIENT *Client, char *User, bool Idented )); +GLOBAL void Client_SetInfo PARAMS(( CLIENT *Client, char *Info )); +GLOBAL void Client_SetPassword PARAMS(( CLIENT *Client, char *Pwd )); +GLOBAL void Client_SetType PARAMS(( CLIENT *Client, int Type )); +GLOBAL void Client_SetHops PARAMS(( CLIENT *Client, int Hops )); +GLOBAL void Client_SetToken PARAMS(( CLIENT *Client, int Token )); +GLOBAL void Client_SetOperByMe PARAMS(( CLIENT *Client, bool OperByMe )); +GLOBAL void Client_SetModes PARAMS(( CLIENT *Client, char *Modes )); +GLOBAL void Client_SetFlags PARAMS(( CLIENT *Client, char *Flags )); +GLOBAL void Client_SetIntroducer PARAMS(( CLIENT *Client, CLIENT *Introducer )); +GLOBAL void Client_SetAway PARAMS(( CLIENT *Client, char *Txt )); -GLOBAL BOOLEAN Client_ModeAdd PARAMS(( CLIENT *Client, CHAR Mode )); -GLOBAL BOOLEAN Client_ModeDel PARAMS(( CLIENT *Client, CHAR Mode )); +GLOBAL bool Client_ModeAdd PARAMS(( CLIENT *Client, char Mode )); +GLOBAL bool Client_ModeDel PARAMS(( CLIENT *Client, char Mode )); -GLOBAL BOOLEAN Client_CheckNick PARAMS(( CLIENT *Client, CHAR *Nick )); -GLOBAL BOOLEAN Client_CheckID PARAMS(( CLIENT *Client, CHAR *ID )); +GLOBAL bool Client_CheckNick PARAMS(( CLIENT *Client, char *Nick )); +GLOBAL bool Client_CheckID PARAMS(( CLIENT *Client, char *ID )); -GLOBAL LONG Client_UserCount PARAMS(( VOID )); -GLOBAL LONG Client_ServiceCount PARAMS(( VOID )); -GLOBAL LONG Client_ServerCount PARAMS(( VOID )); -GLOBAL LONG Client_OperCount PARAMS(( VOID )); -GLOBAL LONG Client_UnknownCount PARAMS(( VOID )); -GLOBAL LONG Client_MyUserCount PARAMS(( VOID )); -GLOBAL LONG Client_MyServiceCount PARAMS(( VOID )); -GLOBAL LONG Client_MyServerCount PARAMS(( VOID )); -GLOBAL LONG Client_MaxUserCount PARAMS(( VOID )); -GLOBAL LONG Client_MyMaxUserCount PARAMS(( VOID )); +GLOBAL long Client_UserCount PARAMS(( void )); +GLOBAL long Client_ServiceCount PARAMS(( void )); +GLOBAL long Client_ServerCount PARAMS(( void )); +GLOBAL long Client_OperCount PARAMS(( void )); +GLOBAL long Client_UnknownCount PARAMS(( void )); +GLOBAL long Client_MyUserCount PARAMS(( void )); +GLOBAL long Client_MyServiceCount PARAMS(( void )); +GLOBAL long Client_MyServerCount PARAMS(( void )); +GLOBAL long Client_MaxUserCount PARAMS(( void )); +GLOBAL long Client_MyMaxUserCount PARAMS(( void )); -GLOBAL BOOLEAN Client_IsValidNick PARAMS(( CHAR *Nick )); +GLOBAL bool Client_IsValidNick PARAMS(( char *Nick )); #endif blob - cc56e6c09d1efa17f2b3ed4d5283c1fd6d510064 blob + 276fc81ec838a93043d0f57a9ed7012fa7075cc9 --- src/ngircd/conf.c +++ src/ngircd/conf.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conf.c,v 1.71 2005/03/19 15:46:38 fw Exp $"; +static char UNUSED id[] = "$Id: conf.c,v 1.72 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -50,60 +50,60 @@ static char UNUSED id[] = "$Id: conf.c,v 1.71 2005/03/ #include "conf.h" -LOCAL BOOLEAN Use_Log = TRUE; +LOCAL bool Use_Log = true; LOCAL CONF_SERVER New_Server; -LOCAL INT New_Server_Idx; +LOCAL int New_Server_Idx; -LOCAL VOID Set_Defaults PARAMS(( BOOLEAN InitServers )); -LOCAL VOID Read_Config PARAMS(( VOID )); -LOCAL VOID Validate_Config PARAMS(( BOOLEAN TestOnly )); +LOCAL void Set_Defaults PARAMS(( bool InitServers )); +LOCAL void Read_Config PARAMS(( void )); +LOCAL void Validate_Config PARAMS(( bool TestOnly )); -LOCAL VOID Handle_GLOBAL PARAMS(( INT Line, CHAR *Var, CHAR *Arg )); -LOCAL VOID Handle_OPERATOR PARAMS(( INT Line, CHAR *Var, CHAR *Arg )); -LOCAL VOID Handle_SERVER PARAMS(( INT Line, CHAR *Var, CHAR *Arg )); -LOCAL VOID Handle_CHANNEL PARAMS(( INT Line, CHAR *Var, CHAR *Arg )); +LOCAL void Handle_GLOBAL PARAMS(( int Line, char *Var, char *Arg )); +LOCAL void Handle_OPERATOR PARAMS(( int Line, char *Var, char *Arg )); +LOCAL void Handle_SERVER PARAMS(( int Line, char *Var, char *Arg )); +LOCAL void Handle_CHANNEL PARAMS(( int Line, char *Var, char *Arg )); -LOCAL VOID Config_Error PARAMS(( CONST INT Level, CONST CHAR *Format, ... )); +LOCAL void Config_Error PARAMS(( const int Level, const char *Format, ... )); -LOCAL VOID Config_Error_NaN PARAMS(( const int LINE, const char *Value )); -LOCAL VOID Config_Error_TooLong PARAMS(( const int LINE, const char *Value )); +LOCAL void Config_Error_NaN PARAMS(( const int LINE, const char *Value )); +LOCAL void Config_Error_TooLong PARAMS(( const int LINE, const char *Value )); -LOCAL VOID Init_Server_Struct PARAMS(( CONF_SERVER *Server )); +LOCAL void Init_Server_Struct PARAMS(( CONF_SERVER *Server )); -GLOBAL VOID -Conf_Init( VOID ) +GLOBAL void +Conf_Init( void ) { - Set_Defaults( TRUE ); + Set_Defaults( true ); Read_Config( ); - Validate_Config( FALSE ); + Validate_Config( false ); } /* Config_Init */ -GLOBAL VOID -Conf_Rehash( VOID ) +GLOBAL void +Conf_Rehash( void ) { - Set_Defaults( FALSE ); + Set_Defaults( false ); Read_Config( ); - Validate_Config( FALSE ); + Validate_Config( false ); } /* Config_Rehash */ -GLOBAL INT -Conf_Test( VOID ) +GLOBAL int +Conf_Test( void ) { /* Read configuration, validate and output it. */ struct passwd *pwd; struct group *grp; - INT i; + int i; - Use_Log = FALSE; - Set_Defaults( TRUE ); + Use_Log = false; + Set_Defaults( true ); Read_Config( ); - Validate_Config( TRUE ); + Validate_Config( true ); /* If stdin is a valid tty wait for a key: */ if( isatty( fileno( stdout ))) @@ -134,15 +134,15 @@ Conf_Test( VOID ) printf( " Listen = %s\n", Conf_ListenAddress ); pwd = getpwuid( Conf_UID ); if( pwd ) printf( " ServerUID = %s\n", pwd->pw_name ); - else printf( " ServerUID = %ld\n", (LONG)Conf_UID ); + else printf( " ServerUID = %ld\n", (long)Conf_UID ); grp = getgrgid( Conf_GID ); if( grp ) printf( " ServerGID = %s\n", grp->gr_name ); - else printf( " ServerGID = %ld\n", (LONG)Conf_GID ); + else printf( " ServerGID = %ld\n", (long)Conf_GID ); printf( " PingTimeout = %d\n", Conf_PingTimeout ); printf( " PongTimeout = %d\n", Conf_PongTimeout ); printf( " ConnectRetry = %d\n", Conf_ConnectRetry ); - printf( " OperCanUseMode = %s\n", Conf_OperCanMode == TRUE ? "yes" : "no" ); - printf( " OperServerMode = %s\n", Conf_OperServerMode == TRUE ? "yes" : "no" ); + printf( " OperCanUseMode = %s\n", Conf_OperCanMode == true? "yes" : "no" ); + printf( " OperServerMode = %s\n", Conf_OperServerMode == true? "yes" : "no" ); if( Conf_MaxConnections > 0 ) printf( " MaxConnections = %ld\n", Conf_MaxConnections ); else printf( " MaxConnections = -1\n" ); if( Conf_MaxConnectionsIP > 0 ) printf( " MaxConnectionsIP = %d\n", Conf_MaxConnectionsIP ); @@ -194,7 +194,7 @@ Conf_Test( VOID ) } /* Conf_Test */ -GLOBAL VOID +GLOBAL void Conf_UnsetServer( CONN_ID Idx ) { /* Set next time for next connection attempt, if this is a server @@ -202,7 +202,7 @@ Conf_UnsetServer( CONN_ID Idx ) * "once", delete it from our configuration. * Non-Server-Connections will be silently ignored. */ - INT i; + int i; /* Check all our configured servers */ for( i = 0; i < MAX_SERVERS; i++ ) @@ -230,8 +230,8 @@ Conf_UnsetServer( CONN_ID Idx ) } /* Conf_UnsetServer */ -GLOBAL VOID -Conf_SetServer( INT ConfServer, CONN_ID Idx ) +GLOBAL void +Conf_SetServer( int ConfServer, CONN_ID Idx ) { /* Set connection for specified configured server */ @@ -242,12 +242,12 @@ Conf_SetServer( INT ConfServer, CONN_ID Idx ) } /* Conf_SetServer */ -GLOBAL INT +GLOBAL int Conf_GetServer( CONN_ID Idx ) { /* Get index of server in configuration structure */ - INT i = 0; + int i = 0; assert( Idx > NONE ); @@ -259,12 +259,12 @@ Conf_GetServer( CONN_ID Idx ) } /* Conf_GetServer */ -GLOBAL BOOLEAN -Conf_EnableServer( CHAR *Name, INT Port ) +GLOBAL bool +Conf_EnableServer( char *Name, UINT16 Port ) { /* Enable specified server and adjust port */ - INT i; + int i; assert( Name != NULL ); @@ -275,19 +275,19 @@ Conf_EnableServer( CHAR *Name, INT Port ) /* Gotcha! Set port and enable server: */ Conf_Server[i].port = Port; Conf_Server[i].flags &= ~CONF_SFLAG_DISABLED; - return TRUE; + return true; } } - return FALSE; + return false; } /* Conf_EnableServer */ -GLOBAL BOOLEAN -Conf_DisableServer( CHAR *Name ) +GLOBAL bool +Conf_DisableServer( char *Name ) { /* Enable specified server and adjust port */ - INT i; + int i; assert( Name != NULL ); @@ -297,20 +297,20 @@ Conf_DisableServer( CHAR *Name ) { /* Gotcha! Disable and disconnect server: */ Conf_Server[i].flags |= CONF_SFLAG_DISABLED; - if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", TRUE ); - return TRUE; + if( Conf_Server[i].conn_id > NONE ) Conn_Close( Conf_Server[i].conn_id, NULL, "Server link terminated on operator request", true); + return true; } } - return FALSE; + return false; } /* Conf_DisableServer */ -GLOBAL BOOLEAN -Conf_AddServer( CHAR *Name, INT Port, CHAR *Host, CHAR *MyPwd, CHAR *PeerPwd ) +GLOBAL bool +Conf_AddServer( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd ) { /* Add new server to configuration */ - INT i; + int i; assert( Name != NULL ); assert( Host != NULL ); @@ -323,7 +323,7 @@ Conf_AddServer( CHAR *Name, INT Port, CHAR *Host, CHAR /* Is this item used? */ if( ! Conf_Server[i].name[0] ) break; } - if( i >= MAX_SERVERS ) return FALSE; + if( i >= MAX_SERVERS ) return false; Init_Server_Struct( &Conf_Server[i] ); strlcpy( Conf_Server[i].name, Name, sizeof( Conf_Server[i].name )); @@ -333,16 +333,16 @@ Conf_AddServer( CHAR *Name, INT Port, CHAR *Host, CHAR Conf_Server[i].port = Port; Conf_Server[i].flags = CONF_SFLAG_ONCE; - return TRUE; + return true; } /* Conf_AddServer */ -LOCAL VOID -Set_Defaults( BOOLEAN InitServers ) +LOCAL void +Set_Defaults( bool InitServers ) { /* Initialize configuration variables with default values. */ - INT i; + int i; strcpy( Conf_ServerName, "" ); sprintf( Conf_ServerInfo, "%s %s", PACKAGE_NAME, PACKAGE_VERSION ); @@ -374,8 +374,8 @@ Set_Defaults( BOOLEAN InitServers ) Conf_Oper_Count = 0; Conf_Channel_Count = 0; - Conf_OperCanMode = FALSE; - Conf_OperServerMode = FALSE; + Conf_OperCanMode = false; + Conf_OperServerMode = false; Conf_MaxConnections = -1; Conf_MaxConnectionsIP = 5; @@ -386,13 +386,13 @@ Set_Defaults( BOOLEAN InitServers ) } /* Set_Defaults */ -LOCAL VOID -Read_Config( VOID ) +LOCAL void +Read_Config( void ) { /* Read configuration file. */ - CHAR section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; - INT line, i, n; + char section[LINE_LEN], str[LINE_LEN], *var, *arg, *ptr; + int line, i, n; FILE *fd; /* Open configuration file */ @@ -449,7 +449,7 @@ Read_Config( VOID ) New_Server_Idx = NONE; /* Read configuration file */ - while( TRUE ) + while( true ) { if( ! fgets( str, LINE_LEN, fd )) break; ngt_TrimStr( str ); @@ -563,24 +563,24 @@ Read_Config( VOID ) } /* Read_Config */ -LOCAL BOOLEAN +LOCAL bool Check_ArgIsTrue( const char *Arg ) { - if( strcasecmp( Arg, "yes" ) == 0 ) return TRUE; - if( strcasecmp( Arg, "true" ) == 0 ) return TRUE; - if( atoi( Arg ) != 0 ) return TRUE; + if( strcasecmp( Arg, "yes" ) == 0 ) return true; + if( strcasecmp( Arg, "true" ) == 0 ) return true; + if( atoi( Arg ) != 0 ) return true; - return FALSE; + return false; } /* Check_ArgIsTrue */ -LOCAL VOID -Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) +LOCAL void +Handle_GLOBAL( int Line, char *Var, char *Arg ) { struct passwd *pwd; struct group *grp; - CHAR *ptr; - LONG port; + char *ptr; + long port; assert( Line > 0 ); assert( Var != NULL ); @@ -640,7 +640,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) if( Conf_ListenPorts_Count + 1 > MAX_LISTEN_PORTS ) Config_Error( LOG_ERR, "Too many listen ports configured. Port %ld ignored.", port ); else { - if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT)port; + if( port > 0 && port < 0xFFFF ) Conf_ListenPorts[Conf_ListenPorts_Count++] = (UINT16)port; else Config_Error( LOG_ERR, "%s, line %d (section \"Global\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port ); } ptr = strtok( NULL, "," ); @@ -689,10 +689,10 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) else { #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var ); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var ); else #endif - Conf_UID = (UINT)atoi( Arg ); + Conf_UID = (unsigned int)atoi( Arg ); } return; } @@ -704,10 +704,10 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) else { #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var ); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var ); else #endif - Conf_GID = (UINT)atoi( Arg ); + Conf_GID = (unsigned int)atoi( Arg ); } return; } @@ -760,7 +760,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) { /* Maximum number of connections. Values <= 0 are equal to "no limit". */ #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var); else #endif Conf_MaxConnections = atol( Arg ); @@ -770,7 +770,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) { /* Maximum number of simoultanous connections from one IP. Values <= 0 are equal to "no limit". */ #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var ); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var ); else #endif Conf_MaxConnectionsIP = atoi( Arg ); @@ -780,7 +780,7 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) { /* Maximum number of channels a user can join. Values <= 0 are equal to "no limit". */ #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var ); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var ); else #endif Conf_MaxJoins = atoi( Arg ); @@ -800,8 +800,8 @@ Handle_GLOBAL( INT Line, CHAR *Var, CHAR *Arg ) } /* Handle_GLOBAL */ -LOCAL VOID -Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg ) +LOCAL void +Handle_OPERATOR( int Line, char *Var, char *Arg ) { unsigned int len; assert( Line > 0 ); @@ -838,10 +838,10 @@ Handle_OPERATOR( INT Line, CHAR *Var, CHAR *Arg ) } /* Handle_OPERATOR */ -LOCAL VOID -Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg ) +LOCAL void +Handle_SERVER( int Line, char *Var, char *Arg ) { - LONG port; + long port; assert( Line > 0 ); assert( Var != NULL ); @@ -881,7 +881,7 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg ) { /* Port to which this server should connect */ port = atol( Arg ); - if( port > 0 && port < 0xFFFF ) New_Server.port = (INT)port; + if( port > 0 && port < 0xFFFF ) New_Server.port = (UINT16)port; else Config_Error( LOG_ERR, "%s, line %d (section \"Server\"): Illegal port number %ld!", NGIRCd_ConfFile, Line, port ); return; } @@ -889,7 +889,7 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg ) { /* Server group */ #ifdef HAVE_ISDIGIT - if( ! isdigit( (INT)*Arg )) Config_Error_NaN( Line, Var ); + if( ! isdigit( (int)*Arg )) Config_Error_NaN( Line, Var ); else #endif New_Server.group = atoi( Arg ); @@ -900,8 +900,8 @@ Handle_SERVER( INT Line, CHAR *Var, CHAR *Arg ) } /* Handle_SERVER */ -LOCAL VOID -Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg ) +LOCAL void +Handle_CHANNEL( int Line, char *Var, char *Arg ) { assert( Line > 0 ); assert( Var != NULL ); @@ -934,13 +934,13 @@ Handle_CHANNEL( INT Line, CHAR *Var, CHAR *Arg ) } /* Handle_CHANNEL */ -LOCAL VOID -Validate_Config( BOOLEAN Configtest ) +LOCAL void +Validate_Config( bool Configtest ) { /* Validate configuration settings. */ #ifdef DEBUG - INT i, servers, servers_once; + int i, servers, servers_once; #endif if( ! Conf_ServerName[0] ) @@ -984,9 +984,9 @@ Validate_Config( BOOLEAN Configtest ) Config_Error( LOG_WARNING, "No administrative information configured but required by RFC!" ); } #ifdef FD_SETSIZE - if(( Conf_MaxConnections > (LONG)FD_SETSIZE ) || ( Conf_MaxConnections < 1 )) + if(( Conf_MaxConnections > (long)FD_SETSIZE ) || ( Conf_MaxConnections < 1 )) { - Conf_MaxConnections = (LONG)FD_SETSIZE; + Conf_MaxConnections = (long)FD_SETSIZE; Config_Error( LOG_ERR, "Setting MaxConnections to %ld, select() can't handle more file descriptors!", Conf_MaxConnections ); } #else @@ -1008,30 +1008,30 @@ Validate_Config( BOOLEAN Configtest ) } /* Validate_Config */ -LOCAL VOID +LOCAL void Config_Error_TooLong ( const int Line, const char *Item ) { Config_Error( LOG_WARNING, "%s, line %d: Value of \"%s\" too long!", NGIRCd_ConfFile, Line, Item ); } -LOCAL VOID +LOCAL void Config_Error_NaN( const int Line, const char *Item ) { Config_Error( LOG_WARNING, "%s, line %d: Value of \"%s\" is not a number!", NGIRCd_ConfFile, Line, Item ); } #ifdef PROTOTYPES -LOCAL VOID Config_Error( CONST INT Level, CONST CHAR *Format, ... ) +LOCAL void Config_Error( const int Level, const char *Format, ... ) #else -LOCAL VOID Config_Error( Level, Format, va_alist ) -CONST INT Level; -CONST CHAR *Format; +LOCAL void Config_Error( Level, Format, va_alist ) +const int Level; +const char *Format; va_dcl #endif { /* Error! Write to console and/or logfile. */ - CHAR msg[MAX_LOG_MSG_LEN]; + char msg[MAX_LOG_MSG_LEN]; va_list ap; assert( Format != NULL ); @@ -1052,7 +1052,7 @@ va_dcl } /* Config_Error */ -LOCAL VOID +LOCAL void Init_Server_Struct( CONF_SERVER *Server ) { /* Initialize server configuration structur to default values */ blob - 797c5a5c6d935a6e0b8f02247e7042cc499bc493 blob + 8c047699228582db28c09dc13e23b79cc348ad0c --- src/ngircd/conf.h +++ src/ngircd/conf.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conf.h,v 1.32 2005/03/15 16:56:18 alex Exp $ + * $Id: conf.h,v 1.33 2005/03/19 18:43:48 fw Exp $ * * Configuration management (header) */ @@ -20,35 +20,35 @@ #include #include "defines.h" +#include "portab.h" - typedef struct _Conf_Oper { - CHAR name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */ - CHAR pwd[CLIENT_PASS_LEN]; /* Password */ + char name[CLIENT_PASS_LEN]; /* Name (ID) of IRC operator */ + char pwd[CLIENT_PASS_LEN]; /* Password */ char *mask; } CONF_OPER; typedef struct _Conf_Server { - CHAR host[HOST_LEN]; /* Hostname */ - CHAR ip[16]; /* IP address (Resolver) */ - CHAR name[CLIENT_ID_LEN]; /* IRC-Client-ID */ - CHAR pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */ - CHAR pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */ - INT port; /* Server port */ - INT group; /* Group of server */ + char host[HOST_LEN]; /* Hostname */ + char ip[16]; /* IP address (Resolver) */ + char name[CLIENT_ID_LEN]; /* IRC-Client-ID */ + char pwd_in[CLIENT_PASS_LEN]; /* Password which must be received */ + char pwd_out[CLIENT_PASS_LEN]; /* Password to send to peer */ + UINT16 port; /* Server port */ + int group; /* Group of server */ time_t lasttry; /* Last connect attempt */ RES_STAT *res_stat; /* Status of the resolver */ - INT flags; /* Flags */ + int flags; /* Flags */ CONN_ID conn_id; /* ID of server connection or NONE */ } CONF_SERVER; typedef struct _Conf_Channel { - CHAR name[CHANNEL_NAME_LEN]; /* Name of the channel */ - CHAR modes[CHANNEL_MODE_LEN]; /* Initial channel modes */ - CHAR topic[CHANNEL_TOPIC_LEN]; /* Initial topic */ + char name[CHANNEL_NAME_LEN]; /* Name of the channel */ + char modes[CHANNEL_MODE_LEN]; /* Initial channel modes */ + char topic[CHANNEL_TOPIC_LEN]; /* Initial topic */ } CONF_CHANNEL; @@ -57,89 +57,89 @@ typedef struct _Conf_Channel /* Name ("Nick") of the servers */ -GLOBAL CHAR Conf_ServerName[CLIENT_ID_LEN]; +GLOBAL char Conf_ServerName[CLIENT_ID_LEN]; /* Server info text */ -GLOBAL CHAR Conf_ServerInfo[CLIENT_INFO_LEN]; +GLOBAL char Conf_ServerInfo[CLIENT_INFO_LEN]; /* Global server passwort */ -GLOBAL CHAR Conf_ServerPwd[CLIENT_PASS_LEN]; +GLOBAL char Conf_ServerPwd[CLIENT_PASS_LEN]; /* Administrative information */ -GLOBAL CHAR Conf_ServerAdmin1[CLIENT_INFO_LEN]; -GLOBAL CHAR Conf_ServerAdmin2[CLIENT_INFO_LEN]; -GLOBAL CHAR Conf_ServerAdminMail[CLIENT_INFO_LEN]; +GLOBAL char Conf_ServerAdmin1[CLIENT_INFO_LEN]; +GLOBAL char Conf_ServerAdmin2[CLIENT_INFO_LEN]; +GLOBAL char Conf_ServerAdminMail[CLIENT_INFO_LEN]; /* File with MOTD text */ -GLOBAL CHAR Conf_MotdFile[FNAME_LEN]; +GLOBAL char Conf_MotdFile[FNAME_LEN]; /* Phrase with MOTD text */ -GLOBAL CHAR Conf_MotdPhrase[LINE_LEN]; +GLOBAL char Conf_MotdPhrase[LINE_LEN]; /* Ports the server should listen on */ -GLOBAL UINT Conf_ListenPorts[MAX_LISTEN_PORTS]; -GLOBAL INT Conf_ListenPorts_Count; +GLOBAL unsigned int Conf_ListenPorts[MAX_LISTEN_PORTS]; +GLOBAL int Conf_ListenPorts_Count; /* Address to which the socket should be bound or empty (=all) */ -GLOBAL CHAR Conf_ListenAddress[16]; +GLOBAL char Conf_ListenAddress[16]; /* User and group ID the server should run with */ -GLOBAL UINT Conf_UID; -GLOBAL UINT Conf_GID; +GLOBAL unsigned int Conf_UID; +GLOBAL unsigned int Conf_GID; /* A directory to chroot() in */ -GLOBAL CHAR Conf_Chroot[FNAME_LEN]; +GLOBAL char Conf_Chroot[FNAME_LEN]; /* File with PID of daemon */ -GLOBAL CHAR Conf_PidFile[FNAME_LEN]; +GLOBAL char Conf_PidFile[FNAME_LEN]; /* Timeouts for PING and PONG */ -GLOBAL INT Conf_PingTimeout; -GLOBAL INT Conf_PongTimeout; +GLOBAL int Conf_PingTimeout; +GLOBAL int Conf_PongTimeout; /* Seconds between connect attempts to other servers */ -GLOBAL INT Conf_ConnectRetry; +GLOBAL int Conf_ConnectRetry; /* Operators */ GLOBAL CONF_OPER Conf_Oper[MAX_OPERATORS]; -GLOBAL INT Conf_Oper_Count; +GLOBAL int Conf_Oper_Count; /* Servers */ GLOBAL CONF_SERVER Conf_Server[MAX_SERVERS]; /* Pre-defined channels */ GLOBAL CONF_CHANNEL Conf_Channel[MAX_DEFCHANNELS]; -GLOBAL INT Conf_Channel_Count; +GLOBAL int Conf_Channel_Count; /* Are IRC operators allowed to always use MODE? */ -GLOBAL BOOLEAN Conf_OperCanMode; +GLOBAL bool Conf_OperCanMode; /* If an IRC op gives chanop privileges without being a chanop, * ircd2 will ignore the command. This enables a workaround: * It masks the command as coming from the server */ -GLOBAL BOOLEAN Conf_OperServerMode; +GLOBAL bool Conf_OperServerMode; /* Maximum number of connections to this server */ -GLOBAL LONG Conf_MaxConnections; +GLOBAL long Conf_MaxConnections; /* Maximum number of channels a user can join */ -GLOBAL INT Conf_MaxJoins; +GLOBAL int Conf_MaxJoins; /* Maximum number of connections per IP address */ -GLOBAL INT Conf_MaxConnectionsIP; +GLOBAL int Conf_MaxConnectionsIP; -GLOBAL VOID Conf_Init PARAMS((VOID )); -GLOBAL VOID Conf_Rehash PARAMS((VOID )); -GLOBAL INT Conf_Test PARAMS((VOID )); +GLOBAL void Conf_Init PARAMS((void )); +GLOBAL void Conf_Rehash PARAMS((void )); +GLOBAL int Conf_Test PARAMS((void )); -GLOBAL VOID Conf_UnsetServer PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conf_SetServer PARAMS(( INT ConfServer, CONN_ID Idx )); -GLOBAL INT Conf_GetServer PARAMS(( CONN_ID Idx )); +GLOBAL void Conf_UnsetServer PARAMS(( CONN_ID Idx )); +GLOBAL void Conf_SetServer PARAMS(( int ConfServer, CONN_ID Idx )); +GLOBAL int Conf_GetServer PARAMS(( CONN_ID Idx )); -GLOBAL BOOLEAN Conf_EnableServer PARAMS(( CHAR *Name, INT Port )); -GLOBAL BOOLEAN Conf_DisableServer PARAMS(( CHAR *Name )); -GLOBAL BOOLEAN Conf_AddServer PARAMS(( CHAR *Name, INT Port, CHAR *Host, CHAR *MyPwd, CHAR *PeerPwd )); +GLOBAL bool Conf_EnableServer PARAMS(( char *Name, UINT16 Port )); +GLOBAL bool Conf_DisableServer PARAMS(( char *Name )); +GLOBAL bool Conf_AddServer PARAMS(( char *Name, UINT16 Port, char *Host, char *MyPwd, char *PeerPwd )); #endif blob - 06b5b9847ff055787dcbe6f5eebffc60604e0f02 blob + 61516d68c6f34da4eb0f4d2065a1a40f30e77175 --- src/ngircd/conn-func.c +++ src/ngircd/conn-func.c @@ -16,7 +16,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn-func.c,v 1.3 2003/12/26 15:55:07 alex Exp $"; +static char UNUSED id[] = "$Id: conn-func.c,v 1.4 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -28,7 +28,7 @@ static char UNUSED id[] = "$Id: conn-func.c,v 1.3 2003 #include "conn-func.h" -GLOBAL VOID +GLOBAL void Conn_UpdateIdle( CONN_ID Idx ) { /* Idle-Timer zuruecksetzen */ @@ -58,7 +58,7 @@ Conn_LastPing( CONN_ID Idx ) } /* Conn_LastPing */ -GLOBAL VOID +GLOBAL void Conn_SetPenalty( CONN_ID Idx, time_t Seconds ) { /* Penalty-Delay fuer eine Verbindung (in Sekunden) setzen; @@ -76,7 +76,7 @@ Conn_SetPenalty( CONN_ID Idx, time_t Seconds ) } /* Conn_SetPenalty */ -GLOBAL VOID +GLOBAL void Conn_ResetPenalty( CONN_ID Idx ) { assert( Idx > NONE ); @@ -84,8 +84,8 @@ Conn_ResetPenalty( CONN_ID Idx ) } /* Conn_ResetPenalty */ -GLOBAL VOID -Conn_ClearFlags( VOID ) +GLOBAL void +Conn_ClearFlags( void ) { /* Alle Connection auf "nicht-markiert" setzen */ @@ -95,18 +95,18 @@ Conn_ClearFlags( VOID ) } /* Conn_ClearFlags */ -GLOBAL INT +GLOBAL int Conn_Flag( CONN_ID Idx ) { - /* Ist eine Connection markiert (TRUE) oder nicht? */ + /* Ist eine Connection markiert (true) oder nicht? */ assert( Idx > NONE ); return My_Connections[Idx].flag; } /* Conn_Flag */ -GLOBAL VOID -Conn_SetFlag( CONN_ID Idx, INT Flag ) +GLOBAL void +Conn_SetFlag( CONN_ID Idx, int Flag ) { /* Connection markieren */ @@ -116,7 +116,7 @@ Conn_SetFlag( CONN_ID Idx, INT Flag ) GLOBAL CONN_ID -Conn_First( VOID ) +Conn_First( void ) { /* Connection-Struktur der ersten Verbindung liefern; * Ist keine Verbindung vorhanden, wird NONE geliefert. */ @@ -149,8 +149,8 @@ Conn_Next( CONN_ID Idx ) } /* Conn_Next */ -GLOBAL VOID -Conn_SetOption( CONN_ID Idx, INT Option ) +GLOBAL void +Conn_SetOption( CONN_ID Idx, int Option ) { /* Option fuer Verbindung setzen. * Initial sind alle Optionen _nicht_ gesetzt. */ @@ -162,8 +162,8 @@ Conn_SetOption( CONN_ID Idx, INT Option ) } /* Conn_SetOption */ -GLOBAL VOID -Conn_UnsetOption( CONN_ID Idx, INT Option ) +GLOBAL void +Conn_UnsetOption( CONN_ID Idx, int Option ) { /* Option fuer Verbindung loeschen */ @@ -174,7 +174,7 @@ Conn_UnsetOption( CONN_ID Idx, INT Option ) } /* Conn_UnsetOption */ -GLOBAL INT +GLOBAL int Conn_Options( CONN_ID Idx ) { assert( Idx > NONE ); @@ -192,7 +192,7 @@ Conn_StartTime( CONN_ID Idx ) } /* Conn_Uptime */ -GLOBAL INT +GLOBAL int Conn_SendQ( CONN_ID Idx ) { /* Laenge der Daten im Schreibbuffer liefern */ @@ -206,7 +206,7 @@ Conn_SendQ( CONN_ID Idx ) } /* Conn_SendQ */ -GLOBAL LONG +GLOBAL long Conn_SendMsg( CONN_ID Idx ) { /* Anzahl gesendeter Nachrichten liefern */ @@ -216,7 +216,7 @@ Conn_SendMsg( CONN_ID Idx ) } /* Conn_SendMsg */ -GLOBAL LONG +GLOBAL long Conn_SendBytes( CONN_ID Idx ) { /* Anzahl gesendeter Bytes (unkomprimiert) liefern */ @@ -226,7 +226,7 @@ Conn_SendBytes( CONN_ID Idx ) } /* Conn_SendBytes */ -GLOBAL INT +GLOBAL int Conn_RecvQ( CONN_ID Idx ) { /* Laenge der Daten im Lesebuffer liefern */ @@ -240,7 +240,7 @@ Conn_RecvQ( CONN_ID Idx ) } /* Conn_RecvQ */ -GLOBAL LONG +GLOBAL long Conn_RecvMsg( CONN_ID Idx ) { /* Anzahl empfangener Nachrichten liefern */ @@ -250,7 +250,7 @@ Conn_RecvMsg( CONN_ID Idx ) } /* Conn_RecvMsg */ -GLOBAL LONG +GLOBAL long Conn_RecvBytes( CONN_ID Idx ) { /* Anzahl empfangener Bytes (unkomprimiert) liefern */ @@ -260,15 +260,15 @@ Conn_RecvBytes( CONN_ID Idx ) } /* Conn_RecvBytes */ -GLOBAL VOID -Conn_ResetWCounter( VOID ) +GLOBAL void +Conn_ResetWCounter( void ) { WCounter = 0; } /* Conn_ResetWCounter */ -GLOBAL LONG -Conn_WCounter( VOID ) +GLOBAL long +Conn_WCounter( void ) { return WCounter; } /* Conn_WCounter */ blob - 73d9f742a7cfae5f9dac9edfb7726a2bf196c0ef blob + f0ed7f38b01b5aa8e95124f23c596ac7c2fb55fb --- src/ngircd/conn-func.h +++ src/ngircd/conn-func.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conn-func.h,v 1.1 2002/12/30 17:14:28 alex Exp $ + * $Id: conn-func.h,v 1.2 2005/03/19 18:43:48 fw Exp $ * * Connection management: Global functions (header) */ @@ -26,33 +26,33 @@ #endif -GLOBAL VOID Conn_UpdateIdle PARAMS(( CONN_ID Idx )); +GLOBAL void Conn_UpdateIdle PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_GetIdle PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_LastPing PARAMS(( CONN_ID Idx )); GLOBAL time_t Conn_StartTime PARAMS(( CONN_ID Idx )); -GLOBAL INT Conn_SendQ PARAMS(( CONN_ID Idx )); -GLOBAL INT Conn_RecvQ PARAMS(( CONN_ID Idx )); -GLOBAL LONG Conn_SendMsg PARAMS(( CONN_ID Idx )); -GLOBAL LONG Conn_RecvMsg PARAMS(( CONN_ID Idx )); -GLOBAL LONG Conn_SendBytes PARAMS(( CONN_ID Idx )); -GLOBAL LONG Conn_RecvBytes PARAMS(( CONN_ID Idx )); +GLOBAL int Conn_SendQ PARAMS(( CONN_ID Idx )); +GLOBAL int Conn_RecvQ PARAMS(( CONN_ID Idx )); +GLOBAL long Conn_SendMsg PARAMS(( CONN_ID Idx )); +GLOBAL long Conn_RecvMsg PARAMS(( CONN_ID Idx )); +GLOBAL long Conn_SendBytes PARAMS(( CONN_ID Idx )); +GLOBAL long Conn_RecvBytes PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds )); -GLOBAL VOID Conn_ResetPenalty PARAMS(( CONN_ID Idx )); +GLOBAL void Conn_SetPenalty PARAMS(( CONN_ID Idx, time_t Seconds )); +GLOBAL void Conn_ResetPenalty PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conn_ClearFlags PARAMS(( VOID )); -GLOBAL INT Conn_Flag PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conn_SetFlag PARAMS(( CONN_ID Idx, INT Flag )); +GLOBAL void Conn_ClearFlags PARAMS(( void )); +GLOBAL int Conn_Flag PARAMS(( CONN_ID Idx )); +GLOBAL void Conn_SetFlag PARAMS(( CONN_ID Idx, int Flag )); -GLOBAL CONN_ID Conn_First PARAMS(( VOID )); +GLOBAL CONN_ID Conn_First PARAMS(( void )); GLOBAL CONN_ID Conn_Next PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conn_SetOption PARAMS(( CONN_ID Idx, INT Option )); -GLOBAL VOID Conn_UnsetOption PARAMS(( CONN_ID Idx, INT Option )); -GLOBAL INT Conn_Options PARAMS(( CONN_ID Idx )); +GLOBAL void Conn_SetOption PARAMS(( CONN_ID Idx, int Option )); +GLOBAL void Conn_UnsetOption PARAMS(( CONN_ID Idx, int Option )); +GLOBAL int Conn_Options PARAMS(( CONN_ID Idx )); -GLOBAL VOID Conn_ResetWCounter PARAMS(( VOID )); -GLOBAL LONG Conn_WCounter PARAMS(( VOID )); +GLOBAL void Conn_ResetWCounter PARAMS(( void )); +GLOBAL long Conn_WCounter PARAMS(( void )); #endif blob - be65e969d8a354f01b8a81bd78b1ae53b87b5ed5 blob + 6ed53d60c895368be8fbbb2c4b0f599f559075fa --- src/ngircd/conn-zip.c +++ src/ngircd/conn-zip.c @@ -19,7 +19,7 @@ #ifdef ZLIB -static char UNUSED id[] = "$Id: conn-zip.c,v 1.5 2004/04/25 13:55:36 alex Exp $"; +static char UNUSED id[] = "$Id: conn-zip.c,v 1.6 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -34,7 +34,7 @@ static char UNUSED id[] = "$Id: conn-zip.c,v 1.5 2004/ #include "conn-zip.h" -GLOBAL BOOLEAN +GLOBAL bool Zip_InitConn( CONN_ID Idx ) { /* Kompression fuer Link initialisieren */ @@ -52,7 +52,7 @@ Zip_InitConn( CONN_ID Idx ) { /* Fehler! */ Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib inflate)!", Idx ); - return FALSE; + return false; } My_Connections[Idx].zip.out.total_in = 0; @@ -65,7 +65,7 @@ Zip_InitConn( CONN_ID Idx ) { /* Fehler! */ Log( LOG_ALERT, "Can't initialize compression on connection %d (zlib deflate)!", Idx ); - return FALSE; + return false; } My_Connections[Idx].zip.bytes_in = My_Connections[Idx].bytes_in; @@ -74,15 +74,15 @@ Zip_InitConn( CONN_ID Idx ) Log( LOG_INFO, "Enabled link compression (zlib) on connection %d.", Idx ); Conn_SetOption( Idx, CONN_ZIP ); - return TRUE; + return true; } /* Zip_InitConn */ -GLOBAL BOOLEAN -Zip_Buffer( CONN_ID Idx, CHAR *Data, INT Len ) +GLOBAL bool +Zip_Buffer( CONN_ID Idx, char *Data, int Len ) { /* Daten zum Komprimieren im "Kompressions-Puffer" sammeln. - * Es wird TRUE bei Erfolg, sonst FALSE geliefert. */ + * Es wird true bei Erfolg, sonst false geliefert. */ assert( Idx > NONE ); assert( Data != NULL ); @@ -92,39 +92,39 @@ Zip_Buffer( CONN_ID Idx, CHAR *Data, INT Len ) if( ZWRITEBUFFER_LEN - My_Connections[Idx].zip.wdatalen < Len + 50 ) { /* Nein! Puffer zunaechst leeren ...*/ - if( ! Zip_Flush( Idx )) return FALSE; + if( ! Zip_Flush( Idx )) return false; } /* Daten kopieren */ memmove( My_Connections[Idx].zip.wbuf + My_Connections[Idx].zip.wdatalen, Data, Len ); My_Connections[Idx].zip.wdatalen += Len; - return TRUE; + return true; } /* Zip_Buffer */ -GLOBAL BOOLEAN +GLOBAL bool Zip_Flush( CONN_ID Idx ) { /* Daten komprimieren und in Schreibpuffer kopieren. - * Es wird TRUE bei Erfolg, sonst FALSE geliefert. */ + * Es wird true bei Erfolg, sonst false geliefert. */ - INT result, out_len; + int result, out_len; z_stream *out; out = &My_Connections[Idx].zip.out; - out->next_in = (VOID *)My_Connections[Idx].zip.wbuf; + out->next_in = (void *)My_Connections[Idx].zip.wbuf; out->avail_in = My_Connections[Idx].zip.wdatalen; - out->next_out = (VOID *)(My_Connections[Idx].wbuf + My_Connections[Idx].wdatalen); + out->next_out = (void *)(My_Connections[Idx].wbuf + My_Connections[Idx].wdatalen); out->avail_out = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen; result = deflate( out, Z_SYNC_FLUSH ); if(( result != Z_OK ) || ( out->avail_in > 0 )) { Log( LOG_ALERT, "Compression error: code %d!?", result ); - Conn_Close( Idx, "Compression error!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Compression error!", NULL, false ); + return false; } out_len = WRITEBUFFER_LEN - My_Connections[Idx].wdatalen - out->avail_out; @@ -133,37 +133,37 @@ Zip_Flush( CONN_ID Idx ) My_Connections[Idx].zip.bytes_out += My_Connections[Idx].zip.wdatalen; My_Connections[Idx].zip.wdatalen = 0; - return TRUE; + return true; } /* Zip_Flush */ -GLOBAL BOOLEAN +GLOBAL bool Unzip_Buffer( CONN_ID Idx ) { /* Daten entpacken und in Lesepuffer kopieren. Bei Fehlern - * wird FALSE geliefert, ansonsten TRUE. Der Fall, dass keine + * wird false geliefert, ansonsten true. Der Fall, dass keine * Daten mehr zu entpacken sind, ist _kein_ Fehler! */ - INT result, in_len, out_len; + int result, in_len, out_len; z_stream *in; assert( Idx > NONE ); - if( My_Connections[Idx].zip.rdatalen <= 0 ) return TRUE; + if( My_Connections[Idx].zip.rdatalen <= 0 ) return true; in = &My_Connections[Idx].zip.in; - in->next_in = (VOID *)My_Connections[Idx].zip.rbuf; + in->next_in = (void *)My_Connections[Idx].zip.rbuf; in->avail_in = My_Connections[Idx].zip.rdatalen; - in->next_out = (VOID *)(My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen); + in->next_out = (void *)(My_Connections[Idx].rbuf + My_Connections[Idx].rdatalen); in->avail_out = READBUFFER_LEN - My_Connections[Idx].rdatalen - 1; result = inflate( in, Z_SYNC_FLUSH ); if( result != Z_OK ) { Log( LOG_ALERT, "Decompression error: %s (code=%d, ni=%d, ai=%d, no=%d, ao=%d)!?", in->msg, result, in->next_in, in->avail_in, in->next_out, in->avail_out ); - Conn_Close( Idx, "Decompression error!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Decompression error!", NULL, false ); + return false; } in_len = My_Connections[Idx].zip.rdatalen - in->avail_in; @@ -180,11 +180,11 @@ Unzip_Buffer( CONN_ID Idx ) else My_Connections[Idx].zip.rdatalen = 0; My_Connections[Idx].zip.bytes_in += out_len; - return TRUE; + return true; } /* Unzip_Buffer */ -GLOBAL LONG +GLOBAL long Zip_SendBytes( CONN_ID Idx ) { /* Anzahl gesendeter Bytes (komprimiert!) liefern */ @@ -194,7 +194,7 @@ Zip_SendBytes( CONN_ID Idx ) } /* Zip_SendBytes */ -GLOBAL LONG +GLOBAL long Zip_RecvBytes( CONN_ID Idx ) { /* Anzahl gesendeter Bytes (komprimiert!) liefern */ blob - e2ff93f6b44e8f868f29addc2d5d327cc2840c30 blob + c6518b1402f3ddd3fc9b18eeab25725b78e5e1de --- src/ngircd/conn-zip.h +++ src/ngircd/conn-zip.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conn-zip.h,v 1.2 2003/12/26 15:55:07 alex Exp $ + * $Id: conn-zip.h,v 1.3 2005/03/19 18:43:48 fw Exp $ * * Connection compression using ZLIB (header) */ @@ -20,14 +20,14 @@ #define __conn_zip_h__ -GLOBAL BOOLEAN Zip_InitConn PARAMS(( CONN_ID Idx )); +GLOBAL bool Zip_InitConn PARAMS(( CONN_ID Idx )); -GLOBAL BOOLEAN Zip_Buffer PARAMS(( CONN_ID Idx, CHAR *Data, INT Len )); -GLOBAL BOOLEAN Zip_Flush PARAMS(( CONN_ID Idx )); -GLOBAL BOOLEAN Unzip_Buffer PARAMS(( CONN_ID Idx )); +GLOBAL bool Zip_Buffer PARAMS(( CONN_ID Idx, char *Data, int Len )); +GLOBAL bool Zip_Flush PARAMS(( CONN_ID Idx )); +GLOBAL bool Unzip_Buffer PARAMS(( CONN_ID Idx )); -GLOBAL LONG Zip_SendBytes PARAMS(( CONN_ID Idx )); -GLOBAL LONG Zip_RecvBytes PARAMS(( CONN_ID Idx )); +GLOBAL long Zip_SendBytes PARAMS(( CONN_ID Idx )); +GLOBAL long Zip_RecvBytes PARAMS(( CONN_ID Idx )); #endif /* __conn_zip_h__ */ blob - ba874f8a71bd5f57b9b13595677494f88c6b9d80 blob + 137d4c70e5152c0e4382aa0f7682affbe43a6023 --- src/ngircd/conn.c +++ src/ngircd/conn.c @@ -16,7 +16,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: conn.c,v 1.143 2005/01/19 23:33:54 alex Exp $"; +static char UNUSED id[] = "$Id: conn.c,v 1.144 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -81,34 +81,34 @@ static char UNUSED id[] = "$Id: conn.c,v 1.143 2005/01 #define SERVER_WAIT (NONE - 1) -LOCAL VOID Handle_Read PARAMS(( INT sock )); -LOCAL BOOLEAN Handle_Write PARAMS(( CONN_ID Idx )); -LOCAL VOID New_Connection PARAMS(( INT Sock )); -LOCAL CONN_ID Socket2Index PARAMS(( INT Sock )); -LOCAL VOID Read_Request PARAMS(( CONN_ID Idx )); -LOCAL BOOLEAN Try_Write PARAMS(( CONN_ID Idx )); -LOCAL BOOLEAN Handle_Buffer PARAMS(( CONN_ID Idx )); -LOCAL VOID Check_Connections PARAMS(( VOID )); -LOCAL VOID Check_Servers PARAMS(( VOID )); -LOCAL VOID Init_Conn_Struct PARAMS(( CONN_ID Idx )); -LOCAL BOOLEAN Init_Socket PARAMS(( INT Sock )); -LOCAL VOID New_Server PARAMS(( INT Server, CONN_ID Idx )); -LOCAL VOID Read_Resolver_Result PARAMS(( INT r_fd )); -LOCAL VOID Simple_Message PARAMS(( INT Sock, CHAR *Msg )); -LOCAL INT Count_Connections PARAMS(( struct sockaddr_in addr )); +LOCAL void Handle_Read PARAMS(( int sock )); +LOCAL bool Handle_Write PARAMS(( CONN_ID Idx )); +LOCAL void New_Connection PARAMS(( int Sock )); +LOCAL CONN_ID Socket2Index PARAMS(( int Sock )); +LOCAL void Read_Request PARAMS(( CONN_ID Idx )); +LOCAL bool Try_Write PARAMS(( CONN_ID Idx )); +LOCAL bool Handle_Buffer PARAMS(( CONN_ID Idx )); +LOCAL void Check_Connections PARAMS(( void )); +LOCAL void Check_Servers PARAMS(( void )); +LOCAL void Init_Conn_Struct PARAMS(( CONN_ID Idx )); +LOCAL bool Init_Socket PARAMS(( int Sock )); +LOCAL void New_Server PARAMS(( int Server, CONN_ID Idx )); +LOCAL void Read_Resolver_Result PARAMS(( int r_fd )); +LOCAL void Simple_Message PARAMS(( int Sock, char *Msg )); +LOCAL int Count_Connections PARAMS(( struct sockaddr_in addr )); LOCAL fd_set My_Listeners; LOCAL fd_set My_Sockets; LOCAL fd_set My_Connects; #ifdef TCPWRAP -INT allow_severity = LOG_INFO; -INT deny_severity = LOG_ERR; +int allow_severity = LOG_INFO; +int deny_severity = LOG_ERR; #endif -GLOBAL VOID -Conn_Init( VOID ) +GLOBAL void +Conn_Init( void ) { /* Modul initialisieren: statische Strukturen "ausnullen". */ @@ -148,14 +148,14 @@ Conn_Init( VOID ) } /* Conn_Init */ -GLOBAL VOID -Conn_Exit( VOID ) +GLOBAL void +Conn_Exit( void ) { /* Modul abmelden: alle noch offenen Connections * schliessen und freigeben. */ CONN_ID idx; - INT i; + int i; #ifdef DEBUG Log( LOG_DEBUG, "Shutting down all connections ..." ); @@ -190,8 +190,8 @@ Conn_Exit( VOID ) } else if( idx < Pool_Size ) { - if( NGIRCd_SignalRestart ) Conn_Close( idx, NULL, "Server going down (restarting)", TRUE ); - else Conn_Close( idx, NULL, "Server going down", TRUE ); + if( NGIRCd_SignalRestart ) Conn_Close( idx, NULL, "Server going down (restarting)", true ); + else Conn_Close( idx, NULL, "Server going down", true ); } else { @@ -207,12 +207,12 @@ Conn_Exit( VOID ) } /* Conn_Exit */ -GLOBAL INT -Conn_InitListeners( VOID ) +GLOBAL int +Conn_InitListeners( void ) { /* Initialize ports on which the server should accept connections */ - INT created, i; + int created, i; created = 0; for( i = 0; i < Conf_ListenPorts_Count; i++ ) @@ -224,12 +224,12 @@ Conn_InitListeners( VOID ) } /* Conn_InitListeners */ -GLOBAL VOID -Conn_ExitListeners( VOID ) +GLOBAL void +Conn_ExitListeners( void ) { /* Close down all listening sockets */ - INT i; + int i; #ifdef RENDEZVOUS Rendezvous_UnregisterListeners( ); @@ -249,16 +249,16 @@ Conn_ExitListeners( VOID ) } /* Conn_ExitListeners */ -GLOBAL BOOLEAN -Conn_NewListener( CONST UINT Port ) +GLOBAL bool +Conn_NewListener( const UINT16 Port ) { /* Create new listening socket on specified port */ struct sockaddr_in addr; struct in_addr inaddr; - INT sock; + int sock; #ifdef RENDEZVOUS - CHAR name[CLIENT_ID_LEN], *info; + char name[CLIENT_ID_LEN], *info; #endif /* Server-"Listen"-Socket initialisieren */ @@ -276,7 +276,7 @@ Conn_NewListener( CONST UINT Port ) #endif { Log( LOG_CRIT, "Can't listen on %s:%u: can't convert ip address %s!", Conf_ListenAddress, Port, Conf_ListenAddress ); - return FALSE; + return false; } } else inaddr.s_addr = htonl( INADDR_ANY ); @@ -287,17 +287,17 @@ Conn_NewListener( CONST UINT Port ) if( sock < 0 ) { Log( LOG_CRIT, "Can't create socket: %s!", strerror( errno )); - return FALSE; + return false; } - if( ! Init_Socket( sock )) return FALSE; + if( ! Init_Socket( sock )) return false; /* an Port binden */ if( bind( sock, (struct sockaddr *)&addr, (socklen_t)sizeof( addr )) != 0 ) { Log( LOG_CRIT, "Can't bind socket: %s!", strerror( errno )); close( sock ); - return FALSE; + return false; } /* in "listen mode" gehen :-) */ @@ -305,7 +305,7 @@ Conn_NewListener( CONST UINT Port ) { Log( LOG_CRIT, "Can't listen on soecket: %s!", strerror( errno )); close( sock ); - return FALSE; + return false; } /* Neuen Listener in Strukturen einfuegen */ @@ -345,12 +345,12 @@ Conn_NewListener( CONST UINT Port ) Rendezvous_Register( name, RENDEZVOUS_TYPE, Port ); #endif - return TRUE; + return true; } /* Conn_NewListener */ -GLOBAL VOID -Conn_Handler( VOID ) +GLOBAL void +Conn_Handler( void ) { /* "Hauptschleife": Aktive Verbindungen ueberwachen. Folgende Aktionen * werden dabei durchgefuehrt, bis der Server terminieren oder neu @@ -368,12 +368,12 @@ Conn_Handler( VOID ) struct timeval tv; time_t start, t; CONN_ID i, idx; - BOOLEAN timeout; + bool timeout; start = time( NULL ); while(( ! NGIRCd_SignalQuit ) && ( ! NGIRCd_SignalRestart )) { - timeout = TRUE; + timeout = true; #ifdef RENDEZVOUS Rendezvous_Handler( ); @@ -395,7 +395,7 @@ Conn_Handler( VOID ) ( My_Connections[i].delaytime < t )) { /* Kann aus dem Buffer noch ein Befehl extrahiert werden? */ - if( Handle_Buffer( i )) timeout = FALSE; + if( Handle_Buffer( i )) timeout = false; } } @@ -503,22 +503,22 @@ Conn_Handler( VOID ) #ifdef PROTOTYPES -GLOBAL BOOLEAN -Conn_WriteStr( CONN_ID Idx, CHAR *Format, ... ) +GLOBAL bool +Conn_WriteStr( CONN_ID Idx, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool Conn_WriteStr( Idx, Format, va_alist ) CONN_ID Idx; -CHAR *Format; +char *Format; va_dcl #endif { /* String in Socket schreiben. CR+LF wird von dieser Funktion * automatisch angehaengt. Im Fehlerfall wird dir Verbindung - * getrennt und FALSE geliefert. */ + * getrennt und false geliefert. */ - CHAR buffer[COMMAND_LEN]; - BOOLEAN ok; + char buffer[COMMAND_LEN]; + bool ok; va_list ap; assert( Idx > NONE ); @@ -532,8 +532,8 @@ va_dcl if( vsnprintf( buffer, COMMAND_LEN - 2, Format, ap ) >= COMMAND_LEN - 2 ) { Log( LOG_CRIT, "Text too long to send (connection %d)!", Idx ); - Conn_Close( Idx, "Text too long to send!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Text too long to send!", NULL, false ); + return false; } #ifdef SNIFFER @@ -549,11 +549,11 @@ va_dcl } /* Conn_WriteStr */ -GLOBAL BOOLEAN -Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) +GLOBAL bool +Conn_Write( CONN_ID Idx, char *Data, int Len ) { /* Daten in Socket schreiben. Bei "fatalen" Fehlern wird - * der Client disconnectiert und FALSE geliefert. */ + * der Client disconnectiert und false geliefert. */ assert( Idx > NONE ); assert( Data != NULL ); @@ -568,7 +568,7 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) #ifdef DEBUG Log( LOG_DEBUG, "Skipped write on closed socket (connection %d).", Idx ); #endif - return FALSE; + return false; } /* Pruefen, ob im Schreibpuffer genuegend Platz ist. Ziel ist es, @@ -578,14 +578,14 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) { /* Der Puffer ist dummerweise voll. Jetzt versuchen, den Puffer * zu schreiben, wenn das nicht klappt, haben wir ein Problem ... */ - if( ! Try_Write( Idx )) return FALSE; + if( ! Try_Write( Idx )) return false; /* nun neu pruefen: */ if( WRITEBUFFER_LEN - My_Connections[Idx].wdatalen - Len <= 0 ) { Log( LOG_NOTICE, "Write buffer overflow (connection %d)!", Idx ); - Conn_Close( Idx, "Write buffer overflow!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Write buffer overflow!", NULL, false ); + return false; } } @@ -593,7 +593,7 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) if( My_Connections[Idx].options & CONN_ZIP ) { /* Daten komprimieren und in Puffer kopieren */ - if( ! Zip_Buffer( Idx, Data, Len )) return FALSE; + if( ! Zip_Buffer( Idx, Data, Len )) return false; } else #endif @@ -607,22 +607,22 @@ Conn_Write( CONN_ID Idx, CHAR *Data, INT Len ) /* Adjust global write counter */ WCounter += Len; - return TRUE; + return true; } /* Conn_Write */ -GLOBAL VOID -Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient ) +GLOBAL void +Conn_Close( CONN_ID Idx, char *LogMsg, char *FwdMsg, bool InformClient ) { /* Close connection. Open pipes of asyncronous resolver * sub-processes are closed down. */ CLIENT *c; - CHAR *txt; - DOUBLE in_k, out_k; + char *txt; + double in_k, out_k; #ifdef ZLIB - DOUBLE in_z_k, out_z_k; - INT in_p, out_p; + double in_z_k, out_z_k; + int in_p, out_p; #endif assert( Idx > NONE ); @@ -659,7 +659,7 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, B /* Send statistics to client if registered as user: */ if(( c != NULL ) && ( Client_Type( c ) == CLIENT_USER )) { - Conn_WriteStr( Idx, "NOTICE %s :%sConnection statistics: client %.1f kb, server %.1f kb.", Client_ThisServer( ), NOTICE_TXTPREFIX, (DOUBLE)My_Connections[Idx].bytes_in / 1024, (DOUBLE)My_Connections[Idx].bytes_out / 1024 ); + Conn_WriteStr( Idx, "NOTICE %s :%sConnection statistics: client %.1f kb, server %.1f kb.", Client_ThisServer( ), NOTICE_TXTPREFIX, (double)My_Connections[Idx].bytes_in / 1024, (double)My_Connections[Idx].bytes_out / 1024 ); } #endif @@ -669,7 +669,7 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, B } /* Try to write out the write buffer */ - (VOID)Try_Write( Idx ); + (void)Try_Write( Idx ); /* Shut down socket */ if( close( My_Connections[Idx].sock ) != 0 ) @@ -686,18 +686,18 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, B My_Connections[Idx].sock = NONE; /* If there is still a client, unregister it now */ - if( c ) Client_Destroy( c, LogMsg, FwdMsg, TRUE ); + if( c ) Client_Destroy( c, LogMsg, FwdMsg, true ); /* Calculate statistics and log information */ - in_k = (DOUBLE)My_Connections[Idx].bytes_in / 1024; - out_k = (DOUBLE)My_Connections[Idx].bytes_out / 1024; + in_k = (double)My_Connections[Idx].bytes_in / 1024; + out_k = (double)My_Connections[Idx].bytes_out / 1024; #ifdef ZLIB if( My_Connections[Idx].options & CONN_ZIP ) { - in_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_in / 1024; - out_z_k = (DOUBLE)My_Connections[Idx].zip.bytes_out / 1024; - in_p = (INT)(( in_k * 100 ) / in_z_k ); - out_p = (INT)(( out_k * 100 ) / out_z_k ); + in_z_k = (double)My_Connections[Idx].zip.bytes_in / 1024; + out_z_k = (double)My_Connections[Idx].zip.bytes_out / 1024; + in_p = (int)(( in_k * 100 ) / in_z_k ); + out_p = (int)(( out_k * 100 ) / out_z_k ); Log( LOG_INFO, "Connection %d with %s:%d closed (in: %.1fk/%.1fk/%d%%, out: %.1fk/%.1fk/%d%%).", Idx, My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port ), in_k, in_z_k, in_p, out_k, out_z_k, out_p ); } else @@ -737,15 +737,15 @@ Conn_Close( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, B } /* Conn_Close */ -GLOBAL VOID -Conn_SyncServerStruct( VOID ) +GLOBAL void +Conn_SyncServerStruct( void ) { /* Synchronize server structures (connection IDs): * connections <-> configuration */ CLIENT *client; CONN_ID i; - INT c; + int c; for( i = 0; i < Pool_Size; i++ ) { @@ -768,13 +768,13 @@ Conn_SyncServerStruct( VOID ) } /* SyncServerStruct */ -LOCAL BOOLEAN +LOCAL bool Try_Write( CONN_ID Idx ) { /* Versuchen, Daten aus dem Schreib-Puffer in den Socket zu - * schreiben. TRUE wird geliefert, wenn entweder keine Daten + * schreiben. true wird geliefert, wenn entweder keine Daten * zum Versenden vorhanden sind oder erfolgreich bearbeitet - * werden konnten. Im Fehlerfall wird FALSE geliefert und + * werden konnten. Im Fehlerfall wird false geliefert und * die Verbindung geschlossen. */ fd_set write_socket; @@ -785,9 +785,9 @@ Try_Write( CONN_ID Idx ) /* sind ueberhaupt Daten vorhanden? */ #ifdef ZLIB - if(( ! My_Connections[Idx].wdatalen > 0 ) && ( ! My_Connections[Idx].zip.wdatalen )) return TRUE; + if(( ! My_Connections[Idx].wdatalen > 0 ) && ( ! My_Connections[Idx].zip.wdatalen )) return true; #else - if( ! My_Connections[Idx].wdatalen > 0 ) return TRUE; + if( ! My_Connections[Idx].wdatalen > 0 ) return true; #endif /* Timeout initialisieren: 0 Sekunden, also nicht blockieren */ @@ -801,18 +801,18 @@ Try_Write( CONN_ID Idx ) if( errno != EINTR ) { Log( LOG_ALERT, "Try_Write(): select() failed: %s (con=%d, sock=%d)!", strerror( errno ), Idx, My_Connections[Idx].sock ); - Conn_Close( Idx, "Server error!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Server error!", NULL, false ); + return false; } } if( FD_ISSET( My_Connections[Idx].sock, &write_socket )) return Handle_Write( Idx ); - else return TRUE; + else return true; } /* Try_Write */ -LOCAL VOID -Handle_Read( INT Sock ) +LOCAL void +Handle_Read( int Sock ) { /* Aktivitaet auf einem Socket verarbeiten: * - neue Clients annehmen, @@ -846,12 +846,12 @@ Handle_Read( INT Sock ) } /* Handle_Read */ -LOCAL BOOLEAN +LOCAL bool Handle_Write( CONN_ID Idx ) { /* Daten aus Schreibpuffer versenden bzw. Connection aufbauen */ - INT len, res, err; + int len, res, err; socklen_t sock_len; CLIENT *c; @@ -888,7 +888,7 @@ Handle_Write( CONN_ID Idx ) Conf_Server[Conf_GetServer( Idx )].lasttry = time( NULL ); Conf_UnsetServer( Idx ); - return FALSE; + return false; } Log( LOG_INFO, "Connection %d with \"%s:%d\" established. Now logging in ...", Idx, My_Connections[Idx].host, Conf_Server[Conf_GetServer( Idx )].port ); @@ -910,24 +910,24 @@ Handle_Write( CONN_ID Idx ) if( len < 0 ) { /* Operation haette Socket "nur" blockiert ... */ - if( errno == EAGAIN ) return TRUE; + if( errno == EAGAIN ) return true; /* Oops, ein Fehler! */ Log( LOG_ERR, "Write error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror( errno )); - Conn_Close( Idx, "Write error!", NULL, FALSE ); - return FALSE; + Conn_Close( Idx, "Write error!", NULL, false ); + return false; } /* Puffer anpassen */ My_Connections[Idx].wdatalen -= len; memmove( My_Connections[Idx].wbuf, My_Connections[Idx].wbuf + len, My_Connections[Idx].wdatalen ); - return TRUE; + return true; } /* Handle_Write */ -LOCAL VOID -New_Connection( INT Sock ) +LOCAL void +New_Connection( int Sock ) { /* Neue Client-Verbindung von Listen-Socket annehmen und * CLIENT-Struktur anlegen. */ @@ -936,12 +936,12 @@ New_Connection( INT Sock ) struct request_info req; #endif struct sockaddr_in new_addr; - INT new_sock, new_sock_len; + int new_sock, new_sock_len; RES_STAT *s; CONN_ID idx; CLIENT *c; POINTER *ptr; - LONG new_size, cnt; + long new_size, cnt; assert( Sock > NONE ); @@ -1037,7 +1037,7 @@ New_Connection( INT Sock ) } /* Client-Struktur initialisieren */ - c = Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWN, FALSE ); + c = Client_NewLocal( idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWN, false ); if( ! c ) { Log( LOG_ALERT, "Can't accept connection: can't create client structure!" ); @@ -1077,7 +1077,7 @@ New_Connection( INT Sock ) LOCAL CONN_ID -Socket2Index( INT Sock ) +Socket2Index( int Sock ) { /* zum Socket passende Connection suchen */ @@ -1100,13 +1100,13 @@ Socket2Index( INT Sock ) } /* Socket2Index */ -LOCAL VOID +LOCAL void Read_Request( CONN_ID Idx ) { /* Daten von Socket einlesen und entsprechend behandeln. * Tritt ein Fehler auf, so wird der Socket geschlossen. */ - INT len, bsize; + int len, bsize; #ifdef ZLIB CLIENT *c; #endif @@ -1130,7 +1130,7 @@ Read_Request( CONN_ID Idx ) { /* Der Lesepuffer ist voll */ Log( LOG_ERR, "Receive buffer overflow (connection %d): %d bytes!", Idx, My_Connections[Idx].rdatalen ); - Conn_Close( Idx, "Receive buffer overflow!", NULL, FALSE ); + Conn_Close( Idx, "Receive buffer overflow!", NULL, false ); return; } @@ -1151,7 +1151,7 @@ Read_Request( CONN_ID Idx ) { /* Socket wurde geschlossen */ Log( LOG_INFO, "%s:%d (%s) is closing the connection ...", My_Connections[Idx].host, ntohs( My_Connections[Idx].addr.sin_port), inet_ntoa( My_Connections[Idx].addr.sin_addr )); - Conn_Close( Idx, "Socket closed!", "Client closed connection", FALSE ); + Conn_Close( Idx, "Socket closed!", "Client closed connection", false ); return; } @@ -1162,7 +1162,7 @@ Read_Request( CONN_ID Idx ) /* Fehler beim Lesen */ Log( LOG_ERR, "Read error on connection %d (socket %d): %s!", Idx, My_Connections[Idx].sock, strerror( errno )); - Conn_Close( Idx, "Read error!", "Client closed connection", FALSE ); + Conn_Close( Idx, "Read error!", "Client closed connection", false ); return; } @@ -1176,24 +1176,24 @@ Read_Request( CONN_ID Idx ) } /* Read_Request */ -LOCAL BOOLEAN +LOCAL bool Handle_Buffer( CONN_ID Idx ) { /* Daten im Lese-Puffer einer Verbindung verarbeiten. - * Wurde ein Request verarbeitet, so wird TRUE geliefert, - * ansonsten FALSE (auch bei Fehlern). */ + * Wurde ein Request verarbeitet, so wird true geliefert, + * ansonsten false (auch bei Fehlern). */ #ifndef STRICT_RFC - CHAR *ptr1, *ptr2; + char *ptr1, *ptr2; #endif - CHAR *ptr; - INT len, delta; - BOOLEAN action, result; + char *ptr; + int len, delta; + bool action, result; #ifdef ZLIB - BOOLEAN old_z; + bool old_z; #endif - result = FALSE; + result = false; do { /* Check penalty */ @@ -1203,7 +1203,7 @@ Handle_Buffer( CONN_ID Idx ) /* ggf. noch unkomprimiete Daten weiter entpacken */ if( My_Connections[Idx].options & CONN_ZIP ) { - if( ! Unzip_Buffer( Idx )) return FALSE; + if( ! Unzip_Buffer( Idx )) return false; } #endif @@ -1229,7 +1229,7 @@ Handle_Buffer( CONN_ID Idx ) } #endif - action = FALSE; + action = false; if( ptr ) { /* Ende der Anfrage wurde gefunden */ @@ -1241,8 +1241,8 @@ Handle_Buffer( CONN_ID Idx ) * (incl. CR+LF!) werden; vgl. RFC 2812. Wenn soetwas * empfangen wird, wird der Client disconnectiert. */ Log( LOG_ERR, "Request too long (connection %d): %d bytes (max. %d expected)!", Idx, My_Connections[Idx].rdatalen, COMMAND_LEN - 1 ); - Conn_Close( Idx, NULL, "Request too long", TRUE ); - return FALSE; + Conn_Close( Idx, NULL, "Request too long", true ); + return false; } #ifdef ZLIB @@ -1254,8 +1254,8 @@ Handle_Buffer( CONN_ID Idx ) { /* Es wurde ein Request gelesen */ My_Connections[Idx].msg_in++; - if( ! Parse_Request( Idx, My_Connections[Idx].rbuf )) return FALSE; - else action = TRUE; + if( ! Parse_Request( Idx, My_Connections[Idx].rbuf )) return false; + else action = true; } /* Puffer anpassen */ @@ -1272,7 +1272,7 @@ Handle_Buffer( CONN_ID Idx ) { /* Hupsa! Soviel Platz haben wir aber gar nicht! */ Log( LOG_ALERT, "Can't move receive buffer: No space left in unzip buffer (need %d bytes)!", My_Connections[Idx].rdatalen ); - return FALSE; + return false; } memcpy( My_Connections[Idx].zip.rbuf, My_Connections[Idx].rbuf, My_Connections[Idx].rdatalen ); My_Connections[Idx].zip.rdatalen = My_Connections[Idx].rdatalen; @@ -1284,15 +1284,15 @@ Handle_Buffer( CONN_ID Idx ) #endif /* ZLIB */ } - if( action ) result = TRUE; + if( action ) result = true; } while( action ); return result; } /* Handle_Buffer */ -LOCAL VOID -Check_Connections( VOID ) +LOCAL void +Check_Connections( void ) { /* Pruefen, ob Verbindungen noch "alive" sind. Ist dies * nicht der Fall, zunaechst PING-PONG spielen und, wenn @@ -1318,7 +1318,7 @@ Check_Connections( VOID ) #ifdef DEBUG Log( LOG_DEBUG, "Connection %d: Ping timeout: %d seconds.", i, Conf_PongTimeout ); #endif - Conn_Close( i, NULL, "Ping timeout", TRUE ); + Conn_Close( i, NULL, "Ping timeout", true ); } } else if( My_Connections[i].lastdata < time( NULL ) - Conf_PingTimeout ) @@ -1340,21 +1340,21 @@ Check_Connections( VOID ) #ifdef DEBUG Log( LOG_DEBUG, "Connection %d timed out ...", i ); #endif - Conn_Close( i, NULL, "Timeout", FALSE ); + Conn_Close( i, NULL, "Timeout", false ); } } } } /* Check_Connections */ -LOCAL VOID -Check_Servers( VOID ) +LOCAL void +Check_Servers( void ) { /* Check if we can establish further server links */ RES_STAT *s; CONN_ID idx; - INT i, n; + int i, n; /* Serach all connections, are there results from the resolver? */ for( idx = 0; idx < Pool_Size; idx++ ) @@ -1417,14 +1417,14 @@ Check_Servers( VOID ) } /* Check_Servers */ -LOCAL VOID -New_Server( INT Server, CONN_ID Idx ) +LOCAL void +New_Server( int Server, CONN_ID Idx ) { /* Establish new server link */ struct sockaddr_in new_addr; struct in_addr inaddr; - INT res, new_sock; + int res, new_sock; CLIENT *c; assert( Server > NONE ); @@ -1486,7 +1486,7 @@ New_Server( INT Server, CONN_ID Idx ) } /* Client-Struktur initialisieren */ - c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWNSERVER, FALSE ); + c = Client_NewLocal( Idx, inet_ntoa( new_addr.sin_addr ), CLIENT_UNKNOWNSERVER, false ); if( ! c ) { /* Can't create new client structure */ @@ -1515,7 +1515,7 @@ New_Server( INT Server, CONN_ID Idx ) } /* New_Server */ -LOCAL VOID +LOCAL void Init_Conn_Struct( CONN_ID Idx ) { /* Connection-Struktur initialisieren */ @@ -1550,19 +1550,19 @@ Init_Conn_Struct( CONN_ID Idx ) } /* Init_Conn_Struct */ -LOCAL BOOLEAN -Init_Socket( INT Sock ) +LOCAL bool +Init_Socket( int Sock ) { /* Initialize socket (set options) */ - INT value; + int value; #ifdef O_NONBLOCK /* unknown on A/UX */ if( fcntl( Sock, F_SETFL, O_NONBLOCK ) != 0 ) { Log( LOG_CRIT, "Can't enable non-blocking mode for socket: %s!", strerror( errno )); close( Sock ); - return FALSE; + return false; } #endif @@ -1587,21 +1587,21 @@ Init_Socket( INT Sock ) } #endif - return TRUE; + return true; } /* Init_Socket */ -LOCAL VOID -Read_Resolver_Result( INT r_fd ) +LOCAL void +Read_Resolver_Result( int r_fd ) { /* Read result of resolver sub-process from pipe and update the * apropriate connection/client structure(s): hostname and/or * IDENT user name.*/ CLIENT *c; - INT len, i, n; + int len, i, n; RES_STAT *s; - CHAR *ptr; + char *ptr; /* Search associated connection ... */ for( i = 0; i < Pool_Size; i++ ) @@ -1689,7 +1689,7 @@ try_resolve: if( s->buffer[0] ) { Log( LOG_INFO, "IDENT lookup for connection %ld: \"%s\".", i, s->buffer ); - Client_SetUser( c, s->buffer, TRUE ); + Client_SetUser( c, s->buffer, true ); } else Log( LOG_INFO, "IDENT lookup for connection %ld: no result.", i ); #endif @@ -1724,8 +1724,8 @@ try_resolve: } /* Read_Resolver_Result */ -LOCAL VOID -Simple_Message( INT Sock, CHAR *Msg ) +LOCAL void +Simple_Message( int Sock, char *Msg ) { /* Write "simple" message to socket, without using compression * or even the connection write buffers. Used e.g. for error @@ -1734,15 +1734,15 @@ Simple_Message( INT Sock, CHAR *Msg ) assert( Sock > NONE ); assert( Msg != NULL ); - (VOID)send( Sock, Msg, strlen( Msg ), 0 ); - (VOID)send( Sock, "\r\n", 2, 0 ); + (void)send( Sock, Msg, strlen( Msg ), 0 ); + (void)send( Sock, "\r\n", 2, 0 ); } /* Simple_Error */ -LOCAL INT +LOCAL int Count_Connections( struct sockaddr_in addr_in ) { - INT i, cnt; + int i, cnt; cnt = 0; for( i = 0; i < Pool_Size; i++ ) blob - 91be9d622c5cc5c3953057e6cb315b15b9612832 blob + 5bcfb4d553a693e64edd0fe78e718f2d14171fc2 --- src/ngircd/conn.h +++ src/ngircd/conn.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: conn.h,v 1.32 2003/12/26 15:55:07 alex Exp $ + * $Id: conn.h,v 1.33 2005/03/19 18:43:48 fw Exp $ * * Connection management (header) */ @@ -18,7 +18,7 @@ #define __conn_h__ -#include /* fro time_t, see below */ +#include /* for time_t, see below */ #define CONN_ISCLOSING 1 /* Conn_Close() already called */ @@ -28,7 +28,7 @@ #endif -typedef INT CONN_ID; +typedef int CONN_ID; #ifdef CONN_MODULE @@ -42,33 +42,33 @@ typedef struct _ZipData { z_stream in; /* "Handle" for input stream */ z_stream out; /* "Handle" for output stream */ - CHAR rbuf[READBUFFER_LEN]; /* Read buffer */ - INT rdatalen; /* Length of data in read buffer (compressed) */ - CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */ - INT wdatalen; /* Length of data in write buffer (uncompressed) */ - LONG bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */ + char rbuf[READBUFFER_LEN]; /* Read buffer */ + int rdatalen; /* Length of data in read buffer (compressed) */ + char wbuf[WRITEBUFFER_LEN]; /* Write buffer */ + int wdatalen; /* Length of data in write buffer (uncompressed) */ + long bytes_in, bytes_out; /* Counter for statistics (uncompressed!) */ } ZIPDATA; #endif /* ZLIB */ typedef struct _Connection { - INT sock; /* Socket handle */ + int sock; /* Socket handle */ struct sockaddr_in addr; /* Client address */ RES_STAT *res_stat; /* Status of resolver process, if any */ - CHAR host[HOST_LEN]; /* Hostname */ - CHAR rbuf[READBUFFER_LEN]; /* Read buffer */ - INT rdatalen; /* Length of data in read buffer */ - CHAR wbuf[WRITEBUFFER_LEN]; /* Write buffer */ - INT wdatalen; /* Length of data in write buffer */ + char host[HOST_LEN]; /* Hostname */ + char rbuf[READBUFFER_LEN]; /* Read buffer */ + int rdatalen; /* Length of data in read buffer */ + char wbuf[WRITEBUFFER_LEN]; /* Write buffer */ + int wdatalen; /* Length of data in write buffer */ time_t starttime; /* Start time of link */ time_t lastdata; /* Last activity */ time_t lastping; /* Last PING */ time_t lastprivmsg; /* Last PRIVMSG */ time_t delaytime; /* Ignore link ("penalty") */ - LONG bytes_in, bytes_out; /* Received and sent bytes */ - LONG msg_in, msg_out; /* Received and sent IRC messages */ - INT flag; /* Flag (see "irc-write" module) */ - INT options; /* Link options */ + long bytes_in, bytes_out; /* Received and sent bytes */ + long msg_in, msg_out; /* Received and sent IRC messages */ + int flag; /* Flag (see "irc-write" module) */ + int options; /* Link options */ #ifdef ZLIB ZIPDATA zip; /* Compression information */ #endif /* ZLIB */ @@ -76,29 +76,29 @@ typedef struct _Connection GLOBAL CONNECTION *My_Connections; GLOBAL CONN_ID Pool_Size; -GLOBAL LONG WCounter; +GLOBAL long WCounter; #endif /* CONN_MODULE */ -GLOBAL VOID Conn_Init PARAMS((VOID )); -GLOBAL VOID Conn_Exit PARAMS(( VOID )); +GLOBAL void Conn_Init PARAMS((void )); +GLOBAL void Conn_Exit PARAMS(( void )); -GLOBAL INT Conn_InitListeners PARAMS(( VOID )); -GLOBAL VOID Conn_ExitListeners PARAMS(( VOID )); +GLOBAL int Conn_InitListeners PARAMS(( void )); +GLOBAL void Conn_ExitListeners PARAMS(( void )); -GLOBAL BOOLEAN Conn_NewListener PARAMS(( CONST UINT Port )); +GLOBAL bool Conn_NewListener PARAMS(( const UINT16 Port )); -GLOBAL VOID Conn_Handler PARAMS(( VOID )); +GLOBAL void Conn_Handler PARAMS(( void )); -GLOBAL BOOLEAN Conn_Write PARAMS(( CONN_ID Idx, CHAR *Data, INT Len )); -GLOBAL BOOLEAN Conn_WriteStr PARAMS(( CONN_ID Idx, CHAR *Format, ... )); +GLOBAL bool Conn_Write PARAMS(( CONN_ID Idx, char *Data, int Len )); +GLOBAL bool Conn_WriteStr PARAMS(( CONN_ID Idx, char *Format, ... )); -GLOBAL VOID Conn_Close PARAMS(( CONN_ID Idx, CHAR *LogMsg, CHAR *FwdMsg, BOOLEAN InformClient )); +GLOBAL void Conn_Close PARAMS(( CONN_ID Idx, char *LogMsg, char *FwdMsg, bool InformClient )); -GLOBAL VOID Conn_SyncServerStruct PARAMS(( VOID )); +GLOBAL void Conn_SyncServerStruct PARAMS(( void )); -GLOBAL INT Conn_MaxFD; +GLOBAL int Conn_MaxFD; #endif blob - 7d6ff21de25b43bcb80ab762618cb7220508770e blob + a3c247899e95d5e9ab1522c8266986c80628844a --- src/ngircd/defines.h +++ src/ngircd/defines.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: defines.h,v 1.50 2005/03/02 16:35:11 alex Exp $ + * $Id: defines.h,v 1.51 2005/03/19 18:43:48 fw Exp $ * * Global defines of ngIRCd. */ @@ -76,8 +76,8 @@ #define USERMODES "aios" /* supported user modes */ #define CHANMODES "biklImnoPstv" /* supported channel modes */ -#define CONNECTED TRUE /* internal status codes */ -#define DISCONNECTED FALSE +#define CONNECTED true /* internal status codes */ +#define DISCONNECTED false #define DEFAULT_AWAY_MSG "Away" /* away message for users connected to linked servers */ blob - 2f46d280e4303f05e91ee49f457ad03baebde1fd blob + 351c547a6e023be39352f4d420c85dacb82ab0d3 --- src/ngircd/hash.c +++ src/ngircd/hash.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: hash.c,v 1.10 2005/03/19 14:50:59 fw Exp $"; +static char UNUSED id[] = "$Id: hash.c,v 1.11 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -31,11 +31,11 @@ LOCAL UINT32 jenkins_hash PARAMS(( register UINT8 *k, GLOBAL UINT32 -Hash( CHAR *String ) +Hash( char *String ) { /* Hash-Wert ueber String berechnen */ - CHAR buffer[LINE_LEN]; + char buffer[LINE_LEN]; strlcpy( buffer, String, sizeof( buffer )); return jenkins_hash( (UINT8 *)ngt_LowerStr( buffer ), strlen( buffer ), 42 ); @@ -99,7 +99,7 @@ jenkins_hash( register UINT8 *k, register UINT32 lengt /* handle the last 11 bytes */ c += length; - switch( (INT)len ) /* all the case statements fall through */ + switch( (int)len ) /* all the case statements fall through */ { case 11: c+=((UINT32)k[10]<<24); case 10: c+=((UINT32)k[9]<<16); blob - aa5da369d6ec229ad06a526d51b81b36b2118243 blob + ea6247be90a5f2b76e43f9a8138372d37389e650 --- src/ngircd/hash.h +++ src/ngircd/hash.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: hash.h,v 1.4 2002/12/12 12:23:43 alex Exp $ + * $Id: hash.h,v 1.5 2005/03/19 18:43:48 fw Exp $ * * Hash calculation (header) */ @@ -18,7 +18,7 @@ #define __hash_h__ -GLOBAL UINT32 Hash PARAMS((CHAR *String )); +GLOBAL UINT32 Hash PARAMS((char *String )); #endif blob - a37fca96adabd7243b6302f7b6327d6aa6f428f1 blob + 90b0c0974514a169dc1833a349f6f2689bccfac3 --- src/ngircd/irc-channel.c +++ src/ngircd/irc-channel.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-channel.c,v 1.28 2005/03/02 16:35:11 alex Exp $"; +static char UNUSED id[] = "$Id: irc-channel.c,v 1.29 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -40,11 +40,11 @@ static char UNUSED id[] = "$Id: irc-channel.c,v 1.28 2 #include "irc-channel.h" -GLOBAL BOOLEAN +GLOBAL bool IRC_JOIN( CLIENT *Client, REQUEST *Req ) { - CHAR *channame, *key, *flags, *topic, modes[8]; - BOOLEAN is_new_chan, is_invited, is_banned; + char *channame, *key, *flags, *topic, modes[8]; + bool is_new_chan, is_invited, is_banned; CLIENT *target; CHANNEL *chan; @@ -71,8 +71,8 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) chan = NULL; flags = NULL; /* wird der Channel neu angelegt? */ - if( Channel_Search( channame )) is_new_chan = FALSE; - else is_new_chan = TRUE; + if( Channel_Search( channame )) is_new_chan = false; + else is_new_chan = true; /* Hat ein Server Channel-User-Modes uebergeben? */ if( Client_Type( Client ) == CLIENT_SERVER ) @@ -115,7 +115,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) is_invited = Lists_CheckInvited( target, chan ); /* Testen, ob Client gebanned ist */ - if(( is_banned == TRUE ) && ( is_invited == FALSE )) + if(( is_banned == true) && ( is_invited == false )) { /* Client ist gebanned (und nicht invited): */ IRC_WriteStrClient( Client, ERR_BANNEDFROMCHAN_MSG, Client_ID( Client ), channame ); @@ -126,7 +126,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) } /* Ist der Channel "invite-only"? */ - if(( strchr( Channel_Modes( chan ), 'i' )) && ( is_invited == FALSE )) + if(( strchr( Channel_Modes( chan ), 'i' )) && ( is_invited == false )) { /* Channel ist "invite-only" und Client wurde nicht invited: */ IRC_WriteStrClient( Client, ERR_INVITEONLYCHAN_MSG, Client_ID( Client ), channame ); @@ -167,7 +167,7 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) * commands) in this list become deleted when a user * joins a channel this way. */ chan = Channel_Search( channame ); - if( chan != NULL ) (VOID)Lists_CheckInvited( target, chan ); + if( chan != NULL ) (void)Lists_CheckInvited( target, chan ); } /* Channel joinen (und ggf. anlegen) */ @@ -199,11 +199,11 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) IRC_WriteStrServersPrefix( Client, target, "JOIN :%s%s", channame, modes ); /* im Channel bekannt machen */ - IRC_WriteStrChannelPrefix( Client, chan, target, FALSE, "JOIN :%s", channame ); + IRC_WriteStrChannelPrefix( Client, chan, target, false, "JOIN :%s", channame ); if( modes[1] ) { /* Modes im Channel bekannt machen */ - IRC_WriteStrChannelPrefix( Client, chan, target, FALSE, "MODE %s +%s %s", channame, &modes[1], Client_ID( target )); + IRC_WriteStrChannelPrefix( Client, chan, target, false, "MODE %s +%s %s", channame, &modes[1], Client_ID( target )); } if( Client_Type( Client ) == CLIENT_USER ) @@ -227,11 +227,11 @@ IRC_JOIN( CLIENT *Client, REQUEST *Req ) } /* IRC_JOIN */ -GLOBAL BOOLEAN +GLOBAL bool IRC_PART( CLIENT *Client, REQUEST *Req ) { CLIENT *target; - CHAR *chan; + char *chan; assert( Client != NULL ); assert( Req != NULL ); @@ -262,12 +262,12 @@ IRC_PART( CLIENT *Client, REQUEST *Req ) } /* IRC_PART */ -GLOBAL BOOLEAN +GLOBAL bool IRC_TOPIC( CLIENT *Client, REQUEST *Req ) { CHANNEL *chan; CLIENT *from; - CHAR *topic; + char *topic; assert( Client != NULL ); assert( Req != NULL ); @@ -306,17 +306,17 @@ IRC_TOPIC( CLIENT *Client, REQUEST *Req ) /* im Channel bekannt machen und an Server weiterleiten */ IRC_WriteStrServersPrefix( Client, from, "TOPIC %s :%s", Req->argv[0], Req->argv[1] ); - IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Req->argv[1] ); + IRC_WriteStrChannelPrefix( Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Req->argv[1] ); if( Client_Type( Client ) == CLIENT_USER ) return IRC_WriteStrClientPrefix( Client, Client, "TOPIC %s :%s", Req->argv[0], Req->argv[1] ); else return CONNECTED; } /* IRC_TOPIC */ -GLOBAL BOOLEAN +GLOBAL bool IRC_LIST( CLIENT *Client, REQUEST *Req ) { - CHAR *pattern; + char *pattern; CHANNEL *chan; CLIENT *from, *target; @@ -375,13 +375,13 @@ IRC_LIST( CLIENT *Client, REQUEST *Req ) } /* IRC_LIST */ -GLOBAL BOOLEAN +GLOBAL bool IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) { - CHAR modes_add[COMMAND_LEN], l[16], *ptr; + char modes_add[COMMAND_LEN], l[16], *ptr; CLIENT *from; CHANNEL *chan; - INT arg_topic; + int arg_topic; assert( Client != NULL ); assert( Req != NULL ); @@ -441,7 +441,7 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) } /* Inform members of this channel */ - IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "MODE %s +%s%s", Req->argv[0], Channel_Modes( chan ), modes_add ); + IRC_WriteStrChannelPrefix( Client, chan, from, false, "MODE %s +%s%s", Req->argv[0], Channel_Modes( chan ), modes_add ); } } else Log( LOG_WARNING, "CHANINFO: invalid MODE format ignored!" ); @@ -454,7 +454,7 @@ IRC_CHANINFO( CLIENT *Client, REQUEST *Req ) { /* OK, there is no topic jet */ Channel_SetTopic( chan, Req->argv[arg_topic] ); - IRC_WriteStrChannelPrefix( Client, chan, from, FALSE, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan )); + IRC_WriteStrChannelPrefix( Client, chan, from, false, "TOPIC %s :%s", Req->argv[0], Channel_Topic( chan )); } } blob - 5a7ffd5cd58fdd78eba1b4e937dc42796cdc3ffb blob + d8bddbff04bc186431825253351aba8309ec53e9 --- src/ngircd/irc-channel.h +++ src/ngircd/irc-channel.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-channel.h,v 1.6 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-channel.h,v 1.7 2005/03/19 18:43:48 fw Exp $ * * IRC channel commands (header) */ @@ -18,13 +18,13 @@ #define __irc_channel_h__ -GLOBAL BOOLEAN IRC_JOIN PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_PART PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_TOPIC PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_JOIN PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_PART PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_TOPIC PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_LIST PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_LIST PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_CHANINFO PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_CHANINFO PARAMS((CLIENT *Client, REQUEST *Req )); #endif blob - 3811ea73d406c7b429eaee389b575bdc78a0a726 blob + cf283b51d90e8a50280dc547099b6873d37884c9 --- src/ngircd/irc-info.c +++ src/ngircd/irc-info.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-info.c,v 1.27 2005/03/02 16:35:11 alex Exp $"; +static char UNUSED id[] = "$Id: irc-info.c,v 1.28 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -42,7 +42,7 @@ static char UNUSED id[] = "$Id: irc-info.c,v 1.27 2005 #include "irc-info.h" -GLOBAL BOOLEAN +GLOBAL bool IRC_ADMIN(CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; @@ -83,13 +83,13 @@ IRC_ADMIN(CLIENT *Client, REQUEST *Req ) } /* IRC_ADMIN */ -GLOBAL BOOLEAN +GLOBAL bool IRC_ISON( CLIENT *Client, REQUEST *Req ) { - CHAR rpl[COMMAND_LEN]; + char rpl[COMMAND_LEN]; CLIENT *c; - CHAR *ptr; - INT i; + char *ptr; + int i; assert( Client != NULL ); assert( Req != NULL ); @@ -120,11 +120,11 @@ IRC_ISON( CLIENT *Client, REQUEST *Req ) } /* IRC_ISON */ -GLOBAL BOOLEAN +GLOBAL bool IRC_LINKS( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from, *c; - CHAR *mask; + char *mask; assert( Client != NULL ); assert( Req != NULL ); @@ -169,7 +169,7 @@ IRC_LINKS( CLIENT *Client, REQUEST *Req ) } /* IRC_LINKS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_LUSERS( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from; @@ -205,7 +205,7 @@ IRC_LUSERS( CLIENT *Client, REQUEST *Req ) } /* IRC_LUSERS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_MOTD( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target; @@ -239,10 +239,10 @@ IRC_MOTD( CLIENT *Client, REQUEST *Req ) } /* IRC_MOTD */ -GLOBAL BOOLEAN +GLOBAL bool IRC_NAMES( CLIENT *Client, REQUEST *Req ) { - CHAR rpl[COMMAND_LEN], *ptr; + char rpl[COMMAND_LEN], *ptr; CLIENT *target, *from, *c; CHANNEL *chan; @@ -334,12 +334,12 @@ IRC_NAMES( CLIENT *Client, REQUEST *Req ) } /* IRC_NAMES */ -GLOBAL BOOLEAN +GLOBAL bool IRC_STATS( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *cl; CONN_ID con; - CHAR query; + char query; COMMAND *cmd; assert( Client != NULL ); @@ -383,12 +383,12 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) #ifdef ZLIB if( Conn_Options( con ) & CONN_ZIP ) { - if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Zip_SendBytes( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Zip_RecvBytes( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; + if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFOZIP_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Zip_SendBytes( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Zip_RecvBytes( con ), Conn_RecvBytes( con ), (long)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; } else #endif { - if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFO_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytes( con ), (LONG)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; + if( ! IRC_WriteStrClient( from, RPL_STATSLINKINFO_MSG, Client_ID( from ), Client_Mask( cl ), Conn_SendQ( con ), Conn_SendMsg( con ), Conn_SendBytes( con ), Conn_RecvMsg( con ), Conn_RecvBytes( con ), (long)( time( NULL ) - Conn_StartTime( con )))) return DISCONNECTED; } } con = Conn_Next( con ); @@ -413,11 +413,11 @@ IRC_STATS( CLIENT *Client, REQUEST *Req ) } /* IRC_STATS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_TIME( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target; - CHAR t_str[64]; + char t_str[64]; time_t t; assert( Client != NULL ); @@ -445,17 +445,17 @@ IRC_TIME( CLIENT *Client, REQUEST *Req ) } t = time( NULL ); - (VOID)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %Z", localtime( &t )); + (void)strftime( t_str, 60, "%A %B %d %Y -- %H:%M %Z", localtime( &t )); return IRC_WriteStrClient( from, RPL_TIME_MSG, Client_ID( from ), Client_ID( Client_ThisServer( )), t_str ); } /* IRC_TIME */ -GLOBAL BOOLEAN +GLOBAL bool IRC_USERHOST( CLIENT *Client, REQUEST *Req ) { - CHAR rpl[COMMAND_LEN]; + char rpl[COMMAND_LEN]; CLIENT *c; - INT max, i; + int max, i; assert( Client != NULL ); assert( Req != NULL ); @@ -490,12 +490,12 @@ IRC_USERHOST( CLIENT *Client, REQUEST *Req ) } /* IRC_USERHOST */ -GLOBAL BOOLEAN +GLOBAL bool IRC_VERSION( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *prefix; #ifdef CVSDATE - CHAR ver[12], vertxt[30]; + char ver[12], vertxt[30]; #endif assert( Client != NULL ); @@ -537,11 +537,11 @@ IRC_VERSION( CLIENT *Client, REQUEST *Req ) } /* IRC_VERSION */ -GLOBAL BOOLEAN +GLOBAL bool IRC_WHO( CLIENT *Client, REQUEST *Req ) { - BOOLEAN ok, only_ops; - CHAR flags[8], *ptr; + bool ok, only_ops; + char flags[8], *ptr; CL2CHAN *cl2chan; CHANNEL *chan, *cn; CLIENT *c; @@ -552,13 +552,13 @@ IRC_WHO( CLIENT *Client, REQUEST *Req ) /* Falsche Anzahl Parameter? */ if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - only_ops = FALSE; + only_ops = false; chan = NULL; if( Req->argc == 2 ) { /* Nur OPs anzeigen? */ - if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = TRUE; + if( strcmp( Req->argv[1], "o" ) == 0 ) only_ops = true; #ifdef STRICT_RFC else return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); #endif @@ -581,12 +581,12 @@ IRC_WHO( CLIENT *Client, REQUEST *Req ) { if(( Client_Type( c ) == CLIENT_USER ) && ( ! strchr( Client_Modes( c ), 'i' ))) { - ok = FALSE; - if( Req->argc == 0 ) ok = TRUE; + ok = false; + if( Req->argc == 0 ) ok = true; else { - if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = TRUE; - else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = TRUE; + if( strcasecmp( Req->argv[0], Client_ID( c )) == 0 ) ok = true; + else if( strcmp( Req->argv[0], "0" ) == 0 ) ok = true; } if( ok && (( ! only_ops ) || ( strchr( Client_Modes( c ), 'o' )))) @@ -624,11 +624,11 @@ IRC_WHO( CLIENT *Client, REQUEST *Req ) } /* IRC_WHO */ -GLOBAL BOOLEAN +GLOBAL bool IRC_WHOIS( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *c; - CHAR str[LINE_LEN + 1]; + char str[LINE_LEN + 1]; CL2CHAN *cl2chan; CHANNEL *chan; @@ -722,7 +722,7 @@ IRC_WHOIS( CLIENT *Client, REQUEST *Req ) } /* IRC_WHOIS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_WHOWAS( CLIENT *Client, REQUEST *Req ) { assert( Client != NULL ); @@ -737,10 +737,10 @@ IRC_WHOWAS( CLIENT *Client, REQUEST *Req ) } /* IRC_WHOWAS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_Send_LUSERS( CLIENT *Client ) { - LONG cnt; + long cnt; assert( Client != NULL ); @@ -778,11 +778,11 @@ IRC_Send_LUSERS( CLIENT *Client ) } /* IRC_Send_LUSERS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_Show_MOTD( CLIENT *Client ) { - BOOLEAN ok; - CHAR line[127]; + bool ok; + char line[127]; FILE *fd; assert( Client != NULL ); @@ -802,7 +802,7 @@ IRC_Show_MOTD( CLIENT *Client ) } if( ! IRC_WriteStrClient( Client, RPL_MOTDSTART_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )))) return DISCONNECTED; - while( TRUE ) + while( true ) { if( ! fgets( line, sizeof( line ), fd )) break; @@ -811,7 +811,7 @@ IRC_Show_MOTD( CLIENT *Client ) if( ! IRC_WriteStrClient( Client, RPL_MOTD_MSG, Client_ID( Client ), line )) { fclose( fd ); - return FALSE; + return false; } } ok = IRC_WriteStrClient( Client, RPL_ENDOFMOTD_MSG, Client_ID( Client ) ); @@ -822,19 +822,19 @@ IRC_Show_MOTD( CLIENT *Client ) } /* IRC_Show_MOTD */ -GLOBAL BOOLEAN +GLOBAL bool IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan ) { - BOOLEAN is_visible, is_member; - CHAR str[LINE_LEN + 1]; + bool is_visible, is_member; + char str[LINE_LEN + 1]; CL2CHAN *cl2chan; CLIENT *cl; assert( Client != NULL ); assert( Chan != NULL ); - if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE; - else is_member = FALSE; + if( Channel_IsMemberOf( Chan, Client )) is_member = true; + else is_member = false; /* Secret channel? */ if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED; @@ -846,8 +846,8 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan ) { cl = Channel_GetClient( cl2chan ); - if( strchr( Client_Modes( cl ), 'i' )) is_visible = FALSE; - else is_visible = TRUE; + if( strchr( Client_Modes( cl ), 'i' )) is_visible = false; + else is_visible = true; if( is_member || is_visible ) { @@ -878,19 +878,19 @@ IRC_Send_NAMES( CLIENT *Client, CHANNEL *Chan ) } /* IRC_Send_NAMES */ -GLOBAL BOOLEAN -IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps ) +GLOBAL bool +IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, bool OnlyOps ) { - BOOLEAN is_visible, is_member; + bool is_visible, is_member; CL2CHAN *cl2chan; - CHAR flags[8]; + char flags[8]; CLIENT *c; assert( Client != NULL ); assert( Chan != NULL ); - if( Channel_IsMemberOf( Chan, Client )) is_member = TRUE; - else is_member = FALSE; + if( Channel_IsMemberOf( Chan, Client )) is_member = true; + else is_member = false; /* Secret channel? */ if( ! is_member && strchr( Channel_Modes( Chan ), 's' )) return CONNECTED; @@ -901,8 +901,8 @@ IRC_Send_WHO( CLIENT *Client, CHANNEL *Chan, BOOLEAN O { c = Channel_GetClient( cl2chan ); - if( strchr( Client_Modes( c ), 'i' )) is_visible = FALSE; - else is_visible = TRUE; + if( strchr( Client_Modes( c ), 'i' )) is_visible = false; + else is_visible = true; if( is_member || is_visible ) { blob - 82d55f9e900b0946de73d5d7af8fe1318ee7cb3a blob + 24181e375e7c0396860ff68ff3ef8bb4866deb3d --- src/ngircd/irc-info.h +++ src/ngircd/irc-info.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-info.h,v 1.2 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-info.h,v 1.3 2005/03/19 18:43:48 fw Exp $ * * IRC info commands (header) */ @@ -18,24 +18,24 @@ #define __irc_info_h__ -GLOBAL BOOLEAN IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_ADMIN PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_ISON PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_LINKS PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_LUSERS PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_MOTD PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_NAMES PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_STATS PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_TIME PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_USERHOST PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_VERSION PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_WHO PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_WHOIS PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_WHOWAS PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_Send_LUSERS PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan )); -GLOBAL BOOLEAN IRC_Show_MOTD PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN IRC_Send_WHO PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN OnlyOps )); +GLOBAL bool IRC_Send_LUSERS PARAMS(( CLIENT *Client )); +GLOBAL bool IRC_Send_NAMES PARAMS(( CLIENT *Client, CHANNEL *Chan )); +GLOBAL bool IRC_Show_MOTD PARAMS(( CLIENT *Client )); +GLOBAL bool IRC_Send_WHO PARAMS(( CLIENT *Client, CHANNEL *Chan, bool OnlyOps )); #endif blob - 149cbfe94ccda4b431c7dc66502ed8e2a2fa5c93 blob + 3a7c127d4afc7f71a38077c9b362e8e39bc00b5e --- src/ngircd/irc-login.c +++ src/ngircd/irc-login.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-login.c,v 1.40 2004/03/11 22:16:31 alex Exp $"; +static char UNUSED id[] = "$Id: irc-login.c,v 1.41 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -41,11 +41,11 @@ static char UNUSED id[] = "$Id: irc-login.c,v 1.40 200 #include "irc-login.h" -LOCAL BOOLEAN Hello_User PARAMS(( CLIENT *Client )); -LOCAL VOID Kill_Nick PARAMS(( CHAR *Nick, CHAR *Reason )); +LOCAL bool Hello_User PARAMS(( CLIENT *Client )); +LOCAL void Kill_Nick PARAMS(( char *Nick, char *Reason )); -GLOBAL BOOLEAN +GLOBAL bool IRC_PASS( CLIENT *Client, REQUEST *Req ) { assert( Client != NULL ); @@ -67,8 +67,8 @@ IRC_PASS( CLIENT *Client, REQUEST *Req ) } else if((( Client_Type( Client ) == CLIENT_UNKNOWN ) || ( Client_Type( Client ) == CLIENT_UNKNOWNSERVER )) && (( Req->argc == 3 ) || ( Req->argc == 4 ))) { - CHAR c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags; - INT protohigh, protolow; + char c2, c4, *type, *impl, *serverver, *flags, *ptr, *ircflags; + int protohigh, protolow; /* noch nicht registrierte Server-Verbindung */ Log( LOG_DEBUG, "Connection %d: got PASS command (new server link) ...", Client_Conn( Client )); @@ -143,11 +143,11 @@ IRC_PASS( CLIENT *Client, REQUEST *Req ) } /* IRC_PASS */ -GLOBAL BOOLEAN +GLOBAL bool IRC_NICK( CLIENT *Client, REQUEST *Req ) { CLIENT *intr_c, *target, *c; - CHAR *modes; + char *modes; assert( Client != NULL ); assert( Req != NULL ); @@ -221,7 +221,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req ) /* alle betroffenen User und Server ueber Nick-Aenderung informieren */ if( Client_Type( Client ) == CLIENT_USER ) IRC_WriteStrClientPrefix( Client, Client, "NICK :%s", Req->argv[0] ); IRC_WriteStrServersPrefix( Client, target, "NICK :%s", Req->argv[0] ); - IRC_WriteStrRelatedPrefix( target, target, FALSE, "NICK :%s", Req->argv[0] ); + IRC_WriteStrRelatedPrefix( target, target, false, "NICK :%s", Req->argv[0] ); /* neuen Client-Nick speichern */ Client_SetID( target, Req->argv[0] ); @@ -259,7 +259,7 @@ IRC_NICK( CLIENT *Client, REQUEST *Req ) } /* Neue Client-Struktur anlegen */ - c = Client_NewRemoteUser( intr_c, Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], atoi( Req->argv[4] ), Req->argv[5] + 1, Req->argv[6], TRUE ); + c = Client_NewRemoteUser( intr_c, Req->argv[0], atoi( Req->argv[1] ), Req->argv[2], Req->argv[3], atoi( Req->argv[4] ), Req->argv[5] + 1, Req->argv[6], true); if( ! c ) { /* Eine neue Client-Struktur konnte nicht angelegt werden. @@ -283,11 +283,11 @@ IRC_NICK( CLIENT *Client, REQUEST *Req ) } /* IRC_NICK */ -GLOBAL BOOLEAN +GLOBAL bool IRC_USER( CLIENT *Client, REQUEST *Req ) { #ifdef IDENTAUTH - CHAR *ptr; + char *ptr; #endif assert( Client != NULL ); @@ -305,9 +305,9 @@ IRC_USER( CLIENT *Client, REQUEST *Req ) /* User name */ #ifdef IDENTAUTH ptr = Client_User( Client ); - if( ! ptr || ! *ptr || *ptr == '~' ) Client_SetUser( Client, Req->argv[0], FALSE ); + if( ! ptr || ! *ptr || *ptr == '~' ) Client_SetUser( Client, Req->argv[0], false ); #else - Client_SetUser( Client, Req->argv[0], FALSE ); + Client_SetUser( Client, Req->argv[0], false ); #endif /* "Real name" or user info text: Don't set it to the empty string, the original ircd @@ -328,7 +328,7 @@ IRC_USER( CLIENT *Client, REQUEST *Req ) } /* IRC_USER */ -GLOBAL BOOLEAN +GLOBAL bool IRC_QUIT( CLIENT *Client, REQUEST *Req ) { CLIENT *target; @@ -351,8 +351,8 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req ) return CONNECTED; } - if( Req->argc == 0 ) Client_Destroy( target, "Got QUIT command.", NULL, TRUE ); - else Client_Destroy( target, "Got QUIT command.", Req->argv[0], TRUE ); + if( Req->argc == 0 ) Client_Destroy( target, "Got QUIT command.", NULL, true); + else Client_Destroy( target, "Got QUIT command.", Req->argv[0], true); return CONNECTED; } @@ -363,15 +363,15 @@ IRC_QUIT( CLIENT *Client, REQUEST *Req ) /* Falsche Anzahl Parameter? */ if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); - if( Req->argc == 0 ) Conn_Close( Client_Conn( Client ), "Got QUIT command.", NULL, TRUE ); - else Conn_Close( Client_Conn( Client ), "Got QUIT command.", Req->argv[0], TRUE ); + if( Req->argc == 0 ) Conn_Close( Client_Conn( Client ), "Got QUIT command.", NULL, true); + else Conn_Close( Client_Conn( Client ), "Got QUIT command.", Req->argv[0], true); return DISCONNECTED; } } /* IRC_QUIT */ -GLOBAL BOOLEAN +GLOBAL bool IRC_PING( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from; @@ -405,7 +405,7 @@ IRC_PING( CLIENT *Client, REQUEST *Req ) } /* IRC_PING */ -GLOBAL BOOLEAN +GLOBAL bool IRC_PONG( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from; @@ -442,11 +442,11 @@ IRC_PONG( CLIENT *Client, REQUEST *Req ) } /* IRC_PONG */ -LOCAL BOOLEAN +LOCAL bool Hello_User( CLIENT *Client ) { #ifdef CVSDATE - CHAR ver[12], vertxt[30]; + char ver[12], vertxt[30]; #endif assert( Client != NULL ); @@ -456,7 +456,7 @@ Hello_User( CLIENT *Client ) { /* Bad password! */ Log( LOG_ERR, "User \"%s\" rejected (connection %d): Bad password!", Client_Mask( Client ), Client_Conn( Client )); - Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE ); + Conn_Close( Client_Conn( Client ), NULL, "Bad password", true); return DISCONNECTED; } @@ -466,7 +466,7 @@ Hello_User( CLIENT *Client ) IRC_WriteStrServers( NULL, "NICK %s 1 %s %s 1 +%s :%s", Client_ID( Client ), Client_User( Client ), Client_Hostname( Client ), Client_Modes( Client ), Client_Info( Client )); /* Welcome :-) */ - if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_WELCOME_MSG, Client_ID( Client ), Client_Mask( Client ))) return false; /* Version and system type */ #ifdef CVSDATE @@ -474,16 +474,16 @@ Hello_User( CLIENT *Client ) strncpy( ver + 4, ver + 5, 2 ); strncpy( ver + 6, ver + 8, 3 ); snprintf( vertxt, sizeof( vertxt ), "%s(%s)", PACKAGE_VERSION, ver ); - if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false; #else - if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_YOURHOST_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, TARGET_CPU, TARGET_VENDOR, TARGET_OS )) return false; #endif - if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_CREATED_MSG, Client_ID( Client ), NGIRCd_StartStr )) return false; #ifdef CVSDATE - if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, USERMODES, CHANMODES )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), vertxt, USERMODES, CHANMODES )) return false; #else - if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return FALSE; + if( ! IRC_WriteStrClient( Client, RPL_MYINFO_MSG, Client_ID( Client ), Client_ID( Client_ThisServer( )), PACKAGE_VERSION, USERMODES, CHANMODES )) return false; #endif /* Features */ @@ -501,15 +501,15 @@ Hello_User( CLIENT *Client ) } /* Hello_User */ -LOCAL VOID -Kill_Nick( CHAR *Nick, CHAR *Reason ) +LOCAL void +Kill_Nick( char *Nick, char *Reason ) { REQUEST r; assert( Nick != NULL ); assert( Reason != NULL ); - r.prefix = (CHAR *)Client_ThisServer( ); + r.prefix = (char *)Client_ThisServer( ); r.argv[0] = Nick; r.argv[1] = Reason; r.argc = 2; blob - e7ac327a23a20d552742ef6c8b9d7108e2948196 blob + 28df23ea03bc6f39c0fa725ea42b2fca831c5a5a --- src/ngircd/irc-login.h +++ src/ngircd/irc-login.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-login.h,v 1.5 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-login.h,v 1.6 2005/03/19 18:43:48 fw Exp $ * * Login and logout (header) */ @@ -18,12 +18,12 @@ #define __irc_login_h__ -GLOBAL BOOLEAN IRC_PASS PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_USER PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_PING PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_PASS PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_NICK PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_USER PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_PING PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_PONG PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_QUIT PARAMS((CLIENT *Client, REQUEST *Req )); #endif blob - 6fcb9e3307efd7a65084865651562c330ebeb7aa blob + d83355690b86f8e1b6d1ff3f1c97539376abd3ef --- src/ngircd/irc-mode.c +++ src/ngircd/irc-mode.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-mode.c,v 1.39 2005/03/15 16:56:18 alex Exp $"; +static char UNUSED id[] = "$Id: irc-mode.c,v 1.40 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -38,19 +38,19 @@ static char UNUSED id[] = "$Id: irc-mode.c,v 1.39 2005 #include "irc-mode.h" -LOCAL BOOLEAN Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )); -LOCAL BOOLEAN Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )); +LOCAL bool Client_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )); +LOCAL bool Channel_Mode PARAMS(( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )); -LOCAL BOOLEAN Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )); -LOCAL BOOLEAN Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )); +LOCAL bool Add_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )); +LOCAL bool Add_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )); -LOCAL BOOLEAN Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )); -LOCAL BOOLEAN Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern )); +LOCAL bool Del_Invite PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )); +LOCAL bool Del_Ban PARAMS(( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern )); -LOCAL BOOLEAN Send_ListChange PARAMS(( CHAR *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Mask )); +LOCAL bool Send_ListChange PARAMS(( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask )); -GLOBAL BOOLEAN +GLOBAL bool IRC_MODE( CLIENT *Client, REQUEST *Req ) { CLIENT *cl, *origin; @@ -83,14 +83,14 @@ IRC_MODE( CLIENT *Client, REQUEST *Req ) } /* IRC_MODE */ -LOCAL BOOLEAN +LOCAL bool Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ) { /* Handle client mode requests */ - CHAR the_modes[COMMAND_LEN], x[2], *mode_ptr; - BOOLEAN ok, set; - INT mode_arg; + char the_modes[COMMAND_LEN], x[2], *mode_ptr; + bool ok, set; + int mode_arg; size_t len; /* Is the client allowed to request or change the modes? */ @@ -107,8 +107,8 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori mode_ptr = Req->argv[mode_arg]; /* Initial state: set or unset modes? */ - if( *mode_ptr == '+' ) set = TRUE; - else if( *mode_ptr == '-' ) set = FALSE; + if( *mode_ptr == '+' ) set = true; + else if( *mode_ptr == '-' ) set = false; else return IRC_WriteStrClient( Origin, ERR_UMODEUNKNOWNFLAG_MSG, Client_ID( Origin )); /* Prepare reply string */ @@ -147,8 +147,8 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori x[0] = *mode_ptr; strlcat( the_modes, x, sizeof( the_modes )); } - if( *mode_ptr == '+' ) set = TRUE; - else set = FALSE; + if( *mode_ptr == '+' ) set = true; + else set = false; } continue; } @@ -174,7 +174,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Ori case 'o': /* IRC operator (only unsettable!) */ if(( ! set ) || ( Client_Type( Client ) == CLIENT_SERVER )) { - Client_SetOperByMe( Target, FALSE ); + Client_SetOperByMe( Target, false ); x[0] = 'o'; } else ok = IRC_WriteStrClient( Origin, ERR_NOPRIVILEGES_MSG, Client_ID( Origin )); @@ -236,16 +236,16 @@ client_exit: } /* Client_Mode */ -LOCAL BOOLEAN +LOCAL bool Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel ) { /* Handle channel and channel-user modes */ - CHAR the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr; - BOOLEAN ok, set, modeok = FALSE, skiponce, use_servermode = FALSE; - INT mode_arg, arg_arg; + char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr; + bool ok, set, modeok = false, skiponce, use_servermode = false; + int mode_arg, arg_arg; CLIENT *client; - LONG l; + long l; size_t len; /* Mode request: let's answer it :-) */ @@ -285,17 +285,17 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel )); /* Is he channel operator? */ - if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE; + if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = true; else if( Conf_OperCanMode ) { /* IRC-Operators can use MODE as well */ if( Client_OperByMe( Origin )) { - modeok = TRUE; - if ( Conf_OperServerMode ) use_servermode = TRUE; /* Change Origin to Server */ + modeok = true; + if ( Conf_OperServerMode ) use_servermode = true; /* Change Origin to Server */ } } } - else modeok = TRUE; + else modeok = true; mode_arg = 1; mode_ptr = Req->argv[mode_arg]; @@ -303,10 +303,10 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or else arg_arg = -1; /* Initial state: set or unset modes? */ - skiponce = FALSE; - if( *mode_ptr == '-' ) set = FALSE; - else if( *mode_ptr == '+' ) set = TRUE; - else set = skiponce = TRUE; + skiponce = false; + if( *mode_ptr == '-' ) set = false; + else if( *mode_ptr == '+' ) set = true; + else set = skiponce = true; /* Prepare reply string */ if( set ) strcpy( the_modes, "+" ); @@ -328,7 +328,7 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or if( Req->argc > mode_arg + 1 ) arg_arg = mode_arg + 1; else arg_arg = -1; } - skiponce = FALSE; + skiponce = false; switch( *mode_ptr ) { @@ -349,8 +349,8 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or x[0] = *mode_ptr; strlcat( the_modes, x, sizeof( the_modes )); } - if( *mode_ptr == '+' ) set = TRUE; - else set = FALSE; + if( *mode_ptr == '+' ) set = true; + else set = false; } continue; } @@ -582,7 +582,7 @@ chan_exit: { /* Forward mode changes to channel users and other servers */ IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); - IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); + IRC_WriteStrChannelPrefix( Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); } else { @@ -591,7 +591,7 @@ chan_exit: /* Send reply to client and inform other servers and channel users */ ok = IRC_WriteStrClientPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); IRC_WriteStrServersPrefix( Client, Origin, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); - IRC_WriteStrChannelPrefix( Client, Channel, Origin, FALSE, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); + IRC_WriteStrChannelPrefix( Client, Channel, Origin, false, "MODE %s %s%s", Channel_Name( Channel ), the_modes, the_args ); } } @@ -600,7 +600,7 @@ chan_exit: } /* Channel_Mode */ -GLOBAL BOOLEAN +GLOBAL bool IRC_AWAY( CLIENT *Client, REQUEST *Req ) { assert( Client != NULL ); @@ -627,11 +627,11 @@ IRC_AWAY( CLIENT *Client, REQUEST *Req ) } /* IRC_AWAY */ -LOCAL BOOLEAN -Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ) +LOCAL bool +Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ) { - CHAR *mask; - BOOLEAN already; + char *mask; + bool already; assert( Client != NULL ); assert( Channel != NULL ); @@ -641,19 +641,19 @@ Add_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *C already = Lists_IsInviteEntry( mask, Channel ); - if( ! Lists_AddInvited( mask, Channel, FALSE )) return CONNECTED; + if( ! Lists_AddInvited( mask, Channel, false )) return CONNECTED; - if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == TRUE )) return CONNECTED; + if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == true)) return CONNECTED; return Send_ListChange( "+I", Prefix, Client, Channel, mask ); } /* Add_Invite */ -LOCAL BOOLEAN -Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ) +LOCAL bool +Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ) { - CHAR *mask; - BOOLEAN already; + char *mask; + bool already; assert( Client != NULL ); assert( Channel != NULL ); @@ -665,16 +665,16 @@ Add_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Chan if( ! Lists_AddBanned( mask, Channel )) return CONNECTED; - if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == TRUE )) return CONNECTED; + if(( Client_Type( Prefix ) == CLIENT_SERVER ) && ( already == true)) return CONNECTED; return Send_ListChange( "+b", Prefix, Client, Channel, mask ); } /* Add_Ban */ -LOCAL BOOLEAN -Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ) +LOCAL bool +Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ) { - CHAR *mask; + char *mask; assert( Client != NULL ); assert( Channel != NULL ); @@ -686,10 +686,10 @@ Del_Invite( CLIENT *Prefix, CLIENT *Client, CHANNEL *C } /* Del_Invite */ -LOCAL BOOLEAN -Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Pattern ) +LOCAL bool +Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Pattern ) { - CHAR *mask; + char *mask; assert( Client != NULL ); assert( Channel != NULL ); @@ -701,25 +701,25 @@ Del_Ban( CLIENT *Prefix, CLIENT *Client, CHANNEL *Chan } /* Del_Ban */ -LOCAL BOOLEAN -Send_ListChange( CHAR *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, CHAR *Mask ) +LOCAL bool +Send_ListChange( char *Mode, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel, char *Mask ) { /* Bestaetigung an Client schicken & andere Server sowie Channel-User informieren */ - BOOLEAN ok; + bool ok; if( Client_Type( Client ) == CLIENT_USER ) { /* Bestaetigung an Client */ ok = IRC_WriteStrClientPrefix( Client, Prefix, "MODE %s %s %s", Channel_Name( Channel ), Mode, Mask ); } - else ok = TRUE; + else ok = true; /* an andere Server */ IRC_WriteStrServersPrefix( Client, Prefix, "MODE %s %s %s", Channel_Name( Channel ), Mode, Mask ); /* und lokale User im Channel */ - IRC_WriteStrChannelPrefix( Client, Channel, Prefix, FALSE, "MODE %s %s %s", Channel_Name( Channel ), Mode, Mask ); + IRC_WriteStrChannelPrefix( Client, Channel, Prefix, false, "MODE %s %s %s", Channel_Name( Channel ), Mode, Mask ); return ok; } /* Send_ListChange */ blob - bede5423978f528e9d2b63e5a04d9c7970d4bb0e blob + dd5d9dd007518ff9dfba511999bbaed68872c820 --- src/ngircd/irc-mode.h +++ src/ngircd/irc-mode.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-mode.h,v 1.5 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-mode.h,v 1.6 2005/03/19 18:43:48 fw Exp $ * * IRC commands for mode changes (header) */ @@ -18,8 +18,8 @@ #define __irc_mode_h__ -GLOBAL BOOLEAN IRC_MODE PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_AWAY PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_MODE PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_AWAY PARAMS((CLIENT *Client, REQUEST *Req )); #endif blob - e90d07458932ea42bec7f1343581e9cc08c436f5 blob + f1c3fcd4a9e1068c467abd06b988aff7cbd9d8e9 --- src/ngircd/irc-op.c +++ src/ngircd/irc-op.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-op.c,v 1.13 2004/04/09 21:41:52 alex Exp $"; +static char UNUSED id[] = "$Id: irc-op.c,v 1.14 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -35,7 +35,7 @@ static char UNUSED id[] = "$Id: irc-op.c,v 1.13 2004/0 #include "irc-op.h" -GLOBAL BOOLEAN +GLOBAL bool IRC_KICK( CLIENT *Client, REQUEST *Req ) { CLIENT *target, *from; @@ -59,12 +59,12 @@ IRC_KICK( CLIENT *Client, REQUEST *Req ) } /* IRC_KICK */ -GLOBAL BOOLEAN +GLOBAL bool IRC_INVITE( CLIENT *Client, REQUEST *Req ) { CHANNEL *chan; CLIENT *target, *from; - BOOLEAN remember = FALSE; + bool remember = false; assert( Client != NULL ); assert( Req != NULL ); @@ -92,19 +92,19 @@ IRC_INVITE( CLIENT *Client, REQUEST *Req ) { /* Yes. The user must be channel operator! */ if( ! strchr( Channel_UserModes( chan, from ), 'o' )) return IRC_WriteStrClient( from, ERR_CHANOPRIVSNEEDED_MSG, Client_ID( from ), Channel_Name( chan )); - remember = TRUE; + remember = true; } /* Is the target user already member of the channel? */ if( Channel_IsMemberOf( chan, target )) return IRC_WriteStrClient( from, ERR_USERONCHANNEL_MSG, Client_ID( from ), Req->argv[0], Req->argv[1] ); /* If the target user is banned on that channel: remember invite */ - if( Lists_CheckBanned( target, chan )) remember = TRUE; + if( Lists_CheckBanned( target, chan )) remember = true; if( remember ) { /* We must memember this invite */ - if( ! Lists_AddInvited( Client_Mask( target ), chan, TRUE )) return CONNECTED; + if( ! Lists_AddInvited( Client_Mask( target ), chan, true)) return CONNECTED; } } blob - 0618444779e9c26e0e986c68b54bb3430c357edd blob + 0c8a0f2059128806a65eef980c6c2f04cb84cb8a --- src/ngircd/irc-op.h +++ src/ngircd/irc-op.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-op.h,v 1.3 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-op.h,v 1.4 2005/03/19 18:43:48 fw Exp $ * * Channel operator commands (header) */ @@ -18,8 +18,8 @@ #define __irc_op_h__ -GLOBAL BOOLEAN IRC_KICK PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_INVITE PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_KICK PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_INVITE PARAMS(( CLIENT *Client, REQUEST *Req )); #endif blob - 2c03ad2a1841113e049ac739801d3ba8d273ccca blob + 499fbb94bef57a3aed733ed72d82b652d26561dc --- src/ngircd/irc-oper.c +++ src/ngircd/irc-oper.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-oper.c,v 1.19 2005/03/03 08:36:19 alex Exp $"; +static char UNUSED id[] = "$Id: irc-oper.c,v 1.20 2005/03/19 18:43:48 fw Exp $"; #include "imp.h" #include @@ -37,10 +37,10 @@ static char UNUSED id[] = "$Id: irc-oper.c,v 1.19 2005 #include "irc-oper.h" -GLOBAL BOOLEAN +GLOBAL bool IRC_OPER( CLIENT *Client, REQUEST *Req ) { - INT i; + int i; assert( Client != NULL ); assert( Req != NULL ); @@ -83,12 +83,12 @@ IRC_OPER( CLIENT *Client, REQUEST *Req ) if( ! Client_OperByMe( Client )) Log( LOG_NOTICE|LOG_snotice, "Got valid OPER from \"%s\", user is an IRC operator now.", Client_Mask( Client )); - Client_SetOperByMe( Client, TRUE ); + Client_SetOperByMe( Client, true); return IRC_WriteStrClient( Client, RPL_YOUREOPER_MSG, Client_ID( Client )); } /* IRC_OPER */ -GLOBAL BOOLEAN +GLOBAL bool IRC_DIE( CLIENT *Client, REQUEST *Req ) { /* Shut down server */ @@ -103,12 +103,12 @@ IRC_DIE( CLIENT *Client, REQUEST *Req ) if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); Log( LOG_NOTICE|LOG_snotice, "Got DIE command from \"%s\" ...", Client_Mask( Client )); - NGIRCd_SignalQuit = TRUE; + NGIRCd_SignalQuit = true; return CONNECTED; } /* IRC_DIE */ -GLOBAL BOOLEAN +GLOBAL bool IRC_REHASH( CLIENT *Client, REQUEST *Req ) { /* Reload configuration file */ @@ -123,13 +123,13 @@ IRC_REHASH( CLIENT *Client, REQUEST *Req ) if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); Log( LOG_NOTICE|LOG_snotice, "Got REHASH command from \"%s\" ...", Client_Mask( Client )); - NGIRCd_SignalRehash = TRUE; + NGIRCd_SignalRehash = true; return CONNECTED; } /* IRC_REHASH */ -GLOBAL BOOLEAN +GLOBAL bool IRC_RESTART( CLIENT *Client, REQUEST *Req ) { /* Restart IRC server (fork a new process) */ @@ -144,12 +144,12 @@ IRC_RESTART( CLIENT *Client, REQUEST *Req ) if( Req->argc != 0 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); Log( LOG_NOTICE|LOG_snotice, "Got RESTART command from \"%s\" ...", Client_Mask( Client )); - NGIRCd_SignalRestart = TRUE; + NGIRCd_SignalRestart = true; return CONNECTED; } /* IRC_RESTART */ -GLOBAL BOOLEAN +GLOBAL bool IRC_CONNECT(CLIENT *Client, REQUEST *Req ) { /* Connect configured or new server */ @@ -182,7 +182,7 @@ IRC_CONNECT(CLIENT *Client, REQUEST *Req ) } /* IRC_CONNECT */ -GLOBAL BOOLEAN +GLOBAL bool IRC_DISCONNECT(CLIENT *Client, REQUEST *Req ) { /* Disconnect and disable configured server */ blob - 8478c7bd905ecef8af018aad69e03f17ece9d0a6 blob + dd2faa24ef7a7df3e86beac762d750836c763d12 --- src/ngircd/irc-oper.h +++ src/ngircd/irc-oper.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-oper.h,v 1.10 2002/12/31 16:11:06 alex Exp $ + * $Id: irc-oper.h,v 1.11 2005/03/19 18:43:48 fw Exp $ * * IRC operator commands (header) */ @@ -18,12 +18,12 @@ #define __irc_oper_h__ -GLOBAL BOOLEAN IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_OPER PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_DIE PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_REHASH PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_RESTART PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_CONNECT PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_DISCONNECT PARAMS((CLIENT *Client, REQUEST *Req )); #endif blob - 72ca92bbcb28df7a802850dfe090a7d1d0780fa2 blob + 989e5787f6d386a25b31b39aec3febbf07540a19 --- src/ngircd/irc-server.c +++ src/ngircd/irc-server.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-server.c,v 1.37 2004/05/11 00:01:11 alex Exp $"; +static char UNUSED id[] = "$Id: irc-server.c,v 1.38 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -41,15 +41,15 @@ static char UNUSED id[] = "$Id: irc-server.c,v 1.37 20 #include "irc-server.h" -GLOBAL BOOLEAN +GLOBAL bool IRC_SERVER( CLIENT *Client, REQUEST *Req ) { - CHAR str[LINE_LEN], *ptr, *modes, *topic; + char str[LINE_LEN], *ptr, *modes, *topic; CLIENT *from, *c, *cl; CL2CHAN *cl2chan; - INT max_hops, i; + int max_hops, i; CHANNEL *chan; - BOOLEAN ok; + bool ok; CONN_ID con; assert( Client != NULL ); @@ -72,14 +72,14 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) { /* Server ist nicht konfiguriert! */ Log( LOG_ERR, "Connection %d: Server \"%s\" not configured here!", Client_Conn( Client ), Req->argv[0] ); - Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", TRUE ); + Conn_Close( Client_Conn( Client ), NULL, "Server not configured here", true); return DISCONNECTED; } if( strcmp( Client_Password( Client ), Conf_Server[i].pwd_in ) != 0 ) { /* Falsches Passwort */ Log( LOG_ERR, "Connection %d: Got bad password from server \"%s\"!", Client_Conn( Client ), Req->argv[0] ); - Conn_Close( Client_Conn( Client ), NULL, "Bad password", TRUE ); + Conn_Close( Client_Conn( Client ), NULL, "Bad password", true); return DISCONNECTED; } @@ -97,12 +97,12 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) if( Client_Token( Client ) != TOKEN_OUTBOUND ) { /* Eingehende Verbindung: Unseren SERVER- und PASS-Befehl senden */ - ok = TRUE; - if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = FALSE; + ok = true; + if( ! IRC_WriteStrClient( Client, "PASS %s %s", Conf_Server[i].pwd_out, NGIRCd_ProtoID )) ok = false; else ok = IRC_WriteStrClient( Client, "SERVER %s 1 :%s", Conf_ServerName, Conf_ServerInfo ); if( ! ok ) { - Conn_Close( con, "Unexpected server behavior!", NULL, FALSE ); + Conn_Close( con, "Unexpected server behavior!", NULL, false ); return DISCONNECTED; } Client_SetIntroducer( Client, Client ); @@ -127,7 +127,7 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) if( ! Zip_InitConn( con )) { /* Fehler! */ - Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, FALSE ); + Conn_Close( con, "Can't inizialize compression (zlib)!", NULL, false ); return DISCONNECTED; } } @@ -281,17 +281,17 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) { /* Hm, Server, der diesen einfuehrt, ist nicht bekannt!? */ Log( LOG_ALERT, "Unknown ID in prefix of SERVER: \"%s\"! (on connection %d)", Req->prefix, Client_Conn( Client )); - Conn_Close( Client_Conn( Client ), NULL, "Unknown ID in prefix of SERVER", TRUE ); + Conn_Close( Client_Conn( Client ), NULL, "Unknown ID in prefix of SERVER", true); return DISCONNECTED; } /* Neue Client-Struktur anlegen */ - c = Client_NewRemoteServer( Client, Req->argv[0], from, atoi( Req->argv[1] ), atoi( Req->argv[2] ), ptr, TRUE ); + c = Client_NewRemoteServer( Client, Req->argv[0], from, atoi( Req->argv[1] ), atoi( Req->argv[2] ), ptr, true); if( ! c ) { /* Neue Client-Struktur konnte nicht angelegt werden */ Log( LOG_ALERT, "Can't create client structure for server! (on connection %d)", Client_Conn( Client )); - Conn_Close( Client_Conn( Client ), NULL, "Can't allocate client structure for remote server", TRUE ); + Conn_Close( Client_Conn( Client ), NULL, "Can't allocate client structure for remote server", true); return DISCONNECTED; } @@ -309,11 +309,11 @@ IRC_SERVER( CLIENT *Client, REQUEST *Req ) } /* IRC_SERVER */ -GLOBAL BOOLEAN +GLOBAL bool IRC_NJOIN( CLIENT *Client, REQUEST *Req ) { - CHAR nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; - BOOLEAN is_op, is_voiced; + char nick_in[COMMAND_LEN], nick_out[COMMAND_LEN], *channame, *ptr, modes[8]; + bool is_op, is_voiced; CHANNEL *chan; CLIENT *c; @@ -330,13 +330,13 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) ptr = strtok( nick_in, "," ); while( ptr ) { - is_op = is_voiced = FALSE; + is_op = is_voiced = false; /* Prefixe abschneiden */ while(( *ptr == '@' ) || ( *ptr == '+' )) { - if( *ptr == '@' ) is_op = TRUE; - if( *ptr == '+' ) is_voiced = TRUE; + if( *ptr == '@' ) is_op = true; + if( *ptr == '+' ) is_voiced = true; ptr++; } @@ -351,14 +351,14 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) if( is_voiced ) Channel_UserModeAdd( chan, c, 'v' ); /* im Channel bekannt machen */ - IRC_WriteStrChannelPrefix( Client, chan, c, FALSE, "JOIN :%s", channame ); + IRC_WriteStrChannelPrefix( Client, chan, c, false, "JOIN :%s", channame ); /* Channel-User-Modes setzen */ strlcpy( modes, Channel_UserModes( chan, c ), sizeof( modes )); if( modes[0] ) { /* Modes im Channel bekannt machen */ - IRC_WriteStrChannelPrefix( Client, chan, Client, FALSE, "MODE %s +%s %s", channame, modes, Client_ID( c )); + IRC_WriteStrChannelPrefix( Client, chan, Client, false, "MODE %s +%s %s", channame, modes, Client_ID( c )); } if( nick_out[0] != '\0' ) strlcat( nick_out, ",", sizeof( nick_out )); @@ -379,11 +379,11 @@ IRC_NJOIN( CLIENT *Client, REQUEST *Req ) } /* IRC_NJOIN */ -GLOBAL BOOLEAN +GLOBAL bool IRC_SQUIT( CLIENT *Client, REQUEST *Req ) { CLIENT *target; - CHAR msg[LINE_LEN + 64]; + char msg[LINE_LEN + 64]; assert( Client != NULL ); assert( Req != NULL ); @@ -411,14 +411,14 @@ IRC_SQUIT( CLIENT *Client, REQUEST *Req ) if( Client_Conn( target ) > NONE ) { /* dieser Server hat die Connection */ - if( Req->argv[1][0] ) Conn_Close( Client_Conn( target ), msg, Req->argv[1], TRUE ); - else Conn_Close( Client_Conn( target ), msg, NULL, TRUE ); + if( Req->argv[1][0] ) Conn_Close( Client_Conn( target ), msg, Req->argv[1], true); + else Conn_Close( Client_Conn( target ), msg, NULL, true); return DISCONNECTED; } else { /* Verbindung hielt anderer Server */ - Client_Destroy( target, msg, Req->argv[1], FALSE ); + Client_Destroy( target, msg, Req->argv[1], false ); return CONNECTED; } } /* IRC_SQUIT */ blob - 413aa90cd62f7593a390eaccd9d9cb7612b183b0 blob + 6322b25368f74f1c849c3b44e1c128147ae128ef --- src/ngircd/irc-server.h +++ src/ngircd/irc-server.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-server.h,v 1.4 2002/12/12 12:23:43 alex Exp $ + * $Id: irc-server.h,v 1.5 2005/03/19 18:43:49 fw Exp $ * * IRC commands for server links (header) */ @@ -18,9 +18,9 @@ #define __irc_server_h__ -GLOBAL BOOLEAN IRC_SERVER PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_NJOIN PARAMS((CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_SQUIT PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_SERVER PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_NJOIN PARAMS((CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_SQUIT PARAMS((CLIENT *Client, REQUEST *Req )); #endif blob - 56f9b22278433762bcfe6ffaceb2e747793997b7 blob + 3064f7bd41c2abeb4094104850e1b35985d40ad7 --- src/ngircd/irc-write.c +++ src/ngircd/irc-write.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-write.c,v 1.16 2004/10/20 13:47:32 alex Exp $"; +static char UNUSED id[] = "$Id: irc-write.c,v 1.17 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -39,22 +39,22 @@ static char UNUSED id[] = "$Id: irc-write.c,v 1.16 200 #define SEND_TO_SERVER 2 -LOCAL CHAR *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client )); +LOCAL char *Get_Prefix PARAMS(( CLIENT *Target, CLIENT *Client )); #ifdef PROTOTYPES -GLOBAL BOOLEAN -IRC_WriteStrClient( CLIENT *Client, CHAR *Format, ... ) +GLOBAL bool +IRC_WriteStrClient( CLIENT *Client, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool IRC_WriteStrClient( Client, Format, va_alist ) CLIENT *Client; -CHAR *Format; +char *Format; va_dcl #endif { - CHAR buffer[1000]; - BOOLEAN ok = CONNECTED; + char buffer[1000]; + bool ok = CONNECTED; va_list ap; assert( Client != NULL ); @@ -76,20 +76,20 @@ va_dcl #ifdef PROTOTYPES -GLOBAL BOOLEAN -IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... ) +GLOBAL bool +IRC_WriteStrClientPrefix( CLIENT *Client, CLIENT *Prefix, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool IRC_WriteStrClientPrefix( Client, Prefix, Format, va_alist ) CLIENT *Client; CLIENT *Prefix; -CHAR *Format; +char *Format; va_dcl #endif { /* Text an Clients, lokal bzw. remote, senden. */ - CHAR buffer[1000]; + char buffer[1000]; va_list ap; assert( Client != NULL ); @@ -109,19 +109,19 @@ va_dcl #ifdef PROTOTYPES -GLOBAL BOOLEAN -IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... ) +GLOBAL bool +IRC_WriteStrChannel( CLIENT *Client, CHANNEL *Chan, bool Remote, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool IRC_WriteStrChannel( Client, Chan, Remote, Format, va_alist ) CLIENT *Client; CHANNEL *Chan; -BOOLEAN Remote; -CHAR *Format; +bool Remote; +char *Format; va_dcl #endif { - CHAR buffer[1000]; + char buffer[1000]; va_list ap; assert( Client != NULL ); @@ -140,21 +140,21 @@ va_dcl #ifdef PROTOTYPES -GLOBAL BOOLEAN -IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ) +GLOBAL bool +IRC_WriteStrChannelPrefix( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, bool Remote, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool IRC_WriteStrChannelPrefix( Client, Chan, Prefix, Remote, Format, va_alist ) CLIENT *Client; CHANNEL *Chan; CLIENT *Prefix; -BOOLEAN Remote; -CHAR *Format; +bool Remote; +char *Format; va_dcl #endif { - BOOLEAN ok = CONNECTED; - CHAR buffer[1000]; + bool ok = CONNECTED; + char buffer[1000]; CL2CHAN *cl2chan; CONN_ID conn; CLIENT *c; @@ -216,17 +216,17 @@ va_dcl #ifdef PROTOTYPES -GLOBAL VOID -IRC_WriteStrServers( CLIENT *ExceptOf, CHAR *Format, ... ) +GLOBAL void +IRC_WriteStrServers( CLIENT *ExceptOf, char *Format, ... ) #else -GLOBAL VOID +GLOBAL void IRC_WriteStrServers( ExceptOf, Format, va_alist ) CLIENT *ExceptOf; -CHAR *Format; +char *Format; va_dcl #endif { - CHAR buffer[1000]; + char buffer[1000]; va_list ap; assert( Format != NULL ); @@ -245,18 +245,18 @@ va_dcl #ifdef PROTOTYPES -GLOBAL VOID -IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... ) +GLOBAL void +IRC_WriteStrServersPrefix( CLIENT *ExceptOf, CLIENT *Prefix, char *Format, ... ) #else -GLOBAL VOID +GLOBAL void IRC_WriteStrServersPrefix( ExceptOf, Prefix, Format, va_alist ) CLIENT *ExceptOf; CLIENT *Prefix; -CHAR *Format; +char *Format; va_dcl #endif { - CHAR buffer[1000]; + char buffer[1000]; va_list ap; assert( Format != NULL ); @@ -275,19 +275,19 @@ va_dcl #ifdef PROTOTYPES -GLOBAL VOID -IRC_WriteStrServersPrefixFlag( CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... ) +GLOBAL void +IRC_WriteStrServersPrefixFlag( CLIENT *ExceptOf, CLIENT *Prefix, char Flag, char *Format, ... ) #else -GLOBAL VOID +GLOBAL void IRC_WriteStrServersPrefixFlag( ExceptOf, Prefix, Flag, Format, va_alist ) CLIENT *ExceptOf; CLIENT *Prefix; -CHAR Flag; -CHAR *Format; +char Flag; +char *Format; va_dcl #endif { - CHAR buffer[1000]; + char buffer[1000]; CLIENT *c; va_list ap; @@ -316,21 +316,21 @@ va_dcl #ifdef PROTOTYPES -GLOBAL BOOLEAN -IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... ) +GLOBAL bool +IRC_WriteStrRelatedPrefix( CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ... ) #else -GLOBAL BOOLEAN +GLOBAL bool IRC_WriteStrRelatedPrefix( Client, Prefix, Remote, Format, va_alist ) CLIENT *Client; CLIENT *Prefix; -BOOLEAN Remote; -CHAR *Format; +bool Remote; +char *Format; va_dcl #endif { - BOOLEAN ok = CONNECTED; + bool ok = CONNECTED; CL2CHAN *chan_cl2chan, *cl2chan; - CHAR buffer[1000]; + char buffer[1000]; CHANNEL *chan; CONN_ID conn; va_list ap; @@ -399,8 +399,8 @@ va_dcl } /* IRC_WriteStrRelatedPrefix */ -GLOBAL VOID -IRC_SetPenalty( CLIENT *Client, INT Seconds ) +GLOBAL void +IRC_SetPenalty( CLIENT *Client, int Seconds ) { CONN_ID c; @@ -414,7 +414,7 @@ IRC_SetPenalty( CLIENT *Client, INT Seconds ) } /* IRC_SetPenalty */ -LOCAL CHAR * +LOCAL char * Get_Prefix( CLIENT *Target, CLIENT *Client ) { assert( Target != NULL ); blob - 41e2f2e7359e2316ee31f6358e2c1d2a06362058 blob + d7d742c54b460ec3e9fb130ad423156a928b3bd7 --- src/ngircd/irc-write.h +++ src/ngircd/irc-write.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc-write.h,v 1.6 2003/11/05 23:24:48 alex Exp $ + * $Id: irc-write.h,v 1.7 2005/03/19 18:43:49 fw Exp $ * * Sending IRC commands over the network (header) */ @@ -18,19 +18,19 @@ #define __irc_write_h__ -GLOBAL BOOLEAN IRC_WriteStrClient PARAMS(( CLIENT *Client, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrClientPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, CHAR *Format, ... )); +GLOBAL bool IRC_WriteStrClient PARAMS(( CLIENT *Client, char *Format, ... )); +GLOBAL bool IRC_WriteStrClientPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, char *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrChannel PARAMS(( CLIENT *Client, CHANNEL *Chan, BOOLEAN Remote, CHAR *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrChannelPrefix PARAMS(( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); +GLOBAL bool IRC_WriteStrChannel PARAMS(( CLIENT *Client, CHANNEL *Chan, bool Remote, char *Format, ... )); +GLOBAL bool IRC_WriteStrChannelPrefix PARAMS(( CLIENT *Client, CHANNEL *Chan, CLIENT *Prefix, bool Remote, char *Format, ... )); -GLOBAL VOID IRC_WriteStrServers PARAMS(( CLIENT *ExceptOf, CHAR *Format, ... )); -GLOBAL VOID IRC_WriteStrServersPrefix PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR *Format, ... )); -GLOBAL VOID IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, CHAR Flag, CHAR *Format, ... )); +GLOBAL void IRC_WriteStrServers PARAMS(( CLIENT *ExceptOf, char *Format, ... )); +GLOBAL void IRC_WriteStrServersPrefix PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, char *Format, ... )); +GLOBAL void IRC_WriteStrServersPrefixFlag PARAMS(( CLIENT *ExceptOf, CLIENT *Prefix, char Flag, char *Format, ... )); -GLOBAL BOOLEAN IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, BOOLEAN Remote, CHAR *Format, ... )); +GLOBAL bool IRC_WriteStrRelatedPrefix PARAMS(( CLIENT *Client, CLIENT *Prefix, bool Remote, char *Format, ... )); -GLOBAL VOID IRC_SetPenalty PARAMS(( CLIENT *Client, INT Seconds )); +GLOBAL void IRC_SetPenalty PARAMS(( CLIENT *Client, int Seconds )); #endif blob - 8d7f6d37cb6c78f076c7afb9bfb33b215a9177ac blob + 447747e1017d8b065c65abb6077b037dbd0cdb20 --- src/ngircd/irc.c +++ src/ngircd/irc.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc.c,v 1.124 2004/02/28 02:18:16 alex Exp $"; +static char UNUSED id[] = "$Id: irc.c,v 1.125 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -38,10 +38,10 @@ static char UNUSED id[] = "$Id: irc.c,v 1.124 2004/02/ #include "irc.h" -LOCAL CHAR *Option_String PARAMS(( CONN_ID Idx )); +LOCAL char *Option_String PARAMS(( CONN_ID Idx )); -GLOBAL BOOLEAN +GLOBAL bool IRC_ERROR( CLIENT *Client, REQUEST *Req ) { assert( Client != NULL ); @@ -54,11 +54,11 @@ IRC_ERROR( CLIENT *Client, REQUEST *Req ) } /* IRC_ERROR */ -GLOBAL BOOLEAN +GLOBAL bool IRC_KILL( CLIENT *Client, REQUEST *Req ) { CLIENT *prefix, *c; - CHAR reason[COMMAND_LEN]; + char reason[COMMAND_LEN]; CONN_ID my_conn, conn; assert( Client != NULL ); @@ -104,7 +104,7 @@ IRC_KILL( CLIENT *Client, REQUEST *Req ) Log( LOG_ERR, "Can't KILL server \"%s\"!", Req->argv[0] ); conn = Client_Conn( Client_NextHop( c )); assert( conn > NONE ); - Conn_Close( conn, NULL, "Nick collision for server!?", TRUE ); + Conn_Close( conn, NULL, "Nick collision for server!?", true); } } else if( Client_Type( c ) != CLIENT_USER ) @@ -116,15 +116,15 @@ IRC_KILL( CLIENT *Client, REQUEST *Req ) Log( LOG_ERR, "Can't KILL \"%s\": invalid client type!", Req->argv[0] ); conn = Client_Conn( Client_NextHop( c )); assert( conn > NONE ); - Conn_Close( conn, NULL, "Collision for invalid client type!?", TRUE ); + Conn_Close( conn, NULL, "Collision for invalid client type!?", true); } } else { /* Kill user NOW! */ conn = Client_Conn( c ); - Client_Destroy( c, NULL, reason, FALSE ); - if( conn != NONE ) Conn_Close( conn, NULL, reason, TRUE ); + Client_Destroy( c, NULL, reason, false ); + if( conn != NONE ) Conn_Close( conn, NULL, reason, true); } } else Log( LOG_NOTICE, "Client with nick \"%s\" is unknown here.", Req->argv[0] ); @@ -135,7 +135,7 @@ IRC_KILL( CLIENT *Client, REQUEST *Req ) } /* IRC_KILL */ -GLOBAL BOOLEAN +GLOBAL bool IRC_NOTICE( CLIENT *Client, REQUEST *Req ) { CLIENT *to, *from; @@ -162,7 +162,7 @@ IRC_NOTICE( CLIENT *Client, REQUEST *Req ) } /* IRC_NOTICE */ -GLOBAL BOOLEAN +GLOBAL bool IRC_PRIVMSG( CLIENT *Client, REQUEST *Req ) { CLIENT *cl, *from; @@ -205,12 +205,12 @@ IRC_PRIVMSG( CLIENT *Client, REQUEST *Req ) } /* IRC_PRIVMSG */ -GLOBAL BOOLEAN +GLOBAL bool IRC_TRACE( CLIENT *Client, REQUEST *Req ) { CLIENT *from, *target, *c; CONN_ID idx, idx2; - CHAR user[CLIENT_USER_LEN]; + char user[CLIENT_USER_LEN]; assert( Client != NULL ); assert( Req != NULL ); @@ -270,7 +270,7 @@ IRC_TRACE( CLIENT *Client, REQUEST *Req ) } /* IRC_TRACE */ -GLOBAL BOOLEAN +GLOBAL bool IRC_HELP( CLIENT *Client, REQUEST *Req ) { COMMAND *cmd; @@ -293,11 +293,11 @@ IRC_HELP( CLIENT *Client, REQUEST *Req ) } /* IRC_HELP */ -LOCAL CHAR * +LOCAL char * Option_String( CONN_ID Idx ) { - STATIC CHAR option_txt[8]; - INT options; + static char option_txt[8]; + int options; options = Conn_Options( Idx ); blob - bca9d029b7fd10acad33d610635de365b770256c blob + a96c8e43b6c1b89b8e4f1566338c43bc658acb48 --- src/ngircd/irc.h +++ src/ngircd/irc.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: irc.h,v 1.38 2003/01/15 13:49:20 alex Exp $ + * $Id: irc.h,v 1.39 2005/03/19 18:43:49 fw Exp $ * * IRC commands (header) */ @@ -18,12 +18,12 @@ #define __irc_h__ -GLOBAL BOOLEAN IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_TRACE PARAMS(( CLIENT *Client, REQUEST *Req )); -GLOBAL BOOLEAN IRC_HELP PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_ERROR PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_KILL PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_NOTICE PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_PRIVMSG PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_TRACE PARAMS(( CLIENT *Client, REQUEST *Req )); +GLOBAL bool IRC_HELP PARAMS(( CLIENT *Client, REQUEST *Req )); #endif blob - fce351a9ea52fcdaadca8096c9f73b5d344c4b15 blob + e16cdd7087ad1e3f1e0a23e7853e706cc1b43bc9 --- src/ngircd/lists.c +++ src/ngircd/lists.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: lists.c,v 1.16 2005/01/26 13:23:24 alex Exp $"; +static char UNUSED id[] = "$Id: lists.c,v 1.17 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -42,24 +42,24 @@ static char UNUSED id[] = "$Id: lists.c,v 1.16 2005/01 typedef struct _C2C { struct _C2C *next; - CHAR mask[MASK_LEN]; + char mask[MASK_LEN]; CHANNEL *channel; - BOOLEAN onlyonce; + bool onlyonce; } C2C; LOCAL C2C *My_Invites, *My_Bans; -LOCAL C2C *New_C2C PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )); +LOCAL C2C *New_C2C PARAMS(( char *Mask, CHANNEL *Chan, bool OnlyOnce )); -LOCAL BOOLEAN Check_List PARAMS(( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan )); -LOCAL BOOLEAN Already_Registered PARAMS(( C2C *Cl2Chan, CHAR *Mask, CHANNEL *Chan )); +LOCAL bool Check_List PARAMS(( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan )); +LOCAL bool Already_Registered PARAMS(( C2C *Cl2Chan, char *Mask, CHANNEL *Chan )); -GLOBAL VOID -Lists_Init( VOID ) +GLOBAL void +Lists_Init( void ) { /* Modul initialisieren */ @@ -67,8 +67,8 @@ Lists_Init( VOID ) } /* Lists_Init */ -GLOBAL VOID -Lists_Exit( VOID ) +GLOBAL void +Lists_Exit( void ) { /* Modul abmelden */ @@ -94,15 +94,15 @@ Lists_Exit( VOID ) } /* Lists_Exit */ -GLOBAL BOOLEAN +GLOBAL bool Lists_CheckInvited( CLIENT *Client, CHANNEL *Chan ) { return Check_List( &My_Invites, Client, Chan ); } /* Lists_CheckInvited */ -GLOBAL BOOLEAN -Lists_IsInviteEntry( CHAR *Mask, CHANNEL *Chan ) +GLOBAL bool +Lists_IsInviteEntry( char *Mask, CHANNEL *Chan ) { assert( Mask != NULL ); assert( Chan != NULL ); @@ -111,21 +111,21 @@ Lists_IsInviteEntry( CHAR *Mask, CHANNEL *Chan ) } /* Lists_IsInviteEntry */ -GLOBAL BOOLEAN -Lists_AddInvited( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ) +GLOBAL bool +Lists_AddInvited( char *Mask, CHANNEL *Chan, bool OnlyOnce ) { C2C *c2c; assert( Mask != NULL ); assert( Chan != NULL ); - if( Already_Registered( My_Invites, Mask, Chan )) return TRUE; + if( Already_Registered( My_Invites, Mask, Chan )) return true; c2c = New_C2C( Mask, Chan, OnlyOnce ); if( ! c2c ) { Log( LOG_ERR, "Can't add new invite list entry!" ); - return FALSE; + return false; } /* verketten */ @@ -133,12 +133,12 @@ Lists_AddInvited( CHAR *Mask, CHANNEL *Chan, BOOLEAN O My_Invites = c2c; Log( LOG_DEBUG, "Added \"%s\" to invite list for \"%s\".", Mask, Channel_Name( Chan )); - return TRUE; + return true; } /* Lists_AddInvited */ -GLOBAL VOID -Lists_DelInvited( CHAR *Mask, CHANNEL *Chan ) +GLOBAL void +Lists_DelInvited( char *Mask, CHANNEL *Chan ) { C2C *c2c, *last, *next; @@ -164,7 +164,7 @@ Lists_DelInvited( CHAR *Mask, CHANNEL *Chan ) } /* Lists_DelInvited */ -GLOBAL BOOLEAN +GLOBAL bool Lists_ShowInvites( CLIENT *Client, CHANNEL *Channel ) { C2C *c2c; @@ -186,7 +186,7 @@ Lists_ShowInvites( CLIENT *Client, CHANNEL *Channel ) } /* Lists_ShowInvites */ -GLOBAL BOOLEAN +GLOBAL bool Lists_SendInvites( CLIENT *Client ) { C2C *c2c; @@ -203,7 +203,7 @@ Lists_SendInvites( CLIENT *Client ) } /* Lists_SendInvites */ -GLOBAL BOOLEAN +GLOBAL bool Lists_SendBans( CLIENT *Client ) { C2C *c2c; @@ -220,15 +220,15 @@ Lists_SendBans( CLIENT *Client ) } /* Lists_SendBans */ -GLOBAL BOOLEAN +GLOBAL bool Lists_CheckBanned( CLIENT *Client, CHANNEL *Chan ) { return Check_List( &My_Bans, Client, Chan ); } /* Lists_CheckBanned */ -GLOBAL BOOLEAN -Lists_IsBanEntry( CHAR *Mask, CHANNEL *Chan ) +GLOBAL bool +Lists_IsBanEntry( char *Mask, CHANNEL *Chan ) { assert( Mask != NULL ); assert( Chan != NULL ); @@ -237,21 +237,21 @@ Lists_IsBanEntry( CHAR *Mask, CHANNEL *Chan ) } /* Lists_IsBanEntry */ -GLOBAL BOOLEAN -Lists_AddBanned( CHAR *Mask, CHANNEL *Chan ) +GLOBAL bool +Lists_AddBanned( char *Mask, CHANNEL *Chan ) { C2C *c2c; assert( Mask != NULL ); assert( Chan != NULL ); - if( Already_Registered( My_Bans, Mask, Chan )) return TRUE; + if( Already_Registered( My_Bans, Mask, Chan )) return true; - c2c = New_C2C( Mask, Chan, FALSE ); + c2c = New_C2C( Mask, Chan, false ); if( ! c2c ) { Log( LOG_ERR, "Can't add new ban list entry!" ); - return FALSE; + return false; } /* verketten */ @@ -259,12 +259,12 @@ Lists_AddBanned( CHAR *Mask, CHANNEL *Chan ) My_Bans = c2c; Log( LOG_DEBUG, "Added \"%s\" to ban list for \"%s\".", Mask, Channel_Name( Chan )); - return TRUE; + return true; } /* Lists_AddBanned */ -GLOBAL VOID -Lists_DelBanned( CHAR *Mask, CHANNEL *Chan ) +GLOBAL void +Lists_DelBanned( char *Mask, CHANNEL *Chan ) { C2C *c2c, *last, *next; @@ -290,7 +290,7 @@ Lists_DelBanned( CHAR *Mask, CHANNEL *Chan ) } /* Lists_DelBanned */ -GLOBAL BOOLEAN +GLOBAL bool Lists_ShowBans( CLIENT *Client, CHANNEL *Channel ) { C2C *c2c; @@ -312,7 +312,7 @@ Lists_ShowBans( CLIENT *Client, CHANNEL *Channel ) } /* Lists_ShowBans */ -GLOBAL VOID +GLOBAL void Lists_DeleteChannel( CHANNEL *Chan ) { /* Channel wurde geloescht, Invite- und Ban-Lists aufraeumen */ @@ -357,16 +357,16 @@ Lists_DeleteChannel( CHANNEL *Chan ) } /* Lists_DeleteChannel */ -GLOBAL CHAR * -Lists_MakeMask( CHAR *Pattern ) +GLOBAL char * +Lists_MakeMask( char *Pattern ) { /* This function generats a valid IRC mask of "any" string. This * mask is only valid until the next call to Lists_MakeMask(), * because a single global buffer is used. You have to copy the * generated mask to some sane location yourself! */ - STATIC CHAR TheMask[MASK_LEN]; - CHAR *excl, *at; + static char TheMask[MASK_LEN]; + char *excl, *at; assert( Pattern != NULL ); @@ -408,7 +408,7 @@ Lists_MakeMask( CHAR *Pattern ) LOCAL C2C * -New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ) +New_C2C( char *Mask, CHANNEL *Chan, bool OnlyOnce ) { C2C *c2c; @@ -431,7 +431,7 @@ New_C2C( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce ) } /* New_C2C */ -LOCAL BOOLEAN +LOCAL bool Check_List( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Chan ) { C2C *c2c, *last; @@ -459,29 +459,29 @@ Check_List( C2C **Cl2Chan, CLIENT *Client, CHANNEL *Ch else *Cl2Chan = c2c->next; free( c2c ); } - return TRUE; + return true; } } last = c2c; c2c = c2c->next; } - return FALSE; + return false; } /* Check_List */ -LOCAL BOOLEAN -Already_Registered( C2C *List, CHAR *Mask, CHANNEL *Chan ) +LOCAL bool +Already_Registered( C2C *List, char *Mask, CHANNEL *Chan ) { C2C *c2c; c2c = List; while( c2c ) { - if(( c2c->channel == Chan ) && ( strcasecmp( c2c->mask, Mask ) == 0 )) return TRUE; + if(( c2c->channel == Chan ) && ( strcasecmp( c2c->mask, Mask ) == 0 )) return true; c2c = c2c->next; } - return FALSE; + return false; } /* Already_Registered */ blob - f9b3ff2feaa09f8d9b091ca405caa1d933a8bc86 blob + 5a9740cd31cf0759f31c406fc3d085ade68304f1 --- src/ngircd/lists.h +++ src/ngircd/lists.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: lists.h,v 1.11 2004/04/25 15:40:19 alex Exp $ + * $Id: lists.h,v 1.12 2005/03/19 18:43:49 fw Exp $ * * Management of IRC lists: ban, invite, ... (header) */ @@ -18,26 +18,26 @@ #define __lists_h__ -GLOBAL VOID Lists_Init PARAMS(( VOID )); -GLOBAL VOID Lists_Exit PARAMS(( VOID )); +GLOBAL void Lists_Init PARAMS(( void )); +GLOBAL void Lists_Exit PARAMS(( void )); -GLOBAL BOOLEAN Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan )); -GLOBAL BOOLEAN Lists_AddInvited PARAMS(( CHAR *Mask, CHANNEL *Chan, BOOLEAN OnlyOnce )); -GLOBAL VOID Lists_DelInvited PARAMS(( CHAR *Mask, CHANNEL *Chan )); -GLOBAL BOOLEAN Lists_ShowInvites PARAMS(( CLIENT *Client, CHANNEL *Channel )); -GLOBAL BOOLEAN Lists_SendInvites PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN Lists_IsInviteEntry PARAMS(( CHAR *Mask, CHANNEL *Chan )); +GLOBAL bool Lists_CheckInvited PARAMS(( CLIENT *Client, CHANNEL *Chan )); +GLOBAL bool Lists_AddInvited PARAMS(( char *Mask, CHANNEL *Chan, bool OnlyOnce )); +GLOBAL void Lists_DelInvited PARAMS(( char *Mask, CHANNEL *Chan )); +GLOBAL bool Lists_ShowInvites PARAMS(( CLIENT *Client, CHANNEL *Channel )); +GLOBAL bool Lists_SendInvites PARAMS(( CLIENT *Client )); +GLOBAL bool Lists_IsInviteEntry PARAMS(( char *Mask, CHANNEL *Chan )); -GLOBAL BOOLEAN Lists_CheckBanned PARAMS(( CLIENT *Client, CHANNEL *Chan )); -GLOBAL BOOLEAN Lists_AddBanned PARAMS(( CHAR *Mask, CHANNEL *Chan )); -GLOBAL VOID Lists_DelBanned PARAMS(( CHAR *Mask, CHANNEL *Chan )); -GLOBAL BOOLEAN Lists_ShowBans PARAMS(( CLIENT *Client, CHANNEL *Channel )); -GLOBAL BOOLEAN Lists_SendBans PARAMS(( CLIENT *Client )); -GLOBAL BOOLEAN Lists_IsBanEntry PARAMS(( CHAR *Mask, CHANNEL *Chan )); +GLOBAL bool Lists_CheckBanned PARAMS(( CLIENT *Client, CHANNEL *Chan )); +GLOBAL bool Lists_AddBanned PARAMS(( char *Mask, CHANNEL *Chan )); +GLOBAL void Lists_DelBanned PARAMS(( char *Mask, CHANNEL *Chan )); +GLOBAL bool Lists_ShowBans PARAMS(( CLIENT *Client, CHANNEL *Channel )); +GLOBAL bool Lists_SendBans PARAMS(( CLIENT *Client )); +GLOBAL bool Lists_IsBanEntry PARAMS(( char *Mask, CHANNEL *Chan )); -GLOBAL VOID Lists_DeleteChannel PARAMS(( CHANNEL *Chan )); +GLOBAL void Lists_DeleteChannel PARAMS(( CHANNEL *Chan )); -GLOBAL CHAR *Lists_MakeMask PARAMS(( CHAR *Pattern )); +GLOBAL char *Lists_MakeMask PARAMS(( char *Pattern )); #endif blob - 153ffedd9c48fa238e49ca5f34b4bd896b9c1fbd blob + 62113f11e77ca6435a4afdb6d1844395380cab67 --- src/ngircd/log.c +++ src/ngircd/log.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: log.c,v 1.52 2005/02/10 12:49:04 alex Exp $"; +static char UNUSED id[] = "$Id: log.c,v 1.53 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -44,18 +44,18 @@ static char UNUSED id[] = "$Id: log.c,v 1.52 2005/02/1 #include "log.h" -LOCAL CHAR Init_Txt[127]; +LOCAL char Init_Txt[127]; #ifdef DEBUG -LOCAL CHAR Error_File[FNAME_LEN]; +LOCAL char Error_File[FNAME_LEN]; #endif -LOCAL VOID Wall_ServerNotice PARAMS(( CHAR *Msg )); +LOCAL void Wall_ServerNotice PARAMS(( char *Msg )); -GLOBAL VOID -Log_Init( VOID ) +GLOBAL void +Log_Init( void ) { #ifdef SYSLOG /* Syslog initialisieren */ @@ -100,14 +100,14 @@ Log_Init( VOID ) #ifdef DEBUG -GLOBAL VOID -Log_InitErrorfile( VOID ) +GLOBAL void +Log_InitErrorfile( void ) { /* "Error-Log" initialisieren: stderr in Datei umlenken. Dort * landen z.B. alle Ausgaben von assert()-Aufrufen. */ /* Dateiname zusammen bauen */ - sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (LONG)getpid( )); + sprintf( Error_File, "%s/%s-%ld.err", ERROR_DIR, PACKAGE_NAME, (long)getpid( )); /* stderr umlenken */ fflush( stderr ); @@ -129,8 +129,8 @@ Log_InitErrorfile( VOID ) #endif -GLOBAL VOID -Log_Exit( VOID ) +GLOBAL void +Log_Exit( void ) { /* Good Bye! */ if( NGIRCd_SignalRestart ) Log( LOG_NOTICE, "%s done (restarting).", PACKAGE_NAME ); @@ -152,20 +152,20 @@ Log_Exit( VOID ) #ifdef PROTOTYPES -GLOBAL VOID -Log( INT Level, CONST CHAR *Format, ... ) +GLOBAL void +Log( int Level, const char *Format, ... ) #else -GLOBAL VOID +GLOBAL void Log( Level, Format, va_alist ) -INT Level; -CONST CHAR *Format; +int Level; +const char *Format; va_dcl #endif { /* Eintrag in Logfile(s) schreiben */ - CHAR msg[MAX_LOG_MSG_LEN]; - BOOLEAN snotice; + char msg[MAX_LOG_MSG_LEN]; + bool snotice; va_list ap; assert( Format != NULL ); @@ -173,10 +173,10 @@ va_dcl if( Level & LOG_snotice ) { /* Notice an User mit "s" Mode */ - snotice = TRUE; + snotice = true; Level &= ~LOG_snotice; } - else snotice = FALSE; + else snotice = false; #ifdef DEBUG if(( Level == LOG_DEBUG ) && ( ! NGIRCd_Debug )) return; @@ -196,7 +196,7 @@ va_dcl if( NGIRCd_NoDaemon ) { /* auf Konsole ausgeben */ - fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg ); + fprintf( stdout, "[%d:%d] %s\n", (int)getpid( ), Level, msg ); fflush( stdout ); } #ifdef SYSLOG @@ -222,8 +222,8 @@ va_dcl } /* Log */ -GLOBAL VOID -Log_Init_Resolver( VOID ) +GLOBAL void +Log_Init_Resolver( void ) { #ifdef SYSLOG openlog( PACKAGE_NAME, LOG_CONS|LOG_PID, LOG_LOCAL5 ); @@ -232,8 +232,8 @@ Log_Init_Resolver( VOID ) } /* Log_Init_Resolver */ -GLOBAL VOID -Log_Exit_Resolver( VOID ) +GLOBAL void +Log_Exit_Resolver( void ) { Log_Resolver( LOG_DEBUG, "Resolver sub-process %d done.", getpid( )); #ifdef SYSLOG @@ -243,19 +243,19 @@ Log_Exit_Resolver( VOID ) #ifdef PROTOTYPES -GLOBAL VOID -Log_Resolver( CONST INT Level, CONST CHAR *Format, ... ) +GLOBAL void +Log_Resolver( const int Level, const char *Format, ... ) #else -GLOBAL VOID +GLOBAL void Log_Resolver( Level, Format, va_alist ) -CONST INT Level; -CONST CHAR *Format; +const int Level; +const char *Format; va_dcl #endif { /* Eintrag des Resolver in Logfile(s) schreiben */ - CHAR msg[MAX_LOG_MSG_LEN]; + char msg[MAX_LOG_MSG_LEN]; va_list ap; assert( Format != NULL ); @@ -279,7 +279,7 @@ va_dcl if( NGIRCd_NoDaemon ) { /* Output to console */ - fprintf( stdout, "[%d:%d] %s\n", (INT)getpid( ), Level, msg ); + fprintf( stdout, "[%d:%d] %s\n", (int)getpid( ), Level, msg ); fflush( stdout ); } #ifdef SYSLOG @@ -288,8 +288,8 @@ va_dcl } /* Log_Resolver */ -LOCAL VOID -Wall_ServerNotice( CHAR *Msg ) +LOCAL void +Wall_ServerNotice( char *Msg ) { /* Server-Notice an entsprechende User verschicken */ blob - 24c3f88cfdff3b2124952587f1859e873de4905a blob + 05fa9f5752450a8261e9067eea219b7817666c88 --- src/ngircd/log.h +++ src/ngircd/log.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: log.h,v 1.15 2005/02/10 12:49:04 alex Exp $ + * $Id: log.h,v 1.16 2005/03/19 18:43:49 fw Exp $ * * Logging functions (header) */ @@ -35,18 +35,18 @@ #define LOG_snotice 1024 -GLOBAL VOID Log_Init PARAMS((VOID )); -GLOBAL VOID Log_Exit PARAMS((VOID )); +GLOBAL void Log_Init PARAMS((void )); +GLOBAL void Log_Exit PARAMS((void )); -GLOBAL VOID Log PARAMS((INT Level, CONST CHAR *Format, ... )); +GLOBAL void Log PARAMS((int Level, const char *Format, ... )); -GLOBAL VOID Log_Init_Resolver PARAMS((VOID )); -GLOBAL VOID Log_Exit_Resolver PARAMS((VOID )); +GLOBAL void Log_Init_Resolver PARAMS((void )); +GLOBAL void Log_Exit_Resolver PARAMS((void )); -GLOBAL VOID Log_Resolver PARAMS((CONST INT Level, CONST CHAR *Format, ... )); +GLOBAL void Log_Resolver PARAMS((const int Level, const char *Format, ... )); #ifdef DEBUG -GLOBAL VOID Log_InitErrorfile PARAMS((VOID )); +GLOBAL void Log_InitErrorfile PARAMS((void )); #endif blob - 2ba5bcae00001d260edc591dcba0383ee4453349 blob + ff5807723a83b24ca542e655184e6a5dc508c731 --- src/ngircd/match.c +++ src/ngircd/match.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: match.c,v 1.2 2002/12/12 12:24:18 alex Exp $"; +static char UNUSED id[] = "$Id: match.c,v 1.3 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -32,8 +32,8 @@ static char UNUSED id[] = "$Id: match.c,v 1.2 2002/12/ */ -LOCAL INT Matche PARAMS(( REGISTER CHAR *p, REGISTER CHAR *t )); -LOCAL INT Matche_After_Star PARAMS(( REGISTER CHAR *p, REGISTER CHAR *t )); +LOCAL int Matche PARAMS(( char *p, char *t )); +LOCAL int Matche_After_Star PARAMS(( char *p, char *t )); #define MATCH_PATTERN 6 /* bad pattern */ @@ -44,22 +44,22 @@ LOCAL INT Matche_After_Star PARAMS(( REGISTER CHAR *p, #define MATCH_VALID 1 /* valid match */ -GLOBAL BOOLEAN -Match( CHAR *Pattern, CHAR *String ) +GLOBAL bool +Match( char *Pattern, char *String ) { /* Pattern mit String vergleichen */ - if( Matche( Pattern, String ) == MATCH_VALID ) return TRUE; - else return FALSE; + if( Matche( Pattern, String ) == MATCH_VALID ) return true; + else return false; } /* Match */ -LOCAL INT -Matche( REGISTER CHAR *p, REGISTER CHAR *t ) +LOCAL int +Matche( char *p, char *t ) { - REGISTER CHAR range_start, range_end; - BOOLEAN invert; - BOOLEAN member_match; - BOOLEAN loop; + register char range_start, range_end; + bool invert; + bool member_match; + bool loop; for( ; *p; p++, t++ ) { @@ -83,25 +83,25 @@ Matche( REGISTER CHAR *p, REGISTER CHAR *t ) p++; /* check if this is a member match or exclusion match */ - invert = FALSE; + invert = false; if( *p == '!' || *p == '^' ) { - invert = TRUE; + invert = true; p++; } /* if closing bracket here or at range start then we have a malformed pattern */ if ( *p == ']' ) return MATCH_PATTERN; - member_match = FALSE; - loop = TRUE; + member_match = false; + loop = true; while( loop ) { /* if end of construct then loop is done */ if( *p == ']' ) { - loop = FALSE; + loop = false; continue; } @@ -140,16 +140,16 @@ Matche( REGISTER CHAR *p, REGISTER CHAR *t ) { if( *t >= range_start && *t <= range_end ) { - member_match = TRUE; - loop = FALSE; + member_match = true; + loop = false; } } else { if( *t >= range_end && *t <= range_start ) { - member_match = TRUE; - loop = FALSE; + member_match = true; + loop = false; } } } @@ -200,10 +200,10 @@ Matche( REGISTER CHAR *p, REGISTER CHAR *t ) } /* Matche */ -LOCAL INT -Matche_After_Star( REGISTER CHAR *p, REGISTER CHAR *t ) +LOCAL int +Matche_After_Star( char *p, char *t ) { - REGISTER INT nextp, match = 0; + register int nextp, match = 0; /* pass over existing ? and * in pattern */ while( *p == '?' || *p == '*' ) blob - 3c83427e53ced9d6589c738cf45b24e536ac2177 blob + ddd64835340d9fa0d76d9cea70b5e36542a1da5b --- src/ngircd/match.h +++ src/ngircd/match.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: match.h,v 1.2 2002/12/12 12:23:43 alex Exp $ + * $Id: match.h,v 1.3 2005/03/19 18:43:49 fw Exp $ * * Wildcard pattern matching (header) */ @@ -18,7 +18,7 @@ #define __match_h__ -GLOBAL BOOLEAN Match PARAMS(( CHAR *Pattern, CHAR *String )); +GLOBAL bool Match PARAMS(( char *Pattern, char *String )); #endif blob - 263c3a542e597d69126623d6cae196ac29a3b5dd blob + 31f08eeede2e60c80bc366619baab2745ccd4866 --- src/ngircd/ngircd.c +++ src/ngircd/ngircd.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: ngircd.c,v 1.94 2005/02/11 13:52:37 alex Exp $"; +static char UNUSED id[] = "$Id: ngircd.c,v 1.95 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -52,18 +52,18 @@ static char UNUSED id[] = "$Id: ngircd.c,v 1.94 2005/0 #include "ngircd.h" -LOCAL VOID Initialize_Signal_Handler PARAMS(( VOID )); -LOCAL VOID Signal_Handler PARAMS(( INT Signal )); +LOCAL void Initialize_Signal_Handler PARAMS(( void )); +LOCAL void Signal_Handler PARAMS(( int Signal )); -LOCAL VOID Show_Version PARAMS(( VOID )); -LOCAL VOID Show_Help PARAMS(( VOID )); +LOCAL void Show_Version PARAMS(( void )); +LOCAL void Show_Help PARAMS(( void )); -LOCAL VOID Pidfile_Create PARAMS(( LONG )); -LOCAL VOID Pidfile_Delete PARAMS(( VOID )); +LOCAL void Pidfile_Create PARAMS(( long )); +LOCAL void Pidfile_Delete PARAMS(( void )); -LOCAL VOID Fill_Version PARAMS(( VOID )); +LOCAL void Fill_Version PARAMS(( void )); -LOCAL VOID Setup_FDStreams PARAMS(( VOID )); +LOCAL void Setup_FDStreams PARAMS(( void )); GLOBAL int @@ -71,19 +71,20 @@ main( int argc, const char *argv[] ) { struct passwd *pwd; struct group *grp; - BOOLEAN ok, configtest = FALSE; - LONG pid, n; - INT i; + bool ok, configtest = false; + long pid; + int i; + size_t n; umask( 0077 ); - NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = FALSE; - NGIRCd_NoDaemon = NGIRCd_Passive = FALSE; + NGIRCd_SignalQuit = NGIRCd_SignalRestart = NGIRCd_SignalRehash = false; + NGIRCd_NoDaemon = NGIRCd_Passive = false; #ifdef DEBUG - NGIRCd_Debug = FALSE; + NGIRCd_Debug = false; #endif #ifdef SNIFFER - NGIRCd_Sniffer = FALSE; + NGIRCd_Sniffer = false; #endif strlcpy( NGIRCd_ConfFile, SYSCONFDIR, sizeof( NGIRCd_ConfFile )); strlcat( NGIRCd_ConfFile, CONFIG_FILE, sizeof( NGIRCd_ConfFile )); @@ -93,7 +94,7 @@ main( int argc, const char *argv[] ) /* Kommandozeile parsen */ for( i = 1; i < argc; i++ ) { - ok = FALSE; + ok = false; if(( argv[i][0] == '-' ) && ( argv[i][1] == '-' )) { /* Lange Option */ @@ -106,19 +107,19 @@ main( int argc, const char *argv[] ) strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); /* next parameter */ - i++; ok = TRUE; + i++; ok = true; } } if( strcmp( argv[i], "--configtest" ) == 0 ) { - configtest = TRUE; - ok = TRUE; + configtest = true; + ok = true; } #ifdef DEBUG if( strcmp( argv[i], "--debug" ) == 0 ) { - NGIRCd_Debug = TRUE; - ok = TRUE; + NGIRCd_Debug = true; + ok = true; } #endif if( strcmp( argv[i], "--help" ) == 0 ) @@ -129,19 +130,19 @@ main( int argc, const char *argv[] ) } if( strcmp( argv[i], "--nodaemon" ) == 0 ) { - NGIRCd_NoDaemon = TRUE; - ok = TRUE; + NGIRCd_NoDaemon = true; + ok = true; } if( strcmp( argv[i], "--passive" ) == 0 ) { - NGIRCd_Passive = TRUE; - ok = TRUE; + NGIRCd_Passive = true; + ok = true; } #ifdef SNIFFER if( strcmp( argv[i], "--sniffer" ) == 0 ) { - NGIRCd_Sniffer = TRUE; - ok = TRUE; + NGIRCd_Sniffer = true; + ok = true; } #endif if( strcmp( argv[i], "--version" ) == 0 ) @@ -153,15 +154,14 @@ main( int argc, const char *argv[] ) else if(( argv[i][0] == '-' ) && ( argv[i][1] != '-' )) { /* Kurze Option */ - - for( n = 1; n < (LONG)strlen( argv[i] ); n++ ) + for( n = 1; n < strlen( argv[i] ); n++ ) { - ok = FALSE; + ok = false; #ifdef DEBUG if( argv[i][n] == 'd' ) { - NGIRCd_Debug = TRUE; - ok = TRUE; + NGIRCd_Debug = true; + ok = true; } #endif if( argv[i][n] == 'f' ) @@ -172,31 +172,32 @@ main( int argc, const char *argv[] ) strlcpy( NGIRCd_ConfFile, argv[i + 1], sizeof( NGIRCd_ConfFile )); /* go to the following parameter */ - i++; n = (LONG)strlen( argv[i] ); - ok = TRUE; + i++; + n = strlen( argv[i] ); + ok = true; } } if( argv[i][n] == 'n' ) { - NGIRCd_NoDaemon = TRUE; - ok = TRUE; + NGIRCd_NoDaemon = true; + ok = true; } if( argv[i][n] == 'p' ) { - NGIRCd_Passive = TRUE; - ok = TRUE; + NGIRCd_Passive = true; + ok = true; } #ifdef SNIFFER if( argv[i][n] == 's' ) { - NGIRCd_Sniffer = TRUE; - ok = TRUE; + NGIRCd_Sniffer = true; + ok = true; } #endif if( argv[i][n] == 't' ) { - configtest = TRUE; - ok = TRUE; + configtest = true; + ok = true; } if( ! ok ) @@ -224,7 +225,7 @@ main( int argc, const char *argv[] ) #ifdef SNIFFER if( NGIRCd_Sniffer ) { - NGIRCd_Debug = TRUE; + NGIRCd_Debug = true; strcpy( NGIRCd_DebugLevel, "2" ); } #endif @@ -240,11 +241,11 @@ main( int argc, const char *argv[] ) { /* Initialize global variables */ NGIRCd_Start = time( NULL ); - (VOID)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); + (void)strftime( NGIRCd_StartStr, 64, "%a %b %d %Y at %H:%M:%S (%Z)", localtime( &NGIRCd_Start )); - NGIRCd_SignalRehash = FALSE; - NGIRCd_SignalRestart = FALSE; - NGIRCd_SignalQuit = FALSE; + NGIRCd_SignalRehash = false; + NGIRCd_SignalRestart = false; + NGIRCd_SignalQuit = false; /* Initialize modules, part I */ Log_Init( ); @@ -276,7 +277,7 @@ main( int argc, const char *argv[] ) if( ! NGIRCd_NoDaemon ) { /* fork child process */ - pid = (LONG)fork( ); + pid = (long)fork( ); if( pid > 0 ) { /* "Old" process: exit. */ @@ -290,20 +291,20 @@ main( int argc, const char *argv[] ) } /* New child process */ - (VOID)setsid( ); + (void)setsid( ); chdir( "/" ); /* Detach stdin, stdout and stderr */ - (VOID)Setup_FDStreams( ); + Setup_FDStreams( ); } /* Create PID file */ - pid = (LONG) getpid( ); + pid = (long) getpid( ); Pidfile_Create( pid ); /* Show user, group, and PID of the running daemon */ pwd = getpwuid( getuid( )); grp = getgrgid( getgid( )); - Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (LONG)getuid( ), grp ? grp->gr_name : "unknown", (LONG)getgid( ), pid); + Log( LOG_INFO, "Running as user %s(%ld), group %s(%ld), with PID %ld.", pwd ? pwd->pw_name : "unknown", (long)getuid( ), grp ? grp->gr_name : "unknown", (long)getgid( ), pid); /* Change working directory to home directory of the user * we are running as (when not running chroot()'ed!) */ @@ -390,8 +391,8 @@ main( int argc, const char *argv[] ) } /* main */ -LOCAL VOID -Fill_Version( VOID ) +LOCAL void +Fill_Version( void ) { NGIRCd_VersionAddition[0] = '\0'; @@ -446,13 +447,13 @@ Fill_Version( VOID ) } /* Fill_Version */ -GLOBAL VOID -NGIRCd_Rehash( VOID ) +GLOBAL void +NGIRCd_Rehash( void ) { - CHAR old_name[CLIENT_ID_LEN]; + char old_name[CLIENT_ID_LEN]; Log( LOG_NOTICE|LOG_snotice, "Re-reading configuration NOW!" ); - NGIRCd_SignalRehash = FALSE; + NGIRCd_SignalRehash = false; /* Close down all listening sockets */ Conn_ExitListeners( ); @@ -483,8 +484,8 @@ NGIRCd_Rehash( VOID ) } /* NGIRCd_Rehash */ -LOCAL VOID -Initialize_Signal_Handler( VOID ) +LOCAL void +Initialize_Signal_Handler( void ) { /* Signal-Handler initialisieren: einige Signale * werden ignoriert, andere speziell behandelt. */ @@ -530,8 +531,8 @@ Initialize_Signal_Handler( VOID ) } /* Initialize_Signal_Handler */ -LOCAL VOID -Signal_Handler( INT Signal ) +LOCAL void +Signal_Handler( int Signal ) { /* Signal-Handler. Dieser wird aufgerufen, wenn eines der Signale eintrifft, * fuer das wir uns registriert haben (vgl. Initialize_Signal_Handler). Die @@ -543,11 +544,11 @@ Signal_Handler( INT Signal ) case SIGINT: case SIGQUIT: /* wir soll(t)en uns wohl beenden ... */ - NGIRCd_SignalQuit = TRUE; + NGIRCd_SignalQuit = true; break; case SIGHUP: /* Konfiguration neu einlesen: */ - NGIRCd_SignalRehash = TRUE; + NGIRCd_SignalRehash = true; break; case SIGCHLD: /* Child-Prozess wurde beendet. Zombies vermeiden: */ @@ -562,8 +563,8 @@ Signal_Handler( INT Signal ) } /* Signal_Handler */ -LOCAL VOID -Show_Version( VOID ) +LOCAL void +Show_Version( void ) { puts( NGIRCd_Version ); puts( "Copyright (c)2001-2005 by Alexander Barton ()." ); @@ -573,8 +574,8 @@ Show_Version( VOID ) } /* Show_Version */ -LOCAL VOID -Show_Help( VOID ) +LOCAL void +Show_Help( void ) { #ifdef DEBUG puts( " -d, --debug log extra debug messages" ); @@ -591,8 +592,8 @@ Show_Help( VOID ) } /* Show_Help */ -LOCAL VOID -Pidfile_Delete( VOID ) +LOCAL void +Pidfile_Delete( void ) { /* Pidfile configured? */ if( ! Conf_PidFile[0] ) return; @@ -606,8 +607,8 @@ Pidfile_Delete( VOID ) } /* Pidfile_Delete */ -LOCAL VOID -Pidfile_Create( LONG pid ) +LOCAL void +Pidfile_Create( long pid ) { FILE *pidf; @@ -634,10 +635,10 @@ Pidfile_Create( LONG pid ) } /* Pidfile_Create */ -LOCAL VOID -Setup_FDStreams( VOID ) +LOCAL void +Setup_FDStreams( void ) { - INT fd; + int fd; /* Test if we can open /dev/null for reading and writing. If not * we are most probably chrooted already and the server has been blob - b82f312b284c141753619816b33da85a7d3c2767 blob + d7ae879cb888ee2c0f3a48b64af40a05d8241c8c --- src/ngircd/ngircd.h +++ src/ngircd/ngircd.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: ngircd.h,v 1.20 2005/02/09 09:52:58 alex Exp $ + * $Id: ngircd.h,v 1.21 2005/03/19 18:43:49 fw Exp $ * * Prototypes of the "main module". */ @@ -23,34 +23,34 @@ GLOBAL time_t NGIRCd_Start; /* Startzeitpunkt des Daemon */ -GLOBAL CHAR NGIRCd_StartStr[64]; -GLOBAL CHAR NGIRCd_Version[126]; -GLOBAL CHAR NGIRCd_VersionAddition[126]; +GLOBAL char NGIRCd_StartStr[64]; +GLOBAL char NGIRCd_Version[126]; +GLOBAL char NGIRCd_VersionAddition[126]; #ifdef DEBUG -GLOBAL BOOLEAN NGIRCd_Debug; /* Debug-Modus aktivieren */ +GLOBAL bool NGIRCd_Debug; /* Debug-Modus aktivieren */ #endif #ifdef SNIFFER -GLOBAL BOOLEAN NGIRCd_Sniffer; /* Sniffer aktivieren */ +GLOBAL bool NGIRCd_Sniffer; /* Sniffer aktivieren */ #endif -GLOBAL BOOLEAN NGIRCd_NoDaemon; /* nicht im Hintergrund laufen */ +GLOBAL bool NGIRCd_NoDaemon; /* nicht im Hintergrund laufen */ -GLOBAL BOOLEAN NGIRCd_Passive; /* nicht zu anderen Servern connecten */ +GLOBAL bool NGIRCd_Passive; /* nicht zu anderen Servern connecten */ -GLOBAL BOOLEAN NGIRCd_SignalQuit; /* TRUE: quit server*/ -GLOBAL BOOLEAN NGIRCd_SignalRestart; /* TRUE: restart server */ -GLOBAL BOOLEAN NGIRCd_SignalRehash; /* TRUE: reload configuration */ +GLOBAL bool NGIRCd_SignalQuit; /* true: quit server*/ +GLOBAL bool NGIRCd_SignalRestart; /* true: restart server */ +GLOBAL bool NGIRCd_SignalRehash; /* true: reload configuration */ -GLOBAL CHAR NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */ +GLOBAL char NGIRCd_DebugLevel[2]; /* Debug-Level fuer IRC_VERSION() */ -GLOBAL CHAR NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ +GLOBAL char NGIRCd_ConfFile[FNAME_LEN]; /* Konfigurationsdatei */ -GLOBAL CHAR NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ +GLOBAL char NGIRCd_ProtoID[COMMAND_LEN];/* Protokoll- und Server-Identifikation */ -GLOBAL VOID NGIRCd_Rehash PARAMS(( VOID )); +GLOBAL void NGIRCd_Rehash PARAMS(( void )); #endif blob - a470dff2b946bb09a6d88f01dbb17a7770244c62 blob + de6e696056830120a53539b11fa3e2999078b6bb --- src/ngircd/parse.c +++ src/ngircd/parse.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: parse.c,v 1.60 2004/01/17 03:17:49 alex Exp $"; +static char UNUSED id[] = "$Id: parse.c,v 1.61 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -100,32 +100,32 @@ COMMAND My_Commands[] = }; -LOCAL VOID Init_Request PARAMS(( REQUEST *Req )); +LOCAL void Init_Request PARAMS(( REQUEST *Req )); -LOCAL BOOLEAN Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )); -LOCAL BOOLEAN Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )); -LOCAL BOOLEAN Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed )); +LOCAL bool Validate_Prefix PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); +LOCAL bool Validate_Command PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); +LOCAL bool Validate_Args PARAMS(( CONN_ID Idx, REQUEST *Req, bool *Closed )); -LOCAL BOOLEAN Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req )); +LOCAL bool Handle_Request PARAMS(( CONN_ID Idx, REQUEST *Req )); GLOBAL COMMAND * -Parse_GetCommandStruct( VOID ) +Parse_GetCommandStruct( void ) { return My_Commands; } /* Parse_GetCommandStruct */ -GLOBAL BOOLEAN -Parse_Request( CONN_ID Idx, CHAR *Request ) +GLOBAL bool +Parse_Request( CONN_ID Idx, char *Request ) { /* Client-Request parsen. Bei einem schwerwiegenden Fehler wird - * die Verbindung geschlossen und FALSE geliefert. + * die Verbindung geschlossen und false geliefert. * Der Aufbau gueltiger Requests ist in RFC 2812, 2.3 definiert. */ REQUEST req; - CHAR *start, *ptr; - BOOLEAN closed; + char *start, *ptr; + bool closed; assert( Idx >= 0 ); assert( Request != NULL ); @@ -220,12 +220,12 @@ Parse_Request( CONN_ID Idx, CHAR *Request ) } /* Parse_Request */ -LOCAL VOID +LOCAL void Init_Request( REQUEST *Req ) { /* Neue Request-Struktur initialisieren */ - INT i; + int i; assert( Req != NULL ); @@ -236,18 +236,18 @@ Init_Request( REQUEST *Req ) } /* Init_Request */ -LOCAL BOOLEAN -Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ) +LOCAL bool +Validate_Prefix( CONN_ID Idx, REQUEST *Req, bool *Closed ) { CLIENT *client, *c; assert( Idx >= 0 ); assert( Req != NULL ); - *Closed = FALSE; + *Closed = false; /* ist ueberhaupt ein Prefix vorhanden? */ - if( ! Req->prefix ) return TRUE; + if( ! Req->prefix ) return true; /* Client-Struktur der Connection ermitteln */ client = Client_GetFromConn( Idx ); @@ -259,7 +259,7 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *C /* noch nicht registrierte Verbindung. * Das Prefix wird ignoriert. */ Req->prefix = NULL; - return TRUE; + return true; } /* pruefen, ob der im Prefix angegebene Client bekannt ist */ @@ -268,8 +268,8 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *C { /* im Prefix angegebener Client ist nicht bekannt */ Log( LOG_ERR, "Invalid prefix \"%s\", client not known (connection %d, command %s)!?", Req->prefix, Idx, Req->command ); - if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix \"%s\", client not known!?", Req->prefix )) *Closed = TRUE; - return FALSE; + if( ! Conn_WriteStr( Idx, "ERROR :Invalid prefix \"%s\", client not known!?", Req->prefix )) *Closed = true; + return false; } /* pruefen, ob der Client mit dem angegebenen Prefix in Richtung @@ -280,48 +280,48 @@ Validate_Prefix( CONN_ID Idx, REQUEST *Req, BOOLEAN *C /* das angegebene Prefix ist aus dieser Richtung, also * aus der gegebenen Connection, ungueltig! */ Log( LOG_ERR, "Spoofed prefix \"%s\" from \"%s\" (connection %d, command %s)!", Req->prefix, Client_Mask( Client_GetFromConn( Idx )), Idx, Req->command ); - Conn_Close( Idx, NULL, "Spoofed prefix", TRUE ); - *Closed = TRUE; - return FALSE; + Conn_Close( Idx, NULL, "Spoofed prefix", true); + *Closed = true; + return false; } - return TRUE; + return true; } /* Validate_Prefix */ -LOCAL BOOLEAN -Validate_Command( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ) +LOCAL bool +Validate_Command( CONN_ID Idx, REQUEST *Req, bool *Closed ) { assert( Idx >= 0 ); assert( Req != NULL ); - *Closed = FALSE; + *Closed = false; - return TRUE; + return true; } /* Validate_Comman */ -LOCAL BOOLEAN -Validate_Args( CONN_ID Idx, REQUEST *Req, BOOLEAN *Closed ) +LOCAL bool +Validate_Args( CONN_ID Idx, REQUEST *Req, bool *Closed ) { assert( Idx >= 0 ); assert( Req != NULL ); - *Closed = FALSE; + *Closed = false; - return TRUE; + return true; } /* Validate_Args */ -LOCAL BOOLEAN +LOCAL bool Handle_Request( CONN_ID Idx, REQUEST *Req ) { /* Client-Request verarbeiten. Bei einem schwerwiegenden Fehler - * wird die Verbindung geschlossen und FALSE geliefert. */ + * wird die Verbindung geschlossen und false geliefert. */ CLIENT *client, *target, *prefix; - CHAR str[LINE_LEN]; - BOOLEAN result; + char str[LINE_LEN]; + bool result; COMMAND *cmd; - INT i; + int i; assert( Idx >= 0 ); assert( Req != NULL ); @@ -343,13 +343,13 @@ Handle_Request( CONN_ID Idx, REQUEST *Req ) /* Status code without target!? */ if( Req->argc > 0 ) Log( LOG_WARNING, "Unknown target for status code %s: \"%s\"", Req->command, Req->argv[0] ); else Log( LOG_WARNING, "Unknown target for status code %s!", Req->command ); - return TRUE; + return true; } if( target == Client_ThisServer( )) { /* This server is the target, ignore it */ Log( LOG_DEBUG, "Ignored status code %s from \"%s\".", Req->command, Client_ID( client )); - return TRUE; + return true; } /* Determine source */ @@ -357,14 +357,14 @@ Handle_Request( CONN_ID Idx, REQUEST *Req ) { /* Oops, no prefix!? */ Log( LOG_WARNING, "Got status code %s from \"%s\" without prefix!?", Req->command, Client_ID( client )); - return TRUE; + return true; } else prefix = Client_Search( Req->prefix ); if( ! prefix ) { /* Oops, unknown prefix!? */ Log( LOG_WARNING, "Got status code %s from unknown source: \"%s\"", Req->command, Req->prefix ); - return TRUE; + return true; } /* Forward status code */ @@ -410,7 +410,7 @@ Handle_Request( CONN_ID Idx, REQUEST *Req ) /* Unbekannter Befehl */ Log( LOG_DEBUG, "Connection %d: Unknown command \"%s\", %d %s,%s prefix.", Client_Conn( client ), Req->command, Req->argc, Req->argc == 1 ? "parameter" : "parameters", Req->prefix ? "" : " no" ); if( Client_Type( client ) != CLIENT_SERVER ) return IRC_WriteStrClient( client, ERR_UNKNOWNCOMMAND_MSG, Client_ID( client ), Req->command ); - else return TRUE; + else return true; } /* Handle_Request */ blob - 217ca131dd16c44a9f117cfeeb034467453de77f blob + b095666601ba7018284055dc8698232de88c9d4c --- src/ngircd/parse.h +++ src/ngircd/parse.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: parse.h,v 1.10 2003/01/03 22:03:51 alex Exp $ + * $Id: parse.h,v 1.11 2005/03/19 18:43:49 fw Exp $ * * IRC command parser and validator (header) */ @@ -17,29 +17,30 @@ #ifndef __parse_h__ #define __parse_h__ +#include "portab.h" typedef struct _REQUEST /* vgl. RFC 2812, 2.3 */ { - CHAR *prefix; /* Prefix */ - CHAR *command; /* IRC-Befehl */ - CHAR *argv[15]; /* Parameter (max. 15: 0..14) */ - INT argc; /* Anzahl vorhandener Parameter */ + char *prefix; /* Prefix */ + char *command; /* IRC-Befehl */ + char *argv[15]; /* Parameter (max. 15: 0..14) */ + int argc; /* Anzahl vorhandener Parameter */ } REQUEST; typedef struct _COMMAND { - CHAR *name; /* command name */ - BOOLEAN (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); - CLIENT_TYPE type; /* valid client types (bit mask) */ - LONG lcount, rcount; /* number of local and remote calls */ - LONG bytes; /* number of bytes created */ + char *name; /* command name */ + bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request )); + CLIENT_TYPE type; /* valid client types (bit mask) */ + long lcount, rcount; /* number of local and remote calls */ + long bytes; /* number of bytes created */ } COMMAND; -GLOBAL BOOLEAN Parse_Request PARAMS((CONN_ID Idx, CHAR *Request )); +GLOBAL bool Parse_Request PARAMS((CONN_ID Idx, char *Request )); -GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( VOID )); +GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( void )); #endif blob - 5272cfa8bba369f5d17b6112b1b4d655656f2bde blob + f7a4b4a6a8db2e8acbdf81d233ae1b0b9fa59b6b --- src/ngircd/rendezvous.c +++ src/ngircd/rendezvous.c @@ -21,7 +21,7 @@ #ifdef RENDEZVOUS -static char UNUSED id[] = "$Id: rendezvous.c,v 1.4 2004/12/26 16:48:53 alex Exp $"; +static char UNUSED id[] = "$Id: rendezvous.c,v 1.5 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -62,7 +62,7 @@ static char UNUSED id[] = "$Id: rendezvous.c,v 1.4 200 typedef struct _service { - CHAR Desc[CLIENT_ID_LEN]; + char Desc[CLIENT_ID_LEN]; #ifdef APPLE dns_service_discovery_ref Discovery_Ref; mach_port_t Mach_Port; @@ -75,7 +75,7 @@ typedef struct _service LOCAL SERVICE My_Rendezvous[MAX_RENDEZVOUS]; -LOCAL VOID Unregister( INT Idx ); +LOCAL void Unregister( int Idx ); /* -- Apple API -- */ @@ -84,7 +84,7 @@ LOCAL VOID Unregister( INT Idx ); #define MAX_MACH_MSG_SIZE 512 -LOCAL VOID Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, VOID *Context ); +LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context ); #endif /* Apple */ @@ -101,11 +101,11 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( s #endif /* Howl */ -GLOBAL VOID Rendezvous_Init( VOID ) +GLOBAL void Rendezvous_Init( void ) { /* Initialize structures */ - INT i; + int i; #ifdef HOWL if( sw_discovery_init( &My_Discovery_Session ) != SW_OKAY ) @@ -127,11 +127,11 @@ GLOBAL VOID Rendezvous_Init( VOID ) } /* Rendezvous_Init */ -GLOBAL VOID Rendezvous_Exit( VOID ) +GLOBAL void Rendezvous_Exit( void ) { /* Clean up & exit module */ - INT i; + int i; for( i = 0; i < MAX_RENDEZVOUS; i++ ) { @@ -144,18 +144,18 @@ GLOBAL VOID Rendezvous_Exit( VOID ) } /* Rendezvous_Exit */ -GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR *Type, UINT Port ) +GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port ) { /* Register new service */ - INT i; + int i; /* Search free port structure */ for( i = 0; i < MAX_RENDEZVOUS; i++ ) if( ! My_Rendezvous[i].Desc[0] ) break; if( i >= MAX_RENDEZVOUS ) { Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: limit (%d) reached!", Name, MAX_RENDEZVOUS ); - return FALSE; + return false; } strlcpy( My_Rendezvous[i].Desc, Name, sizeof( My_Rendezvous[i].Desc )); @@ -166,7 +166,7 @@ GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR * { Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: can't register service!", My_Rendezvous[i].Desc ); My_Rendezvous[i].Desc[0] = '\0'; - return FALSE; + return false; } /* Get and save the corresponding Mach Port */ @@ -177,7 +177,7 @@ GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR * /* Here we actually leek a descriptor :-( */ My_Rendezvous[i].Discovery_Ref = 0; My_Rendezvous[i].Desc[0] = '\0'; - return FALSE; + return false; } #endif /* Apple */ @@ -186,29 +186,29 @@ GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR * { Log( LOG_ERR, "Can't register \"%s\" with Rendezvous: can't register service!", My_Rendezvous[i].Desc ); My_Rendezvous[i].Desc[0] = '\0'; - return FALSE; + return false; } #endif /* Howl */ Log( LOG_DEBUG, "Rendezvous: Registering \"%s\" ...", My_Rendezvous[i].Desc ); - return TRUE; + return true; } /* Rendezvous_Register */ -GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name ) +GLOBAL bool Rendezvous_Unregister( char *Name ) { /* Unregister service from rendezvous */ - INT i; - BOOLEAN ok; + int i; + bool ok; - ok = FALSE; + ok = false; for( i = 0; i < MAX_RENDEZVOUS; i++ ) { if( strcmp( Name, My_Rendezvous[i].Desc ) == 0 ) { Unregister( i ); - ok = TRUE; + ok = true; } } @@ -216,11 +216,11 @@ GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name ) } /* Rendezvous_Unregister */ -GLOBAL VOID Rendezvous_UnregisterListeners( VOID ) +GLOBAL void Rendezvous_UnregisterListeners( void ) { /* Unregister all our listening sockets from Rendezvous */ - INT i; + int i; for( i = 0; i < MAX_RENDEZVOUS; i++ ) { @@ -229,14 +229,14 @@ GLOBAL VOID Rendezvous_UnregisterListeners( VOID ) } /* Rendezvous_UnregisterListeners */ -GLOBAL VOID Rendezvous_Handler( VOID ) +GLOBAL void Rendezvous_Handler( void ) { /* Handle all Rendezvous stuff; this function must be called * periodically from the run loop of the main program */ #ifdef APPLE - INT i; - CHAR buffer[MAX_MACH_MSG_SIZE]; + int i; + char buffer[MAX_MACH_MSG_SIZE]; mach_msg_return_t result; mach_msg_header_t *msg; @@ -251,7 +251,7 @@ GLOBAL VOID Rendezvous_Handler( VOID ) /* Handle message */ if( result == MACH_MSG_SUCCESS ) DNSServiceDiscovery_handleReply( msg ); #ifdef DEBUG - else if( result != MACH_RCV_TIMED_OUT ) Log( LOG_DEBUG, "mach_msg(): %ld", (LONG)result ); + else if( result != MACH_RCV_TIMED_OUT ) Log( LOG_DEBUG, "mach_msg(): %ld", (long)result ); #endif /* Debug */ } #endif /* Apple */ @@ -263,7 +263,7 @@ GLOBAL VOID Rendezvous_Handler( VOID ) } /* Rendezvous_Handler */ -LOCAL VOID Unregister( INT Idx ) +LOCAL void Unregister( int Idx ) { /* Unregister service */ @@ -289,10 +289,10 @@ LOCAL VOID Unregister( INT Idx ) #ifdef APPLE -LOCAL VOID Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, VOID *Context ) +LOCAL void Registration_Reply_Handler( DNSServiceRegistrationReplyErrorType ErrCode, void *Context ) { SERVICE *s = (SERVICE *)Context; - CHAR txt[50]; + char txt[50]; if( ErrCode == kDNSServiceDiscoveryNoError ) { @@ -310,7 +310,7 @@ LOCAL VOID Registration_Reply_Handler( DNSServiceRegis strcpy( txt, "name conflict!" ); break; default: - sprintf( txt, "error code %ld!", (LONG)ErrCode ); + sprintf( txt, "error code %ld!", (long)ErrCode ); } Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt ); @@ -329,7 +329,7 @@ LOCAL VOID Registration_Reply_Handler( DNSServiceRegis LOCAL sw_result HOWL_API Registration_Reply_Handler( sw_discovery Session, sw_discovery_publish_status Status, UNUSED sw_discovery_oid Id, sw_opaque Extra ) { SERVICE *s = (SERVICE *)Extra; - CHAR txt[50]; + char txt[50]; assert( Session == My_Discovery_Session ); assert( Extra != NULL ); @@ -347,7 +347,7 @@ LOCAL sw_result HOWL_API Registration_Reply_Handler( s strcpy( txt, "name conflict!" ); break; default: - sprintf( txt, "error code %ld!", (LONG)Status ); + sprintf( txt, "error code %ld!", (long)Status ); } Log( LOG_INFO, "Can't register \"%s\" with Rendezvous: %s", s->Desc, txt ); blob - fa1d30c20ad476d8d2de2d39511997d091d0e5dc blob + 1f8df67be6e0f55d51520e55e6d0b5350fdfabb4 --- src/ngircd/rendezvous.h +++ src/ngircd/rendezvous.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: rendezvous.h,v 1.1 2003/02/23 12:02:26 alex Exp $ + * $Id: rendezvous.h,v 1.2 2005/03/19 18:43:49 fw Exp $ * * "Rendezvous" functions (Header) */ @@ -20,15 +20,15 @@ #define __rdezvous_h__ -GLOBAL VOID Rendezvous_Init( VOID ); -GLOBAL VOID Rendezvous_Exit( VOID ); +GLOBAL void Rendezvous_Init( void ); +GLOBAL void Rendezvous_Exit( void ); -GLOBAL BOOLEAN Rendezvous_Register( CHAR *Name, CHAR *Type, UINT Port ); +GLOBAL bool Rendezvous_Register( char *Name, char *Type, unsigned int Port ); -GLOBAL BOOLEAN Rendezvous_Unregister( CHAR *Name ); -GLOBAL VOID Rendezvous_UnregisterListeners( VOID ); +GLOBAL bool Rendezvous_Unregister( char *Name ); +GLOBAL void Rendezvous_UnregisterListeners( void ); -GLOBAL VOID Rendezvous_Handler( VOID ); +GLOBAL void Rendezvous_Handler( void ); #endif /* __rdezvous_h__ */ blob - 846e5236d40b1d630c22405a9e1477aa81622a9b blob + 5b33acc405faf1118c38bd5393d4539dcc6a3045 --- src/ngircd/resolve.c +++ src/ngircd/resolve.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: resolve.c,v 1.10 2005/03/05 12:57:14 alex Exp $"; +static char UNUSED id[] = "$Id: resolve.c,v 1.11 2005/03/19 18:43:49 fw Exp $"; #include "imp.h" #include @@ -42,22 +42,22 @@ static char UNUSED id[] = "$Id: resolve.c,v 1.10 2005/ #ifdef IDENTAUTH -LOCAL VOID Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, INT Sock, INT w_fd )); +LOCAL void Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, int Sock, int w_fd )); #else -LOCAL VOID Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, INT w_fd )); +LOCAL void Do_ResolveAddr PARAMS(( struct sockaddr_in *Addr, int w_fd )); #endif -LOCAL VOID Do_ResolveName PARAMS(( CHAR *Host, INT w_fd )); +LOCAL void Do_ResolveName PARAMS(( char *Host, int w_fd )); #ifdef h_errno -LOCAL CHAR *Get_Error PARAMS(( INT H_Error )); +LOCAL char *Get_Error PARAMS(( int H_Error )); #endif -LOCAL RES_STAT *New_Res_Stat PARAMS(( VOID )); +LOCAL RES_STAT *New_Res_Stat PARAMS(( void )); -GLOBAL VOID -Resolve_Init( VOID ) +GLOBAL void +Resolve_Init( void ) { /* Initialize module */ @@ -77,7 +77,7 @@ Resolve_Addr( struct sockaddr_in *Addr ) * can't be forked, this functions returns NULL. */ RES_STAT *s; - INT pid; + int pid; s = New_Res_Stat( ); if( ! s ) return NULL; @@ -116,13 +116,13 @@ Resolve_Addr( struct sockaddr_in *Addr ) GLOBAL RES_STAT * -Resolve_Name( CHAR *Host ) +Resolve_Name( char *Host ) { /* Resolve hostname (asynchronous!). On errors, e.g. if the child * process can't be forked, this functions returns NULL. */ RES_STAT *s; - INT pid; + int pid; s = New_Res_Stat( ); if( ! s ) return NULL; @@ -157,26 +157,26 @@ Resolve_Name( CHAR *Host ) #ifdef IDENTAUTH -LOCAL VOID -Do_ResolveAddr( struct sockaddr_in *Addr, int Sock, INT w_fd ) +LOCAL void +Do_ResolveAddr( struct sockaddr_in *Addr, int Sock, int w_fd ) #else -LOCAL VOID -Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd ) +LOCAL void +Do_ResolveAddr( struct sockaddr_in *Addr, int w_fd ) #endif { /* Resolver sub-process: resolve IP address and write result into * pipe to parent. */ - CHAR hostname[HOST_LEN]; + char hostname[HOST_LEN]; struct hostent *h; - INT len; + int len; #ifdef IDENTAUTH - CHAR *res; + char *res; #endif /* Resolve IP address */ Log_Resolver( LOG_DEBUG, "Now resolving %s ...", inet_ntoa( Addr->sin_addr )); - h = gethostbyaddr( (CHAR *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET ); + h = gethostbyaddr( (char *)&Addr->sin_addr, sizeof( Addr->sin_addr ), AF_INET ); if( h ) strlcpy( hostname, h->h_name, sizeof( hostname )); else { @@ -219,16 +219,16 @@ Do_ResolveAddr( struct sockaddr_in *Addr, INT w_fd ) } /* Do_ResolveAddr */ -LOCAL VOID -Do_ResolveName( CHAR *Host, INT w_fd ) +LOCAL void +Do_ResolveName( char *Host, int w_fd ) { /* Resolver sub-process: resolve name and write result into pipe * to parent. */ - CHAR ip[16]; + char ip[16]; struct hostent *h; struct in_addr *addr; - INT len; + int len; Log_Resolver( LOG_DEBUG, "Now resolving \"%s\" ...", Host ); @@ -263,8 +263,8 @@ Do_ResolveName( CHAR *Host, INT w_fd ) #ifdef h_errno -LOCAL CHAR * -Get_Error( INT H_Error ) +LOCAL char * +Get_Error( int H_Error ) { /* Get error message for H_Error */ @@ -287,7 +287,7 @@ Get_Error( INT H_Error ) LOCAL RES_STAT * -New_Res_Stat( VOID ) +New_Res_Stat( void ) { RES_STAT *s; blob - 2956fac14b07b68160cebe7feb9c66c1c6261900 blob + 596a0832bebbc01dd4152c9bfbf4f39acbfb2182 --- src/ngircd/resolve.h +++ src/ngircd/resolve.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: resolve.h,v 1.7 2004/05/11 00:01:11 alex Exp $ + * $Id: resolve.h,v 1.8 2005/03/19 18:43:49 fw Exp $ * * Asynchronous resolver (header) */ @@ -27,18 +27,18 @@ typedef struct _Res_Stat { - INT pid; /* PID des Child-Prozess */ - INT pipe[2]; /* Pipe fuer IPC */ - INT stage; /* Hostname/IP(0) or IDENT(1)? */ - INT bufpos; /* Position in buffer */ - CHAR buffer[HOST_LEN]; /* Buffer */ + int pid; /* PID des Child-Prozess */ + int pipe[2]; /* Pipe fuer IPC */ + int stage; /* Hostname/IP(0) or IDENT(1)? */ + int bufpos; /* Position in buffer */ + char buffer[HOST_LEN]; /* Buffer */ } RES_STAT; GLOBAL fd_set Resolver_FDs; -GLOBAL VOID Resolve_Init PARAMS(( VOID )); +GLOBAL void Resolve_Init PARAMS(( void )); #ifdef IDENTAUTH GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr, int Sock )); @@ -46,7 +46,7 @@ GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr GLOBAL RES_STAT *Resolve_Addr PARAMS(( struct sockaddr_in *Addr )); #endif -GLOBAL RES_STAT *Resolve_Name PARAMS(( CHAR *Host )); +GLOBAL RES_STAT *Resolve_Name PARAMS(( char *Host )); #endif blob - cb50bbd62eaa296c3d1c7f582f28a3d85e51d4cc blob + d14805893ce100972772e311a370b617a971d2eb --- src/portab/portab.h +++ src/portab/portab.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: portab.h,v 1.17 2004/03/15 19:26:39 alex Exp $ + * $Id: portab.h,v 1.18 2005/03/19 18:43:50 fw Exp $ * * Portability functions and declarations (header for libngbportab). */ @@ -24,7 +24,24 @@ # include #endif +#ifdef HAVE_INTTYPES_H +# include +# define NGIRC_GOT_INTTYPES +#else +# ifdef HAVE_STDINT_H +# include +# define NGIRC_GOT_INTTYPES +# endif +#endif +#ifdef HAVE_STDDEF_H +# include +#endif + +#ifdef HAVE_STDBOOL_H +# include +#endif + /* compiler features */ #if (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)) @@ -45,14 +62,8 @@ /* keywords */ - -#define EXTERN extern -#define STATIC static #define LOCAL static -#define CONST const -#define REGISTER register - /* datatypes */ #ifndef PROTOTYPES @@ -61,40 +72,31 @@ # endif #endif -typedef void VOID; typedef void POINTER; -typedef signed int INT; -typedef unsigned int UINT; -typedef signed long LONG; -typedef unsigned long ULONG; - -typedef signed char INT8; +#ifdef NGIRC_GOT_INTTYPES +typedef uint8_t UINT8; +typedef uint16_t UINT16; +typedef uint32_t UINT32; +#else typedef unsigned char UINT8; -typedef signed short INT16; typedef unsigned short UINT16; -typedef signed long INT32; -typedef unsigned long UINT32; +typedef unsigned int UINT32; +#endif -typedef double DOUBLE; -typedef float FLOAT; +#ifndef HAVE_STDBOOL_H +typedef unsigned char bool; +#define true (bool)1 +#define false (bool)0 +#endif -typedef char CHAR; - -typedef UINT8 BOOLEAN; - -#undef TRUE -#define TRUE (BOOLEAN)1 - -#undef FALSE -#define FALSE (BOOLEAN)0 - -#undef NULL +#ifndef NULL #ifdef PROTOTYPES -# define NULL (VOID *)0 +# define NULL (void *)0 #else # define NULL 0L #endif +#endif #undef GLOBAL #define GLOBAL @@ -130,20 +132,20 @@ typedef UINT8 BOOLEAN; #endif #ifndef HAVE_SNPRINTF -EXTERN INT snprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, ... )); +extern int snprintf PARAMS(( char *str, size_t count, const char *fmt, ... )); #endif #ifndef HAVE_STRLCAT -EXTERN size_t strlcat PARAMS(( CHAR *dst, CONST CHAR *src, size_t size )); +extern size_t strlcat PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_STRLCPY -EXTERN size_t strlcpy PARAMS(( CHAR *dst, CONST CHAR *src, size_t size )); +extern size_t strlcpy PARAMS(( char *dst, const char *src, size_t size )); #endif #ifndef HAVE_VSNPRINTF #include -EXTERN INT vsnprintf PARAMS(( CHAR *str, size_t count, CONST CHAR *fmt, va_list args )); +extern int vsnprintf PARAMS(( char *str, size_t count, const char *fmt, va_list args )); #endif #ifndef PACKAGE_NAME blob - 055799eabb68be0a4ae88911a7b8e5b077e435f1 blob + d9bea61f71d68d8943a2541609dcd189f914fe24 --- src/portab/portabtest.c +++ src/portab/portabtest.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: portabtest.c,v 1.11 2003/01/04 10:40:01 alex Exp $"; +static char UNUSED id[] = "$Id: portabtest.c,v 1.12 2005/03/19 18:43:50 fw Exp $"; #include "imp.h" #include @@ -25,20 +25,17 @@ static char UNUSED id[] = "$Id: portabtest.c,v 1.11 20 #include "exp.h" -LOCAL VOID Panic PARAMS (( CHAR *Reason, INT Code )); +LOCAL void Panic PARAMS (( char *Reason, int Code )); GLOBAL int -main( VOID ) +main( void ) { /* validate datatypes */ - if( FALSE != 0 ) Panic( "FALSE", 1 ); - if( TRUE != 1 ) Panic( "TRUE", 1 ); - if( sizeof( INT8 ) != 1 ) Panic( "INT8", 1 ); + if( false != 0 ) Panic( "false", 1 ); + if( true != 1 ) Panic( "true", 1 ); if( sizeof( UINT8 ) != 1 ) Panic( "UINT8", 1 ); - if( sizeof( INT16 ) != 2 ) Panic( "INT16", 1 ); if( sizeof( UINT16 ) != 2 ) Panic( "UINT16", 1 ); - if( sizeof( INT32 ) != 4 ) Panic( "INT32", 1 ); if( sizeof( UINT32 ) != 4 ) Panic( "UINT32", 1 ); #ifdef PROTOTYPES @@ -54,8 +51,8 @@ main( VOID ) } /* portab_check_types */ -LOCAL VOID -Panic( CHAR *Reason, INT Code ) +LOCAL void +Panic( char *Reason, int Code ) { /* Oops, something failed!? */ fprintf( stderr, "Oops, test for %s failed!?", Reason ); blob - 5e2c72228c1c6429d85f290abc0a4cd5e225f4c7 blob + ee93d1d6fcfba52a31b550d4e633edfd63ca3e42 --- src/portab/strlcpy.c +++ src/portab/strlcpy.c @@ -19,7 +19,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: strlcpy.c,v 1.4 2005/02/27 09:29:13 alex Exp $"; +static char UNUSED id[] = "$Id: strlcpy.c,v 1.5 2005/03/19 18:43:50 fw Exp $"; #include "imp.h" #include @@ -31,7 +31,7 @@ static char UNUSED id[] = "$Id: strlcpy.c,v 1.4 2005/0 #ifndef HAVE_STRLCAT GLOBAL size_t -strlcat( CHAR *dst, CONST CHAR *src, size_t size ) +strlcat( char *dst, const char *src, size_t size ) { /* Like strncat() but does not 0 fill the buffer and * always null terminates. */ @@ -55,7 +55,7 @@ strlcat( CHAR *dst, CONST CHAR *src, size_t size ) #ifndef HAVE_STRLCPY GLOBAL size_t -strlcpy( CHAR *dst, CONST CHAR *src, size_t size ) +strlcpy( char *dst, const char *src, size_t size ) { /* Like strncpy but does not 0 fill the buffer and * always null terminates. */ blob - 2792c7edf63acea5e932b410aaa8ccd2e37b159b blob + a83906922c1d1239faeaf8bfb4380b208eae517e --- src/tool/tool.c +++ src/tool/tool.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: tool.c,v 1.2 2005/01/25 16:16:48 alex Exp $"; +static char UNUSED id[] = "$Id: tool.c,v 1.3 2005/03/19 18:43:52 fw Exp $"; #include "imp.h" #include @@ -26,14 +26,14 @@ static char UNUSED id[] = "$Id: tool.c,v 1.2 2005/01/2 #include "tool.h" -GLOBAL VOID -ngt_TrimStr( CHAR *String ) +GLOBAL void +ngt_TrimStr( char *String ) { /* Mit ngt_TrimStr() werden fuehrende und folgende Leerzeichen, * Tabulatoren und Zeilenumbrueche (ASCII 10 und ASCII 13) aus * dem String entfernt. */ - CHAR *start, *ptr; + char *start, *ptr; assert( String != NULL ); @@ -51,14 +51,14 @@ ngt_TrimStr( CHAR *String ) } /* ngt_TrimStr */ -GLOBAL CHAR * -ngt_LowerStr( CHAR *String ) +GLOBAL char * +ngt_LowerStr( char *String ) { /* String in Kleinbuchstaben konvertieren. Der uebergebene * Speicherbereich wird durch das Ergebnis ersetzt, zusaetzlich * wird dieser auch als Pointer geliefert. */ - CHAR *ptr; + char *ptr; assert( String != NULL ); @@ -74,13 +74,13 @@ ngt_LowerStr( CHAR *String ) } /* ngt_LowerStr */ -GLOBAL VOID -ngt_TrimLastChr( CHAR *String, CONST CHAR Chr) +GLOBAL void +ngt_TrimLastChr( char *String, const char Chr) { /* If last character in the string matches Chr, remove it. * Empty strings are handled correctly. */ - UINT len; + unsigned int len; assert( String != NULL ); blob - 13d4a9fca27252762db261e06609d10f2b65b196 blob + 5b386e59c71f19f89f2319a035abee4cec9afb52 --- src/tool/tool.h +++ src/tool/tool.h @@ -8,7 +8,7 @@ * (at your option) any later version. * Please read the file COPYING, README and AUTHORS for more information. * - * $Id: tool.h,v 1.2 2005/02/04 13:09:03 alex Exp $ + * $Id: tool.h,v 1.3 2005/03/19 18:43:53 fw Exp $ * * Tool functions (Header) */ @@ -18,11 +18,11 @@ #define __tool_h__ -GLOBAL VOID ngt_TrimLastChr PARAMS((CHAR *String, CONST CHAR Chr )); +GLOBAL void ngt_TrimLastChr PARAMS((char *String, const char Chr )); -GLOBAL VOID ngt_TrimStr PARAMS((CHAR *String )); +GLOBAL void ngt_TrimStr PARAMS((char *String )); -GLOBAL CHAR *ngt_LowerStr PARAMS((CHAR *String )); +GLOBAL char *ngt_LowerStr PARAMS((char *String )); #endif