logic fixes, lf fixes and decl fixups
This commit is contained in:
parent
97c8baa979
commit
01eebbdd1c
29 changed files with 340 additions and 329 deletions
|
@ -25,9 +25,9 @@
|
|||
#define _DNS_H_
|
||||
|
||||
int InitDns( void );
|
||||
void do_dns(int notused, short event, void *arg);
|
||||
void do_dns( int notused, short event, void *arg );
|
||||
void FiniDns( void );
|
||||
void canx_dns( Module* modptr );
|
||||
void do_dns_stats_Z( Client * );
|
||||
void canx_dns( Module *modptr );
|
||||
void do_dns_stats_Z( const Client *u );
|
||||
|
||||
#endif /* _DNS_H_ */
|
||||
|
|
|
@ -68,7 +68,7 @@ extern struct lang_stats {
|
|||
typedef void (*LANGDebugFunc) (const char *fmt, ...);
|
||||
|
||||
|
||||
void LANGSetData( char* key, void* data, int size, char *lang, int keydone );
|
||||
void LANGSetData( char *key, void *data, int size, char *lang, int keydone );
|
||||
int LANGGotData( char *key, char *lang );
|
||||
int LANGDumpDB( char *lang, int missing, void *mylist );
|
||||
int LANGNewLang( char *lang );
|
||||
|
|
|
@ -1680,7 +1680,7 @@ EXPORTFUNC int os_sock_close( OS_SOCKET sock );
|
|||
EXPORTFUNC int os_sock_write( OS_SOCKET s, const char *buf, int len );
|
||||
EXPORTFUNC int os_sock_sendto( OS_SOCKET s, const char *buf, int len, int flags, const struct sockaddr* to, int tolen );
|
||||
EXPORTFUNC int os_sock_read( OS_SOCKET s, char *buf, int len );
|
||||
EXPORTFUNC int os_sock_recvfrom( OS_SOCKET s, char* buf, int len, int flags, struct sockaddr *from, int *fromlen );
|
||||
EXPORTFUNC int os_sock_recvfrom( OS_SOCKET s, char *buf, int len, int flags, struct sockaddr *from, int *fromlen );
|
||||
EXPORTFUNC int os_sock_set_nonblocking( OS_SOCKET s );
|
||||
EXPORTFUNC int os_sock_connect( OS_SOCKET s, const struct sockaddr* name, int namelen );
|
||||
EXPORTFUNC OS_SOCKET os_sock_socket( int socket_family, int socket_type, int protocol );
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#define _SERVER_H_
|
||||
|
||||
Client *AddServer( const char *name, const char *uplink, const char *hops, const char *numeric, const char *infoline );
|
||||
void DelServer( const char *name, const char* reason );
|
||||
void DelServer( const char *name, const char *reason );
|
||||
int ns_cmd_serverlist( const CmdParams *cmdparams );
|
||||
int InitServers( void );
|
||||
void PingServers( void );
|
||||
|
|
|
@ -40,8 +40,8 @@
|
|||
|
||||
static int
|
||||
_gdbm_rename (old_name, new_name)
|
||||
char* old_name;
|
||||
char* new_name;
|
||||
char *old_name;
|
||||
char *new_name;
|
||||
{
|
||||
if (unlink (new_name) != 0)
|
||||
return -1;
|
||||
|
|
|
@ -243,7 +243,7 @@ void send_sjoin( const char *source, const char *target, const char *chan, const
|
|||
send_cmd( ":%s %s %lu %s + :%s", source, MSG_SJOIN, ts, chan, target );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s 0 %lu :%s", MSG_NICK, nick, ts, newmode, ident, host, server, ts, realname );
|
||||
}
|
||||
|
|
|
@ -249,7 +249,7 @@ void send_sjoin( const char *source, const char *target, const char *chan, const
|
|||
send_cmd( ":%s %s %lu %s + :%s", source, MSG_SJOIN, ts, chan, target );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s 0 %lu :%s", MSG_NICK, nick, ts, newmode, ident, host, server, ts, realname );
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@ char *MSG_SENDSNO = "SENDSNO";
|
|||
#define CMODE_ONLYSECURE 0x40000000
|
||||
#define CMODE_NONICKCHANGE 0x80000000
|
||||
|
||||
static void m_private( char* origin, char **av, int ac, int srv );
|
||||
static void m_private( char *origin, char **av, int ac, int srv );
|
||||
static void m_nick( char *origin, char **argv, int argc, int srv );
|
||||
static void m_topic( char *origin, char **argv, int argc, int srv );
|
||||
static void m_kick( char *origin, char **argv, int argc, int srv );
|
||||
|
@ -298,7 +298,7 @@ void send_cmode( const char *sourceserver, const char *sourceuser, const char *c
|
|||
send_cmd( ":%s %s %s %s %s %lu", sourceuser, MSG_MODE, chan, mode, args, ts );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s", MSG_NICK, nick );
|
||||
}
|
||||
|
@ -369,7 +369,7 @@ static void m_part( char *origin, char **argv, int argc, int srv )
|
|||
* @return none
|
||||
*/
|
||||
|
||||
static void m_private( char* origin, char **av, int ac, int srv )
|
||||
static void m_private( char *origin, char **av, int ac, int srv )
|
||||
{
|
||||
char *p;
|
||||
char nick[MAXNICK];
|
||||
|
|
|
@ -182,7 +182,7 @@ void send_server_connect( const char *name, const int numeric, const char *infol
|
|||
send_cmd( "%s %s :%s", MSG_SERVER, name, infoline );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s :%s", MSG_NICK, nick, ts, newmode, ident, host, server, realname );
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ void send_cmode( const char *sourceserver, const char *sourceuser, const char *c
|
|||
send_cmd( ":%s %s %s %s %s %lu", sourceuser, MSG_MODE, chan, mode, args, ts );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s :%s", MSG_NICK, nick, ts, newmode, ident, host, server, realname );
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ void send_cmode( const char *sourceserver, const char *sourceuser, const char *c
|
|||
send_cmd( ":%s %s %s %s %s %lu", sourceuser, MSG_MODE, chan, mode, args, ts );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s %s %s%lu :%s", MSG_NICK, nick, ts, newmode, ident, host, host, server, nick, ts, realname );
|
||||
}
|
||||
|
|
|
@ -437,13 +437,13 @@ void send_cmode( const char *sourceserver, const char *sourceuser, const char *c
|
|||
send_cmd( ":%s %s %s %s %s %lu", sourceuser, MSGTOK( MODE ), chan, mode, args, ts );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s 0 :%s", MSGTOK( NICK ), nick, ts, ident, host, server, realname );
|
||||
send_cmd( ":%s %s %s :%s", nick, MSGTOK( MODE ), nick, newmode );
|
||||
}
|
||||
|
||||
void send_vctrl( const int uprot, const int nicklen, const int modex, const int gc, const char* netname )
|
||||
void send_vctrl( const int uprot, const int nicklen, const int modex, const int gc, const char *netname )
|
||||
{
|
||||
send_cmd( "%s %d %d %d %d 0 0 0 0 0 0 0 0 0 0 :%s", MSG_VCTRL, uprot, nicklen, modex, gc, netname );
|
||||
}
|
||||
|
|
|
@ -317,12 +317,12 @@ void send_cmode( const char *sourceserver, const char *sourceuser, const char *c
|
|||
send_cmd( ":%s %s %s %s %s %lu", sourceuser, MSG_MODE, chan, mode, args, ts );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s %s 0 %lu :%s", MSG_NICK, nick, ts, newmode, ident, host, server, ts, realname );
|
||||
}
|
||||
|
||||
void send_vctrl( const int uprot, const int nicklen, const int modex, const int gc, const char* netname )
|
||||
void send_vctrl( const int uprot, const int nicklen, const int modex, const int gc, const char *netname )
|
||||
{
|
||||
send_cmd( "%s %d %d %d %d 0 0 0 0 0 0 0 0 0 0 :%s", MSG_VCTRL, uprot, nicklen, modex, gc, netname );
|
||||
}
|
||||
|
|
|
@ -446,7 +446,7 @@ void send_sjoin( const char *source, const char *target, const char *chan, const
|
|||
send_cmd( ":%s %s %lu %s + :%s", source, MSGTOK( SJOIN ), ts, chan, target );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s 0 %s * :%s", MSGTOK( NICK ), nick, ts, ident, host, server, newmode, realname );
|
||||
}
|
||||
|
@ -500,7 +500,7 @@ void send_svstime( const char *source, const unsigned long ts )
|
|||
|
||||
static void m_server( char *origin, char **argv, int argc, int srv )
|
||||
{
|
||||
char* s = argv[argc-1];
|
||||
char *s = argv[argc-1];
|
||||
if( *origin== 0 )
|
||||
{
|
||||
/* server desc from uplink includes extra info so we need to
|
||||
|
|
|
@ -591,7 +591,7 @@ void send_sjoin( const char *source, const char *target, const char *chan, const
|
|||
send_cmd( ":%s %s %lu %s + :%s", source, MSGTOK( SJOIN ), ts, chan, target );
|
||||
}
|
||||
|
||||
void send_nick( const char *nick, const unsigned long ts, const char* newmode, const char *ident, const char *host, const char* server, const char *realname )
|
||||
void send_nick( const char *nick, const unsigned long ts, const char *newmode, const char *ident, const char *host, const char *server, const char *realname )
|
||||
{
|
||||
send_cmd( "%s %s 1 %lu %s %s %s 0 %s * :%s", MSGTOK( NICK ), nick, ts, ident, host, server, newmode, realname );
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ void send_svstime( const char *source, const unsigned long ts )
|
|||
|
||||
static void m_server( char *origin, char **argv, int argc, int srv )
|
||||
{
|
||||
char* s = argv[argc-1];
|
||||
char *s = argv[argc-1];
|
||||
if( *origin== 0 )
|
||||
{
|
||||
/* server desc from uplink includes extra info so we need to
|
||||
|
|
|
@ -40,7 +40,7 @@ typedef void( *htmlhandler )( void );
|
|||
|
||||
/** HTML handler table struct */
|
||||
typedef struct htmlfunc {
|
||||
char* directive;
|
||||
char *directive;
|
||||
htmlhandler handler;
|
||||
}htmlfunc;
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ int ss_event_signon( const CmdParams *cmdparams )
|
|||
*/
|
||||
|
||||
static int operlistaway = 0;
|
||||
static char* operlistserver;
|
||||
static char *operlistserver;
|
||||
|
||||
static int operlist( Client *u, void * v )
|
||||
{
|
||||
|
|
|
@ -41,7 +41,7 @@ static Bot *template_bot;
|
|||
* You must change this or your module will not load.
|
||||
*/
|
||||
|
||||
const char* template_copyright[] =
|
||||
const char *template_copyright[] =
|
||||
{
|
||||
"Copyright (c) <year>, <your name>",
|
||||
NULL
|
||||
|
|
|
@ -191,7 +191,8 @@ static int cmd_level( const CmdParams *cmdparams )
|
|||
otheruser = FindUser( cmdparams->av[0] );
|
||||
/* Force recalc user level */
|
||||
otheruser->user->ulevel = -1;
|
||||
if( !otheruser ) {
|
||||
if( otheruser == NULL )
|
||||
{
|
||||
irc_prefmsg( ns_botptr, cmdparams->source, __( "User %s not found", cmdparams->source ), cmdparams->av[0] );
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
|
|
@ -121,7 +121,7 @@ void AddBan( const char *type, const char *user, const char *host, const char *m
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
ban = new_ban( mask );
|
||||
if( !ban )
|
||||
if( ban == NULL )
|
||||
return;
|
||||
strlcpy( ban->type, type, 8 );
|
||||
strlcpy( ban->user, user, MAXUSER );
|
||||
|
@ -167,7 +167,7 @@ void DelBan( const char *mask )
|
|||
|
||||
SET_SEGV_LOCATION();
|
||||
bansnode = hash_lookup( banhash, mask );
|
||||
if( !bansnode )
|
||||
if( bansnode == NULL )
|
||||
{
|
||||
nlog( LOG_WARNING, "DelBan: unknown ban %s", mask );
|
||||
return;
|
||||
|
@ -260,7 +260,7 @@ void FiniBans( void )
|
|||
int InitBans( void )
|
||||
{
|
||||
banhash = hash_create( HASHCOUNT_T_MAX, 0, 0 );
|
||||
if( !banhash )
|
||||
if( banhash == NULL )
|
||||
{
|
||||
nlog( LOG_CRITICAL, "Unable to create bans hash" );
|
||||
return NS_FAILURE;
|
||||
|
|
44
src/base64.c
44
src/base64.c
|
@ -48,12 +48,13 @@
|
|||
* @return NS_SUCCESS if succeeds, NS_FAILURE if not
|
||||
*/
|
||||
|
||||
int set_server_base64( const char *name, const char* base64name )
|
||||
int set_server_base64( const char *name, const char *base64name )
|
||||
{
|
||||
Client *s;
|
||||
|
||||
s = FindServer( name );
|
||||
if( !s ) {
|
||||
if( s == NULL )
|
||||
{
|
||||
dlog( DEBUG1, "set_server_base64: cannot find %s for %s", name, base64name );
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
@ -72,13 +73,14 @@ int set_server_base64( const char *name, const char* base64name )
|
|||
* @return base64 name or NULL if not found
|
||||
*/
|
||||
|
||||
char *server_to_base64( const char* name )
|
||||
char *server_to_base64( const char *name )
|
||||
{
|
||||
Client *s;
|
||||
|
||||
dlog( DEBUG1, "server_to_base64: scanning for %s", name );
|
||||
dlog( DEBUG7, "server_to_base64: scanning for %s", name );
|
||||
s = FindServer( name );
|
||||
if( s ) {
|
||||
if( s != NULL )
|
||||
{
|
||||
return s->name64;
|
||||
}
|
||||
dlog( DEBUG1, "server_to_base64: cannot find %s", name );
|
||||
|
@ -95,13 +97,14 @@ char *server_to_base64( const char* name )
|
|||
* @return name or NULL if not found
|
||||
*/
|
||||
|
||||
char *base64_to_server( const char* base64name )
|
||||
char *base64_to_server( const char *base64name )
|
||||
{
|
||||
Client *s;
|
||||
|
||||
dlog( DEBUG1, "base64_to_server: scanning for %s", base64name );
|
||||
dlog( DEBUG7, "base64_to_server: scanning for %s", base64name );
|
||||
s = find_server_base64( base64name );
|
||||
if( s ) {
|
||||
if( s )
|
||||
{
|
||||
return s->name;
|
||||
}
|
||||
dlog( DEBUG1, "base64_to_server: cannot find %s", base64name );
|
||||
|
@ -119,12 +122,13 @@ char *base64_to_server( const char* base64name )
|
|||
* @return NS_SUCCESS if succeeds, NS_FAILURE if not
|
||||
*/
|
||||
|
||||
int set_nick_base64( const char *nick, const char* base64name )
|
||||
int set_nick_base64( const char *nick, const char *base64name )
|
||||
{
|
||||
Client *u;
|
||||
|
||||
u = FindUser( nick );
|
||||
if( !u ) {
|
||||
if( u == NULL )
|
||||
{
|
||||
dlog( DEBUG1, "set_nick_base64: cannot find %s for %s", nick, base64name );
|
||||
return NS_FAILURE;
|
||||
}
|
||||
|
@ -143,13 +147,14 @@ int set_nick_base64( const char *nick, const char* base64name )
|
|||
* @return base64 name or NULL if not found
|
||||
*/
|
||||
|
||||
char *nick_to_base64( const char* nick )
|
||||
char *nick_to_base64( const char *nick )
|
||||
{
|
||||
Client *u;
|
||||
|
||||
dlog( DEBUG1, "nick_to_base64: scanning for %s", nick );
|
||||
u = FindUser( nick );
|
||||
if( u ) {
|
||||
if( u != NULL )
|
||||
{
|
||||
return u->name64;
|
||||
}
|
||||
dlog( DEBUG1, "nick_to_base64: cannot find %s", nick );
|
||||
|
@ -166,13 +171,14 @@ char *nick_to_base64( const char* nick )
|
|||
* @return name or NULL if not found
|
||||
*/
|
||||
|
||||
char *base64_to_nick( const char* base64name )
|
||||
char *base64_to_nick( const char *base64name )
|
||||
{
|
||||
Client *u;
|
||||
|
||||
dlog( DEBUG1, "base64_to_nick: scanning for %s", base64name );
|
||||
u = find_user_base64( base64name );
|
||||
if( u ) {
|
||||
if( u != NULL )
|
||||
{
|
||||
return u->name;
|
||||
}
|
||||
dlog( DEBUG1, "base64_to_nick: cannot find %s", base64name );
|
||||
|
@ -189,17 +195,21 @@ char *base64_to_nick( const char* base64name )
|
|||
* @return name or NULL if not found
|
||||
*/
|
||||
|
||||
char *base64_to_name( const char* base64name )
|
||||
char *base64_to_name( const char *base64name )
|
||||
{
|
||||
Client *c;
|
||||
|
||||
dlog( DEBUG1, "base64_to_name: scanning for %s", base64name );
|
||||
c = find_user_base64( base64name );
|
||||
if( c )
|
||||
if( c != NULL )
|
||||
{
|
||||
return c->name;
|
||||
}
|
||||
c = find_server_base64( base64name );
|
||||
if( c )
|
||||
if( c != NULL )
|
||||
{
|
||||
return c->name;
|
||||
}
|
||||
dlog( DEBUG1, "base64_to_name: cannot find %s", base64name );
|
||||
return NULL;
|
||||
}
|
||||
|
|
14
src/dns.c
14
src/dns.c
|
@ -411,12 +411,12 @@ void do_dns (int notused, short event, void *arg)
|
|||
dns_check_queue();
|
||||
}
|
||||
|
||||
void do_dns_stats_Z(Client *u)
|
||||
void do_dns_stats_Z( const Client *u )
|
||||
{
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Active DNS queries: %d", (int) list_count(dnslist));
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Queued DNS Queries: %d", (int) list_count(dnsqueue));
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Max Queued Queries: %d", DNSStats.maxqueued);
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Total DNS Queries: %d", DNSStats.totalq);
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Successful Lookups: %d", DNSStats.success);
|
||||
irc_numeric (RPL_MEMSTATS, u->name, "Unsuccessful Lookups: %d", DNSStats.failure);
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Active DNS queries: %d", ( int ) list_count( dnslist ) );
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Queued DNS Queries: %d", ( int ) list_count( dnsqueue ) );
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Max Queued Queries: %d", DNSStats.maxqueued );
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Total DNS Queries: %d", DNSStats.totalq );
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Successful Lookups: %d", DNSStats.success );
|
||||
irc_numeric( RPL_MEMSTATS, u->name, "Unsuccessful Lookups: %d", DNSStats.failure );
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ typedef struct Exclude
|
|||
typedef int (*ExcludeHandler) ( Exclude *exclude, void *v );
|
||||
|
||||
/* String descriptions of exclude types */
|
||||
static const char* ExcludeDesc[ NS_EXCLUDE_LIMIT ] =
|
||||
static const char *ExcludeDesc[ NS_EXCLUDE_LIMIT ] =
|
||||
{
|
||||
"Host",
|
||||
"Server",
|
||||
|
|
|
@ -137,14 +137,14 @@ static int parse( void *notused, void *rline, int len )
|
|||
char **av = NULL;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if( !( *line ) )
|
||||
if( *line == '\0' )
|
||||
return NS_FAILURE;
|
||||
dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
|
||||
dlog( DEBUGRX, "%s", line );
|
||||
if( *line == ':' )
|
||||
{
|
||||
coreLine = strpbrk( line, " " );
|
||||
if( !coreLine )
|
||||
if( coreLine == NULL )
|
||||
return NS_FAILURE;
|
||||
*coreLine = 0;
|
||||
while( isspace( *++coreLine ) );
|
||||
|
@ -157,7 +157,7 @@ static int parse( void *notused, void *rline, int len )
|
|||
cmdptr = 0;
|
||||
*origin = 0;
|
||||
}
|
||||
if( !*line )
|
||||
if( *line == '\0' )
|
||||
return NS_FAILURE;
|
||||
coreLine = strpbrk( line, " " );
|
||||
if( coreLine )
|
||||
|
@ -203,7 +203,7 @@ static int parsep10( void *notused, void *rline, int len )
|
|||
char **av = NULL;
|
||||
|
||||
SET_SEGV_LOCATION();
|
||||
if( !( *line ) )
|
||||
if( *line == '\0' )
|
||||
return NS_FAILURE;
|
||||
dlog( DEBUG1, "------------------------BEGIN PARSE-------------------------" );
|
||||
dlog( DEBUGRX, "%s", line );
|
||||
|
@ -272,7 +272,7 @@ static int parsep10( void *notused, void *rline, int len )
|
|||
static int InitIrcdProtocol( void )
|
||||
{
|
||||
protocol_info = ns_dlsym( protocol_module_handle, "protocol_info" );
|
||||
if( !protocol_info )
|
||||
if( protocol_info == NULL )
|
||||
{
|
||||
nlog( LOG_CRITICAL, "Unable to find protocol_info in protocol module %s", protocol_path );
|
||||
return NS_FAILURE;
|
||||
|
@ -294,7 +294,7 @@ static int InitIrcdProtocol( void )
|
|||
irc_parse = parse;
|
||||
}
|
||||
cmd_list = ns_dlsym( protocol_module_handle, "cmd_list" );
|
||||
if( !cmd_list )
|
||||
if( cmd_list == NULL )
|
||||
{
|
||||
nlog( LOG_CRITICAL, "Unable to find command list in selected IRCd module" );
|
||||
return NS_FAILURE;
|
||||
|
@ -347,7 +347,7 @@ int InitIrcd( void )
|
|||
ircsnprintf( protocol_path, 255, "%s/%s%s", MOD_PATH, me.protocol,MOD_STDEXT );
|
||||
nlog( LOG_NORMAL, "Using protocol module %s", protocol_path );
|
||||
protocol_module_handle = ns_dlopen( protocol_path, RTLD_NOW || RTLD_GLOBAL );
|
||||
if( !protocol_module_handle )
|
||||
if( protocol_module_handle == NULL )
|
||||
{
|
||||
nlog( LOG_CRITICAL, "Unable to load protocol module %s", protocol_path );
|
||||
return NS_FAILURE;
|
||||
|
|
|
@ -304,7 +304,7 @@ int InitIrcdSymbols( void )
|
|||
dlog( DEBUG7, "InitIrcdSymbols: apply default handler for: %s %p", pprotocol_sym->sym ? pprotocol_sym->sym : "NONE", pprotocol_sym->defaulthandler );
|
||||
}
|
||||
/* If no default or IRCd handler but we require the function, quit with error */
|
||||
if( pprotocol_sym->required && !*pprotocol_sym->handler )
|
||||
if( pprotocol_sym->required && ( *pprotocol_sym->handler == NULL ) )
|
||||
{
|
||||
nlog( LOG_CRITICAL, "Unable to find %s in selected IRCd module", pprotocol_sym->sym );
|
||||
return NS_FAILURE;
|
||||
|
@ -977,7 +977,7 @@ int irc_join( const Bot *botptr, const char *chan, const char *mode )
|
|||
Channel *c;
|
||||
|
||||
c = FindChannel( chan );
|
||||
ts = ( !c ) ? me.now : c->creationtime;
|
||||
ts = ( c == NULL ) ? me.now : c->creationtime;
|
||||
/* Use sjoin if available */
|
||||
if( ( ircd_srv.protocol & PROTOCOL_SJOIN ) && irc_send_sjoin )
|
||||
{
|
||||
|
@ -1204,7 +1204,7 @@ int irc_kick( const Bot *botptr, const char *chan, const char *target, const cha
|
|||
return NS_FAILURE;
|
||||
}
|
||||
irc_send_kick( botptr->u->name, chan, target, reason );
|
||||
PartChannel( FindUser( target ), ( char *) chan, reason[0] != 0 ?( char *)reason : NULL );
|
||||
PartChannel( FindUser( target ), ( char *) chan, reason[0] != '\0' ?( char *)reason : NULL );
|
||||
return NS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ static Module *load_stdmodule( const char *modfilename, Client * u )
|
|||
}
|
||||
}
|
||||
cmd = ns_calloc( sizeof( CmdParams ) );
|
||||
cmd->param = ( char* )infoptr->name;
|
||||
cmd->param = ( char * )infoptr->name;
|
||||
SendAllModuleEvent( EVENT_MODULELOAD, cmd );
|
||||
ns_free( cmd );
|
||||
if( u ) {
|
||||
|
@ -649,7 +649,7 @@ int unload_module( const char *modname, Client * u )
|
|||
FiniModExcludes( mod_ptr );
|
||||
}
|
||||
cmdparams = ns_calloc( sizeof( CmdParams ) );
|
||||
cmdparams->param = ( char* )modname;
|
||||
cmdparams->param = ( char * )modname;
|
||||
SendAllModuleEvent( EVENT_MODULEUNLOAD, cmdparams );
|
||||
ns_free( cmdparams );
|
||||
RESET_RUN_LEVEL();
|
||||
|
|
|
@ -108,7 +108,7 @@ static int bot_cmd_set_list( const CmdParams *cmdparams )
|
|||
case SET_TYPE_IPV4:
|
||||
case SET_TYPE_CHANNEL:
|
||||
irc_prefmsg( cmdparams->bot, cmdparams->source, "%s: %s",
|
||||
set_ptr->option, ( char* )set_ptr->varptr );
|
||||
set_ptr->option, ( char * )set_ptr->varptr );
|
||||
break;
|
||||
case SET_TYPE_CUSTOM:
|
||||
if( set_ptr->handler )
|
||||
|
@ -264,7 +264,7 @@ static int bot_cmd_set_string( const CmdParams *cmdparams, const bot_setting *se
|
|||
if( set_ptr->handler( cmdparams, SET_VALIDATE ) != NS_SUCCESS )
|
||||
return NS_FAILURE;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
@ -295,7 +295,7 @@ static int bot_cmd_set_channel( const CmdParams *cmdparams, const bot_setting *s
|
|||
if( set_ptr->handler( cmdparams, SET_VALIDATE ) != NS_SUCCESS )
|
||||
return NS_FAILURE;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
@ -317,7 +317,7 @@ static int bot_cmd_set_msg( const CmdParams *cmdparams, const bot_setting *set_p
|
|||
char *buf;
|
||||
|
||||
buf = joinbuf( cmdparams->av, cmdparams->ac, 1 );
|
||||
strlcpy( ( char* )set_ptr->varptr, buf, set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, buf, set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, buf, set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, buf );
|
||||
ns_free( buf );
|
||||
|
@ -343,7 +343,7 @@ static int bot_cmd_set_nick( const CmdParams *cmdparams, const bot_setting *set_
|
|||
__( "%s contains invalid characters", cmdparams->source ), cmdparams->av[1] );
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
@ -368,7 +368,7 @@ static int bot_cmd_set_user( const CmdParams *cmdparams, const bot_setting *set_
|
|||
__( "%s contains invalid characters", cmdparams->source ), cmdparams->av[1] );
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
@ -399,7 +399,7 @@ static int bot_cmd_set_host( const CmdParams *cmdparams, const bot_setting *set_
|
|||
__( "%s contains invalid characters", cmdparams->source ), cmdparams->av[1] );
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
@ -421,7 +421,7 @@ static int bot_cmd_set_realname( const CmdParams *cmdparams, const bot_setting *
|
|||
char *buf;
|
||||
|
||||
buf = joinbuf( cmdparams->av, cmdparams->ac, 1 );
|
||||
strlcpy( ( char* )set_ptr->varptr, buf, set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, buf, set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, buf, set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, buf );
|
||||
ns_free( buf );
|
||||
|
@ -447,7 +447,7 @@ static int bot_cmd_set_ipv4( const CmdParams *cmdparams, const bot_setting *set_
|
|||
__( "Invalid IPV4 format. Should be dotted quad, e.g. 1.2.3.4", cmdparams->source ) );
|
||||
return NS_ERR_SYNTAX_ERROR;
|
||||
}
|
||||
strlcpy( ( char* )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
strlcpy( ( char * )set_ptr->varptr, cmdparams->av[1], set_ptr->max );
|
||||
DBAStoreConfigStr( set_ptr->option, cmdparams->av[1], set_ptr->max );
|
||||
bot_cmd_set_report( cmdparams, set_ptr, cmdparams->av[1] );
|
||||
return NS_SUCCESS;
|
||||
|
|
|
@ -155,7 +155,7 @@ char *strndup( const char *src, size_t count )
|
|||
if ( ( src == NULL ) || ( count == 0 ) )
|
||||
return NULL;
|
||||
/* Allocate count plus one for trailing NULL */
|
||||
dup = ( char* ) ns_malloc( count + 1 );
|
||||
dup = ( char * ) ns_malloc( count + 1 );
|
||||
/* Copy string into created buffer */
|
||||
os_memcpy( dup, src, count );
|
||||
dup[count] = 0;
|
||||
|
@ -182,7 +182,7 @@ char *strdup( const char *src )
|
|||
if ( src == NULL )
|
||||
return NULL;
|
||||
/* Allocate count plus one for trailing NULL */
|
||||
dup = ( char* )ns_malloc( strlen( src ) + 1 );
|
||||
dup = ( char * )ns_malloc( strlen( src ) + 1 );
|
||||
/* Copy string into created buffer */
|
||||
strlcpy( dup, src, strlen( src ) + 1 );
|
||||
/* Return pointer to duplicated string */
|
||||
|
|
Reference in a new issue