logic fixes, lf fixes and decl fixups

This commit is contained in:
Mark 2005-12-07 23:07:16 +00:00
parent 97c8baa979
commit 01eebbdd1c
29 changed files with 340 additions and 329 deletions

View file

@ -33,20 +33,20 @@
#ifndef ADNS_H_INCLUDED
#define ADNS_H_INCLUDED
#ifdef WIN32
#if defined (_MSC_VER)
#pragma warning(disable:4003)
#endif /* _MSC_VER */
#include <winsock2.h>
#include <windows.h>
#ifdef WIN32
#if defined (_MSC_VER)
#pragma warning(disable:4003)
#endif /* _MSC_VER */
#include <winsock2.h>
#include <windows.h>
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif /* HAVE_LIMITS_H */
#ifdef HAVE_MALLOC_H
#include <malloc.h>
#endif /* HAVE_MALLOC_H */
#define ENOPROTOOPT WSAENOPROTOOPT
#include <malloc.h>
#endif /* HAVE_MALLOC_H */
#define ENOPROTOOPT WSAENOPROTOOPT
#endif
@ -335,14 +335,14 @@ extern "C" { /* I really dislike this - iwj. */
* 0, otherwise it will be >0. type will always be the type
* requested.
*/
/* this is called when there is a update for a socket */
typedef void (*fd_update) (int fd, short what);
EXPORTFUNC int adns_init(adns_state *newstate_r, adns_initflags flags,
/* this is called when there is a update for a socket */
typedef void (*fd_update) (int fd, short what);
EXPORTFUNC int adns_init(adns_state *newstate_r, adns_initflags flags,
FILE * diagfile /*0=>stderr */, fd_update func );
EXPORTFUNC int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags,
FILE *diagfile /*0=>discard*/, const char *configtext);
EXPORTFUNC int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags,
FILE *diagfile /*0=>discard*/, const char *configtext);
/* Configuration:
* adns_init reads /etc/resolv.conf, which is expected to be (broadly
@ -444,7 +444,7 @@ EXPORTFUNC int adns_init_strcfg(adns_state *newstate_r, adns_initflags flags,
* line in resolv.conf.
*/
EXPORTFUNC int adns_synchronous(adns_state ads,
EXPORTFUNC int adns_synchronous(adns_state ads,
const char *owner, adns_rrtype type,
adns_queryflags flags, adns_answer ** answer_r);
@ -453,27 +453,27 @@ EXPORTFUNC int adns_synchronous(adns_state ads,
* processing functions to actually get things to happen.
*/
EXPORTFUNC int adns_submit(adns_state ads,
EXPORTFUNC int adns_submit(adns_state ads,
const char *owner, adns_rrtype type,
adns_queryflags flags, void *context,
adns_query *query_r);
adns_queryflags flags, void *context,
adns_query *query_r);
/* The owner should be quoted in master file format. */
EXPORTFUNC int adns_check(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
EXPORTFUNC int adns_check(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
EXPORTFUNC int adns_wait(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
EXPORTFUNC int adns_wait(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
/* same as adns_wait but uses poll(2) internally */
EXPORTFUNC int adns_wait_poll(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
EXPORTFUNC int adns_wait_poll(adns_state ads,
adns_query * query_io, adns_answer **answer_r,
void **context_r);
EXPORTFUNC void adns_cancel(adns_query query);
EXPORTFUNC void adns_cancel(adns_query query);
/* The adns_query you get back from _submit is valid (ie, can be
* legitimately passed into adns functions) until it is returned by
@ -487,32 +487,32 @@ EXPORTFUNC void adns_cancel(adns_query query);
* query type.
*/
EXPORTFUNC int adns_submit_reverse(adns_state ads,
EXPORTFUNC int adns_submit_reverse(adns_state ads,
const struct sockaddr *addr, adns_rrtype type,
adns_queryflags flags, void *context,
adns_query *query_r);
adns_queryflags flags, void *context,
adns_query *query_r);
/* type must be _r_ptr or _r_ptr_raw. _qf_search is ignored.
* addr->sa_family must be AF_INET or you get ENOSYS.
*/
EXPORTFUNC int adns_submit_reverse_any(adns_state ads,
EXPORTFUNC int adns_submit_reverse_any(adns_state ads,
const struct sockaddr *addr, const char *rzone,
adns_rrtype type, adns_queryflags flags,
void *context, adns_query *query_r);
void *context, adns_query *query_r);
/* For RBL-style reverse `zone's; look up
* <reversed-address>.<zone>
* Any type is allowed. _qf_search is ignored.
* addr->sa_family must be AF_INET or you get ENOSYS.
*/
EXPORTFUNC void adns_finish(adns_state ads);
EXPORTFUNC void adns_finish(adns_state ads);
/* You may call this even if you have queries outstanding;
* they will be cancelled.
*/
EXPORTFUNC void adns_forallqueries_begin(adns_state ads);
EXPORTFUNC adns_query adns_forallqueries_next(adns_state ads, void **context_r);
EXPORTFUNC void adns_forallqueries_begin(adns_state ads);
EXPORTFUNC adns_query adns_forallqueries_next(adns_state ads, void **context_r);
/* Iterator functions, which you can use to loop over the outstanding
* (submitted but not yet successfuly checked/waited) queries.
*
@ -528,7 +528,7 @@ EXPORTFUNC adns_query adns_forallqueries_next(adns_state ads, void **context_r);
* context_r may be 0. *context_r may not be set when _next returns 0.
*/
EXPORTFUNC void adns_checkconsistency(adns_state ads, adns_query qu);
EXPORTFUNC void adns_checkconsistency(adns_state ads, adns_query qu);
/* Checks the consistency of adns's internal data structures.
* If any error is found, the program will abort().
* You may pass 0 for qu; if you pass non-null then additional checks
@ -560,16 +560,16 @@ EXPORTFUNC void adns_checkconsistency(adns_state ads, adns_query qu);
* blocking, or you may not have an up-to-date list of it's fds.
*/
EXPORTFUNC int adns_processany(adns_state ads);
EXPORTFUNC int adns_processany(adns_state ads);
/* Gives adns flow-of-control for a bit. This will never block, and
* can be used with any threading/asynch-io model. If some error
* occurred which might cause an event loop to spin then the errno
* value is returned.
*/
EXPORTFUNC int adns_processreadable(adns_state ads, OS_SOCKET fd, const struct timeval *now);
EXPORTFUNC int adns_processwriteable(adns_state ads, OS_SOCKET fd, const struct timeval *now);
EXPORTFUNC int adns_processexceptional(adns_state ads, OS_SOCKET fd, const struct timeval *now);
EXPORTFUNC int adns_processreadable(adns_state ads, OS_SOCKET fd, const struct timeval *now);
EXPORTFUNC int adns_processwriteable(adns_state ads, OS_SOCKET fd, const struct timeval *now);
EXPORTFUNC int adns_processexceptional(adns_state ads, OS_SOCKET fd, const struct timeval *now);
/* Gives adns flow-of-control so that it can process incoming data
* from, or send outgoing data via, fd. Very like _processany. If it
* returns zero then fd will no longer be readable or writeable
@ -588,7 +588,7 @@ EXPORTFUNC int adns_processexceptional(adns_state ads, OS_SOCKET fd, const struc
* then the errno value is returned.
*/
EXPORTFUNC void adns_processtimeouts(adns_state ads, const struct timeval *now);
EXPORTFUNC void adns_processtimeouts(adns_state ads, const struct timeval *now);
/* Gives adns flow-of-control so that it can process any timeouts
* which might have happened. Very like _processreadable/writeable.
*
@ -596,9 +596,9 @@ EXPORTFUNC void adns_processtimeouts(adns_state ads, const struct timeval *now);
* obtained from gettimeofday.
*/
EXPORTFUNC void adns_firsttimeout(adns_state ads,
struct timeval **tv_mod, struct timeval *tv_buf,
struct timeval now);
EXPORTFUNC void adns_firsttimeout(adns_state ads,
struct timeval **tv_mod, struct timeval *tv_buf,
struct timeval now);
/* Asks adns when it would first like the opportunity to time
* something out. now must be the current time, from gettimeofday.
*
@ -615,7 +615,7 @@ EXPORTFUNC void adns_firsttimeout(adns_state ads,
* is using. It always succeeds and never blocks.
*/
EXPORTFUNC void adns_globalsystemfailure(adns_state ads);
EXPORTFUNC void adns_globalsystemfailure(adns_state ads);
/* If serious problem(s) happen which globally affect your ability to
* interact properly with adns, or adns's ability to function
* properly, you or adns can call this function.
@ -634,9 +634,9 @@ EXPORTFUNC void adns_globalsystemfailure(adns_state ads);
* Entrypoints for select-loop based asynch io:
*/
EXPORTFUNC void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds,
fd_set *writefds, fd_set *exceptfds,
struct timeval **tv_mod, struct timeval *tv_buf,
EXPORTFUNC void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds,
fd_set *writefds, fd_set *exceptfds,
struct timeval **tv_mod, struct timeval *tv_buf,
const struct timeval *now);
/* Find out file descriptors adns is interested in, and when it would
* like the opportunity to time something out. If you do not plan to
@ -650,7 +650,7 @@ EXPORTFUNC void adns_beforeselect(adns_state ads, int *maxfd, fd_set *readfds,
* finishes in _beforeselect.
*/
EXPORTFUNC void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
EXPORTFUNC void adns_afterselect(adns_state ads, int maxfd, const fd_set *readfds,
const fd_set *writefds, const fd_set *exceptfds, const struct timeval *now);
/* Gives adns flow-of-control for a bit; intended for use after
* select. This is just a fancy way of calling adns_processreadable/
@ -683,7 +683,7 @@ struct pollfd;
* entrypoints will not be defined in libadns. Sorry !
*/
EXPORTFUNC int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io,
EXPORTFUNC int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io, int *timeout_io,
const struct timeval *now);
/* Finds out which fd's adns is interested in, and when it would like
* to be able to time things out. This is in a form suitable for use
@ -735,16 +735,16 @@ EXPORTFUNC int adns_beforepoll(adns_state ads, struct pollfd *fds, int *nfds_io,
* require more space than this.
*/
EXPORTFUNC void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds,
const struct timeval *now);
EXPORTFUNC void adns_afterpoll(adns_state ads, const struct pollfd *fds, int nfds,
const struct timeval *now);
/* Gives adns flow-of-control for a bit; intended for use after
* poll(2). fds and nfds should be the results from poll(). pollfd
* structs mentioning fds not belonging to adns will be ignored.
*/
EXPORTFUNC adns_status adns_rr_info(adns_rrtype type,
const char **rrtname_r, const char **fmtname_r,
EXPORTFUNC adns_status adns_rr_info(adns_rrtype type,
const char **rrtname_r, const char **fmtname_r,
int *len_r, const void *datap, char **data_r);
/*
* Get information about a query type, or convert reply data to a
@ -802,9 +802,9 @@ EXPORTFUNC adns_status adns_rr_info(adns_rrtype type,
* dns2.spong.dyn.ml.org timeout "DNS query timed out" ?
*/
EXPORTFUNC const char *adns_strerror(adns_status st);
EXPORTFUNC const char *adns_errabbrev(adns_status st);
EXPORTFUNC const char *adns_errtypeabbrev(adns_status st);
EXPORTFUNC const char *adns_strerror(adns_status st);
EXPORTFUNC const char *adns_errabbrev(adns_status st);
EXPORTFUNC const char *adns_errtypeabbrev(adns_status st);
/* Like strerror but for adns_status values. adns_errabbrev returns
* the abbreviation of the error - eg, for adns_s_timeout it returns
* "timeout". adns_errtypeabbrev returns the abbreviation of the

View file

@ -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_ */

View file

@ -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 );

View file

@ -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 );

View file

@ -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 );

View file

@ -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;

View file

@ -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 );
}

