[warnings] Fix various SOS warnings

2008-08-15 Paul Jakma <paul.jakma@sun.com>

	* */*: Fix various problems flagged by Sun Studio compiler.
	  - '<qualifier> <storage>' obsolescent in declarations
	  - empty statements (';' after ALIAS definitions)
	  - implicit declarations (e.g printstack in lib/log.c)
	  - "\%" in printf string instead of "%%"
	  - loops that return on the first iteration (legitimately, but
 	    compiler can't really know), e.g. bgp_routemap.c
 	  - internal declarations which mask prototypes.
diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c
index 6f13974..d116c30 100644
--- a/bgpd/bgp_attr.c
+++ b/bgpd/bgp_attr.c
@@ -2298,8 +2298,6 @@
 void
 bgp_attr_init (void)
 {
-  void attrhash_init ();
-
   aspath_init ();
   attrhash_init ();
   community_init ();
diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c
index b639db0..4a642e3 100644
--- a/bgpd/bgp_route.c
+++ b/bgpd/bgp_route.c
@@ -9176,7 +9176,7 @@
             vty_out (vty, "%12llu%s", ts.counts[i], VTY_NEWLINE);
             if (ts.counts[BGP_STATS_MAXBITLEN] < 9)
               break;
-            vty_out (vty, "%30s: ", "\% announced ");
+            vty_out (vty, "%30s: ", "%% announced ");
             vty_out (vty, "%12.2f%s", 
                      100 * (float)ts.counts[BGP_STATS_SPACE] / 
                        (float)((uint64_t)1UL << ts.counts[BGP_STATS_MAXBITLEN]),
diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c
index 78ad3f0..2d4a863 100644
--- a/bgpd/bgp_routemap.c
+++ b/bgpd/bgp_routemap.c
@@ -245,9 +245,8 @@
             {
               if (sockunion_same (su, &peer->su))
                 return RMAP_MATCH;
-
-              return RMAP_NOMATCH;
             }
+          return RMAP_NOMATCH;
         }
     }
   return RMAP_NOMATCH;
@@ -2574,7 +2573,7 @@
        "Match advertising source address of route\n"
        "IP access-list number\n"
        "IP access-list number (expanded range)\n"
-       "IP standard access-list name\n");
+       "IP standard access-list name\n")
 
 DEFUN (match_ip_address_prefix_list, 
        match_ip_address_prefix_list_cmd,
@@ -2685,7 +2684,7 @@
        IP_STR
        "Match advertising source address of route\n"
        "Match entries of prefix-lists\n"
-       "IP prefix-list name\n");
+       "IP prefix-list name\n")
 
 DEFUN (match_metric, 
        match_metric_cmd,
diff --git a/lib/daemon.c b/lib/daemon.c
index e73a74f..c473555 100644
--- a/lib/daemon.c
+++ b/lib/daemon.c
@@ -21,6 +21,7 @@
  */
 
 #include <zebra.h>
+#include <log.h>
 
 #ifndef HAVE_DAEMON
 
diff --git a/lib/filter.c b/lib/filter.c
index 069919b..7aeb8de 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -138,7 +138,7 @@
 }
 
 /* Return string of filter_type. */
-const static char *
+static const char *
 filter_type_str (struct filter *filter)
 {
   switch (filter->type)
diff --git a/lib/log.c b/lib/log.c
index 677cf9a..407904d 100644
--- a/lib/log.c
+++ b/lib/log.c
@@ -30,6 +30,10 @@
 #ifndef SUNOS_5
 #include <sys/un.h>
 #endif
+/* for printstack on solaris */
+#ifdef HAVE_UCONTEXT_H
+#include <ucontext.h>
+#endif
 
 static int logfile_fd = -1;	/* Used in signal handler. */
 
diff --git a/lib/plist.c b/lib/plist.c
index 6caece0..4b498c4 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -518,7 +518,7 @@
 }
 
 /* Return string of prefix_list_type. */
-const static char *
+static const char *
 prefix_list_type_str (struct prefix_list_entry *pentry)
 {
   switch (pentry->type)
diff --git a/ospfclient/ospfclient.c b/ospfclient/ospfclient.c
index b005615..ef1d22b 100644
--- a/ospfclient/ospfclient.c
+++ b/ospfclient/ospfclient.c
@@ -121,7 +121,7 @@
   counter++;
 
   return 0;
-};
+}
 
 
 /* This thread handles asynchronous messages coming in from the OSPF
diff --git a/ospfd/ospf_ism.c b/ospfd/ospf_ism.c
index 829ea00..f215bfc 100644
--- a/ospfd/ospf_ism.c
+++ b/ospfd/ospf_ism.c
@@ -520,7 +520,7 @@
   },
 };  
 
-const static char *ospf_ism_event_str[] =
+static const char *ospf_ism_event_str[] =
 {
   "NoEvent",
   "InterfaceUp",
diff --git a/ospfd/ospf_nsm.c b/ospfd/ospf_nsm.c
index 47b16af..f3ac9ea 100644
--- a/ospfd/ospf_nsm.c
+++ b/ospfd/ospf_nsm.c
@@ -576,7 +576,7 @@
   },
 };
 
-const static char *ospf_nsm_event_str[] =
+static const char *ospf_nsm_event_str[] =
 {
   "NoEvent",
   "HelloReceived",
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 5f9fa2c..5307b41 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -50,7 +50,7 @@
 #include "ospfd/ospf_dump.h"
 
 
-const static char *ospf_network_type_str[] =
+static const char *ospf_network_type_str[] =
 {
   "Null",
   "POINTOPOINT",
diff --git a/zebra/rtadv.h b/zebra/rtadv.h
index 3665503..abd1c6f 100644
--- a/zebra/rtadv.h
+++ b/zebra/rtadv.h
@@ -23,6 +23,7 @@
 #ifndef _ZEBRA_RTADV_H
 #define _ZEBRA_RTADV_H
 
+#include "vty.h"
 #include "zebra/interface.h"
 
 /* Router advertisement prefix. */