From ee442551e1531712226a3a3ba26afff466100bb5 Mon Sep 17 00:00:00 2001 From: Karl Ramm Date: Mon, 21 Jan 2008 07:57:32 +0000 Subject: passes gcc -Wall with no warnings other than des cryppt C_block sadness and getsid problem --- zhm/queue.c | 17 +++++++++++++---- zhm/timer.c | 1 - zhm/zhm.c | 12 +++++++++--- zhm/zhm.h | 2 ++ zhm/zhm_client.c | 5 ++++- zhm/zhm_server.c | 2 +- 6 files changed, 29 insertions(+), 10 deletions(-) (limited to 'zhm') diff --git a/zhm/queue.c b/zhm/queue.c index 27e7ca2..b028f7c 100644 --- a/zhm/queue.c +++ b/zhm/queue.c @@ -14,7 +14,7 @@ #ifndef lint #ifndef SABER -static char rcsid_queue_c[] = "$Id$"; +static const char rcsid_queue_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ @@ -31,9 +31,10 @@ static Queue *hm_queue; static int retransmits_enabled = 0; static Queue *find_notice_in_queue(ZNotice_t *notice); -static Code_t dump_queue(void); static void queue_timeout(void *arg); +extern void new_server(char *); + int rexmit_times[] = { 2, 2, 4, 4, 8, -1 }; #ifdef DEBUG @@ -82,7 +83,13 @@ add_notice_to_queue(ZNotice_t *notice, free(entry->packet); } else { entry->reply = *repl; - LIST_INSERT(&hm_queue, entry); + /*LIST_INSERT(&hm_queue, entry);*/ + + (entry)->next = *(&hm_queue); + if (*&hm_queue) ((*(&hm_queue))->prev_p = &(entry)->next); + (*&hm_queue) = (entry); + (entry)->prev_p = (&hm_queue); + } entry->timer = (retransmits_enabled) ? timer_set_rel(rexmit_times[0], queue_timeout, entry) : NULL; @@ -107,7 +114,9 @@ remove_notice_from_queue(ZNotice_t *notice, if (entry->timer) timer_reset(entry->timer); free(entry->packet); - LIST_DELETE(entry); + /*LIST_DELETE(entry);*/ + *(entry)->prev_p = (entry)->next; + if((entry)->next) ((entry)->next->prev_p = (entry)->prev_p); #ifdef DEBUG dump_queue(); #endif /* DEBUG */ diff --git a/zhm/timer.c b/zhm/timer.c index 82c02aa..4fb764e 100644 --- a/zhm/timer.c +++ b/zhm/timer.c @@ -211,7 +211,6 @@ timer_process(void) Timer *t; timer_proc func; void *arg; - int valid = 0; if (num_timers == 0 || heap[0]->abstime > time(NULL)) return; diff --git a/zhm/zhm.c b/zhm/zhm.c index f6f3fc1..8e1303d 100644 --- a/zhm/zhm.c +++ b/zhm/zhm.c @@ -49,6 +49,11 @@ static void init_hm(void); static void detach(void); static void send_stats(ZNotice_t *, struct sockaddr_in *); static char *strsave(const char *); + +extern void send_flush_notice(char *); +extern void server_manager(ZNotice_t *); +extern void send_boot_notice(char *); +extern void find_next_server(char *); extern int optind; static RETSIGTYPE @@ -70,7 +75,7 @@ main(int argc, ZNotice_t notice; ZPacket_t packet; Code_t ret; - int opt, pak_len, i, j = 0, fd, count; + int opt, pak_len, fd, count; fd_set readers; struct timeval tv; @@ -465,8 +470,9 @@ detach(void) /* detach from terminal and fork. */ register int i, x = ZGetFD(); register long size; - - if (i = fork()) { + + i = fork(); + if (i) { if (i < 0) perror("fork"); exit(0); diff --git a/zhm/zhm.h b/zhm/zhm.h index 3d6f153..c930098 100644 --- a/zhm/zhm.h +++ b/zhm/zhm.h @@ -16,6 +16,8 @@ #include #include #include +#include +#include #include #include "timer.h" diff --git a/zhm/zhm_client.c b/zhm/zhm_client.c index 03514c6..0c5b68e 100644 --- a/zhm/zhm_client.c +++ b/zhm/zhm_client.c @@ -14,13 +14,16 @@ #ifndef lint #ifndef SABER -static char rcsid_hm_client_c[] = "$Id$"; +static const char rcsid_hm_client_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ extern int no_server, nclt, deactivated, noflushflag; extern struct sockaddr_in cli_sin, serv_sin, from; +extern void send_flush_notice(char *); +extern void new_server(char *sugg_serv); + void transmission_tower(ZNotice_t *notice, char *packet, int pak_len) diff --git a/zhm/zhm_server.c b/zhm/zhm_server.c index 47b2d59..9d8157f 100644 --- a/zhm/zhm_server.c +++ b/zhm/zhm_server.c @@ -14,7 +14,7 @@ #ifndef lint #ifndef SABER -static char rcsid_hm_server_c[] = "$Id$"; +static const char rcsid_hm_server_c[] = "$Id$"; #endif /* SABER */ #endif /* lint */ -- cgit v1.2.3