View file

@ -25,105 +25,105 @@
#include "protocol.h"
/* Messages/Tokens */
char *MSG_PRIVATE = "PRIVMSG"; /* PRIV */
char *MSG_WHO = "WHO"; /* WHO -> WHOC */
char *MSG_WHOIS = "WHOIS"; /* WHOI */
char *MSG_WHOWAS = "WHOWAS"; /* WHOW */
char *MSG_USER = "USER"; /* USER */
char *MSG_NICK = "NICK"; /* NICK */
char *MSG_SERVER = "SERVER"; /* SERV */
char *MSG_LIST = "LIST"; /* LIST */
char *MSG_TOPIC = "TOPIC"; /* TOPI */
char *MSG_INVITE = "INVITE"; /* INVI */
char *MSG_VERSION = "VERSION"; /* VERS */
char *MSG_QUIT = "QUIT"; /* QUIT */
char *MSG_SQUIT = "SQUIT"; /* SQUI */
char *MSG_KILL = "KILL"; /* KILL */
char *MSG_INFO = "INFO"; /* INFO */
char *MSG_LINKS = "LINKS"; /* LINK */
char *MSG_STATS = "STATS"; /* STAT */
char *MSG_USERS = "USERS"; /* USER -> USRS */
char *MSG_HELP = "HELP"; /* HELP */
char *MSG_ERROR = "ERROR"; /* ERRO */
char *MSG_AWAY = "AWAY"; /* AWAY */
char *MSG_CONNECT = "CONNECT"; /* CONN */
char *MSG_PING = "PING"; /* PING */
char *MSG_PONG = "PONG"; /* PONG */
char *MSG_OPER = "OPER"; /* OPER */
char *MSG_PASS = "PASS"; /* PASS */
char *MSG_WALLOPS = "WALLOPS"; /* WALL */
char *MSG_TIME = "TIME"; /* TIME */
char *MSG_NAMES = "NAMES"; /* NAME */
char *MSG_ADMIN = "ADMIN"; /* ADMI */
char *MSG_TRACE = "TRACE"; /* TRAC */
char *MSG_NOTICE = "NOTICE"; /* NOTI */
char *MSG_JOIN = "JOIN"; /* JOIN */
char *MSG_PART = "PART"; /* PART */
char *MSG_LUSERS = "LUSERS"; /* LUSE */
char *MSG_MOTD = "MOTD"; /* MOTD */
char *MSG_MODE = "MODE"; /* MODE */
char *MSG_KICK = "KICK"; /* KICK */
char *MSG_USERHOST = "USERHOST"; /* USER -> USRH */
char *MSG_USERIP = "USERIP"; /* USER -> USRH */
char *MSG_ISON = "ISON"; /* ISON */
char *MSG_REHASH = "REHASH"; /* REHA */
char *MSG_RESTART = "RESTART"; /* REST */
char *MSG_CLOSE = "CLOSE"; /* CLOS */
char *MSG_SVINFO = "SVINFO"; /* SVINFO */
char *MSG_SJOIN = "SJOIN"; /* SJOIN */
char *MSG_DIE = "DIE"; /* DIE */
char *MSG_HASH = "HASH"; /* HASH */
char *MSG_DNS = "DNS"; /* DNS -> DNSS */
char *MSG_OPERWALL = "OPERWALL"; /* OPERWALL */
char *MSG_GLOBOPS = "GLOBOPS"; /* GLOBOPS */
char *MSG_CHATOPS = "CHATOPS"; /* CHATOPS */
char *MSG_GOPER = "GOPER"; /* GOPER */
char *MSG_GNOTICE = "GNOTICE"; /* GNOTICE */
char *MSG_KLINE = "KLINE"; /* KLINE */
char *MSG_UNKLINE = "UNKLINE"; /* UNKLINE */
char *MSG_SET = "SET"; /* SET */
char *MSG_SAMODE = "SAMODE"; /* SAMODE */
char *MSG_SAJOIN = "SAJOIN"; /* SAJOIN */
char *MSG_CHANSERV = "CHANSERV"; /* CHANSERV */
char *MSG_NICKSERV = "NICKSERV"; /* NICKSERV */
char *MSG_MEMOSERV = "MEMOSERV"; /* MEMOSERV */
char *MSG_ROOTSERV = "ROOTSERV"; /* MEMOSERV */
char *MSG_OPERSERV = "OPERSERV"; /* OPERSERV */
char *MSG_STATSERV = "STATSERV"; /* STATSERV */
char *MSG_HELPSERV = "HELPSERV"; /* HELPSERV */
char *MSG_SERVICES = "SERVICES"; /* SERVICES */
char *MSG_IDENTIFY = "IDENTIFY"; /* IDENTIFY */
char *MSG_CAPAB = "CAPAB"; /* CAPAB */
char *MSG_LOCOPS = "LOCOPS"; /* LOCOPS */
char *MSG_SVSNICK = "SVSNICK"; /* SVSNICK */
char *MSG_SVSNOOP = "SVSNOOP"; /* SVSNOOP */
char *MSG_SVSKILL = "SVSKILL"; /* SVSKILL */
char *MSG_SVSMODE = "SVSMODE"; /* SVSMODE */
char *MSG_SVSHOLD = "SVSHOLD"; /* SVSHOLD */
char *MSG_AKILL = "AKILL"; /* AKILL */
char *MSG_RAKILL = "RAKILL"; /* RAKILL */
char *MSG_SILENCE = "SILENCE"; /* SILENCE */
char *MSG_WATCH = "WATCH"; /* WATCH */
char *MSG_SQLINE = "SQLINE"; /* SQLINE */
char *MSG_UNSQLINE = "UNSQLINE"; /* UNSQLINE */
char *MSG_BURST = "BURST"; /* BURST */
char *MSG_DCCALLOW = "DCCALLOW"; /* dccallow */
char *MSG_SGLINE = "SGLINE"; /* sgline */
char *MSG_UNSGLINE = "UNSGLINE"; /* unsgline */
char *MSG_DKEY = "DKEY"; /* diffie-hellman negotiation */
char *MSG_NS = "NS"; /* NickServ commands */
char *MSG_CS = "CS"; /* ChanServ commands */
char *MSG_MS = "MS"; /* MemoServ commands */
char *MSG_RS = "RS"; /* RootServ commands */
char *MSG_OS = "OS"; /* OperServ commands */
char *MSG_SS = "SS"; /* StatServ commands */
char *MSG_HS = "HS"; /* StatServ commands */
char *MSG_RESYNCH = "RESYNCH"; /* RESYNCH */
char *MSG_LUSERSLOCK = "LUSERSLOCK"; /* Lusers LOCK */
char *MSG_LINKSCONTROL = "LINKSCONTROL"; /* LINKSCONTROL */
char *MSG_MODULE = "MODULE"; /* MODULE */
char *MSG_RWHO = "RWHO"; /* RWHO */
char *MSG_SVSCLONE = "SVSCLONE"; /* SVSCLONE */
char *MSG_PRIVATE = "PRIVMSG"; /* PRIV */
char *MSG_WHO = "WHO"; /* WHO -> WHOC */
char *MSG_WHOIS = "WHOIS"; /* WHOI */
char *MSG_WHOWAS = "WHOWAS"; /* WHOW */
char *MSG_USER = "USER"; /* USER */
char *MSG_NICK = "NICK"; /* NICK */
char *MSG_SERVER = "SERVER"; /* SERV */
char *MSG_LIST = "LIST"; /* LIST */
char *MSG_TOPIC = "TOPIC"; /* TOPI */
char *MSG_INVITE = "INVITE"; /* INVI */
char *MSG_VERSION = "VERSION"; /* VERS */
char *MSG_QUIT = "QUIT"; /* QUIT */
char *MSG_SQUIT = "SQUIT"; /* SQUI */
char *MSG_KILL = "KILL"; /* KILL */
char *MSG_INFO = "INFO"; /* INFO */
char *MSG_LINKS = "LINKS"; /* LINK */
char *MSG_STATS = "STATS"; /* STAT */
char *MSG_USERS = "USERS"; /* USER -> USRS */
char *MSG_HELP = "HELP"; /* HELP */
char *MSG_ERROR = "ERROR"; /* ERRO */
char *MSG_AWAY = "AWAY"; /* AWAY */
char *MSG_CONNECT = "CONNECT"; /* CONN */
char *MSG_PING = "PING"; /* PING */
char *MSG_PONG = "PONG"; /* PONG */
char *MSG_OPER = "OPER"; /* OPER */
char *MSG_PASS = "PASS"; /* PASS */
char *MSG_WALLOPS = "WALLOPS"; /* WALL */
char *MSG_TIME = "TIME"; /* TIME */
char *MSG_NAMES = "NAMES"; /* NAME */
char *MSG_ADMIN = "ADMIN"; /* ADMI */
char *MSG_TRACE = "TRACE"; /* TRAC */
char *MSG_NOTICE = "NOTICE"; /* NOTI */
char *MSG_JOIN = "JOIN"; /* JOIN */
char *MSG_PART = "PART"; /* PART */
char *MSG_LUSERS = "LUSERS"; /* LUSE */
char *MSG_MOTD = "MOTD"; /* MOTD */
char *MSG_MODE = "MODE"; /* MODE */
char *MSG_KICK = "KICK"; /* KICK */
char *MSG_USERHOST = "USERHOST"; /* USER -> USRH */
char *MSG_USERIP = "USERIP"; /* USER -> USRH */
char *MSG_ISON = "ISON"; /* ISON */
char *MSG_REHASH = "REHASH"; /* REHA */
char *MSG_RESTART = "RESTART"; /* REST */
char *MSG_CLOSE = "CLOSE"; /* CLOS */
char *MSG_SVINFO = "SVINFO"; /* SVINFO */
char *MSG_SJOIN = "SJOIN"; /* SJOIN */
char *MSG_DIE = "DIE"; /* DIE */
char *MSG_HASH = "HASH"; /* HASH */
char *MSG_DNS = "DNS"; /* DNS -> DNSS */
char *MSG_OPERWALL = "OPERWALL"; /* OPERWALL */
char *MSG_GLOBOPS = "GLOBOPS"; /* GLOBOPS */
char *MSG_CHATOPS = "CHATOPS"; /* CHATOPS */
char *MSG_GOPER = "GOPER"; /* GOPER */
char *MSG_GNOTICE = "GNOTICE"; /* GNOTICE */
char *MSG_KLINE = "KLINE"; /* KLINE */
char *MSG_UNKLINE = "UNKLINE"; /* UNKLINE */
char *MSG_SET = "SET"; /* SET */
char *MSG_SAMODE = "SAMODE"; /* SAMODE */
char *MSG_SAJOIN = "SAJOIN"; /* SAJOIN */
char *MSG_CHANSERV = "CHANSERV"; /* CHANSERV */
char *MSG_NICKSERV = "NICKSERV"; /* NICKSERV */
char *MSG_MEMOSERV = "MEMOSERV"; /* MEMOSERV */
char *MSG_ROOTSERV = "ROOTSERV"; /* MEMOSERV */
char *MSG_OPERSERV = "OPERSERV"; /* OPERSERV */
char *MSG_STATSERV = "STATSERV"; /* STATSERV */
char *MSG_HELPSERV = "HELPSERV"; /* HELPSERV */
char *MSG_SERVICES = "SERVICES"; /* SERVICES */
char *MSG_IDENTIFY = "IDENTIFY"; /* IDENTIFY */
char *MSG_CAPAB = "CAPAB"; /* CAPAB */
char *MSG_LOCOPS = "LOCOPS"; /* LOCOPS */
char *MSG_SVSNICK = "SVSNICK"; /* SVSNICK */
char *MSG_SVSNOOP = "SVSNOOP"; /* SVSNOOP */
char *MSG_SVSKILL = "SVSKILL"; /* SVSKILL */
char *MSG_SVSMODE = "SVSMODE"; /* SVSMODE */
char *MSG_SVSHOLD = "SVSHOLD"; /* SVSHOLD */
char *MSG_AKILL = "AKILL"; /* AKILL */
char *MSG_RAKILL = "RAKILL"; /* RAKILL */
char *MSG_SILENCE = "SILENCE"; /* SILENCE */
char *MSG_WATCH = "WATCH"; /* WATCH */
char *MSG_SQLINE = "SQLINE"; /* SQLINE */
char *MSG_UNSQLINE = "UNSQLINE"; /* UNSQLINE */
char *MSG_BURST = "BURST"; /* BURST */
char *MSG_DCCALLOW = "DCCALLOW"; /* dccallow */
char *MSG_SGLINE = "SGLINE"; /* sgline */
char *MSG_UNSGLINE = "UNSGLINE"; /* unsgline */
char *MSG_DKEY = "DKEY"; /* diffie-hellman negotiation */
char *MSG_NS = "NS"; /* NickServ commands */
char *MSG_CS = "CS"; /* ChanServ commands */
char *MSG_MS = "MS"; /* MemoServ commands */
char *MSG_RS = "RS"; /* RootServ commands */
char *MSG_OS = "OS"; /* OperServ commands */
char *MSG_SS = "SS"; /* StatServ commands */
char *MSG_HS = "HS"; /* StatServ commands */
char *MSG_RESYNCH = "RESYNCH"; /* RESYNCH */
char *MSG_LUSERSLOCK = "LUSERSLOCK"; /* Lusers LOCK */
char *MSG_LINKSCONTROL = "LINKSCONTROL"; /* LINKSCONTROL */
char *MSG_MODULE = "MODULE"; /* MODULE */
char *MSG_RWHO = "RWHO"; /* RWHO */
char *MSG_SVSCLONE = "SVSCLONE"; /* SVSCLONE */
/* Umodes */
#define UMODE_SERVNOTICE 0x00100000 /* umode +s - Server notices */
@ -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 );
}

