]> asedeno.scripts.mit.edu Git - 1ts-debian.git/commitdiff
de K&Rify
authorkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Mon, 21 Jan 2008 03:11:12 +0000 (03:11 +0000)
committerkcr <kcr@cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f>
Mon, 21 Jan 2008 03:11:12 +0000 (03:11 +0000)
git-svn-id: svn://svn.1ts.org/debian/branches/zephyr-reloaded@253 cbed1d16-5ef5-0310-b6a1-d4a37b08ba1f

zephyr/zhm/queue.c
zephyr/zhm/timer.c
zephyr/zhm/zhm.c
zephyr/zhm/zhm_client.c
zephyr/zhm/zhm_server.c

index 5a072aabf32661b90d0f3d85592398cfe05f2088..27e7ca2343a0f58b72560a9a1f949b5fec3a67f7 100644 (file)
@@ -30,17 +30,18 @@ typedef struct _Queue {
 static Queue *hm_queue;
 static int retransmits_enabled = 0;
 
-static Queue *find_notice_in_queue __P((ZNotice_t *notice));
-static Code_t dump_queue __P((void));
-static void queue_timeout __P((void *arg));
+static Queue *find_notice_in_queue(ZNotice_t *notice);
+static Code_t dump_queue(void);
+static void queue_timeout(void *arg);
 
 int rexmit_times[] = { 2, 2, 4, 4, 8, -1 };
 
 #ifdef DEBUG
-Code_t dump_queue();
+Code_t dump_queue(void);
 #endif
 
-void init_queue()
+void
+init_queue(void)
 {
     Queue *q;
 
@@ -56,11 +57,11 @@ void init_queue()
     DPR("Queue initialized and flushed.\n");
 }
 
-Code_t add_notice_to_queue(notice, packet, repl, len)
-    ZNotice_t *notice;
-    char * packet;
-    struct sockaddr_in *repl;
-    int len;
+Code_t
+add_notice_to_queue(ZNotice_t *notice,
+                   char *packet,
+                   struct sockaddr_in *repl,
+                   int len)
 {
     Queue *entry;
 
@@ -89,10 +90,10 @@ Code_t add_notice_to_queue(notice, packet, repl, len)
     return(ZERR_NONE);
 }
 
-Code_t remove_notice_from_queue(notice, kind, repl)
-    ZNotice_t *notice;
-    ZNotice_Kind_t *kind;
-    struct sockaddr_in *repl;
+Code_t
+remove_notice_from_queue(ZNotice_t *notice,
+                        ZNotice_Kind_t *kind,
+                        struct sockaddr_in *repl)
 {
     Queue *entry;
 
@@ -115,8 +116,8 @@ Code_t remove_notice_from_queue(notice, kind, repl)
 }
 
 /* We have a server; transmit all of our packets. */
-void retransmit_queue(sin)
-    struct sockaddr_in *sin;
+void
+retransmit_queue(struct sockaddr_in *sin)
 {
     Queue *entry;
     Code_t ret;
@@ -148,7 +149,8 @@ void retransmit_queue(sin)
 }
 
 /* We lost our server; nuke all of our timers. */
-void disable_queue_retransmits()
+void
+disable_queue_retransmits(void)
 {
     Queue *entry;
 
@@ -161,7 +163,8 @@ void disable_queue_retransmits()
 }
 
 #ifdef DEBUG
-static Code_t dump_queue()
+static Code_t
+dump_queue(void)
 {
     Queue *entry;
     caddr_t mp;
@@ -193,7 +196,8 @@ static Code_t dump_queue()
 }
 #endif /* DEBUG */
 
-int queue_len()
+int
+queue_len(void)
 {
     int length = 0;
     Queue *entry;
@@ -203,8 +207,8 @@ int queue_len()
     return length;
 }
 
-static Queue *find_notice_in_queue(notice)
-    ZNotice_t *notice;
+static Queue *
+find_notice_in_queue(ZNotice_t *notice)
 {
     Queue *entry;
 
@@ -215,8 +219,8 @@ static Queue *find_notice_in_queue(notice)
     return NULL;
 }
 
-static void queue_timeout(arg)
-    void *arg;
+static void
+queue_timeout(void *arg)
 {
     Queue *entry = (Queue *) arg;
     Code_t ret;
index 1fe3d3931488b82543cd4d7fd345d25a487bfbb2..82c02aa7fba0ef0bdb33e75fef3cfaaad2d04fe4 100644 (file)
@@ -115,13 +115,13 @@ static Timer **heap;
 static int num_timers = 0;
 static int heap_size = 0;
 
-static void timer_botch __P((void*));
-static Timer *add_timer __P((Timer *));
+static void timer_botch (void*);
+static Timer *add_timer (Timer *);
 
-Timer *timer_set_rel(time_rel, proc, arg)
-    long time_rel;
-    void (*proc) __P((void *));
-    void *arg;
+Timer *
+timer_set_rel(long time_rel,
+             void (*proc)(void *),
+             void *arg)
 {
     Timer *new_t;
 
@@ -135,8 +135,7 @@ Timer *timer_set_rel(time_rel, proc, arg)
 }
 
 void
-timer_reset(tmr)
-    Timer *tmr;
+timer_reset(Timer *tmr)
 {
     int pos, min;
 
@@ -177,8 +176,7 @@ timer_reset(tmr)
 #define set_timeval(t,s) ((t).tv_sec=(s),(t).tv_usec=0,(t))
 
 static Timer *
-add_timer(new)
-    Timer *new;
+add_timer(Timer *new)
 {
     int pos;
 
@@ -208,7 +206,7 @@ add_timer(new)
 }
 
 void
-timer_process()
+timer_process(void)
 {
     Timer *t;
     timer_proc func;
@@ -232,8 +230,7 @@ timer_process()
 }
 
 struct timeval *
-timer_timeout(tvbuf)
-    struct timeval *tvbuf;
+timer_timeout(struct timeval *tvbuf)
 {
     if (num_timers > 0) {
        tvbuf->tv_sec = heap[0]->abstime - time(NULL);
@@ -247,8 +244,7 @@ timer_timeout(tvbuf)
 }
 
 static void
-timer_botch(arg)
-    void *arg;
+timer_botch(void *arg)
 {
     syslog(LOG_CRIT, "timer botch\n");
     abort();
index 4061c17d5c991950d7feef22a1cab71f7381fb3a..f6f3fc172a3883ac2ac5cf476ab5f1814875a7c4 100644 (file)
@@ -42,27 +42,30 @@ struct hostent *hp;
 char hostname[MAXHOSTNAMELEN], loopback[4];
 char PidFile[128];
 
-static RETSIGTYPE deactivate __P((void));
-static RETSIGTYPE terminate __P((void));
-static void choose_server __P((void));
-static void init_hm __P((void));
-static void detach __P((void));
-static void send_stats __P((ZNotice_t *, struct sockaddr_in *));
-static char *strsave __P((const char *));
+static RETSIGTYPE deactivate(int);
+static RETSIGTYPE terminate(int);
+static void choose_server(void);
+static void init_hm(void);
+static void detach(void);
+static void send_stats(ZNotice_t *, struct sockaddr_in *);
+static char *strsave(const char *);
 extern int optind;
 
-static RETSIGTYPE deactivate()
+static RETSIGTYPE
+deactivate(int ignored)
 {
     deactivating = 1;
 }
 
-static RETSIGTYPE terminate()
+static RETSIGTYPE
+terminate(int ignored)
 {
     terminating = 1;
 }
 
-main(argc, argv)
-char *argv[];
+int
+main(int argc,
+     char *argv[])
 {
     ZNotice_t notice;
     ZPacket_t packet;
@@ -246,7 +249,8 @@ char *argv[];
     }
 }
 
-static void choose_server()
+static void
+choose_server(void)
 {
     int i = 0;
     char **clust_info, **cpp;
@@ -353,7 +357,8 @@ static void choose_server()
     }
 }
 
-static void init_hm()
+static void
+init_hm(void)
 {
      struct servent *sp;
      Code_t ret;
@@ -454,7 +459,8 @@ static void init_hm()
 #endif
 }
 
-static void detach()
+static void
+detach(void)
 {
      /* detach from terminal and fork. */
      register int i, x = ZGetFD();
@@ -494,9 +500,9 @@ static void detach()
 
 static char version[BUFSIZ];
 
-static void send_stats(notice, sin)
-     ZNotice_t *notice;
-     struct sockaddr_in *sin;
+static void
+send_stats(ZNotice_t *notice,
+          struct sockaddr_in *sin)
 {
      ZNotice_t newnotice;
      Code_t ret;
@@ -608,7 +614,8 @@ static void send_stats(notice, sin)
          free(list[i]);
 }
 
-void die_gracefully()
+void
+die_gracefully(void)
 {
      syslog(LOG_INFO, "Terminate signal caught...");
      unlink(PidFile);
@@ -616,14 +623,13 @@ void die_gracefully()
      exit(0);
 }
 
-static char *strsave(sp)
-    const char *sp;
+static char *
+strsave(const char *sp)
 {
     register char *ret;
 
-    if((ret = malloc((unsigned) strlen(sp)+1)) == NULL) {
+    if((ret = strdup(sp)) == NULL) {
            abort();
     }
-    strcpy(ret,sp);
     return(ret);
 }
index 0da6bee72936d4c234aad40c545c15782ab2f612..03514c66ed4f0e3c188116a3bc213a4f10d66a0d 100644 (file)
@@ -21,10 +21,9 @@ static char rcsid_hm_client_c[] = "$Id$";
 extern int no_server, nclt, deactivated, noflushflag;
 extern struct sockaddr_in cli_sin, serv_sin, from;
 
-void transmission_tower(notice, packet, pak_len)
-     ZNotice_t *notice;
-     char *packet;
-     int pak_len;
+void transmission_tower(ZNotice_t *notice,
+                       char *packet,
+                       int pak_len)
 {
     ZNotice_t gack;
     Code_t ret;
@@ -84,8 +83,7 @@ void transmission_tower(notice, packet, pak_len)
 }
 
 Code_t
-send_outgoing(notice)
-ZNotice_t *notice;
+send_outgoing(ZNotice_t *notice)
 {
     Code_t retval;
     char *packet;
index 50fa04f2cc9cd80367092ebfe5e22100bad22a0f..47b2d5933968c3f1c8a629e5e7606ddbe8775efe 100644 (file)
@@ -33,15 +33,16 @@ extern int deactivated, rebootflag;
 extern int numserv;
 extern char **serv_list;
 extern char cur_serv[], prim_serv[];
-extern void die_gracefully();
+extern void die_gracefully(void);
 
-void hm_control(), send_back(), new_server();
+void hm_control(ZNotice_t *);
+void send_back(ZNotice_t *);
+void new_server(char *);
 
 /* Argument is whether we are actually booting, or just attaching
  * after a server switch */
 void
-send_boot_notice(op)
-char *op;
+send_boot_notice(char *op)
 {
      ZNotice_t notice;
      Code_t ret;
@@ -72,8 +73,7 @@ char *op;
 
 /* Argument is whether we are detaching or really going down */
 void
-send_flush_notice(op)
-char *op;
+send_flush_notice(char *op)
 {
      ZNotice_t notice;
      Code_t ret;
@@ -102,8 +102,7 @@ char *op;
 }
 
 void
-find_next_server(sugg_serv)
-char *sugg_serv;
+find_next_server(char *sugg_serv)
 {
      struct hostent *hp;
      int done = 0;
@@ -176,8 +175,7 @@ char *sugg_serv;
 }
 
 void
-server_manager(notice)
-ZNotice_t *notice;
+server_manager(ZNotice_t *notice)
 {
     if (memcmp((char *)&serv_sin.sin_addr, (char *)&from.sin_addr, 4) ||
        (serv_sin.sin_port != from.sin_port)) {
@@ -208,8 +206,7 @@ ZNotice_t *notice;
 }
 
 void
-hm_control(notice)
-ZNotice_t *notice;
+hm_control(ZNotice_t *notice)
 {
     Code_t ret;
     struct hostent *hp;
@@ -251,8 +248,7 @@ ZNotice_t *notice;
 }
 
 void
-send_back(notice)
-ZNotice_t *notice;
+send_back(ZNotice_t *notice)
 {
     ZNotice_Kind_t kind;
     struct sockaddr_in repl;
@@ -290,8 +286,7 @@ ZNotice_t *notice;
 }
 
 void
-new_server(sugg_serv)
-char *sugg_serv;
+new_server(char *sugg_serv)
 {
     no_server = 1;
     syslog (LOG_INFO, "Server went down, finding new server.");
@@ -306,8 +301,8 @@ char *sugg_serv;
     disable_queue_retransmits();
 }
 
-static void boot_timeout(arg)
-void *arg;
+static void
+boot_timeout(void *arg)
 {
     serv_timeouts++;
     new_server(NULL);