From ddf3a33851e56c7e415721f6386efd8e63367e30 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Remco=20R=C4=B3nders?= Date: Sat, 7 Mar 2026 12:17:36 -0500 Subject: [PATCH] CLEANUP: Modernize C from 90s style to current C - Convert all K&R function definitions to ANSI C prototypes - Remove register keyword throughout - Replace bzero/bcopy/bcmp with memset/memcpy/memcmp - Replace index/rindex with strchr/strrchr - Remove extern int errno declarations - Remove PROTO() macro (K&R/ANSI compatibility shim) - Convert all fake-variadic functions (p1..p8 pattern) to proper stdarg.h variadics: sendto_one, sendto_prefix_one, sendto_serv_butone, sendto_channel_butone, sendto_channelops_butone, sendto_channelvoice_butone, sendto_match_butone, sendto_all_butone, sendto_common_channels, sendto_channel_butserv, sendto_match_servs, sendto_ops, sendto_failops, sendto_umode, sendto_failops_whoare_opers, sendto_locfailops, sendto_opers, sendto_ops_butone, sendto_opers_butone, sendto_ops_butme, sendto_realops, sendto_SNICK_butone, sendto_serv_butone_quit, sendto_one_notice, debug, dumpcore Co-Authored-By: Claude Opus 4.6 --- include/class.h | 16 +- include/common.h | 10 +- include/dbuf.h | 10 +- include/h.h | 388 +++++++++++++++++++------------------- include/sys.h | 2 +- include/userload.h | 6 +- include/whowas.h | 10 +- src/bsd.c | 5 +- src/channel.c | 285 ++++++++-------------------- src/chkconf.c | 22 +-- src/class.c | 28 +-- src/dbuf.c | 29 +-- src/hash.c | 68 ++----- src/ircd.c | 14 +- src/list.c | 61 ++---- src/match.c | 13 +- src/packet.c | 5 +- src/parse.c | 4 +- src/res.c | 31 ++- src/s_bsd.c | 82 +++----- src/s_conf.c | 168 ++++------------- src/s_debug.c | 19 +- src/s_err.c | 13 +- src/s_misc.c | 56 ++---- src/s_numeric.c | 6 +- src/s_ping.c | 40 ++-- src/s_serv.c | 156 ++++------------ src/s_user.c | 186 ++++-------------- src/send.c | 457 ++++++++++++++++++++++++--------------------- src/strtoul.c | 5 +- src/support.c | 41 ++-- src/userload.c | 4 +- src/whowas.c | 19 +- 33 files changed, 835 insertions(+), 1424 deletions(-) diff --git a/include/class.h b/include/class.h index 5f6565f..8a08800 100644 --- a/include/class.h +++ b/include/class.h @@ -49,13 +49,13 @@ typedef struct Class { extern aClass *classes; -extern aClass *find_class PROTO((int)); -extern int get_conf_class PROTO((aConfItem *)); -extern int get_client_class PROTO((aClient *)); -extern int get_client_ping PROTO((aClient *)); -extern int get_con_freq PROTO((aClass *)); -extern void add_class PROTO((int, int, int, int, long)); -extern void check_class PROTO((void)); -extern void initclass PROTO((void)); +extern aClass *find_class (int); +extern int get_conf_class (aConfItem *); +extern int get_client_class (aClient *); +extern int get_client_ping (aClient *); +extern int get_con_freq (aClass *); +extern void add_class (int, int, int, int, long); +extern void check_class (void); +extern void initclass (void); #endif /* __class_include__ */ diff --git a/include/common.h b/include/common.h index 21d2ad6..4aba493 100644 --- a/include/common.h +++ b/include/common.h @@ -23,8 +23,6 @@ #include #include "sys.h" -#define PROTO(x) x - #ifdef TRUE #undef TRUE #endif @@ -40,16 +38,16 @@ #define UNSURE (2) #endif -extern int match PROTO((char *, char *)); +extern int match (char *, char *); extern int mycmp (char *, char *); #ifndef HAVE_STRTOKEN -extern char *strtoken PROTO((char **, char *, char *)); +extern char *strtoken (char **, char *, char *); #endif extern int global_count, max_global_count; -extern char *myctime PROTO((time_t)); -extern char *strtoken PROTO((char **, char *, char *)); +extern char *myctime (time_t); +extern char *strtoken (char **, char *, char *); #ifndef MAX #define MAX(a, b) ((a) > (b) ? (a) : (b)) diff --git a/include/dbuf.h b/include/dbuf.h index 0aedc8c..c9410a2 100644 --- a/include/dbuf.h +++ b/include/dbuf.h @@ -67,7 +67,7 @@ typedef struct dbufbuf ** returns > 0, if operation successfull ** < 0, if failed (due memory allocation problem) */ -int dbuf_put PROTO((dbuf *, char *, int)); +int dbuf_put (dbuf *, char *, int); /* Dynamic buffer header */ /* Pointer to data to be stored */ /* Number of bytes to store */ @@ -87,7 +87,7 @@ int dbuf_put PROTO((dbuf *, char *, int)); ** Negative return values indicate some unspecified ** error condition, rather fatal... */ -int dbuf_get PROTO(( dbuf *, char *, int)); +int dbuf_get ( dbuf *, char *, int); /* Dynamic buffer header */ /* Pointer to buffer to receive the data */ /* Max amount of bytes that can be received */ @@ -116,11 +116,11 @@ int dbuf_get PROTO(( dbuf *, char *, int)); ** Note: delete can be used alone, there is no real binding ** between map and delete functions... */ -char *dbuf_map PROTO((dbuf *, int *)); +char *dbuf_map (dbuf *, int *); /* Dynamic buffer header */ /* Return number of bytes accessible */ -int dbuf_delete PROTO((dbuf *, int)); +int dbuf_delete (dbuf *, int); /* Dynamic buffer header */ /* Number of bytes to delete */ @@ -139,6 +139,6 @@ int dbuf_delete PROTO((dbuf *, int)); */ #define DBufClear(dyn) dbuf_delete((dyn),DBufLength(dyn)) -extern int dbuf_getmsg PROTO((dbuf *, char *, int)); +extern int dbuf_getmsg (dbuf *, char *, int); #endif /* __dbuf_include__ */ diff --git a/include/h.h b/include/h.h index 283029b..7484bcb 100644 --- a/include/h.h +++ b/include/h.h @@ -47,62 +47,62 @@ extern char REPORT_DO_DNS[128], REPORT_FIN_DNS[128], REPORT_FIN_DNSC[128], extern int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id; -extern aChannel *find_channel PROTO((char *, aChannel *)); -extern void remove_user_from_channel PROTO((aClient *, aChannel *)); -extern void del_invite PROTO((aClient *, aChannel *)); -extern int del_silence PROTO((aClient *, char *)); -extern void send_user_joins PROTO((aClient *, aClient *)); -extern void clean_channelname PROTO((char *)); -extern int do_nick_name PROTO((char *)); +extern aChannel *find_channel (char *, aChannel *); +extern void remove_user_from_channel (aClient *, aChannel *); +extern void del_invite (aClient *, aChannel *); +extern int del_silence (aClient *, char *); +extern void send_user_joins (aClient *, aClient *); +extern void clean_channelname (char *); +extern int do_nick_name (char *); /* We're going to pass the msg text to can_send() for +c channelmode -Defiant */ -extern int can_send PROTO((aClient *, aChannel *, char *)); -extern int is_chan_op PROTO((aClient *, aChannel *)); -extern int has_voice PROTO((aClient *, aChannel *)); -extern int count_channels PROTO((aClient *)); -extern Ban *is_banned PROTO((aClient *, aChannel *)); -extern Ban *is_banexception PROTO((aClient *, aChannel *)) ; -extern aClient *find_client PROTO((char *, aClient *)); -extern aClient *find_name PROTO((char *, aClient *)); -extern aClient *find_nickserv PROTO((char *, aClient *)); -extern aClient *find_person PROTO((char *, aClient *)); -extern aClient *find_server PROTO((char *, aClient *)); -extern aClient *find_service PROTO((char *, aClient *)); +extern int can_send (aClient *, aChannel *, char *); +extern int is_chan_op (aClient *, aChannel *); +extern int has_voice (aClient *, aChannel *); +extern int count_channels (aClient *); +extern Ban *is_banned (aClient *, aChannel *); +extern Ban *is_banexception (aClient *, aChannel *) ; +extern aClient *find_client (char *, aClient *); +extern aClient *find_name (char *, aClient *); +extern aClient *find_nickserv (char *, aClient *); +extern aClient *find_person (char *, aClient *); +extern aClient *find_server (char *, aClient *); +extern aClient *find_service (char *, aClient *); -extern int attach_conf PROTO((aClient *, aConfItem *)); -extern aConfItem *attach_confs PROTO((aClient*, char *, int)); -extern aConfItem *attach_confs_host PROTO((aClient*, char *, int)); -extern int attach_Iline PROTO((aClient *, struct hostent *, char *)); -extern aConfItem *conf, *find_me PROTO(()), *find_admin PROTO(()); -extern aConfItem *count_cnlines PROTO((Link *)); +extern int attach_conf (aClient *, aConfItem *); +extern aConfItem *attach_confs (aClient*, char *, int); +extern aConfItem *attach_confs_host (aClient*, char *, int); +extern int attach_Iline (aClient *, struct hostent *, char *); +extern aConfItem *conf, *find_me (), *find_admin (); +extern aConfItem *count_cnlines (Link *); extern aSqlineItem *sqline; -extern void det_confs_butmask PROTO((aClient *, int)); -extern int detach_conf PROTO((aClient *, aConfItem *)); -extern aSqlineItem *find_sqline_nick PROTO((char *)); -extern aSqlineItem *find_sqline_match PROTO((char *)); +extern void det_confs_butmask (aClient *, int); +extern int detach_conf (aClient *, aConfItem *); +extern aSqlineItem *find_sqline_nick (char *); +extern aSqlineItem *find_sqline_match (char *); extern aJinxItem *jinx; -extern aJinxItem *find_jinx_userhost PROTO((char *)); -extern aJinxItem *find_jinx_match PROTO((char *, char *)); -extern aConfItem *det_confs_butone PROTO((aClient *, aConfItem *)); +extern aJinxItem *find_jinx_userhost (char *); +extern aJinxItem *find_jinx_match (char *, char *); +extern aConfItem *det_confs_butone (aClient *, aConfItem *); extern char *find_diepass(); extern char *find_restartpass(); -extern aConfItem *find_conf PROTO((Link *, char*, int)); -extern aConfItem *find_conf_exact PROTO((char *, char *, char *, int)); -extern aConfItem *find_conf_host PROTO((Link *, char *, int)); -extern aConfItem *find_conf_ip PROTO((Link *, char *, char *, int)); -extern aConfItem *find_conf_name PROTO((char *, int)); -extern aConfItem *find_temp_conf_entry PROTO((aConfItem *, u_int)); -extern aConfItem *find_conf_servern PROTO((char *)); -extern int find_kill PROTO((aClient *)); -extern char *find_zap PROTO((aClient *, int)); -extern int find_socksexception PROTO((aClient *)); -extern int find_dccblock PROTO((char *)); -extern int find_restrict PROTO((aClient *)); -extern int rehash PROTO((aClient *, aClient *, int)); +extern aConfItem *find_conf (Link *, char*, int); +extern aConfItem *find_conf_exact (char *, char *, char *, int); +extern aConfItem *find_conf_host (Link *, char *, int); +extern aConfItem *find_conf_ip (Link *, char *, char *, int); +extern aConfItem *find_conf_name (char *, int); +extern aConfItem *find_temp_conf_entry (aConfItem *, u_int); +extern aConfItem *find_conf_servern (char *); +extern int find_kill (aClient *); +extern char *find_zap (aClient *, int); +extern int find_socksexception (aClient *); +extern int find_dccblock (char *); +extern int find_restrict (aClient *); +extern int rehash (aClient *, aClient *, int); // fixme: this is used 2 diffrent ways depending on the file ? -extern int initconf PROTO((int)); +extern int initconf (int); // extern aConfItem *initconf(); extern void add_temp_conf(); -extern void inittoken PROTO(()); +extern void inittoken (); extern int do_channel_synch(char *); extern int synchmode; extern int SVSNOOP; @@ -123,146 +123,146 @@ extern void CheckEvents(); extern void AddEvent(); extern void RemoveZLine(char *); -extern char *MyMalloc PROTO(()), *MyRealloc PROTO(()) ; +extern char *MyMalloc (), *MyRealloc () ; extern char *debugmode, *configfile, *sbrk0; -extern char *getfield PROTO((char *)); -extern void get_sockhost PROTO((aClient *, char *)); -extern char *rpl_str PROTO((int)), *err_str PROTO((int)); -extern char *strerror PROTO((int)); -extern int dgets PROTO((int, char *, int)); -extern char *inetntoa PROTO((char *)); +extern char *getfield (char *); +extern void get_sockhost (aClient *, char *); +extern char *rpl_str (int), *err_str (int); +extern char *strerror (int); +extern int dgets (int, char *, int); +extern char *inetntoa (char *); extern int dbufalloc, dbufblocks, debuglevel, errno, h_errno; extern int highest_fd, debuglevel, portnum, debugtty, maxusersperchannel; extern int readcalls, udpfd, resfd; -extern aClient *add_connection PROTO((aClient *, int)); -extern int add_listener PROTO((aConfItem *)); -extern void add_local_domain PROTO((char *, int)); -extern int check_client PROTO((aClient *)); -extern int check_server PROTO((aClient *, struct hostent *, \ - aConfItem *, aConfItem *, int)); -extern int check_server_init PROTO((aClient *)); -extern void close_connection PROTO((aClient *)); -extern void close_listeners PROTO(()); -extern int connect_server PROTO((aConfItem *, aClient *, struct hostent *)); -extern void get_my_name PROTO((aClient *, char *, int)); -extern int get_sockerr PROTO((aClient *)); -extern int inetport PROTO((aClient *, char *, int)); -extern void init_sys PROTO(()); -extern int read_message PROTO((time_t)); -extern void report_error PROTO((char *, aClient *)); -extern void set_non_blocking PROTO((int, aClient *)); -extern int setup_ping PROTO(()); +extern aClient *add_connection (aClient *, int); +extern int add_listener (aConfItem *); +extern void add_local_domain (char *, int); +extern int check_client (aClient *); +extern int check_server (aClient *, struct hostent *, \ + aConfItem *, aConfItem *, int); +extern int check_server_init (aClient *); +extern void close_connection (aClient *); +extern void close_listeners (); +extern int connect_server (aConfItem *, aClient *, struct hostent *); +extern void get_my_name (aClient *, char *, int); +extern int get_sockerr (aClient *); +extern int inetport (aClient *, char *, int); +extern void init_sys (); +extern int read_message (time_t); +extern void report_error (char *, aClient *); +extern void set_non_blocking (int, aClient *); +extern int setup_ping (); extern int ping_server(aClient *, struct hostent *); extern void read_ping(aClient *); extern void send_ping(aClient *); extern void cancel_ping(aClient *, aClient *); extern void end_ping(aClient *); -extern int unixport PROTO((aClient *, char *, int)); -extern int utmp_open PROTO(()); -extern int utmp_read PROTO((int, char *, char *, char *, int)); -extern int utmp_close PROTO((int)); +extern int unixport (aClient *, char *, int); +extern int utmp_open (); +extern int utmp_read (int, char *, char *, char *, int); +extern int utmp_close (int); -extern void restart PROTO((char *)); -extern void send_channel_modes_sts PROTO((aClient *, aChannel *)); /* New StarChat STS1 resynch code */ -extern void server_reboot PROTO((char *)); -extern void terminate PROTO(()), write_pidfile PROTO(()); +extern void restart (char *); +extern void send_channel_modes_sts (aClient *, aChannel *); /* New StarChat STS1 resynch code */ +extern void server_reboot (char *); +extern void terminate (), write_pidfile (); -extern int send_queued PROTO((aClient *)); -extern void sendto_one(); -extern void sendto_channel_butone(); -extern void sendto_channelops_butone(); -extern void sendto_channelvoice_butone(); -extern void sendto_serv_butone(); -extern void sendto_SNICK_butone(); -extern void sendto_serv_butone_quit(); -extern void sendto_common_channels(); -extern void sendto_channel_butserv(); -extern void sendto_match_servs(); -extern void sendto_match_butone(); -extern void sendto_all_butone(); -extern void sendto_ops(); -extern void sendto_ops_butone(); -extern void sendto_ops_butme(); -extern void sendto_prefix_one(); -extern void sendto_failops_whoare_opers(); -extern void sendto_realops(); -extern void sendto_locfailops(); -extern void sendto_failops(); -extern void sendto_opers(); -extern void sendto_umode(); +extern int send_queued (aClient *); +extern void sendto_one(aClient *, char *, ...); +extern void sendto_channel_butone(aClient *, aClient *, aChannel *, char *, ...); +extern void sendto_channelops_butone(aClient *, aClient *, aChannel *, char *, ...); +extern void sendto_channelvoice_butone(aClient *, aClient *, aChannel *, char *, ...); +extern void sendto_serv_butone(aClient *, char *, ...); +extern void sendto_SNICK_butone(aClient *, char *, ...); +extern void sendto_serv_butone_quit(aClient *, char *, ...); +extern void sendto_common_channels(aClient *, char *, ...); +extern void sendto_channel_butserv(aChannel *, aClient *, char *, ...); +extern void sendto_match_servs(aChannel *, aClient *, char *, ...); +extern void sendto_match_butone(aClient *, aClient *, char *, int, char *, ...); +extern void sendto_all_butone(aClient *, aClient *, char *, ...); +extern void sendto_ops(char *, ...); +extern void sendto_ops_butone(aClient *, aClient *, char *, ...); +extern void sendto_ops_butme(aClient **, char *, ...); +extern void sendto_prefix_one(aClient *, aClient *, char *, ...); +extern void sendto_failops_whoare_opers(char *, ...); +extern void sendto_realops(char *, ...); +extern void sendto_locfailops(char *, ...); +extern void sendto_failops(char *, ...); +extern void sendto_opers(char *, ...); +extern void sendto_umode(int, char *, ...); extern int writecalls, writeb[]; -extern int deliver_it PROTO((aClient *, char *, int)); +extern int deliver_it (aClient *, char *, int); -extern int check_registered PROTO((aClient *)); -extern int check_registered_user PROTO((aClient *)); -extern char *get_client_name PROTO((aClient *, int)); -extern char *get_client_host PROTO((aClient *)); -extern char *my_name_for_link PROTO((char *, aConfItem *)); -extern char *myctime PROTO((time_t)), *date PROTO((time_t)); -extern int exit_client PROTO((aClient *, aClient *, aClient *, char *)); -extern void initstats PROTO(()), tstats PROTO((aClient *, char *)); -extern char *check_string PROTO((char *)); -extern char *make_nick_user_host PROTO((char *, char *, char *)); +extern int check_registered (aClient *); +extern int check_registered_user (aClient *); +extern char *get_client_name (aClient *, int); +extern char *get_client_host (aClient *); +extern char *my_name_for_link (char *, aConfItem *); +extern char *myctime (time_t), *date (time_t); +extern int exit_client (aClient *, aClient *, aClient *, char *); +extern void initstats (), tstats (aClient *, char *); +extern char *check_string (char *); +extern char *make_nick_user_host (char *, char *, char *); -extern int parse PROTO((aClient *, char *, char *, struct Message *)); -extern int do_numeric PROTO((int, aClient *, aClient *, int, char **)); -extern int hunt_server PROTO((aClient *,aClient *,char *,int,int,char **)); -extern aClient *next_client PROTO((aClient *, char *)); -extern int m_umode PROTO((aClient *, aClient *, int, char **)); -extern int m_names PROTO((aClient *, aClient *, int, char **)); -extern int m_server_estab PROTO((aClient *)); -extern void send_umode PROTO((aClient *, aClient *, int, int, char *)); -extern void send_umode_out PROTO((aClient*, aClient *, int)); -extern char *hideme PROTO((aClient *, aClient *)); -extern char *maskme PROTO((char *, int)); -extern char *maskmenow PROTO((aClient *, aClient*)); +extern int parse (aClient *, char *, char *, struct Message *); +extern int do_numeric (int, aClient *, aClient *, int, char **); +extern int hunt_server (aClient *,aClient *,char *,int,int,char **); +extern aClient *next_client (aClient *, char *); +extern int m_umode (aClient *, aClient *, int, char **); +extern int m_names (aClient *, aClient *, int, char **); +extern int m_server_estab (aClient *); +extern void send_umode (aClient *, aClient *, int, int, char *); +extern void send_umode_out (aClient*, aClient *, int); +extern char *hideme (aClient *, aClient *); +extern char *maskme (char *, int); +extern char *maskmenow (aClient *, aClient*); -extern void free_client PROTO((aClient *)); -extern void free_link PROTO((Link *)); -extern void free_ban PROTO((Ban *)); -extern void free_conf PROTO((aConfItem *)); -extern void free_class PROTO((aClass *)); -extern void free_user PROTO((anUser *, aClient *)); -extern int find_str_match_link PROTO((Link **, char *)); -extern void free_str_list PROTO ((Link *)); -extern Link *make_link PROTO(()); -extern Ban *make_ban PROTO(()); -extern anUser *make_user PROTO((aClient *)); -extern aSqlineItem *make_sqline PROTO(()); -//extern aJinxItem *make_jinx PROTO(()); -extern aConfItem *make_conf PROTO(()); -extern aClass *make_class PROTO(()); -extern aServer *make_server PROTO(()); -extern aClient *make_client PROTO((aClient *, aClient *)); -extern Link *find_user_link PROTO((Link *, aClient *)); -extern int IsMember PROTO((aClient *, aChannel *)); -extern char *pretty_mask PROTO((char *)); -extern void add_client_to_list PROTO((aClient *)); -extern void checklist PROTO(()); -extern void remove_client_from_list PROTO((aClient *)); -extern void initlists PROTO(()); +extern void free_client (aClient *); +extern void free_link (Link *); +extern void free_ban (Ban *); +extern void free_conf (aConfItem *); +extern void free_class (aClass *); +extern void free_user (anUser *, aClient *); +extern int find_str_match_link (Link **, char *); +extern void free_str_list (Link *); +extern Link *make_link (); +extern Ban *make_ban (); +extern anUser *make_user (aClient *); +extern aSqlineItem *make_sqline (); +//extern aJinxItem *make_jinx (); +extern aConfItem *make_conf (); +extern aClass *make_class (); +extern aServer *make_server (); +extern aClient *make_client (aClient *, aClient *); +extern Link *find_user_link (Link *, aClient *); +extern int IsMember (aClient *, aChannel *); +extern char *pretty_mask (char *); +extern void add_client_to_list (aClient *); +extern void checklist (); +extern void remove_client_from_list (aClient *); +extern void initlists (); -extern void add_class PROTO((int, int, int, int, long)); -extern void fix_class PROTO((aConfItem *, aConfItem *)); -extern long get_sendq PROTO((aClient *)); -extern int get_con_freq PROTO((aClass *)); -extern int get_client_ping PROTO((aClient *)); -extern int get_client_class PROTO((aClient *)); -extern int get_conf_class PROTO((aConfItem *)); -extern void report_classes PROTO((aClient *)); +extern void add_class (int, int, int, int, long); +extern void fix_class (aConfItem *, aConfItem *); +extern long get_sendq (aClient *); +extern int get_con_freq (aClass *); +extern int get_client_ping (aClient *); +extern int get_client_class (aClient *); +extern int get_conf_class (aConfItem *); +extern void report_classes (aClient *); extern int res_init(); extern u_long cres_mem(aClient *); -extern struct hostent *get_res PROTO((char *)); -extern struct hostent *gethost_byaddr PROTO((char *, Link *)); -extern struct hostent *gethost_byname PROTO((char *, Link *)); -extern void flush_cache PROTO(()); -extern int init_resolver PROTO((int)); -extern time_t timeout_query_list PROTO((time_t)); -extern time_t expire_cache PROTO((time_t)); -extern void del_queries PROTO((char *)); +extern struct hostent *get_res (char *); +extern struct hostent *gethost_byaddr (char *, Link *); +extern struct hostent *gethost_byname (char *, Link *); +extern void flush_cache (); +extern int init_resolver (int); +extern time_t timeout_query_list (time_t); +extern time_t expire_cache (time_t); +extern void del_queries (char *); #ifdef ZIP_LINKS extern int zip_init (aClient *); @@ -272,39 +272,39 @@ extern char *zip_buffer (aClient *, char *, int *, int); #endif -extern void clear_channel_hash_table PROTO(()); -extern void clear_client_hash_table PROTO(()); -extern void clear_notify_hash_table PROTO(()); -extern int add_to_client_hash_table PROTO((char *, aClient *)); -extern int del_from_client_hash_table PROTO((char *, aClient *)); -extern int add_to_channel_hash_table PROTO((char *, aChannel *)); -extern int del_from_channel_hash_table PROTO((char *, aChannel *)); -extern int add_to_notify_hash_table PROTO((char *, aClient *)); -extern int del_from_notify_hash_table PROTO((char *, aClient *)); -extern int hash_check_notify PROTO((aClient *, int)); -extern int hash_del_notify_list PROTO((aClient *)); -extern void count_watch_memory PROTO((int *, u_long *)); -extern aNotify *hash_get_notify PROTO((char *)); -extern aChannel *hash_get_chan_bucket PROTO((int)); -extern aChannel *hash_find_channel PROTO((char *, aChannel *)); -extern aClient *hash_find_client PROTO((char *, aClient *)); -extern aClient *hash_find_nickserver PROTO((char *, aClient *)); -extern aClient *hash_find_server PROTO((char *, aClient *)); -extern aClient *find_server_wildcard PROTO((char *)); +extern void clear_channel_hash_table (); +extern void clear_client_hash_table (); +extern void clear_notify_hash_table (); +extern int add_to_client_hash_table (char *, aClient *); +extern int del_from_client_hash_table (char *, aClient *); +extern int add_to_channel_hash_table (char *, aChannel *); +extern int del_from_channel_hash_table (char *, aChannel *); +extern int add_to_notify_hash_table (char *, aClient *); +extern int del_from_notify_hash_table (char *, aClient *); +extern int hash_check_notify (aClient *, int); +extern int hash_del_notify_list (aClient *); +extern void count_watch_memory (int *, u_long *); +extern aNotify *hash_get_notify (char *); +extern aChannel *hash_get_chan_bucket (int); +extern aChannel *hash_find_channel (char *, aChannel *); +extern aClient *hash_find_client (char *, aClient *); +extern aClient *hash_find_nickserver (char *, aClient *); +extern aClient *hash_find_server (char *, aClient *); +extern aClient *find_server_wildcard (char *); -extern void add_history PROTO((aClient *)); -extern aClient *get_history PROTO((char *, time_t)); -extern void initwhowas PROTO(()); -extern void off_history PROTO((aClient *)); +extern void add_history (aClient *); +extern aClient *get_history (char *, time_t); +extern void initwhowas (); +extern void off_history (aClient *); -extern int dopacket PROTO((aClient *, char *, int)); +extern int dopacket (aClient *, char *, int); void count_memory(aClient *, char *); -extern void debug(); +extern void debug(int, char *, ...); #if defined(DEBUGMODE) -extern void send_usage PROTO((aClient *, char *)); -extern void send_listinfo PROTO((aClient *, char *)); -extern void count_memory PROTO((aClient *, char *)); +extern void send_usage (aClient *, char *); +extern void send_listinfo (aClient *, char *); +extern void count_memory (aClient *, char *); #endif extern void get_max_users(void); extern void strip_trailing_spaces(char *) ; diff --git a/include/sys.h b/include/sys.h index 6d9133f..c5e526a 100644 --- a/include/sys.h +++ b/include/sys.h @@ -62,7 +62,7 @@ typedef unsigned int u_int; #endif #ifdef DEBUGMODE -extern void debug(); +extern void debug(int, char *, ...); # define Debug(x) debug x # define LOGFILE LPATH #else diff --git a/include/userload.h b/include/userload.h index 6166bf6..127c32d 100644 --- a/include/userload.h +++ b/include/userload.h @@ -47,6 +47,6 @@ extern struct load_entry *load_list_head, *load_list_tail, *load_free_head, *load_free_tail; -extern void initload PROTO ((void)); -extern void update_load PROTO ((void)); -extern void calc_load PROTO ((aClient *, char *)); +extern void initload (void); +extern void update_load (void); +extern void calc_load (aClient *, char *); diff --git a/include/whowas.h b/include/whowas.h index 7c3059f..abbb493 100644 --- a/include/whowas.h +++ b/include/whowas.h @@ -58,7 +58,7 @@ typedef struct aname { ** Client must be a fully registered user (specifically, ** the user structure must have been allocated). */ -void add_history PROTO((aClient *)); +void add_history (aClient *); /* ** off_history @@ -67,7 +67,7 @@ void add_history PROTO((aClient *)); ** structures and it must know when they cease to exist. This ** also implicitly calls AddHistory. */ -void off_history PROTO((aClient *)); +void off_history (aClient *); /* ** get_history @@ -75,15 +75,15 @@ void off_history PROTO((aClient *)); ** nickname within the timelimit. Returns NULL, if no ** one found... */ -aClient *get_history PROTO((char *, time_t)); +aClient *get_history (char *, time_t); /* Nick name */ /* Time limit in seconds */ -int m_whowas PROTO((aClient *, aClient *, int, char *[])); +int m_whowas (aClient *, aClient *, int, char *[]); /* ** for debugging...counts related structures stored in whowas array. */ -void count_whowas_memory PROTO((int *, int *, u_long *)); +void count_whowas_memory (int *, int *, u_long *); #endif /* __whowas_include__ */ diff --git a/src/bsd.c b/src/bsd.c index c292457..b6897ed 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -73,10 +73,7 @@ void dummy () ** *NOTE* I nuked 'em. At the load of current ircd servers ** you can't run with stuff that blocks. And we don't. */ -int deliver_it (cptr, str, len) - aClient *cptr; - int len; - char *str; +int deliver_it (aClient *cptr, char *str, int len) { int retval; aClient *acpt = cptr->acpt; diff --git a/src/channel.c b/src/channel.c index 2cbc90f..1d7a706 100644 --- a/src/channel.c +++ b/src/channel.c @@ -30,26 +30,26 @@ aChannel *channel = NullChn; aSynchList *SJSynchList = NULL; -static void add_invite PROTO ((aClient *, aChannel *)); -static int can_join PROTO ((aClient *, aChannel *, char *)); -static void channel_modes PROTO ((aClient *, char *, char *, aChannel *)); -static int check_channelmask PROTO ((aClient *, aClient *, char *)); -static int add_banid PROTO ((aClient *, aChannel *, char *)); -static int del_banid PROTO ((aChannel *, char *)); -static int find_banid PROTO ((aChannel *, char *)); -static int add_exbanid PROTO ((aClient *, aChannel *, char *)); -static int del_exbanid PROTO ((aChannel *, char *)); -static int find_exbanid PROTO ((aChannel *, char *)); -static int add_hostrestrictid PROTO ((aClient *, aChannel *, char *)); -static int del_hostrestrictid PROTO ((aChannel *, char *)); -static int find_hostrestrictid PROTO ((aChannel *, char *)); -static int have_ops PROTO ((aChannel *)); -static int set_mode PROTO ((aClient *, aClient *, aChannel *, int, - char **, char *, char *, int *, int)); -static void sub1_from_channel PROTO ((aChannel *)); - -void clean_channelname PROTO ((char *)); -void del_invite PROTO ((aClient *, aChannel *)); +static void add_invite (aClient *, aChannel *); +static int can_join (aClient *, aChannel *, char *); +static void channel_modes (aClient *, char *, char *, aChannel *); +static int check_channelmask (aClient *, aClient *, char *); +static int add_banid (aClient *, aChannel *, char *); +static int del_banid (aChannel *, char *); +static int find_banid (aChannel *, char *); +static int add_exbanid (aClient *, aChannel *, char *); +static int del_exbanid (aChannel *, char *); +static int find_exbanid (aChannel *, char *); +static int add_hostrestrictid (aClient *, aChannel *, char *); +static int del_hostrestrictid (aChannel *, char *); +static int find_hostrestrictid (aChannel *, char *); +static int have_ops (aChannel *); +static int set_mode (aClient *, aClient *, aChannel *, int, + char **, char *, char *, int *, int); +static void sub1_from_channel (aChannel *); + +void clean_channelname (char *); +void del_invite (aClient *, aChannel *); int check_for_target_limit (aClient *, void *, const char *); /* from s_user.c */ int sendmodeto_one (aClient *, char *, char *, char *, char *, time_t); @@ -66,8 +66,7 @@ static char modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; /* * return the length (>=0) of a chain of links. */ -static int list_length (lp) - Link *lp; +static int list_length (Link *lp) { int count = 0; @@ -83,10 +82,7 @@ static int list_length (lp) ** message (NO SUCH NICK) is generated. If the client was found ** through the history, chasing will be 1 and otherwise 0. */ -static aClient *find_chasing (sptr, user, chasing) - aClient *sptr; - char *user; - int *chasing; +static aClient * find_chasing (aClient *sptr, char *user, int *chasing) { aClient *who = find_client (user, (aClient *) NULL); @@ -109,10 +105,7 @@ static aClient *find_chasing (sptr, user, chasing) */ /* add_banid - add an id to be banned to the channel (belongs to cptr) */ -static int add_banid (cptr, chptr, banid) - aClient *cptr; - aChannel *chptr; - char *banid; +static int add_banid (aClient *cptr, aChannel *chptr, char *banid) { Ban *ban; int cnt = 0, len = 0; @@ -153,9 +146,7 @@ static int add_banid (cptr, chptr, banid) /* * del_banid - delete an id belonging to cptr */ -static int del_banid (chptr, banid) - aChannel *chptr; - char *banid; +static int del_banid (aChannel *chptr, char *banid) { Ban **ban; Ban *tmp; @@ -177,9 +168,7 @@ static int del_banid (chptr, banid) /* * find_banid - Find an exact match for a ban */ -static int find_banid (chptr, banid) - aChannel *chptr; - char *banid; +static int find_banid (aChannel *chptr, char *banid) { Ban **ban; @@ -196,10 +185,7 @@ static int find_banid (chptr, banid) * -Ax0n */ -static int add_exbanid (cptr, chptr, banid) - aClient *cptr; - aChannel *chptr; - char *banid; +static int add_exbanid (aClient *cptr, aChannel *chptr, char *banid) { Ban *ban; int cnt = 0, len = 0; @@ -237,9 +223,7 @@ static int add_exbanid (cptr, chptr, banid) return 0; } -static int del_exbanid (chptr, banid) - aChannel *chptr; - char *banid; +static int del_exbanid (aChannel *chptr, char *banid) { Ban **ban; Ban *tmp; @@ -258,9 +242,7 @@ static int del_exbanid (chptr, banid) return -1; } -static int find_exbanid (chptr, banid) - aChannel *chptr; - char *banid; +static int find_exbanid (aChannel *chptr, char *banid) { Ban **ban; @@ -277,10 +259,7 @@ static int find_exbanid (chptr, banid) * -Remmy */ -static int add_hostrestrictid (cptr, chptr, banid) - aClient *cptr; - aChannel *chptr; - char *banid; +static int add_hostrestrictid (aClient *cptr, aChannel *chptr, char *banid) { Ban *ban; int cnt = 0, len = 0; @@ -318,9 +297,7 @@ static int add_hostrestrictid (cptr, chptr, banid) return 0; } -static int del_hostrestrictid (chptr, banid) - aChannel *chptr; - char *banid; +static int del_hostrestrictid (aChannel *chptr, char *banid) { Ban **ban; Ban *tmp; @@ -339,9 +316,7 @@ static int del_hostrestrictid (chptr, banid) return -1; } -static int find_hostrestrictid (chptr, banid) - aChannel *chptr; - char *banid; +static int find_hostrestrictid (aChannel *chptr, char *banid) { Ban **ban; @@ -357,9 +332,7 @@ static int find_hostrestrictid (chptr, banid) /* * IsMember - returns 1 if a person is joined */ -int IsMember (cptr, chptr) - aClient *cptr; - aChannel *chptr; +int IsMember (aClient *cptr, aChannel *chptr) { Link *lp; return (((lp = find_user_link (chptr->members, cptr)))? 1 : 0); @@ -368,9 +341,7 @@ int IsMember (cptr, chptr) /* * is_banned - returns a pointer to the ban structure if banned else NULL */ -extern Ban *is_banned (cptr, chptr) - aClient *cptr; - aChannel *chptr; +extern Ban * is_banned (aClient *cptr, aChannel *chptr) { Ban *tmp; char *s, realaddy[NICKLEN + USERLEN + HOSTLEN + 6], @@ -398,9 +369,7 @@ extern Ban *is_banned (cptr, chptr) /* * is_banexception - see is_banned(), same diff. */ -extern Ban *is_banexception (cptr, chptr) - aClient *cptr; - aChannel *chptr; +extern Ban * is_banexception (aClient *cptr, aChannel *chptr) { Ban *tmp; char *s, realaddy[NICKLEN + USERLEN + HOSTLEN + 6], @@ -428,9 +397,7 @@ extern Ban *is_banexception (cptr, chptr) /* * is_banexception - see is_banned(), same diff. */ -extern Ban *is_host_restricted (cptr, chptr) - aClient *cptr; - aChannel *chptr; +extern Ban * is_host_restricted (aClient *cptr, aChannel *chptr) { Ban *tmp; char *s, realaddy[NICKLEN + USERLEN + HOSTLEN + 6], @@ -459,10 +426,7 @@ extern Ban *is_host_restricted (cptr, chptr) * adds a user to a channel by adding another link to the channels member * chain. */ -static void add_user_to_channel (chptr, who, flags) - aChannel *chptr; - aClient *who; - int flags; +static void add_user_to_channel (aChannel *chptr, aClient *who, int flags) { Link *ptr; @@ -482,9 +446,7 @@ static void add_user_to_channel (chptr, who, flags) } } -void remove_user_from_channel (sptr, chptr) - aClient *sptr; - aChannel *chptr; +void remove_user_from_channel (aClient *sptr, aChannel *chptr) { Link **curr; Link *tmp; @@ -518,8 +480,7 @@ void remove_user_from_channel (sptr, chptr) } -static int have_ops (chptr) - aChannel *chptr; +static int have_ops (aChannel *chptr) { Link *lp; @@ -534,9 +495,7 @@ static int have_ops (chptr) return 0; } -int is_chan_op (cptr, chptr) - aClient *cptr; - aChannel *chptr; +int is_chan_op (aClient *cptr, aChannel *chptr) { Link *lp; @@ -547,9 +506,7 @@ int is_chan_op (cptr, chptr) return 0; } -int has_voice (cptr, chptr) - aClient *cptr; - aChannel *chptr; +int has_voice (aClient *cptr, aChannel *chptr) { Link *lp; @@ -567,10 +524,7 @@ int has_voice (cptr, chptr) #define CANNOT_SEND_NOCOLORS 3 #define CANNOT_SEND_BAN 4 -int can_send (cptr, chptr, msgtext) - aClient *cptr; - aChannel *chptr; - char *msgtext; /* for color checking -Defiant */ +int can_send (aClient *cptr, aChannel *chptr, char *msgtext) { Link *lp; int member; @@ -603,9 +557,7 @@ int can_send (cptr, chptr, msgtext) return 0; } -aChannel *find_channel (chname, chptr) - char *chname; - aChannel *chptr; +aChannel * find_channel (char *chname, aChannel *chptr) { return hash_find_channel (chname, chptr); } @@ -614,10 +566,7 @@ aChannel *find_channel (chname, chptr) * write the "simple" list of channel modes for channel chptr onto buffer mbuf * with the parameters in pbuf. */ -static void channel_modes (cptr, mbuf, pbuf, chptr) - aClient *cptr; - char *mbuf, *pbuf; - aChannel *chptr; +static void channel_modes (aClient *cptr, char *mbuf, char *pbuf, aChannel *chptr) { *mbuf++ = '+'; if (chptr->mode.mode & MODE_SECRET) @@ -652,11 +601,7 @@ static void channel_modes (cptr, mbuf, pbuf, chptr) return; } -static int send_ban_list (cptr, chname, creationtime, top) - aClient *cptr; - Link *top; - char *chname; - time_t creationtime; +static int send_ban_list (aClient *cptr, char *chname, time_t creationtime, Link *top) { Link *lp; char *cp, *name; @@ -700,11 +645,7 @@ static int send_ban_list (cptr, chname, creationtime, top) return sent; } -static int send_exban_list (cptr, chname, creationtime, top) - aClient *cptr; - Link *top; - char *chname; - time_t creationtime; +static int send_exban_list (aClient *cptr, char *chname, time_t creationtime, Link *top) { Link *lp; char *cp, *name; @@ -748,11 +689,7 @@ static int send_exban_list (cptr, chname, creationtime, top) return sent; } -static int send_hostrestrict_list (cptr, chname, creationtime, top) - aClient *cptr; - Link *top; - char *chname; - time_t creationtime; +static int send_hostrestrict_list (aClient *cptr, char *chname, time_t creationtime, Link *top) { Link *lp; char *cp, *name; @@ -801,9 +738,7 @@ static int send_hostrestrict_list (cptr, chname, creationtime, top) * using the new StarChat Time Stamp 1 protocol (based on EFnet TS3) */ -void send_channel_modes_sts (cptr, chptr) - aClient *cptr; - aChannel *chptr; +void send_channel_modes_sts (aClient *cptr, aChannel *chptr) { Link *members; @@ -894,10 +829,7 @@ void send_channel_modes_sts (cptr, chptr) ** parv[2] - reason ** */ -int m_knock (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_knock (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aChannel *chptr; @@ -964,10 +896,7 @@ int m_knock (cptr, sptr, parc, parv) * parv[2] = modes * -taz */ -int m_samode (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_samode (aClient *cptr, aClient *sptr, int parc, char *parv[]) { /* static char tmp[MODEBUFLEN]; Compiler says this is unused */ int badop, sendts; @@ -1022,11 +951,7 @@ int m_samode (cptr, sptr, parc, parv) * parv[0] - sender * parv[1] - channel */ -int m_mode (cptr, sptr, parc, parv) - aClient *cptr; - aClient *sptr; - int parc; - char *parv[]; +int m_mode (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; Link *lp; @@ -1168,8 +1093,7 @@ int m_mode (cptr, sptr, parc, parv) return 0; } -int DoesOp (modebuf) - char *modebuf; +int DoesOp (char *modebuf) { modebuf--; /* Is it possible that a mode starts with o and not +o ? */ while (*++modebuf) @@ -1178,10 +1102,7 @@ int DoesOp (modebuf) return 0; } -int sendmodeto_one (cptr, from, name, mode, param, creationtime) - aClient *cptr; - char *from, *name, *mode, *param; - time_t creationtime; +int sendmodeto_one (aClient *cptr, char *from, char *name, char *mode, char *param, time_t creationtime) { if ((IsServer (cptr) && DoesOp (mode) && creationtime) || IsULine (cptr, cptr)) @@ -1195,8 +1116,7 @@ int sendmodeto_one (cptr, from, name, mode, param, creationtime) return 0; } -char *pretty_mask (mask) - char *mask; +char * pretty_mask (char *mask) { char *cp; char *user; @@ -1219,11 +1139,7 @@ char *pretty_mask (mask) * the client ccptr to channel chptr. The resultant changes are printed * into mbuf and pbuf (if any) and applied to the channel. */ -static int set_mode (cptr, sptr, chptr, parc, parv, mbuf, pbuf, badop, sadmin) - aClient *cptr, *sptr; - aChannel *chptr; - int parc, *badop, sadmin; - char *parv[], *mbuf, *pbuf; +static int set_mode (aClient *cptr, aClient *sptr, aChannel *chptr, int parc, char *parv[], char *mbuf, char *pbuf, int *badop, int sadmin) { static Link chops[MAXMODEPARAMS]; static int flags[] = { @@ -2078,10 +1994,7 @@ static int set_mode (cptr, sptr, chptr, parc, parv, mbuf, pbuf, badop, sadmin) * a user won't have invites on him anyway. -Donwulff */ -static int can_join (sptr, chptr, key) - aClient *sptr; - aChannel *chptr; - char *key; +static int can_join (aClient *sptr, aChannel *chptr, char *key) { Link *lp; @@ -2121,8 +2034,7 @@ static int can_join (sptr, chptr, key) ** Remove bells and commas from channel name */ -void clean_channelname (cn) - char *cn; +void clean_channelname (char *cn) { u_char *ch = (u_char *) cn; @@ -2144,9 +2056,7 @@ void clean_channelname (cn) /* ** Return -1 if mask is present and doesnt match our server name. */ -static int check_channelmask (sptr, cptr, chname) - aClient *sptr, *cptr; - char *chname; +static int check_channelmask (aClient *sptr, aClient *cptr, char *chname) { char *s; @@ -2170,10 +2080,7 @@ static int check_channelmask (sptr, cptr, chname) ** Get Channel block for i (and allocate a new channel ** block, if it didn't exists before). */ -static aChannel *get_channel (cptr, chname, flag) - aClient *cptr; - char *chname; - int flag; +static aChannel * get_channel (aClient *cptr, char *chname, int flag) { aChannel *chptr; int len; @@ -2211,9 +2118,7 @@ static aChannel *get_channel (cptr, chname, flag) * Should U-lined clients have higher limits? -Donwulff */ -static void add_invite (cptr, chptr) - aClient *cptr; - aChannel *chptr; +static void add_invite (aClient *cptr, aChannel *chptr) { Link *inv, *tmp; @@ -2253,9 +2158,7 @@ static void add_invite (cptr, chptr) /* * Delete Invite block from channel invite list and client invite list */ -void del_invite (cptr, chptr) - aClient *cptr; - aChannel *chptr; +void del_invite (aClient *cptr, aChannel *chptr) { Link **inv, *tmp; @@ -2277,8 +2180,7 @@ void del_invite (cptr, chptr) ** Subtract one user from channel i (and free channel ** block, if channel became empty). */ -static void sub1_from_channel (chptr) - aChannel *chptr; +static void sub1_from_channel (aChannel *chptr) { Ban *ban; Link *lp; @@ -2316,10 +2218,7 @@ static void sub1_from_channel (chptr) * - GZ */ -void mode_just_do_it (cptr, chptr, modebuf2, parabuf2) - aClient *cptr; - aChannel *chptr; - char *modebuf2, *parabuf2; +void mode_just_do_it (aClient *cptr, aChannel *chptr, char *modebuf2, char *parabuf2) { static char pbuf1[50]; @@ -2473,10 +2372,7 @@ void mode_just_do_it (cptr, chptr, modebuf2, parabuf2) ** parv[4] = channel mode parameters (key/limit) ** parv[5] = nick names + modes - all in one parameter */ -int m_sjoin (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_sjoin (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr, *tempptr; @@ -3067,10 +2963,7 @@ int m_sjoin (cptr, sptr, parc, parv) ** parv[1] = nick ** parv[2] = channel to join */ -int m_svsjoin (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svsjoin (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -3095,10 +2988,7 @@ int m_svsjoin (cptr, sptr, parc, parv) ** parv[1] = channel ** parv[2] = channel password (key) */ -int m_join (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_join (aClient *cptr, aClient *sptr, int parc, char *parv[]) { static char jbuf[BUFSIZE]; Link *lp; @@ -3283,10 +3173,7 @@ int m_join (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = channel */ -int m_svspart (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svspart (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -3311,10 +3198,7 @@ int m_svspart (cptr, sptr, parc, parv) ** parv[1] = channel ** parv[2] = comment (reason, ignored for jinxed users) */ -int m_part (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_part (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aChannel *chptr; Link *lp; @@ -3389,10 +3273,7 @@ int m_part (cptr, sptr, parc, parv) ** parv[2] = client to kick ** parv[3] = kick comment */ -int m_kick (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_kick (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *who; aChannel *chptr; @@ -3519,8 +3400,7 @@ int m_kick (cptr, sptr, parc, parv) return (0); } -int count_channels (sptr) - aClient *sptr; +int count_channels (aClient *sptr) { aChannel *chptr; int count = 0; @@ -3542,10 +3422,7 @@ int count_channels (sptr) ** parv[3] = topic time ** parv[4] = topic text */ -int m_topic (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_topic (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aChannel *chptr = NullChn; char *topic = NULL, *name, *p = NULL, *tnick = NULL; @@ -3658,10 +3535,7 @@ int m_topic (cptr, sptr, parc, parv) ** parv[1] - user to invite ** parv[2] - channel number */ -int m_invite (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_invite (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; aChannel *chptr; @@ -3769,9 +3643,7 @@ int m_invite (cptr, sptr, parc, parv) * assuming CHANNELHASHSIZE is was well picked). So be conservative * if altering numsend };> -Rak */ -void send_list (cptr, numsend) - aClient *cptr; - int numsend; +void send_list (aClient *cptr, int numsend) { int hashptr, done = 0; aChannel *chptr; @@ -3863,10 +3735,7 @@ void send_list (cptr, numsend) * parv[0] = sender prefix * parv[1,2,3...] = Channels or list options. */ -int m_list (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_list (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aChannel *chptr; char *name, *p = NULL; @@ -4148,10 +4017,7 @@ int m_list (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = channel */ -int m_names (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_names (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aChannel *chptr; aClient *c2ptr; @@ -4359,8 +4225,7 @@ int m_names (cptr, sptr, parc, parv) return (1); } -void send_user_joins (cptr, user) - aClient *cptr, *user; +void send_user_joins (aClient *cptr, aClient *user) { Link *lp; aChannel *chptr; diff --git a/src/chkconf.c b/src/chkconf.c index 0ad7f77..4b0a99a 100644 --- a/src/chkconf.c +++ b/src/chkconf.c @@ -40,9 +40,7 @@ static char *configfile = CONFIGFILE; static char nullfield[] = ""; static char maxsendq[12]; -int main (argc, argv) - int argc; - char *argv[]; +int main (int argc, char *argv[]) { new_class (0); @@ -110,8 +108,7 @@ static int oper_access[] = { ** returns -1, if file cannot be opened ** 0, if file opened */ -static aConfItem *initconf (opt) - int opt; +static aConfItem * initconf (int opt) { int fd; char line[512], *tmp, c[80], *s; @@ -457,8 +454,7 @@ static aConfItem *initconf (opt) return ctop; } -static aClass *get_class (cn) - int cn; +static aClass * get_class (int cn) { static aClass cls; int i = numclasses - 1; @@ -474,8 +470,7 @@ static aClass *get_class (cn) return &cls; } -static void new_class (cn) - int cn; +static void new_class (int cn) { numclasses++; if (classarr) @@ -488,8 +483,7 @@ static void new_class (cn) /* * field breakup for ircd.conf file. */ -static char *getfield (newline) - char *newline; +static char * getfield (char *newline) { static char *line = NULL; char *end, *field; @@ -511,8 +505,7 @@ static char *getfield (newline) return (field); } -static int validate (top) - aConfItem *top; +static int validate (aConfItem *top) { Reg aConfItem *aconf, *bconf; u_int otype = 0, valid = 0; @@ -564,8 +557,7 @@ static int validate (top) return valid ? 0 : -1; } -static char confchar (status) - u_int status; +static char confchar (u_int status) { static char letrs[] = "QICNoOMKARYSLPH"; char *s = letrs; diff --git a/src/class.c b/src/class.c index ad6c564..46e906c 100644 --- a/src/class.c +++ b/src/class.c @@ -31,8 +31,7 @@ aClass *classes; -int get_conf_class (aconf) - aConfItem *aconf; +int get_conf_class (aConfItem *aconf) { if ((aconf) && Class (aconf)) return (ConfClass (aconf)); @@ -44,8 +43,7 @@ int get_conf_class (aconf) } -static int get_conf_ping (aconf) - aConfItem *aconf; +static int get_conf_ping (aConfItem *aconf) { if ((aconf) && Class (aconf)) return (ConfPingFreq (aconf)); @@ -58,8 +56,7 @@ static int get_conf_ping (aconf) -int get_client_class (acptr) - aClient *acptr; +int get_client_class (aClient *acptr) { Link *tmp; aClass *cl; @@ -77,8 +74,7 @@ int get_client_class (acptr) return (retc); } -int get_client_ping (acptr) - aClient *acptr; +int get_client_ping (aClient *acptr) { int ping = 0, ping2; aConfItem *aconf; @@ -107,8 +103,7 @@ int get_client_ping (acptr) return (ping); } -int get_con_freq (clptr) - aClass *clptr; +int get_con_freq (aClass *clptr) { if (clptr) return (ConFreq (clptr)); @@ -123,9 +118,7 @@ int get_con_freq (clptr) * if no present entry is found, then create a new one and add it in * immeadiately after the first one (class 0). */ -void add_class (class, ping, confreq, maxli, sendq) - int class, ping, confreq, maxli; - long sendq; +void add_class (int class, int ping, int confreq, int maxli, long sendq) { aClass *t, *p; @@ -149,8 +142,7 @@ void add_class (class, ping, confreq, maxli, sendq) Links (p) = 0; } -aClass *find_class (cclass) - int cclass; +aClass * find_class (int cclass) { aClass *cltmp; @@ -194,8 +186,7 @@ void initclass () NextClass (FirstClass ()) = NULL; } -void report_classes (sptr) - aClient *sptr; +void report_classes (aClient *sptr) { aClass *cltmp; @@ -205,8 +196,7 @@ void report_classes (sptr) MaxLinks (cltmp), MaxSendq (cltmp)); } -long get_sendq (cptr) - aClient *cptr; +long get_sendq (aClient *cptr) { int sendq = MAXSENDQLENGTH, retc = BAD_CLIENT_CLASS; Link *tmp; diff --git a/src/dbuf.c b/src/dbuf.c index 813beda..b1509d4 100644 --- a/src/dbuf.c +++ b/src/dbuf.c @@ -64,8 +64,7 @@ static dbufbuf *dbuf_alloc () /* ** dbuf_free - return a dbufbuf structure to the freelist */ -static void dbuf_free (ptr) - dbufbuf *ptr; +static void dbuf_free (dbufbuf *ptr) { dbufalloc--; ptr->next = freelist; @@ -78,8 +77,7 @@ static void dbuf_free (ptr) ** there is no reason to continue this buffer...). After this ** the "dbuf" has consistent EMPTY status... ;) */ -static int dbuf_malloc_error (dyn) - dbuf *dyn; +static int dbuf_malloc_error (dbuf *dyn) { dbufbuf *p; @@ -94,10 +92,7 @@ static int dbuf_malloc_error (dyn) } -int dbuf_put (dyn, buf, length) - dbuf *dyn; - char *buf; - int length; +int dbuf_put (dbuf *dyn, char *buf, int length) { dbufbuf **h, *d; int off; @@ -146,9 +141,7 @@ int dbuf_put (dyn, buf, length) } -char *dbuf_map (dyn, length) - dbuf *dyn; - int *length; +char * dbuf_map (dbuf *dyn, int *length) { if (dyn->head == NULL) { dyn->tail = NULL; @@ -161,9 +154,7 @@ char *dbuf_map (dyn, length) return (dyn->head->data + dyn->offset); } -int dbuf_delete (dyn, length) - dbuf *dyn; - int length; +int dbuf_delete (dbuf *dyn, int length) { dbufbuf *d; int chunk; @@ -192,10 +183,7 @@ int dbuf_delete (dyn, length) return 0; } -int dbuf_get (dyn, buf, length) - dbuf *dyn; - char *buf; - int length; +int dbuf_get (dbuf *dyn, char *buf, int length) { int moved = 0; int chunk; @@ -220,10 +208,7 @@ int dbuf_get (dyn, buf, length) ** either a \r or \n prsent. If so, copy as much as possible (determined by ** length) into buf and return the amount copied - else return 0. */ -int dbuf_getmsg (dyn, buf, length) - dbuf *dyn; - char *buf; - int length; +int dbuf_getmsg (dbuf *dyn, char *buf, int length) { dbufbuf *d; char *s; diff --git a/src/hash.c b/src/hash.c index 3d7aed9..7e153f6 100644 --- a/src/hash.c +++ b/src/hash.c @@ -87,8 +87,7 @@ static aNotify *notifyTable[NOTIFYHASHSIZE]; * _really_ minimalistic hash-function and make up for it with huge * hash-tables. -Donwulff */ -unsigned int hash_nn_name (hname) - const char *hname; +unsigned int hash_nn_name (const char *hname) { unsigned int hash_value; @@ -104,8 +103,7 @@ unsigned int hash_nn_name (hname) #define ONE_EIGHTH ((int) (BITS_IN_int / 8)) #define HIGH_BITS ( ~((unsigned int)(~0) >> ONE_EIGHTH )) -unsigned int hash_nn_name (hname) - const char *hname; +unsigned int hash_nn_name (const char *hname) { unsigned int hash_value, i; @@ -160,9 +158,7 @@ void clear_notify_hash_table (void) /* * add_to_client_hash_table */ -int add_to_client_hash_table (name, cptr) - char *name; - aClient *cptr; +int add_to_client_hash_table (char *name, aClient *cptr) { int hashv; /* Also define this if you're using the insert test mode */ @@ -200,9 +196,7 @@ int add_to_client_hash_table (name, cptr) /* * add_to_channel_hash_table */ -int add_to_channel_hash_table (name, chptr) - char *name; - aChannel *chptr; +int add_to_channel_hash_table (char *name, aChannel *chptr) { int hashv; /* Also define this for the insertcheck mode */ @@ -259,9 +253,7 @@ int add_to_channel_hash_table (name, chptr) /* * count_watch_memory */ -void count_watch_memory (count, memory) - int *count; - u_long *memory; +void count_watch_memory (int *count, u_long *memory) { int i = NOTIFYHASHSIZE; aNotify *anptr; @@ -280,9 +272,7 @@ void count_watch_memory (count, memory) /* * add_to_notify_hash_table */ -int add_to_notify_hash_table (nick, cptr) - char *nick; - aClient *cptr; +int add_to_notify_hash_table (char *nick, aClient *cptr) { int hashv; aNotify *anptr; @@ -332,9 +322,7 @@ int add_to_notify_hash_table (nick, cptr) /* * hash_check_notify */ -int hash_check_notify (cptr, reply) - aClient *cptr; - int reply; +int hash_check_notify (aClient *cptr, int reply) { int hashv; aNotify *anptr; @@ -368,8 +356,7 @@ int hash_check_notify (cptr, reply) /* * hash_get_notify */ -aNotify *hash_get_notify (name) - char *name; +aNotify * hash_get_notify (char *name) { int hashv; aNotify *anptr; @@ -387,9 +374,7 @@ aNotify *hash_get_notify (name) /* * del_from_notify_hash_table */ -int del_from_notify_hash_table (nick, cptr) - char *nick; - aClient *cptr; +int del_from_notify_hash_table (char *nick, aClient *cptr) { int hashv; aNotify *anptr, *nlast = NULL; @@ -466,8 +451,7 @@ int del_from_notify_hash_table (nick, cptr) /* * hash_del_notify_list */ -int hash_del_notify_list (cptr) - aClient *cptr; +int hash_del_notify_list (aClient *cptr) { int hashv; aNotify *anptr; @@ -537,9 +521,7 @@ int hash_del_notify_list (cptr) /* * del_from_client_hash_table */ -int del_from_client_hash_table (name, cptr) - char *name; - aClient *cptr; +int del_from_client_hash_table (char *name, aClient *cptr) { aClient *tmp, *prev = NULL; int hashv; @@ -587,9 +569,7 @@ int del_from_client_hash_table (name, cptr) /* * del_from_channel_hash_table */ -int del_from_channel_hash_table (name, chptr) - char *name; - aChannel *chptr; +int del_from_channel_hash_table (char *name, aChannel *chptr) { aChannel *tmp, *prev = NULL; int hashv; @@ -633,8 +613,7 @@ int del_from_channel_hash_table (name, chptr) /* * hash_get_chan_bucket */ -aChannel *hash_get_chan_bucket (hashv) - int hashv; +aChannel * hash_get_chan_bucket (int hashv) { if (hashv > CHANNELHASHSIZE) return NULL; @@ -649,9 +628,7 @@ aChannel *hash_get_chan_bucket (hashv) /* * hash_find_client */ -aClient *hash_find_client (name, cptr) - char *name; - aClient *cptr; +aClient * hash_find_client (char *name, aClient *cptr) { aClient *tmp; aClient *prv = NULL; @@ -710,9 +687,7 @@ aClient *hash_find_client (name, cptr) /* * hash_find_nickserver */ -aClient *hash_find_nickserver (name, cptr) - char *name; - aClient *cptr; +aClient * hash_find_nickserver (char *name, aClient *cptr) { aClient *tmp; aClient *prv = NULL; @@ -798,9 +773,7 @@ aClient *find_server_wildcard (char *server) /* * hash_find_server */ -aClient *hash_find_server (server, cptr) - char *server; - aClient *cptr; +aClient * hash_find_server (char *server, aClient *cptr) { aClient *tmp, *prv = NULL; char *t; @@ -887,9 +860,7 @@ aClient *hash_find_server (server, cptr) /* * hash_find_channel */ -aChannel *hash_find_channel (name, chptr) - char *name; - aChannel *chptr; +aChannel * hash_find_channel (char *name, aChannel *chptr) { int hashv; aChannel *tmp; @@ -942,10 +913,7 @@ aChannel *hash_find_channel (name, chptr) * -avalon */ -int m_hash (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_hash (aClient *cptr, aClient *sptr, int parc, char *parv[]) { #ifdef DEBUGMODE int l, i; diff --git a/src/ircd.c b/src/ircd.c index cd6ceab..ed7cdfb 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -119,8 +119,7 @@ static void s_rehash () (void) sigaction (SIGHUP, &act, NULL); } -void restart (mesg) - char *mesg; +void restart (char *mesg) { #ifdef USE_SYSLOG (void) syslog (LOG_WARNING, "Restarting Server because: %s", mesg); @@ -143,8 +142,7 @@ void s_restart () } } -void server_reboot (mesg) - char *mesg; +void server_reboot (char *mesg) { int i; @@ -187,8 +185,7 @@ void server_reboot (mesg) ** function should be made latest. (No harm done if this ** is called earlier or later...) */ -static time_t try_connections (currenttime) - time_t currenttime; +static time_t try_connections (time_t currenttime) { aConfItem *aconf; aClient *cptr; @@ -412,10 +409,7 @@ static int bad_command () return (-1); } -int main (argc, argv) - int argc; - char *argv[]; - +int main (int argc, char *argv[]) { uid_t uid, euid; time_t delay = 0; diff --git a/src/list.c b/src/list.c index 9402650..c1219f3 100644 --- a/src/list.c +++ b/src/list.c @@ -26,8 +26,8 @@ #ifdef DBMALLOC #include "malloc.h" #endif -void free_link PROTO ((Link *)); -Link *make_link PROTO (()); +void free_link (Link *); +Link *make_link (); #ifdef DEBUGMODE static struct liststats @@ -75,8 +75,7 @@ void outofmemory () ** associated with the client defined by ** 'from'). ('from' is a local client!!). */ -aClient *make_client (from, servr) - aClient *from, *servr; +aClient * make_client (aClient *from, aClient *servr) { aClient *cptr = NULL; size_t size = CLIENT_REMOTE_SIZE; @@ -121,8 +120,7 @@ aClient *make_client (from, servr) return (cptr); } -void free_client (cptr) - aClient *cptr; +void free_client (aClient *cptr) { MyFree ((char *) cptr); } @@ -131,8 +129,7 @@ void free_client (cptr) ** 'make_user' add's an User information block to a client ** if it was not previously allocated. */ -anUser *make_user (cptr) - aClient *cptr; +anUser * make_user (aClient *cptr) { anUser *user; @@ -165,21 +162,18 @@ aEvent *make_event () return eptr; } -void free_event (eptr) - aEvent *eptr; +void free_event (aEvent *eptr) { fprintf (stderr, "%s\n", eptr->arg); MyFree ((char *) eptr); } -void free_synchlist (synchptr) - aSynchList *synchptr; +void free_synchlist (aSynchList *synchptr) { MyFree ((char *) synchptr); } -aServer *make_server (cptr) - aClient *cptr; +aServer * make_server (aClient *cptr) { aServer *serv = cptr->serv; @@ -219,9 +213,7 @@ aSynchList *make_synchlist () ** Decrease user reference count by one and realease block, ** if count reaches 0 */ -void free_user (user, cptr) - anUser *user; - aClient *cptr; +void free_user (anUser *user, aClient *cptr) { if (--user->refcnt <= 0) { if (user->away) @@ -255,8 +247,7 @@ void free_user (user, cptr) * taken the code from ExitOneClient() for this and placed it here. * - avalon */ -void remove_client_from_list (cptr) - aClient *cptr; +void remove_client_from_list (aClient *cptr) { checklist (); if (cptr->prev) @@ -298,8 +289,7 @@ void remove_client_from_list (cptr) * in this file, shouldnt they ? after all, this is list.c, isnt it ? * -avalon */ -void add_client_to_list (cptr) - aClient *cptr; +void add_client_to_list (aClient *cptr) { /* * since we always insert new clients to the top of the list, @@ -315,9 +305,7 @@ void add_client_to_list (cptr) /* * Look for ptr in the linked listed pointed to by link. */ -Link *find_user_link (lp, ptr) - Link *lp; - aClient *ptr; +Link * find_user_link (Link *lp, aClient *ptr) { if (ptr) while (lp) { @@ -356,8 +344,7 @@ int find_str_match_link (lp, str) return 0; } -void free_str_list (lp) - Link *lp; +void free_str_list (Link *lp) { Link *next; @@ -404,8 +391,7 @@ Link *make_link () return lp; } -void free_link (lp) - Link *lp; +void free_link (Link *lp) { lp->next = freelink; freelink = lp; @@ -425,8 +411,7 @@ Ban *make_ban () return lp; } -void free_ban (lp) - Ban *lp; +void free_ban (Ban *lp) { MyFree ((char *) lp); #ifdef DEBUGMODE @@ -445,8 +430,7 @@ aClass *make_class () return tmp; } -void free_class (tmp) - aClass *tmp; +void free_class (aClass *tmp) { MyFree ((char *) tmp); #ifdef DEBUGMODE @@ -494,8 +478,7 @@ aConfItem *make_conf () return (aconf); } -void delist_conf (aconf) - aConfItem *aconf; +void delist_conf (aConfItem *aconf) { if (aconf == conf) conf = conf->next; @@ -508,8 +491,7 @@ void delist_conf (aconf) aconf->next = NULL; } -void free_sqline (asqline) - aSqlineItem *asqline; +void free_sqline (aSqlineItem *asqline) { del_queries ((char *) asqline); MyFree (asqline->sqline); @@ -527,8 +509,7 @@ void free_jinx (aJinxItem * ajinx) return; } -void free_conf (aconf) - aConfItem *aconf; +void free_conf (aConfItem *aconf) { del_queries ((char *) aconf); MyFree (aconf->host); @@ -544,9 +525,7 @@ void free_conf (aconf) } #ifdef DEBUGMODE -void send_listinfo (cptr, name) - aClient *cptr; - char *name; +void send_listinfo (aClient *cptr, char *name) { int inuse = 0, mem = 0, tmp = 0; diff --git a/src/match.c b/src/match.c index ee5475a..7342dbe 100644 --- a/src/match.c +++ b/src/match.c @@ -44,8 +44,7 @@ int r_match (char *, char *); u_char touppertab[], tolowertab[]; #define tolowertab2 tolowertab -int match (mask, string) - char *mask, *string; +int match (char *mask, char *string) { char *rmask = mask; char *rstring = string; @@ -76,8 +75,7 @@ int match (mask, string) * Written by Douglas A Lewis (dalewis@acsu.buffalo.edu) */ -int r_match (mask, name) - char *mask, *name; +int r_match (char *mask, char *name) { u_char *m; u_char *n; @@ -148,8 +146,7 @@ int r_match (mask, name) * This particular version is "in place", so that it changes the pattern * which is to be reduced to a "minimal" size. */ -char *collapse (pattern) - char *pattern; +char * collapse (char *pattern) { char *s; char *s1; @@ -190,9 +187,7 @@ char *collapse (pattern) * <0, if s1 lexicographically less than s2 * >0, if s1 lexicographically greater than s2 */ -int mycmp (s1, s2) - char *s1; - char *s2; +int mycmp (char *s1, char *s2) { u_char *str1; u_char *str2; diff --git a/src/packet.c b/src/packet.c index c844ffb..5cbeebd 100644 --- a/src/packet.c +++ b/src/packet.c @@ -57,10 +57,7 @@ void inittoken (void) ** with cptr of "local" variation, which contains all the ** necessary fields (buffer etc..) */ -int dopacket (cptr, buffer, length) - aClient *cptr; - char *buffer; - int length; +int dopacket (aClient *cptr, char *buffer, int length) { char *ch1; char *ch2; diff --git a/src/parse.c b/src/parse.c index 66823d3..3da86ba 100644 --- a/src/parse.c +++ b/src/parse.c @@ -37,8 +37,8 @@ static char *para[MAXPARA + 1]; static char sender[HOSTLEN + 1]; -static int cancel_clients PROTO ((aClient *, aClient *, char *)); -static void remove_unknown PROTO ((aClient *, char *)); +static int cancel_clients (aClient *, aClient *, char *); +static void remove_unknown (aClient *, char *); /* ** Find a client (server or user) by name. diff --git a/src/res.c b/src/res.c index bd2a80e..7a337de 100644 --- a/src/res.c +++ b/src/res.c @@ -33,20 +33,20 @@ static CacheTable hashtable[ARES_CACSIZE]; static aCache *cachetop = NULL; static ResRQ *last, *first; -static void rem_cache PROTO ((aCache *)); -static int do_query_name PROTO ((Link *, char *, ResRQ *)); -static int do_query_number PROTO ((Link *, struct in_addr *, ResRQ *)); -static void resend_query PROTO ((ResRQ *)); -static int proc_answer PROTO ((ResRQ *, HEADER *, char *, char *)); -static int query_name PROTO ((char *, int, int, ResRQ *)); -static aCache *make_cache PROTO ((ResRQ *)); -static aCache *find_cache_name PROTO ((char *)); -static aCache *find_cache_number PROTO ((ResRQ *, char *)); -static int send_res_msg PROTO ((char *, int, int)); -static ResRQ *find_id PROTO ((int)); -static int hash_number PROTO ((unsigned char *)); -static void update_list PROTO ((ResRQ *, aCache *)); -static int hash_name PROTO ((char *)); +static void rem_cache (aCache *); +static int do_query_name (Link *, char *, ResRQ *); +static int do_query_number (Link *, struct in_addr *, ResRQ *); +static void resend_query (ResRQ *); +static int proc_answer (ResRQ *, HEADER *, char *, char *); +static int query_name (char *, int, int, ResRQ *); +static aCache *make_cache (ResRQ *); +static aCache *find_cache_name (char *); +static aCache *find_cache_number (ResRQ *, char *); +static int send_res_msg (char *, int, int); +static ResRQ *find_id (int); +static int hash_number (unsigned char *); +static void update_list (ResRQ *, aCache *); +static int hash_name (char *); static struct cacheinfo { @@ -75,8 +75,7 @@ static struct resinfo } reinfo; -int init_resolver (op) - int op; +int init_resolver (int op) { int ret = 0; diff --git a/src/s_bsd.c b/src/s_bsd.c index e79d9b6..7a03c7e 100644 --- a/src/s_bsd.c +++ b/src/s_bsd.c @@ -47,10 +47,10 @@ int highest_fd = 0, readcalls = 0, udpfd = -1, resfd = -1; static struct sockaddr_in mysk; static void polludp (); -static struct sockaddr *connect_inet PROTO ((aConfItem *, aClient *, int *)); -static int completed_connection PROTO ((aClient *)); -static int check_init PROTO ((aClient *, char *)); -static void do_dns_async PROTO (()), set_sock_opts PROTO ((int, aClient *)); +static struct sockaddr *connect_inet (aConfItem *, aClient *, int *); +static int completed_connection (aClient *); +static int check_init (aClient *, char *); +static void do_dns_async (), set_sock_opts (int, aClient *); static char readbuf[READBUF_SIZE]; char zlinebuf[BUFSIZE]; extern char *version; @@ -79,9 +79,7 @@ extern char *version; ** (as suggested by eps@TOASTER.SFSU.EDU) */ -void add_local_domain (hname, size) - char *hname; - int size; +void add_local_domain (char *hname, int size) { #ifdef RES_INIT /* try to fix up unqualified names */ @@ -118,9 +116,7 @@ void add_local_domain (hname, size) ** cptr if not NULL, is the *LOCAL* client associated with ** the error. */ -void report_error (text, cptr) - char *text; - aClient *cptr; +void report_error (char *text, aClient *cptr) { int errtmp = errno; /* debug may change 'errno' */ char *host; @@ -157,10 +153,7 @@ void report_error (text, cptr) * depending on the IP# mask given by 'name'. Returns the fd of the * socket created or -1 on error. */ -int inetport (cptr, name, port) - aClient *cptr; - char *name; - int port; +int inetport (aClient *cptr, char *name, int port) { static struct sockaddr_in server; int ad[4], len = sizeof (server); @@ -252,8 +245,7 @@ int inetport (cptr, name, port) * Create a new client which is essentially the stub like 'me' to be used * for a socket that is passive (listen'ing for connections to be accepted). */ -int add_listener (aconf) - aConfItem *aconf; +int add_listener (aConfItem *aconf) { aClient *cptr; @@ -398,9 +390,7 @@ void write_pidfile () * from either the server's sockhost (if client fd is a tty or localhost) * or from the ip# converted into a string. 0 = success, -1 = fail. */ -static int check_init (cptr, sockn) - aClient *cptr; - char *sockn; +static int check_init (aClient *cptr, char *sockn) { struct sockaddr_in sk; int len = sizeof (struct sockaddr_in); @@ -433,8 +423,7 @@ static int check_init (cptr, sockn) * -1 = Access denied * -2 = Bad socket. */ -int check_client (cptr) - aClient *cptr; +int check_client (aClient *cptr) { static char sockname[HOSTLEN + 1]; struct hostent *hp = NULL; @@ -492,8 +481,7 @@ int check_client (cptr) * -1 = Access denied * -2 = Bad socket. */ -int check_server_init (cptr) - aClient *cptr; +int check_server_init (aClient *cptr) { char *name; aConfItem *c_conf = NULL, *n_conf = NULL; @@ -558,11 +546,7 @@ int check_server_init (cptr) return check_server (cptr, hp, c_conf, n_conf, 0); } -int check_server (cptr, hp, c_conf, n_conf, estab) - aClient *cptr; - aConfItem *n_conf, *c_conf; - struct hostent *hp; - int estab; +int check_server (aClient *cptr, struct hostent *hp, aConfItem *c_conf, aConfItem *n_conf, int estab) { char *name; char abuff[HOSTLEN + USERLEN + 2]; @@ -690,8 +674,7 @@ int check_server (cptr, hp, c_conf, n_conf, estab) ** Return TRUE, if successfully completed ** FALSE, if failed and ClientExit */ -static int completed_connection (cptr) - aClient *cptr; +static int completed_connection (aClient *cptr) { aConfItem *aconf; @@ -726,8 +709,7 @@ static int completed_connection (cptr) ** Close the physical connection. This function must make ** MyConnect(cptr) == FALSE, and set cptr->from == NULL. */ -void close_connection (cptr) - aClient *cptr; +void close_connection (aClient *cptr) { aConfItem *aconf; int i, j; @@ -848,9 +830,7 @@ void close_connection (cptr) /* ** set_sock_opts */ -static void set_sock_opts (fd, cptr) - int fd; - aClient *cptr; +static void set_sock_opts (int fd, aClient *cptr) { int opt; #ifdef SO_REUSEADDR @@ -908,8 +888,7 @@ static void set_sock_opts (fd, cptr) } -int get_sockerr (cptr) - aClient *cptr; +int get_sockerr (aClient *cptr) { int errtmp = errno, err = 0, len = sizeof (err); #ifdef SO_ERROR @@ -930,9 +909,7 @@ int get_sockerr (cptr) ** blocking version of IRC--not a problem if you are a ** lightly loaded node...) */ -void set_non_blocking (fd, cptr) - int fd; - aClient *cptr; +void set_non_blocking (int fd, aClient *cptr) { int res, nonb = 0; @@ -951,9 +928,7 @@ void set_non_blocking (fd, cptr) * The client is added to the linked list of clients but isnt added to any * hash tables yuet since it doesnt have a name. */ -aClient *add_connection (cptr, fd) - aClient *cptr; - int fd; +aClient * add_connection (aClient *cptr, int fd) { Link lin; aClient *acptr; @@ -1061,9 +1036,7 @@ aClient *add_connection (cptr, fd) ** Do some tricky stuff for client connections to make sure they don't do ** any flooding >:-) -avalon */ -static int read_packet (cptr, rfd) - aClient *cptr; - fd_set *rfd; +static int read_packet (aClient *cptr, fd_set *rfd) { int dolen = 0, length = 0, done; time_t now = time (NULL); @@ -1402,10 +1375,7 @@ int read_message (delay) /* * connect_server */ -int connect_server (aconf, by, hp) - aConfItem *aconf; - aClient *by; - struct hostent *hp; +int connect_server (aConfItem *aconf, aClient *by, struct hostent *hp) { struct sockaddr *svp; aClient *cptr, *c2ptr; @@ -1537,10 +1507,7 @@ int connect_server (aconf, by, hp) return 0; } -static struct sockaddr *connect_inet (aconf, cptr, lenp) - aConfItem *aconf; - aClient *cptr; - int *lenp; +static struct sockaddr * connect_inet (aConfItem *aconf, aClient *cptr, int *lenp) { static struct sockaddr_in server; struct hostent *hp; @@ -1609,9 +1576,7 @@ static struct sockaddr *connect_inet (aconf, cptr, lenp) } -int utmp_read (fd, name, line, host, hlen) - int fd, hlen; - char *name, *line, *host; +int utmp_read (int fd, char *name, char *line, char *host, int hlen) { struct utmp ut; while (read (fd, (char *) &ut, sizeof (struct utmp)) @@ -1631,8 +1596,7 @@ int utmp_read (fd, name, line, host, hlen) return -1; } -int utmp_close (fd) - int fd; +int utmp_close (int fd) { return (close (fd)); } diff --git a/src/s_conf.c b/src/s_conf.c index 3c32007..8c227e7 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -40,7 +40,7 @@ #include "h.h" #define debug 1 -static int lookup_confhost PROTO ((aConfItem *)); +static int lookup_confhost (aConfItem *); static int advanced_check (char *, int); int ZLineExists (char *); @@ -63,9 +63,7 @@ aJinxItem *make_jinx (); * remove all conf entries from the client except those which match * the status field mask. */ -void det_confs_butmask (cptr, mask) - aClient *cptr; - int mask; +void det_confs_butmask (aClient *cptr, int mask) { Link *tmp, *tmp2; @@ -79,12 +77,7 @@ void det_confs_butmask (cptr, mask) /* * Add a temporary line to the configuration */ -void add_temp_conf (status, host, passwd, name, port, class, temp) - unsigned int status; - char *host; - char *passwd; - char *name; - int port, class, temp; /* temp: 0 = perm 1 = temp 2 = akill */ +void add_temp_conf (unsigned int status, char *host, char *passwd, char *name, int port, int class, int temp) { aConfItem *aconf; @@ -119,12 +112,7 @@ void RemoveZLine (char *zline) /* * delete a temporary conf line. *only* temporary conf lines may be deleted. */ -int del_temp_conf (status, host, passwd, name, port, class, akill) - unsigned int status, akill; - char *host; - char *passwd; - char *name; - int port, class; +int del_temp_conf (unsigned int status, char *host, char *passwd, char *name, int port, int class, unsigned int akill) { aConfItem *aconf; aConfItem *bconf; @@ -169,10 +157,7 @@ int del_temp_conf (status, host, passwd, name, port, class, akill) /* * find the first (best) I line to attach. */ -int attach_Iline (cptr, hp, sockhost) - aClient *cptr; - struct hostent *hp; - char *sockhost; +int attach_Iline (aClient *cptr, struct hostent *hp, char *sockhost) { aConfItem *aconf; char *hname; @@ -224,8 +209,7 @@ int attach_Iline (cptr, hp, sockhost) * Find the single N line and return pointer to it (from list). * If more than one then return NULL pointer. */ -aConfItem *count_cnlines (lp) - Link *lp; +aConfItem * count_cnlines (Link *lp) { aConfItem *aconf, *cline = NULL, *nline = NULL; @@ -246,9 +230,7 @@ aConfItem *count_cnlines (lp) ** Disassociate configuration from the client. ** Also removes a class from the list if marked for deleting. */ -int detach_conf (cptr, aconf) - aClient *cptr; - aConfItem *aconf; +int detach_conf (aClient *cptr, aConfItem *aconf) { Link **lp, *tmp; @@ -278,9 +260,7 @@ int detach_conf (cptr, aconf) return -1; } -static int is_attached (aconf, cptr) - aConfItem *aconf; - aClient *cptr; +static int is_attached (aConfItem *aconf, aClient *cptr) { Link *lp; @@ -298,9 +278,7 @@ static int is_attached (aconf, cptr) ** connection). Note, that this automaticly changes the ** attachment if there was an old one... */ -int attach_conf (cptr, aconf) - aConfItem *aconf; - aClient *cptr; +int attach_conf (aClient *cptr, aConfItem *aconf) { Link *lp; @@ -376,10 +354,7 @@ aConfItem *find_me () * the conf file (for non-C/N lines) or is an exact match (C/N lines * only). The difference in behaviour is to stop C:*::* and N:*::*. */ -aConfItem *attach_confs (cptr, name, statmask) - aClient *cptr; - char *name; - int statmask; +aConfItem * attach_confs (aClient *cptr, char *name, int statmask) { aConfItem *tmp; aConfItem *first = NULL; @@ -407,10 +382,7 @@ aConfItem *attach_confs (cptr, name, statmask) /* * Added for new access check meLazy */ -aConfItem *attach_confs_host (cptr, host, statmask) - aClient *cptr; - char *host; - int statmask; +aConfItem * attach_confs_host (aClient *cptr, char *host, int statmask) { aConfItem *tmp; aConfItem *first = NULL; @@ -439,9 +411,7 @@ aConfItem *attach_confs_host (cptr, host, statmask) /* * find a conf entry which matches the hostname and has the same name. */ -aConfItem *find_conf_exact (name, user, host, statmask) - char *name, *host, *user; - int statmask; +aConfItem * find_conf_exact (char *name, char *user, char *host, int statmask) { aConfItem *tmp; char userhost[USERLEN + HOSTLEN + 3]; @@ -471,9 +441,7 @@ aConfItem *find_conf_exact (name, user, host, statmask) return NULL; } -aConfItem *find_conf_name (name, statmask) - char *name; - int statmask; +aConfItem * find_conf_name (char *name, int statmask) { aConfItem *tmp; @@ -489,8 +457,7 @@ aConfItem *find_conf_name (name, statmask) return NULL; } -aConfItem *find_conf_servern (name) - char *name; +aConfItem * find_conf_servern (char *name) { aConfItem *tmp; @@ -506,10 +473,7 @@ aConfItem *find_conf_servern (name) return NULL; } -aConfItem *find_conf (lp, name, statmask) - char *name; - Link *lp; - int statmask; +aConfItem * find_conf (Link *lp, char *name, int statmask) { aConfItem *tmp; int namelen = name ? strlen (name) : 0; @@ -532,10 +496,7 @@ aConfItem *find_conf (lp, name, statmask) /* * Added for new access check meLazy */ -aConfItem *find_conf_host (lp, host, statmask) - Link *lp; - char *host; - int statmask; +aConfItem * find_conf_host (Link *lp, char *host, int statmask) { aConfItem *tmp; int hostlen = host ? strlen (host) : 0; @@ -558,10 +519,7 @@ aConfItem *find_conf_host (lp, host, statmask) * Find a conf line using the IP# stored in it to search upon. * Added 1/8/92 by Avalon. */ -aConfItem *find_conf_ip (lp, ip, user, statmask) - char *ip, *user; - Link *lp; - int statmask; +aConfItem * find_conf_ip (Link *lp, char *ip, char *user, int statmask) { aConfItem *tmp; char *s; @@ -588,9 +546,7 @@ aConfItem *find_conf_ip (lp, ip, user, statmask) * * - looks for a match on all given fields. */ -aConfItem *find_conf_entry (aconf, mask) - aConfItem *aconf; - u_int mask; +aConfItem * find_conf_entry (aConfItem *aconf, u_int mask) { aConfItem *bconf; @@ -645,9 +601,7 @@ int ZLineExists (char *name) * 1/21/95 Now looks for any conf line. I'm leaving this routine and its * call in because this routine has potential in future upgrades. -Russell */ -aConfItem *find_temp_conf_entry (aconf, mask) - aConfItem *aconf; - u_int mask; +aConfItem * find_temp_conf_entry (aConfItem *aconf, u_int mask) { aConfItem *bconf; @@ -672,8 +626,7 @@ aConfItem *find_temp_conf_entry (aconf, mask) return bconf; } -aSqlineItem *find_sqline_nick (nickmask) - char *nickmask; +aSqlineItem * find_sqline_nick (char *nickmask) { aSqlineItem *asqline; @@ -685,8 +638,7 @@ aSqlineItem *find_sqline_nick (nickmask) return NULL; } -aSqlineItem *find_sqline_match (nickname) - char *nickname; +aSqlineItem * find_sqline_match (char *nickname) { aSqlineItem *asqline; @@ -705,10 +657,7 @@ aSqlineItem *find_sqline_match (nickname) ** ** revamped this code because the original code was kinda wacky. -GZ */ -int m_svsnoop (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svsnoop (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (!IsULine (cptr, sptr) || parc < 2) @@ -737,9 +686,7 @@ int m_svsnoop (cptr, sptr, parc, parv) * as a result of an operator issuing this command, else assume it has been * called as a result of the server receiving a HUP signal. */ -int rehash (cptr, sptr, sig) - aClient *cptr, *sptr; - int sig; +int rehash (aClient *cptr, aClient *sptr, int sig) { aConfItem **tmp = &conf, *tmp2; aClass *cltmp; @@ -885,8 +832,7 @@ static int oper_access[] = { */ #define MAXCONFLINKS 150 -int initconf (opt) - int opt; +int initconf (int opt) { static char quotes[9][2] = { {'b', '\b'}, @@ -1233,8 +1179,7 @@ int initconf (opt) * Do (start) DNS lookups of all hostnames in the conf line and convert * an IP addresses in a.b.c.d number for to IP#s. */ -static int lookup_confhost (aconf) - aConfItem *aconf; +static int lookup_confhost (aConfItem *aconf) { char *s; struct hostent *hp; @@ -1276,8 +1221,7 @@ static int lookup_confhost (aconf) return -1; } -int find_kill (cptr) - aClient *cptr; +int find_kill (aClient *cptr) { char *host, *name; char ipaddy[HOSTLEN + 1]; @@ -1378,8 +1322,7 @@ char *find_zap (aClient * cptr, int dokillmsg) return retval; } -int find_kill_exempt (host, name) - char *host, *name; +int find_kill_exempt (char *host, char *name) { aConfItem *tmp; @@ -1393,8 +1336,7 @@ int find_kill_exempt (host, name) return 0; } -int find_kill_byname (host, name) - char *host, *name; +int find_kill_byname (char *host, char *name) { aConfItem *tmp; @@ -1427,9 +1369,7 @@ int find_dccblock (char *file) ** parv is the sender prefix ** filename is the file that is to be output to the K lined client */ -int m_killcomment (sptr, parv, filename) - aClient *sptr; - char *parv, *filename; +int m_killcomment (aClient *sptr, char *parv, char *filename) { int fd; char line[80]; @@ -1470,10 +1410,7 @@ int m_killcomment (sptr, parv, filename) ** parv[2] = username ** parv[3] = comment */ -int m_rakill (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_rakill (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (check_registered (sptr)) return 0; @@ -1509,10 +1446,7 @@ int m_rakill (cptr, sptr, parc, parv) ** parv[2] = username ** parv[3] = comment */ -int m_akill (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_akill (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (check_registered (sptr)) return 0; @@ -1550,10 +1484,7 @@ int m_akill (cptr, sptr, parc, parv) ** parv[2] = username ** parv[3] = comment */ -int m_rakillex (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_rakillex (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (check_registered (sptr)) return 0; @@ -1589,10 +1520,7 @@ int m_rakillex (cptr, sptr, parc, parv) ** parv[2] = username ** parv[3] = comment */ -int m_akillex (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_akillex (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (check_registered (sptr)) return 0; @@ -1629,10 +1557,7 @@ int m_akillex (cptr, sptr, parc, parv) ** parv[1] = nickmask ** parv[2] = reason */ -int m_sqline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_sqline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aSqlineItem *asqline; @@ -1666,10 +1591,7 @@ int m_sqline (cptr, sptr, parc, parv) ** parv[0] = sender ** parv[1] = nickmask */ -int m_unsqline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_unsqline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aSqlineItem *asqline; @@ -1759,10 +1681,7 @@ int m_unjinx (aClient * cptr, aClient * sptr, int parc, char *parv[]) ** parv[1] = nickname ** parv[2] = comment or filename */ -int m_kline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_kline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *host, *tmp, *hosttemp; char uhost[80], name[80]; @@ -1860,10 +1779,7 @@ int m_kline (cptr, sptr, parc, parv) * parv[0] = sender prefix * parv[1] = userhost */ -int m_unkline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_unkline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int result, temp; @@ -1926,10 +1842,7 @@ int m_unkline (cptr, sptr, parc, parv) * parv[1] = host * parv[2] = reason */ -int m_zline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_zline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char userhost[512 + 2] = "", *in; int uline = 0, i = 0, propo = 0; @@ -2104,10 +2017,7 @@ int m_zline (cptr, sptr, parc, parv) * parv[0] = sender prefix * parv[1] = host */ -int m_unzline (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_unzline (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char userhost[512 + 2] = "", *in; int result = 0, uline = 0, akill = 0; diff --git a/src/s_debug.c b/src/s_debug.c index a6d69ea..8989c11 100644 --- a/src/s_debug.c +++ b/src/s_debug.c @@ -66,6 +66,7 @@ char serveropts[] = { #include #include #include "h.h" +#include #ifndef ssize_t #define ssize_t unsigned int @@ -74,15 +75,15 @@ char serveropts[] = { #ifdef DEBUGMODE static char debugbuf[1024]; -void debug (level, form, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) - int level; - char *form, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10; +void debug (int level, char *form, ...) { int err = errno; if ((debuglevel >= 0) && (level <= debuglevel)) { - (void) sprintf (debugbuf, form, p1, p2, p3, p4, p5, p6, p7, p8, p9, - p10); + va_list vl; + va_start (vl, form); + (void) vsprintf (debugbuf, form, vl); + va_end (vl); if (local[2]) { local[2]->sendM++; local[2]->sendB += strlen (debugbuf); @@ -100,9 +101,7 @@ void debug (level, form, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10) * different field names for "struct rusage". * -avalon */ -void send_usage (cptr, nick) - aClient *cptr; - char *nick; +void send_usage (aClient *cptr, char *nick) { struct rusage rus; time_t secs, rup; @@ -162,9 +161,7 @@ void send_usage (cptr, nick) } #endif -void count_memory (cptr, nick) - aClient *cptr; - char *nick; +void count_memory (aClient *cptr, char *nick) { extern aChannel *channel; extern aClass *classes; diff --git a/src/s_err.c b/src/s_err.c index f72d7f6..b564228 100644 --- a/src/s_err.c +++ b/src/s_err.c @@ -29,7 +29,7 @@ typedef struct } Numeric; -static char *prepbuf PROTO ((char *, int, char *)); +static char *prepbuf (char *, int, char *); static char numbuff[514]; static char numbers[] = "0123456789"; @@ -707,8 +707,7 @@ static Numeric numeric_replies2[] = { {0, (char *) NULL} }; -char *err_str (numeric) - int numeric; +char * err_str (int numeric) { Numeric *nptr; int num = numeric; @@ -731,8 +730,7 @@ char *err_str (numeric) } -char *rpl_str (numeric) - int numeric; +char * rpl_str (int numeric) { Numeric *nptr; int num = numeric; @@ -765,10 +763,7 @@ char *rpl_str (numeric) return numbuff; } -static char *prepbuf (buffer, num, tail) - char *buffer; - int num; - char *tail; +static char * prepbuf (char *buffer, int num, char *tail) { char *s; diff --git a/src/s_misc.c b/src/s_misc.c index bd27708..240afce 100644 --- a/src/s_misc.c +++ b/src/s_misc.c @@ -41,9 +41,9 @@ (float)((float)x/(float)_1GIG) : ((x > _1MEG) ? (float)((float)x/(float)_1MEG) : (float)x))) aEvent *EventList = NULL; -static void exit_one_client PROTO ((aClient *, aClient *, aClient *, char *)); +static void exit_one_client (aClient *, aClient *, aClient *, char *); static void exit_one_client_in_split -PROTO ((aClient *, aClient *, aClient *, char *)); +(aClient *, aClient *, aClient *, char *); static char *months[] = { "January", "February", "March", "April", @@ -61,8 +61,7 @@ static char *weekdays[] = { */ struct stats ircst, *ircstp = &ircst; -char *date (clock) - time_t clock; +char * date (time_t clock) { static char buf[80], plus; struct tm *lt, *gm; @@ -101,8 +100,7 @@ char *date (clock) * string marker (`\-`). returns the 'fixed' string or "*" if the string * was NULL length or a NULL pointer. */ -char *check_string (s) - char *s; +char * check_string (char *s) { static char star[2] = "*"; char *str = s; @@ -122,8 +120,7 @@ char *check_string (s) * create a string of form "foo!bar@fubar" given foo, bar and fubar * as the parameters. If NULL, they become "*". */ -char *make_nick_user_host (nick, name, host) - char *nick, *name, *host; +char * make_nick_user_host (char *nick, char *name, char *host) { static char namebuf[NICKLEN + USERLEN + HOSTLEN + 6]; char *s = namebuf; @@ -156,8 +153,7 @@ char *make_nick_user_host (nick, name, host) ** **/ -char *myctime (value) - time_t value; +char * myctime (time_t value) { static char buf[28]; char *p; @@ -183,8 +179,7 @@ char *myctime (value) ** error message should be restricted to local clients and some ** other thing generated for remotes... */ -int check_registered_user (sptr) - aClient *sptr; +int check_registered_user (aClient *sptr) { if (!IsRegisteredUser (sptr)) { sendto_one (sptr, err_str (ERR_NOTREGISTERED), me.name, "*"); @@ -198,8 +193,7 @@ int check_registered_user (sptr) ** registered (e.g. we don't know yet whether a server ** or user) */ -int check_registered (sptr) - aClient *sptr; +int check_registered (aClient *sptr) { if (!IsRegistered (sptr)) { sendto_one (sptr, err_str (ERR_NOTREGISTERED), me.name, "*"); @@ -232,9 +226,7 @@ int check_registered (sptr) ** to internal buffer (nbuf). *NEVER* use the returned pointer ** to modify what it points!!! */ -char *get_client_name (sptr, showip) - aClient *sptr; - int showip; +char * get_client_name (aClient *sptr, int showip) { static char nbuf[HOSTLEN * 2 + USERLEN + 5]; @@ -265,8 +257,7 @@ char *get_client_name (sptr, showip) return sptr->name; } -char *get_client_host (cptr) - aClient *cptr; +char * get_client_host (aClient *cptr) { static char nbuf[HOSTLEN * 2 + USERLEN + 5]; @@ -287,9 +278,7 @@ char *get_client_host (cptr) * Form sockhost such that if the host is of form user@host, only the host * portion is copied. */ -void get_sockhost (cptr, host) - aClient *cptr; - char *host; +void get_sockhost (aClient *cptr, char *host) { char *s; if ((s = (char *) strchr (host, '@'))) @@ -303,9 +292,7 @@ void get_sockhost (cptr, host) * Return wildcard name of my server name according to given config entry * --Jto */ -char *my_name_for_link (name, aconf) - char *name; - aConfItem *aconf; +char * my_name_for_link (char *name, aConfItem *aconf) { static char namebuf[HOSTLEN]; int count = aconf->port; @@ -539,12 +526,7 @@ int exit_client (cptr, sptr, from, comment) */ /* DANGER: Ugly hack follows. */ /* Yeah :/ */ -static void exit_one_client_backend (cptr, sptr, from, comment, split) - aClient *sptr; - aClient *cptr; - aClient *from; - char *comment; - int split; +static void exit_one_client_backend (aClient *cptr, aClient *sptr, aClient *from, char *comment, int split) { aClient *acptr; int i; @@ -671,16 +653,12 @@ static void exit_one_client_backend (cptr, sptr, from, comment, split) return; } -static void exit_one_client (cptr, sptr, from, comment) - aClient *sptr, *cptr, *from; - char *comment; +static void exit_one_client (aClient *cptr, aClient *sptr, aClient *from, char *comment) { exit_one_client_backend (cptr, sptr, from, comment, 0); } -static void exit_one_client_in_split (cptr, sptr, from, comment) - aClient *sptr, *cptr, *from; - char *comment; +static void exit_one_client_in_split (aClient *cptr, aClient *sptr, aClient *from, char *comment) { exit_one_client_backend (cptr, sptr, from, comment, 1); } @@ -712,9 +690,7 @@ void initstats () memset ((char *) &ircst, 0, sizeof (ircst)); } -void tstats (cptr, name) - aClient *cptr; - char *name; +void tstats (aClient *cptr, char *name) { aClient *acptr; int i; diff --git a/src/s_numeric.c b/src/s_numeric.c index 032f685..c0a3f4f 100644 --- a/src/s_numeric.c +++ b/src/s_numeric.c @@ -42,11 +42,7 @@ static char buffer[1024]; ** sending back a neat error message -- big danger of creating ** a ping pong error message... */ -int do_numeric (numeric, cptr, sptr, parc, parv) - int numeric; - aClient *cptr, *sptr; - int parc; - char *parv[]; +int do_numeric (int numeric, aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; aChannel *chptr; diff --git a/src/s_ping.c b/src/s_ping.c index 8b314db..e17d6e1 100644 --- a/src/s_ping.c +++ b/src/s_ping.c @@ -28,6 +28,7 @@ #include "sock.h" /* If FD_ZERO isn't defined up to this point, */ /* define it (BSD4.2 needs this) */ #include "h.h" +#include #define UPINGBUFSIZE 2000 /* Lot bigger then 1024, bit smaller then 2048 */ #define UPINGTIMEOUT 120 /* Timeout waitting for first ping response */ @@ -45,15 +46,18 @@ * which it's called, and because it should really be removed, I've * put it here; instead of in send.c -TheShadow */ -void sendto_one_notice (to, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; - aClient *to; +void sendto_one_notice (aClient *to, char *pattern, ...) { char nbuf[1024]; + static char notice_buf[1024]; + va_list vl; - (void) sprintf (nbuf, "NOTICE %s :", to->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (to, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + va_start (vl, pattern); + (void) vsprintf (notice_buf, pattern, vl); + va_end (vl); + + (void) sprintf (nbuf, "NOTICE %s :%s", to->name, notice_buf); + sendto_one (to, "%s", nbuf); return; } @@ -97,8 +101,7 @@ void cancel_ping (); * sendM : average in ms * receiveM : maximum in ms */ -int start_ping (cptr) - aClient *cptr; +int start_ping (aClient *cptr) { struct sockaddr_in remote_addr; @@ -129,8 +132,7 @@ int start_ping (cptr) * send_ping * */ -void send_ping (cptr) - aClient *cptr; +void send_ping (aClient *cptr) { struct sockaddr_in remote_addr; struct timeval tv; @@ -169,8 +171,7 @@ void send_ping (cptr) * read_ping * */ -void read_ping (cptr) - aClient *cptr; +void read_ping (aClient *cptr) { int addr_len = sizeof (struct sockaddr_in); struct sockaddr_in remote_addr; @@ -229,9 +230,7 @@ void read_ping (cptr) return; } -int ping_server (cptr, hp) - aClient *cptr; - struct hostent *hp; +int ping_server (aClient *cptr, struct hostent *hp) { if ((!cptr->ip.s_addr)) { struct hostent *hp; @@ -267,10 +266,7 @@ int ping_server (cptr, hp) ** parv[3] = hunted server ** parv[4] = number of requested pings */ -int m_uping (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_uping (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aConfItem *aconf; int fd, opt; @@ -422,8 +418,7 @@ int m_uping (cptr, sptr, parc, parv) return 0; } -void end_ping (cptr) - aClient *cptr; +void end_ping (aClient *cptr) { Debug ((DEBUG_DEBUG, "end_ping: %x", cptr)); if (cptr->acpt) { @@ -461,8 +456,7 @@ void end_ping (cptr) free_client (cptr); } -void cancel_ping (sptr, acptr) - aClient *sptr, *acptr; +void cancel_ping (aClient *sptr, aClient *acptr) { int i; aClient *cptr; diff --git a/src/s_serv.c b/src/s_serv.c index 404e368..833a983 100644 --- a/src/s_serv.c +++ b/src/s_serv.c @@ -103,10 +103,7 @@ void s_die (); ** parv[0] = sender prefix ** parv[1] = remote server */ -int m_version (cptr, sptr, parc, parv) - aClient *sptr, *cptr; - int parc; - char *parv[]; +int m_version (aClient *cptr, aClient *sptr, int parc, char *parv[]) { extern char serveropts[]; @@ -130,10 +127,7 @@ int m_version (cptr, sptr, parc, parv) ** parv[1] = server name ** parv[parc-1] = comment */ -int m_squit (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_squit (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aConfItem *aconf; char *server; @@ -265,10 +259,7 @@ int m_squit (cptr, sptr, parc, parv) * parv[0] = Sender prefix * parv[1+] = Options */ -int m_protoctl (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_protoctl (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int i; char proto[128], *options, *equal; @@ -325,10 +316,7 @@ int m_protoctl (cptr, sptr, parc, parv) ** parv[5] = info */ -int m_server (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_server (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *ch; int i; @@ -577,8 +565,7 @@ int m_server (cptr, sptr, parc, parv) } -int m_server_estab (cptr) - aClient *cptr; +int m_server_estab (aClient *cptr) { aClient *acptr; aConfItem *aconf, *bconf; @@ -899,10 +886,7 @@ int m_server_estab (cptr) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_info (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_info (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char **text = infotext; @@ -967,10 +951,7 @@ int m_info (cptr, sptr, parc, parv) * RPL_WATCHOFF - Succesfully removed from WATCH-list. * ERR_TOOMANYWATCH - Take a guess :> Too many WATCH entries. */ -static void show_watch (cptr, name, rpl1, rpl2) - aClient *cptr; - char *name; - int rpl1, rpl2; +static void show_watch (aClient *cptr, char *name, int rpl1, int rpl2) { aClient *acptr; @@ -987,10 +968,7 @@ static void show_watch (cptr, name, rpl1, rpl2) /* * m_watch */ -int m_watch (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_watch (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *s, **pav = parv, *user; @@ -1146,10 +1124,7 @@ int m_watch (cptr, sptr, parc, parv) ** parv[1] = server to query ** parv[2] = servername mask */ -int m_links (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_links (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *mask; aClient *acptr; @@ -1220,8 +1195,7 @@ static int report_array[19][3] = { {0, 0} }; -static void report_sqlined_nicks (sptr) - aClient *sptr; +static void report_sqlined_nicks (aClient *sptr) { aSqlineItem *tmp; char *nickmask, *reason; @@ -1235,9 +1209,7 @@ static void report_sqlined_nicks (sptr) } } } -static void report_configured_links (sptr, mask) - aClient *sptr; - int mask; +static void report_configured_links (aClient *sptr, int mask) { static char null[] = ""; aConfItem *tmp; @@ -1364,10 +1336,7 @@ char *get_client_name2 (aClient * acptr, int showports) return pointer; } -int m_stats (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_stats (aClient *cptr, aClient *sptr, int parc, char *parv[]) { #ifndef DEBUGMODE static char Sformat[] = @@ -1671,10 +1640,7 @@ int m_stats (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[*] = parameters */ -int m_error (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_error (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *para; @@ -1711,10 +1677,7 @@ int m_error (cptr, sptr, parc, parv) ** m_help ** parv[0] = sender prefix */ -int m_help (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_help (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int i; if (MyClient (sptr)) { @@ -1755,10 +1718,7 @@ int m_help (cptr, sptr, parc, parv) * parv[1] = host/server mask. * parv[2] = server to query */ -int m_lusers (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_lusers (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int s_count, c_count, u_count, i_count; int o_count, m_client, m_client_local, m_server; @@ -1874,10 +1834,7 @@ int m_lusers (cptr, sptr, parc, parv) ** parv[2] = port number ** parv[3] = remote server */ -int m_connect (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_connect (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int port, tmpport, retval; aConfItem *aconf; @@ -1993,10 +1950,7 @@ int m_connect (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = message text */ -int m_gnotice (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_gnotice (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *message; /* char *pv[4]; Compiler says this is not used */ @@ -2026,10 +1980,7 @@ int m_gnotice (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = message text */ -int m_globops (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_globops (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *message; /* char *pv[4]; Compiler says this is not used */ @@ -2060,10 +2011,7 @@ int m_globops (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = message text */ -int m_locops (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_locops (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *message; /* char *pv[4]; Compiler says this is not used */ @@ -2092,10 +2040,7 @@ int m_locops (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = message text */ -int m_goper (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_goper (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *message; /* char *pv[4]; Compiler says this is not used */ @@ -2126,10 +2071,7 @@ int m_goper (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_time (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_time (aClient *cptr, aClient *sptr, int parc, char *parv[]) { time_t t1; @@ -2150,10 +2092,7 @@ int m_time (cptr, sptr, parc, parv) ** parv[1] = client ** parv[2] = kill message */ -int m_svskill (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svskill (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *comment = (parc > 2 && parv[2]) ? parv[2] : "SVS Killed"; @@ -2177,10 +2116,7 @@ int m_svskill (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_admin (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_admin (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aConfItem *aconf; @@ -2239,10 +2175,7 @@ int m_admin (cptr, sptr, parc, parv) ** m_rehash ** */ -int m_rehash (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_rehash (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if (!MyClient (sptr) || !OPCanRehash (sptr)) { sendto_one (sptr, err_str (ERR_NOPRIVILEGES), me.name, parv[0]); @@ -2265,10 +2198,7 @@ int m_rehash (cptr, sptr, parc, parv) ** The password is only valid if there is a matching X line in the ** config file. If it is not, then it becomes the */ -int m_restart (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_restart (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *pass = NULL; @@ -2311,10 +2241,7 @@ int m_restart (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_trace (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_trace (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int i; aClient *acptr; @@ -2502,10 +2429,7 @@ int m_trace (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_motd (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_motd (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int fd, nr; char line[80]; @@ -2552,10 +2476,7 @@ int m_motd (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = servername */ -int m_opermotd (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_opermotd (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int fd, nr; char line[80]; @@ -2597,10 +2518,7 @@ int m_opermotd (cptr, sptr, parc, parv) /* ** m_close - added by Darren Reed Jul 13 1992. */ -int m_close (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_close (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; int i; @@ -2634,10 +2552,7 @@ int m_close (cptr, sptr, parc, parv) * have a reason. If you use it you should first do a GLOBOPS and * then a server notice to let everyone know what is going down... */ -int m_die (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_die (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; int i; @@ -2715,10 +2630,7 @@ char *militime (char *sec, char *usec) * parv[3] = start time in s ;from person: Optional remark * parv[4] = start time in us */ -int m_rping (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_rping (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -2785,11 +2697,7 @@ int m_rping (cptr, sptr, parc, parv) * parv[3] = pingtime in ms * parv[4] = client info (for instance start time) */ -int m_rpong (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; - +int m_rpong (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; diff --git a/src/s_user.c b/src/s_user.c index 28d5bd8..4c348ee 100644 --- a/src/s_user.c +++ b/src/s_user.c @@ -34,10 +34,10 @@ #include #include "h.h" -void send_umode_out PROTO ((aClient *, aClient *, int)); -void send_svsmode_out PROTO ((aClient *, aClient *, aClient *, int)); -void send_umode PROTO ((aClient *, aClient *, int, int, char *)); -static int is_silenced PROTO ((aClient *, aClient *)); +void send_umode_out (aClient *, aClient *, int); +void send_svsmode_out (aClient *, aClient *, aClient *, int); +void send_umode (aClient *, aClient *, int, int, char *); +static int is_silenced (aClient *, aClient *); static char buf[BUFSIZE], buf2[BUFSIZE]; @@ -154,10 +154,7 @@ aClient *next_client (next, ch) ** ** returns: (see #defines) */ -int hunt_server (cptr, sptr, command, server, parc, parv) - aClient *cptr, *sptr; - char *command, *parv[]; - int server, parc; +int hunt_server (aClient *cptr, aClient *sptr, char *command, int server, int parc, char *parv[]) { aClient *acptr; @@ -391,8 +388,7 @@ int check_clones (aClient * cptr, const char *remote) ** result if only few servers allowed it... */ -int do_nick_name (nick) - char *nick; +int do_nick_name (char *nick) { char *ch; @@ -415,8 +411,7 @@ int do_nick_name (nick) ** reduce a string of duplicate list entries to contain only the unique ** items. Unavoidably O(n^2). */ -char *canonize (buffer) - char *buffer; +char * canonize (char *buffer) { static char cbuf[BUFSIZ]; char *s, *t, *cp = cbuf; @@ -473,10 +468,7 @@ char *canonize (buffer) ** nick from local user or kill him/her... */ -static int register_user (cptr, sptr, nick, username) - aClient *cptr; - aClient *sptr; - char *nick, *username; +static int register_user (aClient *cptr, aClient *sptr, char *nick, char *username) { aConfItem *aconf; char *parv[3], *tmpstr, *encr; @@ -787,10 +779,7 @@ static int register_user (cptr, sptr, nick, username) ** parv[2] = new nickname ** parv[3] = timestamp */ -int m_svsnick (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svsnick (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char nick[NICKLEN + 2]; @@ -848,10 +837,7 @@ int m_svsnick (cptr, sptr, parc, parv) ** parv[7] = servicestamp ** parv[8] = info */ -int m_nick (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_nick (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aConfItem *aconf; aSqlineItem *asqline; @@ -1295,11 +1281,7 @@ int m_nick (cptr, sptr, parc, parv) ** */ -static int m_message (cptr, sptr, parc, parv, notice) - aClient *cptr, *sptr; - int parc; - char *parv[]; - int notice; +static int m_message (aClient *cptr, aClient *sptr, int parc, char *parv[], int notice) { aClient *acptr; char *s; @@ -1560,10 +1542,7 @@ static int user_modes[] = { UMODE_OPER, 'o', ** parv[2] = message text */ -int m_private (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_private (aClient *cptr, aClient *sptr, int parc, char *parv[]) { return m_message (cptr, sptr, parc, parv, 0); } @@ -1575,10 +1554,7 @@ int m_private (cptr, sptr, parc, parv) * 'ChanServ@services.starchat.net' so nobody can snoop /cs commands :) -taz */ -int m_chanserv (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_chanserv (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; if (IsJinxed (sptr)) @@ -1598,10 +1574,7 @@ int m_chanserv (cptr, sptr, parc, parv) return 0; } -int m_memoserv (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_memoserv (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -1622,10 +1595,7 @@ int m_memoserv (cptr, sptr, parc, parv) return 0; } -int m_nickserv (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_nickserv (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -1648,10 +1618,7 @@ int m_nickserv (cptr, sptr, parc, parv) } -int m_operserv (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_operserv (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -1678,10 +1645,7 @@ int m_operserv (cptr, sptr, parc, parv) * Automatic NickServ direction for the identify command * -taz */ -int m_identify (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_identify (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; @@ -1707,10 +1671,7 @@ int m_identify (cptr, sptr, parc, parv) ** parv[2] = notice text */ -int m_notice (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_notice (aClient *cptr, aClient *sptr, int parc, char *parv[]) { if ((cptr->name[0]) && !IsNotSpoof (cptr)) { if (BadPtr (parv[1])) @@ -1728,9 +1689,7 @@ int m_notice (cptr, sptr, parc, parv) return 0; } -static void do_who (sptr, acptr, repchan) - aClient *sptr, *acptr; - aChannel *repchan; +static void do_who (aClient *sptr, aClient *acptr, aChannel *repchan) { char status[5]; int i = 0; @@ -1770,10 +1729,7 @@ static void do_who (sptr, acptr, repchan) ** parv[1] = nickname mask list ** parv[2] = additional selection flag, only 'o' for now. */ -int m_who (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_who (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *mask = parc > 1 ? parv[1] : NULL; @@ -1962,10 +1918,7 @@ char *get_mode_str (aClient * acptr) ** parv[0] = sender prefix ** parv[1] = nickname masklist */ -int m_whois (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_whois (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char rpl_oper[] = "an IRC Operator"; char rpl_sadmin[] = "an IRC Operator - Services Operator"; @@ -2182,10 +2135,7 @@ int m_whois (cptr, sptr, parc, parv) ** parv[3] = server host name (used only from other servers) ** parv[4] = users real name info */ -int m_user (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_user (aClient *cptr, aClient *sptr, int parc, char *parv[]) { #define UFLAGS (UMODE_INVISIBLE|UMODE_SERVNOTICE) char *username, *host, *server, *realname; @@ -2264,10 +2214,7 @@ int m_user (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = comment */ -int m_quit (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_quit (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *ocomment = (parc > 1 && parv[1]) ? parv[1] : parv[0]; static char comment[QUITLEN]; @@ -2290,10 +2237,7 @@ int m_quit (cptr, sptr, parc, parv) ** parv[1] = kill victim(s) - comma separated list ** parv[2] = kill path */ -int m_kill (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_kill (aClient *cptr, aClient *sptr, int parc, char *parv[]) { static anUser UnknownUser = { NULL, /* nextu */ @@ -2504,10 +2448,7 @@ int m_kill (cptr, sptr, parc, parv) /* m_mkill() - kills all users with the host provided or with the same host * as a nickname they type in */ -int m_mkill (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_mkill (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char buff[512], *lookhost; aClient *acptr; @@ -2580,10 +2521,7 @@ int m_mkill (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = away message */ -int m_away (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_away (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *away, *awy2 = parv[1]; @@ -2636,10 +2574,7 @@ int m_away (cptr, sptr, parc, parv) ** parv[1] = origin ** parv[2] = destination */ -int m_ping (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_ping (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *origin, *destination; @@ -2681,10 +2616,7 @@ int m_ping (cptr, sptr, parc, parv) ** parv[0] = prefix ** parv[1] = code */ -int m_nospoof (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_nospoof (aClient *cptr, aClient *sptr, int parc, char *parv[]) { unsigned long result; @@ -2722,10 +2654,7 @@ int m_nospoof (cptr, sptr, parc, parv) ** parv[1] = origin ** parv[2] = destination */ -int m_pong (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_pong (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aClient *acptr; char *origin, *destination; @@ -2774,10 +2703,7 @@ int m_pong (cptr, sptr, parc, parv) ** parv[1] = oper name ** parv[2] = oper password */ -int m_oper (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_oper (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aConfItem *aconf; char *name, *password, *encr; @@ -2965,10 +2891,7 @@ int m_oper (cptr, sptr, parc, parv) ** parv[0] = sender prefix ** parv[1] = password */ -int m_pass (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_pass (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char *password = parc > 1 ? parv[1] : NULL; @@ -2991,10 +2914,7 @@ int m_pass (cptr, sptr, parc, parv) * the need for complicated requests like WHOIS. It returns user/host * information only (no spurious AWAY labels or channels). */ -int m_userhost (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_userhost (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int catsize; char *p = NULL; @@ -3089,10 +3009,7 @@ int m_userhost (cptr, sptr, parc, parv) * ISON :nicklist */ -int m_ison (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_ison (aClient *cptr, aClient *sptr, int parc, char *parv[]) { char namebuf[USERLEN + HOSTLEN + 4]; aClient *acptr; @@ -3143,11 +3060,7 @@ int m_ison (cptr, sptr, parc, parv) * parv[1] - username to change mode for * parv[2] - modes to change */ -int m_umode (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; - +int m_umode (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int flag; int *s; @@ -3353,10 +3266,7 @@ int m_umode (cptr, sptr, parc, parv) * parv[2] - modes to change * parv[3] - Service Stamp (if mode == d) */ -int m_svsmode (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_svsmode (aClient *cptr, aClient *sptr, int parc, char *parv[]) { int flag; int *s; @@ -3460,10 +3370,7 @@ int m_svsmode (cptr, sptr, parc, parv) * send the MODE string for user (user) to connection cptr * -avalon */ -void send_umode (cptr, sptr, old, sendmask, umode_buf) - aClient *cptr, *sptr; - int old, sendmask; - char *umode_buf; +void send_umode (aClient *cptr, aClient *sptr, int old, int sendmask, char *umode_buf) { int *s, flag; char *m; @@ -3507,9 +3414,7 @@ void send_umode (cptr, sptr, old, sendmask, umode_buf) /* * added Sat Jul 25 07:30:42 EST 1992 */ -void send_umode_out (cptr, sptr, old) - aClient *cptr, *sptr; - int old; +void send_umode_out (aClient *cptr, aClient *sptr, int old) { int i; aClient *acptr; @@ -3529,9 +3434,7 @@ void send_umode_out (cptr, sptr, old) /* * added by taz */ -void send_svsmode_out (cptr, sptr, bsptr, old) - aClient *cptr, *sptr, *bsptr; - int old; +void send_svsmode_out (aClient *cptr, aClient *sptr, aClient *bsptr, int old) { aClient *acptr = NULL; @@ -3588,9 +3491,7 @@ static int is_silenced (aClient * sptr, aClient * acptr) return 0; } -int del_silence (sptr, mask) - aClient *sptr; - char *mask; +int del_silence (aClient *sptr, char *mask) { Link **lp; Link *tmp; @@ -3606,9 +3507,7 @@ int del_silence (sptr, mask) return -1; } -static int add_silence (sptr, mask) - aClient *sptr; - char *mask; +static int add_silence (aClient *sptr, char *mask) { Link *lp; int cnt = 0, len = 0; @@ -3648,10 +3547,7 @@ static int add_silence (sptr, mask) ** parv[1] = nick that must be silenced ** parv[2] = mask */ -int m_silence (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_silence (aClient *cptr, aClient *sptr, int parc, char *parv[]) { Link *lp; aClient *acptr; diff --git a/src/send.c b/src/send.c index e2e33b2..2cf9d1d 100644 --- a/src/send.c +++ b/src/send.c @@ -27,11 +27,12 @@ #include "sys.h" #include "h.h" #include +#include #define NEWLINE "\r\n" static char sendbuf[2048]; -static int send_message PROTO ((aClient *, char *, int)); +static int send_message (aClient *, char *, int); static int sentalong[MAXCONNECTIONS]; @@ -50,9 +51,7 @@ static int sentalong[MAXCONNECTIONS]; ** Also, the notice is skipped for "uninteresting" cases, ** like Persons and yet unknown connections... */ -static int dead_link (to, notice) - aClient *to; - char *notice; +static int dead_link (aClient *to, char *notice) { if (to->flags2 & FLAGS2_HTC) { if (MyClient (to)) /* Joins large channels increase the htccount */ @@ -83,8 +82,7 @@ static int dead_link (to, notice) ** client and try to send it. if we cant send it, it goes into the sendQ ** -avalon */ -void flush_connections (fd) - int fd; +void flush_connections (int fd) { int i; aClient *cptr; @@ -106,10 +104,7 @@ void flush_connections (fd) ** socket. Takes care of the error handling and buffering, if ** needed. */ -static int send_message (to, msg, len) - aClient *to; - char *msg; /* if msg is a null pointer, we are flushing connection */ - int len; +static int send_message (aClient *to, char *msg, int len) { static int SQinK; @@ -189,8 +184,7 @@ static int send_message (to, msg, len) ** when there is a chance the some output would be possible. This ** attempts to empty the send queue as far as possible... */ -int send_queued (to) - aClient *to; +int send_queued (aClient *to) { char *msg; int len, rlen, more = 0; @@ -221,8 +215,7 @@ int send_queued (to) return dead_link (to, "Fatal error in zip_buffer()"); if (dbuf_put (&to->sendQ, msg, len) < 0) - return dead_link (to, "Buffer allocation error for %s", - get_client_name (to, TRUE)); + return dead_link (to, "Buffer allocation error for %s"); } } #endif @@ -251,8 +244,7 @@ int send_queued (to) return dead_link (to, "Fatal error in zip_buffer()"); if (dbuf_put (&to->sendQ, msg, len) < 0) - return dead_link (to, "Buffer allocation error for %s", - get_client_name (to, TRUE)); + return dead_link (to, "Buffer allocation error for %s"); } #endif @@ -264,13 +256,13 @@ int send_queued (to) /* ** send message to single client */ -void sendto_one (to, pattern, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) - aClient *to; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9, *p10, *p11; +void sendto_one (aClient *to, char *pattern, ...) { + va_list vl; - (void) sprintf (sendbuf, pattern, p1, p2, p3, p4, p5, p6, - p7, p8, p9, p10, p11); + va_start (vl, pattern); + (void) vsprintf (sendbuf, pattern, vl); + va_end (vl); Debug ((DEBUG_SEND, "Sending [%s] to %s", sendbuf, to->name)); if (to->from) @@ -290,15 +282,17 @@ void sendto_one (to, pattern, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11) (void) send_message (to, sendbuf, strlen (sendbuf)); } -void sendto_channel_butone (one, from, chptr, pattern, - p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - aChannel *chptr; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_channel_butone (aClient *one, aClient *from, aChannel *chptr, char *pattern, ...) { Link *lp; aClient *acptr; int i; + va_list vl; + static char chanbut_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (chanbut_buf, pattern, vl); + va_end (vl); memset (sentalong, 0, sizeof (sentalong)); for (lp = chptr->members; lp; lp = lp->next) { @@ -307,16 +301,14 @@ void sendto_channel_butone (one, from, chptr, pattern, continue; /* ...was the one I should skip */ i = acptr->from->fd; if (MyConnect (acptr) && IsRegisteredUser (acptr)) { - sendto_prefix_one (acptr, from, pattern, p1, p2, - p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanbut_buf); sentalong[i] = 1; } else { /* Now check whether a message has been sent to this * remote link already */ if (sentalong[i] == 0) { - sendto_prefix_one (acptr, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanbut_buf); sentalong[i] = 1; } } @@ -334,15 +326,17 @@ void sendto_channel_butone (one, from, chptr, pattern, * or one without will send back an error message. -- Cabal95 */ void -sendto_channelops_butone (one, from, chptr, pattern, - p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - aChannel *chptr; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +sendto_channelops_butone (aClient *one, aClient *from, aChannel *chptr, char *pattern, ...) { Link *lp; aClient *acptr; int i; + va_list vl; + static char chanops_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (chanops_buf, pattern, vl); + va_end (vl); for (i = 0; i < MAXCONNECTIONS; i++) sentalong[i] = 0; @@ -354,16 +348,14 @@ sendto_channelops_butone (one, from, chptr, pattern, or user not not a channel op */ i = acptr->from->fd; if (MyConnect (acptr) && IsRegisteredUser (acptr)) { - sendto_prefix_one (acptr, from, pattern, p1, p2, - p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanops_buf); sentalong[i] = 1; } else { /* Now check whether a message has been sent to this * remote link already */ if (sentalong[i] == 0) { - sendto_prefix_one (acptr, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanops_buf); sentalong[i] = 1; } } @@ -381,15 +373,17 @@ sendto_channelops_butone (one, from, chptr, pattern, */ void -sendto_channelvoice_butone (one, from, chptr, pattern, - p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - aChannel *chptr; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +sendto_channelvoice_butone (aClient *one, aClient *from, aChannel *chptr, char *pattern, ...) { Link *lp; aClient *acptr; int i; + va_list vl; + static char chanvoice_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (chanvoice_buf, pattern, vl); + va_end (vl); for (i = 0; i < MAXCONNECTIONS; i++) sentalong[i] = 0; @@ -401,16 +395,14 @@ sendto_channelvoice_butone (one, from, chptr, pattern, or user not (a channel voice or op) */ i = acptr->from->fd; if (MyConnect (acptr) && IsRegisteredUser (acptr)) { - sendto_prefix_one (acptr, from, pattern, p1, p2, - p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanvoice_buf); sentalong[i] = 1; } else { /* Now check whether a message has been sent to this * remote link already */ if (sentalong[i] == 0) { - sendto_prefix_one (acptr, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", chanvoice_buf); sentalong[i] = 1; } } @@ -423,22 +415,21 @@ sendto_channelvoice_butone (one, from, chptr, pattern, * * Send a message to all connected servers except the client 'one'. */ -void sendto_serv_butone (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_serv_butone (aClient *one, char *pattern, ...) { int i; aClient *cptr; + va_list vl; -#ifdef NPATH - check_command ((long) 2, pattern, p1, p2, p3); -#endif + va_start (vl, pattern); + (void) vsprintf (sendbuf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) { if (!(cptr = local[i]) || (one && cptr == one->from)) continue; if (IsServer (cptr)) - sendto_one (cptr, pattern, p1, p2, p3, p4, p5, p6, p7, p8); + sendto_one (cptr, "%s", sendbuf); } return; } @@ -448,22 +439,21 @@ void sendto_serv_butone (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send a message to all connected servers except the client 'one'. */ -void sendto_SNICK_butone (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8, p9) - aClient *one; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9; +void sendto_SNICK_butone (aClient *one, char *pattern, ...) { int i; aClient *cptr; + va_list vl; -#ifdef NPATH - check_command ((long) 2, pattern, p1, p2, p3); -#endif + va_start (vl, pattern); + (void) vsprintf (sendbuf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) { if (!(cptr = local[i]) || (one && cptr == one->from)) continue; if (IsServer (cptr)) - sendto_one (cptr, pattern, p1, p2, p3, p4, p5, p6, p7, p8, p9); + sendto_one (cptr, "%s", sendbuf); } return; } @@ -474,22 +464,21 @@ void sendto_SNICK_butone (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8, p9) * Send a message to all connected servers except the client 'one'. * BUT, don't send to NOQUIT servers. */ -void sendto_serv_butone_quit (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_serv_butone_quit (aClient *one, char *pattern, ...) { int i; aClient *cptr; + va_list vl; -#ifdef NPATH - check_command ((long) 2, pattern, p1, p2, p3); -#endif + va_start (vl, pattern); + (void) vsprintf (sendbuf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) { if (!(cptr = local[i]) || (one && cptr == one->from)) continue; if (IsServer (cptr) && !DontSendQuit (cptr)) - sendto_one (cptr, pattern, p1, p2, p3, p4, p5, p6, p7, p8); + sendto_one (cptr, "%s", sendbuf); } return; } @@ -500,12 +489,16 @@ void sendto_serv_butone_quit (one, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * Sends a message to all people (inclusing user) on local server who are * in same channel with user. */ -void sendto_common_channels (user, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *user; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_common_channels (aClient *user, char *pattern, ...) { aClient *cptr; Link *lp, *lp2; + va_list vl; + static char common_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (common_buf, pattern, vl); + va_end (vl); memset (sentalong, 0, sizeof (sentalong)); sentalong[0] = 1; @@ -517,12 +510,10 @@ void sendto_common_channels (user, pattern, p1, p2, p3, p4, p5, p6, p7, p8) if (sentalong[cptr->fd]) continue; sentalong[cptr->fd] = 1; - sendto_prefix_one (cptr, user, pattern, p1, p2, p3, p4, p5, p6, - p7, p8); + sendto_prefix_one (cptr, user, "%s", common_buf); } if (MyConnect (user) && !sentalong[user->fd]) - sendto_prefix_one (user, user, pattern, p1, p2, p3, p4, p5, p6, p7, - p8); + sendto_prefix_one (user, user, "%s", common_buf); return; } @@ -533,18 +524,20 @@ void sendto_common_channels (user, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * server. */ void -sendto_channel_butserv (chptr, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aChannel *chptr; - aClient *from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +sendto_channel_butserv (aChannel *chptr, aClient *from, char *pattern, ...) { Link *lp; aClient *acptr; + va_list vl; + static char butserv_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (butserv_buf, pattern, vl); + va_end (vl); for (lp = chptr->members; lp; lp = lp->next) if (MyConnect (acptr = lp->value.cptr) && !(lp->flags & CHFL_ZOMBIE)) - sendto_prefix_one (acptr, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (acptr, from, "%s", butserv_buf); return; } @@ -556,10 +549,7 @@ sendto_channel_butserv (chptr, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) ** addition -- Armin, 8jun90 (gruner@informatik.tu-muenchen.de) */ -static int match_it (one, mask, what) - aClient *one; - char *mask; - int what; +static int match_it (aClient *one, char *mask, int what) { switch (what) { case MATCH_HOST: @@ -577,18 +567,17 @@ static int match_it (one, mask, what) * (if there is a mask present) or to all if no mask. */ void -sendto_match_servs (chptr, from, format, p1, p2, p3, p4, p5, p6, p7, p8, p9) - aChannel *chptr; - aClient *from; - char *format, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9; +sendto_match_servs (aChannel *chptr, aClient *from, char *format, ...) { int i; aClient *cptr; char *mask; + va_list vl; + + va_start (vl, format); + (void) vsprintf (sendbuf, format, vl); + va_end (vl); -#ifdef NPATH - check_command ((long) 3, format, p1, p2, p3); -#endif if (chptr) { if (*chptr->chname == '&') return; @@ -605,7 +594,7 @@ sendto_match_servs (chptr, from, format, p1, p2, p3, p4, p5, p6, p7, p8, p9) continue; if (!BadPtr (mask) && IsServer (cptr) && match (mask, cptr->name)) continue; - sendto_one (cptr, format, p1, p2, p3, p4, p5, p6, p7, p8, p9); + sendto_one (cptr, "%s", sendbuf); } } @@ -616,15 +605,17 @@ sendto_match_servs (chptr, from, format, p1, p2, p3, p4, p5, p6, p7, p8, p9) * either by user hostname or user servername. */ void -sendto_match_butone (one, from, mask, what, pattern, - p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - int what; - char *mask, *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +sendto_match_butone (aClient *one, aClient *from, char *mask, int what, char *pattern, ...) { int i; aClient *cptr, *acptr; char cansendlocal, cansendglobal; + va_list vl; + static char matchbut_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (matchbut_buf, pattern, vl); + va_end (vl); if (MyConnect (from)) { cansendlocal = (OPCanLNotice (from)) ? 1 : 0; @@ -656,8 +647,7 @@ sendto_match_butone (one, from, mask, what, pattern, else if (!cansendlocal || (!(IsRegisteredUser (cptr) && match_it (cptr, mask, what)))) continue; - sendto_prefix_one (cptr, from, pattern, p1, p2, p3, p4, p5, p6, p7, - p8); + sendto_prefix_one (cptr, from, "%s", matchbut_buf); } return; } @@ -668,17 +658,20 @@ sendto_match_butone (one, from, mask, what, pattern, * Send a message to all connections except 'one'. The basic wall type * message generator. */ -void sendto_all_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_all_butone (aClient *one, aClient *from, char *pattern, ...) { int i; aClient *cptr; + va_list vl; + static char allbut_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (allbut_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsMe (cptr) && one != cptr) - sendto_prefix_one (cptr, from, pattern, p1, p2, p3, p4, p5, p6, - p7, p8); + sendto_prefix_one (cptr, from, "%s", allbut_buf); return; } @@ -688,27 +681,31 @@ void sendto_all_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* ops only. */ -void sendto_ops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_ops (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char ops_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (ops_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && IsAnOper (cptr) && SendServNotice (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** Notice -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** Notice -- %s", + me.name, cptr->name, ops_buf); + sendto_one (cptr, "%s", nbuf); } #ifdef USE_SERVICES else if (cptr && IsService (cptr) && (cptr->service->wanted & SERVICE_WANT_SERVNOTE)) { - (void) sprintf (nbuf, "NOTICE %s :*** Notice -- ", cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, "NOTICE %s :*** Notice -- %s", + cptr->name, ops_buf); + sendto_one (cptr, "%s", nbuf); } #endif /* USE_SERVICES */ return; @@ -719,27 +716,31 @@ void sendto_ops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* mode +g ops only. */ -void sendto_failops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_failops (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char fops_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (fops_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && SendFailops (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** Global -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** Global -- %s", + me.name, cptr->name, fops_buf); + sendto_one (cptr, "%s", nbuf); } #ifdef USE_SERVICES else if (cptr && IsService (cptr) && (cptr->service->wanted & SERVICE_WANT_SERVNOTE)) { - (void) sprintf (nbuf, "NOTICE %s :*** Notice -- ", cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, "NOTICE %s :*** Notice -- %s", + cptr->name, fops_buf); + sendto_one (cptr, "%s", nbuf); } #endif return; @@ -750,20 +751,24 @@ void sendto_failops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to specified umode */ -void sendto_umode (umodes, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - int umodes; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_umode (int umodes, char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char umode_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (umode_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && (cptr->umodes & umodes) == umodes) { - (void) sprintf (nbuf, ":%s NOTICE %s :", me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :%s", + me.name, cptr->name, umode_buf); + sendto_one (cptr, "%s", nbuf); } return; } @@ -773,27 +778,31 @@ void sendto_umode (umodes, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* mode +g ops only who are also +o. */ -void sendto_failops_whoare_opers (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_failops_whoare_opers (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char fwops_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (fwops_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && SendFailops (cptr) && IsAnOper (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** Global -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** Global -- %s", + me.name, cptr->name, fwops_buf); + sendto_one (cptr, "%s", nbuf); } #ifdef USE_SERVICES else if (cptr && IsService (cptr) && (cptr->service->wanted & SERVICE_WANT_SERVNOTE)) { - (void) sprintf (nbuf, "NOTICE %s :*** Notice -- ", cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, "NOTICE %s :*** Notice -- %s", + cptr->name, fwops_buf); + sendto_one (cptr, "%s", nbuf); } #endif return; @@ -804,27 +813,31 @@ void sendto_failops_whoare_opers (pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* mode +g ops only who are also +o. */ -void sendto_locfailops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_locfailops (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char locfops_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (locfops_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && SendFailops (cptr) && IsAnOper (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** LocOps -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** LocOps -- %s", + me.name, cptr->name, locfops_buf); + sendto_one (cptr, "%s", nbuf); } #ifdef USE_SERVICES else if (cptr && IsService (cptr) && (cptr->service->wanted & SERVICE_WANT_SERVNOTE)) { - (void) sprintf (nbuf, "NOTICE %s :*** Notice -- ", cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, "NOTICE %s :*** Notice -- %s", + cptr->name, locfops_buf); + sendto_one (cptr, "%s", nbuf); } #endif return; @@ -835,28 +848,31 @@ void sendto_locfailops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* ops only. (all +O or +o people) */ -void sendto_opers (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_opers (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char opers_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (opers_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && IsAnOper (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** Oper -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** Oper -- %s", + me.name, cptr->name, opers_buf); + sendto_one (cptr, "%s", nbuf); } #ifdef USE_SERVICES else if (cptr && IsService (cptr) && (cptr->service->wanted & SERVICE_WANT_SERVNOTE)) { - (void) sprintf (nbuf, "NOTICE %s :*** GLOBAL OPER Notice -- ", - cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, "NOTICE %s :*** GLOBAL OPER Notice -- %s", + cptr->name, opers_buf); + sendto_one (cptr, "%s", nbuf); } #endif return; @@ -867,12 +883,16 @@ void sendto_opers (pattern, p1, p2, p3, p4, p5, p6, p7, p8) ** one - client not to send message to ** from- client which message is from *NEVER* NULL!! */ -void sendto_ops_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_ops_butone (aClient *one, aClient *from, char *pattern, ...) { int i; aClient *cptr; + va_list vl; + static char ops_butone_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (ops_butone_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) sentalong[i] = 0; @@ -883,8 +903,7 @@ void sendto_ops_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) if (cptr->from == one) continue; /* ...was the one I should skip */ sentalong[i] = 1; - sendto_prefix_one (cptr->from, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (cptr->from, from, "%s", ops_butone_buf); } return; } @@ -896,12 +915,16 @@ void sendto_ops_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) ** one - client not to send message to ** from- client which message is from *NEVER* NULL!! */ -void sendto_opers_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *one, *from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_opers_butone (aClient *one, aClient *from, char *pattern, ...) { int i; aClient *cptr; + va_list vl; + static char opers_butone_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (opers_butone_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) sentalong[i] = 0; @@ -914,8 +937,7 @@ void sendto_opers_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) if (cptr->from == one) continue; /* ...was the one I should skip */ sentalong[i] = 1; - sendto_prefix_one (cptr->from, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (cptr->from, from, "%s", opers_butone_buf); } return; } @@ -925,12 +947,16 @@ void sendto_opers_butone (one, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) ** Send message to all operators except local ones ** from- client which message is from *NEVER* NULL!! */ -void sendto_ops_butme (from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient **from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_ops_butme (aClient **from, char *pattern, ...) { int i; aClient *cptr; + va_list vl; + static char ops_butme_buf[2048]; + + va_start (vl, pattern); + (void) vsprintf (ops_butme_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) sentalong[i] = 0; @@ -941,8 +967,7 @@ void sendto_ops_butme (from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) if (!strcmp (cptr->user->server, me.name)) /* a locop */ continue; sentalong[i] = 1; - sendto_prefix_one (cptr->from, from, pattern, - p1, p2, p3, p4, p5, p6, p7, p8); + sendto_prefix_one (cptr->from, from, "%s", ops_butme_buf); } return; } @@ -956,52 +981,60 @@ void sendto_ops_butme (from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * NOTE: NEITHER OF THESE SHOULD *EVER* BE NULL!! * -avalon */ -void sendto_prefix_one (to, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) - aClient *to; - aClient *from; - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_prefix_one (aClient *to, aClient *from, char *pattern, ...) { static char sender[HOSTLEN + NICKLEN + USERLEN + 5]; + static char prefix_buf[2048]; anUser *user; - char *par; int flag = 0; + va_list vl; + char *nick_end; - par = p1; - + va_start (vl, pattern); + (void) vsprintf (prefix_buf, pattern, vl); + va_end (vl); + + /* + * Check if the message starts with ":sendername " and the sender + * matches from->name. If so, expand to :nick!user@host. + */ if (to && from && MyClient (to) && IsPerson (from) && - !mycmp (par, from->name)) { - user = from->user; - (void) strcpy (sender, from->name); - - if (user) { - if (*user->username) { - (void) strcat (sender, "!"); - (void) strcat (sender, user->username); + prefix_buf[0] == ':' && + (nick_end = strchr (prefix_buf + 1, ' ')) != NULL) { + /* Extract the sender nick from the formatted message */ + *nick_end = '\0'; + if (!mycmp (prefix_buf + 1, from->name)) { + user = from->user; + (void) strcpy (sender, from->name); + + if (user) { + if (*user->username) { + (void) strcat (sender, "!"); + (void) strcat (sender, user->username); + } + if (*user->host && !MyConnect (from)) { + (void) strcat (sender, "@"); + if ((IsAnOper (to) && !IsAnOper (from)) || (to == from)) + (void) strcat (sender, user->host); + else + (void) strcat (sender, MaskHost (from)); + flag = 1; + } } - if (*user->host && !MyConnect (from)) { + if (!flag && MyConnect (from) && user && *user->host) { (void) strcat (sender, "@"); if ((IsAnOper (to) && !IsAnOper (from)) || (to == from)) (void) strcat (sender, user->host); else (void) strcat (sender, MaskHost (from)); - - flag = 1; } + *nick_end = ' '; + sendto_one (to, ":%s%s", sender, nick_end); + return; } - /* - ** flag is used instead of strchr (sender, '@') for speed and - ** also since username/nick may have had a '@' in them. -avalon - */ - if (!flag && MyConnect (from) && *user->host) { - (void) strcat (sender, "@"); - if ((IsAnOper (to) && !IsAnOper (from)) || (to == from)) - (void) strcat (sender, user->host); - else - (void) strcat (sender, MaskHost (from)); - } - par = sender; + *nick_end = ' '; } - sendto_one (to, pattern, par, p2, p3, p4, p5, p6, p7, p8); + sendto_one (to, "%s", prefix_buf); } /* @@ -1009,20 +1042,24 @@ void sendto_prefix_one (to, from, pattern, p1, p2, p3, p4, p5, p6, p7, p8) * * Send to *local* ops only but NOT +s nonopers. */ -void sendto_realops (pattern, p1, p2, p3, p4, p5, p6, p7, p8) - char *pattern, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8; +void sendto_realops (char *pattern, ...) { aClient *cptr; int i; char nbuf[1024]; + va_list vl; + static char realops_buf[1024]; + + va_start (vl, pattern); + (void) vsprintf (realops_buf, pattern, vl); + va_end (vl); for (i = 0; i <= highest_fd; i++) if ((cptr = local[i]) && !IsServer (cptr) && !IsMe (cptr) && IsOper (cptr)) { - (void) sprintf (nbuf, ":%s NOTICE %s :*** Notice -- ", - me.name, cptr->name); - (void) strncat (nbuf, pattern, sizeof (nbuf) - strlen (nbuf)); - sendto_one (cptr, nbuf, p1, p2, p3, p4, p5, p6, p7, p8); + (void) sprintf (nbuf, ":%s NOTICE %s :*** Notice -- %s", + me.name, cptr->name, realops_buf); + sendto_one (cptr, "%s", nbuf); } return; } diff --git a/src/strtoul.c b/src/strtoul.c index 1ce5082..be72999 100644 --- a/src/strtoul.c +++ b/src/strtoul.c @@ -42,10 +42,7 @@ * Ignores `locale' stuff. Assumes that the upper and lower case * alphabets and digits are each contiguous. */ -unsigned long strtoul (nptr, endptr, base) - char *nptr; - char **endptr; - int base; +unsigned long strtoul (char *nptr, char **endptr, int base) { char *s; unsigned long acc, cutoff; diff --git a/src/support.c b/src/support.c index 18c6174..1013f56 100644 --- a/src/support.c +++ b/src/support.c @@ -22,6 +22,7 @@ #include "common.h" #include "sys.h" #include "h.h" +#include extern void outofmemory (); @@ -33,9 +34,7 @@ extern void outofmemory (); ** */ -char *strtoken (save, str, fs) - char **save; - char *str, *fs; +char * strtoken (char **save, char *str, char *fs) { char *pos = *save; /* keep last position across calls */ char *tmp; @@ -70,8 +69,7 @@ char *strtoken (save, str, fs) ** -avalon 23/11/92 */ -char *inetntoa (in) - char *in; +char * inetntoa (char *in) { static char buf[16]; u_char *s = (u_char *) in; @@ -89,14 +87,15 @@ char *inetntoa (in) #ifdef DEBUGMODE -void dumpcore (msg, p1, p2, p3, p4, p5, p6, p7, p8, p9) - char *msg, *p1, *p2, *p3, *p4, *p5, *p6, *p7, *p8, *p9; +void dumpcore (char *msg, ...) { static time_t lastd = 0; static int dumps = 0; char corename[12]; + static char dumpcore_buf[1024]; time_t now; int p; + va_list vl; now = time (NULL); @@ -120,8 +119,11 @@ void dumpcore (msg, p1, p2, p3, p4, p5, p6, p7, p8, p9) (void) rename ("core", corename); Debug ((DEBUG_FATAL, "Dumped core : core.%d", p)); sendto_ops ("Dumped core : core.%d", p); - Debug ((DEBUG_FATAL, msg, p1, p2, p3, p4, p5, p6, p7, p8, p9)); - sendto_ops (msg, p1, p2, p3, p4, p5, p6, p7, p8, p9); + va_start (vl, msg); + (void) vsprintf (dumpcore_buf, msg, vl); + va_end (vl); + Debug ((DEBUG_FATAL, "%s", dumpcore_buf)); + sendto_ops ("%s", dumpcore_buf); (void) s_die (); } @@ -133,8 +135,7 @@ static int mindex = 0; #define SZ_CH (sizeof(char *)) #define SZ_ST (sizeof(size_t)) -char *MyMalloc (x) - size_t x; +char * MyMalloc (size_t x) { int i; char **s; @@ -159,9 +160,7 @@ char *MyMalloc (x) return ret + SZ_CHST; } -char *MyRealloc (x, y) - char *x; - size_t y; +char * MyRealloc (char *x, size_t y) { int l; char **s; @@ -198,8 +197,7 @@ char *MyRealloc (x, y) return ret + SZ_CHST; } -void MyFree (x) - char *x; +void MyFree (char *x) { size_t i; char *j; @@ -232,8 +230,7 @@ void MyFree (x) } #else /* DEBUGMODE */ -char *MyMalloc (x) - size_t x; +char * MyMalloc (size_t x) { char *ret = (char *) malloc (x); @@ -243,9 +240,7 @@ char *MyMalloc (x) return ret; } -char *MyRealloc (x, y) - char *x; - size_t y; +char * MyRealloc (char *x, size_t y) { char *ret = (char *) realloc (x, y); @@ -269,9 +264,7 @@ char *MyRealloc (x, y) ** dgets(x,y,0); ** to mark the buffer as being empty. */ -int dgets (fd, buf, num) - int fd, num; - char *buf; +int dgets (int fd, char *buf, int num) { static char dgbuf[8192]; static char *head = dgbuf, *tail = dgbuf; diff --git a/src/userload.c b/src/userload.c index d19c640..d20e7e3 100644 --- a/src/userload.c +++ b/src/userload.c @@ -99,9 +99,7 @@ void update_load () } -void calc_load (sptr, parv) - aClient *sptr; - char *parv; /* we only get passed the original parv[0] */ +void calc_load (aClient *sptr, char *parv) { struct load_entry *cur_load_entry; struct load_entry *last = NULL; diff --git a/src/whowas.c b/src/whowas.c index b374d82..ed77035 100644 --- a/src/whowas.c +++ b/src/whowas.c @@ -28,8 +28,7 @@ static aName was[NICKNAMEHISTORYLENGTH]; static int ww_index = 0; -void add_history (cptr) - aClient *cptr; +void add_history (aClient *cptr) { aName ntmp; aName *np = &ntmp, *np2; @@ -104,9 +103,7 @@ void add_history (cptr) ** nickname within the timelimit. Returns NULL, if no ** one found... */ -aClient *get_history (nick, timelimit) - char *nick; - time_t timelimit; +aClient * get_history (char *nick, time_t timelimit) { aName *wp, *wp2; int i = 0; @@ -134,8 +131,7 @@ aClient *get_history (nick, timelimit) return (NULL); } -void off_history (cptr) - aClient *cptr; +void off_history (aClient *cptr) { Link *lp; Link *next; @@ -167,10 +163,7 @@ void initwhowas () ** parv[0] = sender prefix ** parv[1] = nickname queried */ -int m_whowas (cptr, sptr, parc, parv) - aClient *cptr, *sptr; - int parc; - char *parv[]; +int m_whowas (aClient *cptr, aClient *sptr, int parc, char *parv[]) { aName *wp, *wp2 = NULL; int j = 0; @@ -239,9 +232,7 @@ int m_whowas (cptr, sptr, parc, parv) } -void count_whowas_memory (wwu, wwa, wwam) - int *wwu, *wwa; - u_long *wwam; +void count_whowas_memory (int *wwu, int *wwa, u_long *wwam) { anUser *tmp; int i, j; -- 2.30.2