View file

@ -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];

View file

@ -24,79 +24,79 @@
#include "neostats.h"
#include "protocol.h"
char *MSG_PRIVATE = "PRIVMSG";
char *MSG_WHO = "WHO";
char *MSG_WHOIS = "WHOIS";
char *MSG_WHOWAS = "WHOWAS";
char *MSG_USER = "USER";
char *MSG_NICK = "NICK";
char *MSG_SERVER = "SERVER";
char *MSG_LIST = "LIST";
char *MSG_TOPIC = "TOPIC";
char *MSG_INVITE = "INVITE";
char *MSG_VERSION = "VERSION";
char *MSG_QUIT = "QUIT";
char *MSG_SQUIT = "SQUIT";
char *MSG_KILL = "KILL";
char *MSG_INFO = "INFO";
char *MSG_LINKS = "LINKS";
char *MSG_STATS = "STATS";
char *MSG_USERS = "USERS";
char *MSG_HELP = "HELP";
char *MSG_ERROR = "ERROR";
char *MSG_AWAY = "AWAY";
char *MSG_CONNECT = "CONNECT";
char *MSG_PING = "PING";
char *MSG_PONG = "PONG";
char *MSG_OPER = "OPER";
char *MSG_PASS = "PASS";
char *MSG_WALLOPS = "WALLOPS";
char *MSG_TIME = "TIME";
char *MSG_NAMES = "NAMES";
char *MSG_ADMIN = "ADMIN";
char *MSG_TRACE = "TRACE";
char *MSG_LTRACE = "LTRACE";
char *MSG_NOTICE = "NOTICE";
char *MSG_JOIN = "JOIN";
char *MSG_PART = "PART";
char *MSG_LUSERS = "LUSERS";
char *MSG_MOTD = "MOTD";
char *MSG_MODE = "MODE";
char *MSG_KICK = "KICK";
char *MSG_USERHOST = "USERHOST";
char *MSG_ISON = "ISON";
char *MSG_REHASH = "REHASH";
char *MSG_RESTART = "RESTART";
char *MSG_CLOSE = "CLOSE";
char *MSG_SVINFO = "SVINFO";
char *MSG_SJOIN = "SJOIN";
char *MSG_CAPAB = "CAPAB";
char *MSG_DIE = "DIE";
char *MSG_HASH = "HASH";
char *MSG_DNS = "DNS";
char *MSG_OPERWALL = "OPERWALL";
char *MSG_KLINE = "KLINE";
char *MSG_UNKLINE = "UNKLINE";
char *MSG_DLINE = "DLINE";
char *MSG_UNDLINE = "UNDLINE";
char *MSG_HTM = "HTM";
char *MSG_SET = "SET";
char *MSG_GLINE = "GLINE";
char *MSG_UNGLINE = "UNGLINE";
char *MSG_LOCOPS = "LOCOPS";
char *MSG_LWALLOPS = "LWALLOPS";
char *MSG_KNOCK = "KNOCK";
char *MSG_MAP = "MAP";
char *MSG_ETRACE = "ETRACE";
char *MSG_SINFO = "SINFO";
char *MSG_TESTLINE = "TESTLINE";
char *MSG_OPERSPY = "OPERSPY";
char *MSG_ENCAP = "ENCAP";
char *MSG_XLINE = "XLINE";
char *MSG_UNXLINE = "UNXLINE";
char *MSG_RESV = "RESV";
char *MSG_UNRESV = "UNRESV";
char *MSG_PRIVATE = "PRIVMSG";
char *MSG_WHO = "WHO";
char *MSG_WHOIS = "WHOIS";
char *MSG_WHOWAS = "WHOWAS";
char *MSG_USER = "USER";
char *MSG_NICK = "NICK";
char *MSG_SERVER = "SERVER";
char *MSG_LIST = "LIST";
char *MSG_TOPIC = "TOPIC";
char *MSG_INVITE = "INVITE";
char *MSG_VERSION = "VERSION";
char *MSG_QUIT = "QUIT";
char *MSG_SQUIT = "SQUIT";
char *MSG_KILL = "KILL";
char *MSG_INFO = "INFO";
char *MSG_LINKS = "LINKS";
char *MSG_STATS = "STATS";
char *MSG_USERS = "USERS";
char *MSG_HELP = "HELP";
char *MSG_ERROR = "ERROR";
char *MSG_AWAY = "AWAY";
char *MSG_CONNECT = "CONNECT";
char *MSG_PING = "PING";
char *MSG_PONG = "PONG";
char *MSG_OPER = "OPER";
char *MSG_PASS = "PASS";
char *MSG_WALLOPS = "WALLOPS";
char *MSG_TIME = "TIME";
char *MSG_NAMES = "NAMES";
char *MSG_ADMIN = "ADMIN";
char *MSG_TRACE = "TRACE";
char *MSG_LTRACE = "LTRACE";
char *MSG_NOTICE = "NOTICE";
char *MSG_JOIN = "JOIN";
char *MSG_PART = "PART";
char *MSG_LUSERS = "LUSERS";
char *MSG_MOTD = "MOTD";
char *MSG_MODE = "MODE";
char *MSG_KICK = "KICK";
char *MSG_USERHOST = "USERHOST";
char *MSG_ISON = "ISON";
char *MSG_REHASH = "REHASH";
char *MSG_RESTART = "RESTART";
char *MSG_CLOSE = "CLOSE";
char *MSG_SVINFO = "SVINFO";
char *MSG_SJOIN = "SJOIN";
char *MSG_CAPAB = "CAPAB";
char *MSG_DIE = "DIE";
char *MSG_HASH = "HASH";
char *MSG_DNS = "DNS";
char *MSG_OPERWALL = "OPERWALL";
char *MSG_KLINE = "KLINE";
char *MSG_UNKLINE = "UNKLINE";
char *MSG_DLINE = "DLINE";
char *MSG_UNDLINE = "UNDLINE";
char *MSG_HTM = "HTM";
char *MSG_SET = "SET";
char *MSG_GLINE = "GLINE";
char *MSG_UNGLINE = "UNGLINE";
char *MSG_LOCOPS = "LOCOPS";
char *MSG_LWALLOPS = "LWALLOPS";
char *MSG_KNOCK = "KNOCK";
char *MSG_MAP = "MAP";
char *MSG_ETRACE = "ETRACE";
char *MSG_SINFO = "SINFO";
char *MSG_TESTLINE = "TESTLINE";
char *MSG_OPERSPY = "OPERSPY";
char *MSG_ENCAP = "ENCAP";
char *MSG_XLINE = "XLINE";
char *MSG_UNXLINE = "UNXLINE";
char *MSG_RESV = "RESV";
char *MSG_UNRESV = "UNRESV";
/* Umodes */
#define UMODE_SERVNOTICE 0x00000000 /* server notices such as kill */
#define UMODE_REJ 0x00000000 /* Bot Rejections */
@ -110,14 +110,14 @@ char *MSG_UNRESV = "UNRESV";
#define UMODE_EXTERNAL 0x02000000 /* show servers introduced and splitting */
#define UMODE_CALLERID 0x04000000 /* block unless caller id's */
#define UMODE_UNAUTH 0x08000000 /* show unauth connects here */
#define UMODE_STATSPHIDE 0x10000000 /* Oper hides from stats P */
#define UMODE_OSPYLOG 0x20000000 /* show Oper Spy being used */
#define UMODE_UNIDLE 0x40000000 /* Hide idle time with umode +u */
#define UMODE_LOCOPS 0x80000000 /* Oper see's LOCOPS */
#define UMODE_STATSPHIDE 0x10000000 /* Oper hides from stats P */
#define UMODE_OSPYLOG 0x20000000 /* show Oper Spy being used */
#define UMODE_UNIDLE 0x40000000 /* Hide idle time with umode +u */
#define UMODE_LOCOPS 0x80000000 /* Oper see's LOCOPS */
/* Cmodes */
#define CMODE_EXCEPTION 0x0800
#define CMODE_DENY 0x1000
#define CMODE_EXCEPTION 0x0800
#define CMODE_DENY 0x1000
static void m_server( char *origin, char **argv, int argc, int srv );
static void m_nick( char *origin, char **argv, int argc, int srv );
@ -182,16 +182,16 @@ 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 );
}
/* m_nick
* RX: SERVER servername 1 :hybrid6server
* argv[0] = servername
* argv[1] = hopcount
* argv[2] = serverinfo
* RX: SERVER servername 1 :hybrid6server
* argv[0] = servername
* argv[1] = hopcount
* argv[2] = serverinfo
*/
static void m_server( char *origin, char **argv, int argc, int srv )
@ -202,14 +202,14 @@ static void m_server( char *origin, char **argv, int argc, int srv )
}
/* m_nick
* argv[0] = nickname
* argv[1] = optional hopcount when new user; TS when nick change
* argv[2] = optional TS
* argv[3] = optional umode
* argv[4] = optional username
* argv[5] = optional hostname
* argv[6] = optional server
* argv[7] = optional ircname
* argv[0] = nickname
* argv[1] = optional hopcount when new user; TS when nick change
* argv[2] = optional TS
* argv[3] = optional umode
* argv[4] = optional username
* argv[5] = optional hostname
* argv[6] = optional server
* argv[7] = optional ircname
*/
static void m_nick( char *origin, char **argv, int argc, int srv )

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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

View file

@ -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

View file

@ -40,7 +40,7 @@ typedef void( *htmlhandler )( void );
/** HTML handler table struct */
typedef struct htmlfunc {
char* directive;
char *directive;
htmlhandler handler;
}htmlfunc;

View file

@ -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 )
{

View file

@ -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

View file

@ -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;
}

View file

@ -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;

View file

@ -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;
}

View file

@ -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 );
}

View file

@ -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",

View file

@ -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;

View file

@ -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;
}

View file

@ -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();

View file

@ -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;

View file

@ -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 */