Merge isisd into the Quagga's framework:
  - add privs support
  - use misc quagga's definitions
  - make it compile"able"
  - fix segfault cases related to hostname()
  - add debug isis xxx command

This patch has been approved by Paul Jakma.
diff --git a/isisd/isisd.c b/isisd/isisd.c
index 8794a12..3b8a0a6 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -506,6 +506,79 @@
   return CMD_SUCCESS;
 }
 
+/* Debug node. */
+static struct cmd_node debug_node =
+{
+  DEBUG_NODE,
+ "",
+ 1
+};
+
+static int
+config_write_debug (struct vty *vty)
+{
+  int write = 0;
+  int flags = isis->debugs;
+
+  if (flags & DEBUG_ADJ_PACKETS) {
+    vty_out (vty, "debug isis adj-packets%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_CHECKSUM_ERRORS) {
+    vty_out (vty, "debug isis checksum-errors%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_LOCAL_UPDATES) {
+    vty_out (vty, "debug isis local-updates%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_PROTOCOL_ERRORS) {
+    vty_out (vty, "debug isis protocol-errors%s",  
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_SNP_PACKETS) {
+    vty_out (vty, "debug isis snp-packets%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_SPF_EVENTS) {
+    vty_out (vty, "debug isis spf-events%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_SPF_STATS) {
+    vty_out (vty, "debug isis spf-statistics%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_SPF_TRIGGERS) {
+    vty_out (vty, "debug isis spf-triggers%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_UPDATE_PACKETS) {
+    vty_out (vty, "debug isis update-packets%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_RTE_EVENTS) {
+    vty_out (vty, "debug isis route-events%s",
+             VTY_NEWLINE);
+    write++;
+  }
+  if (flags & DEBUG_EVENTS) {
+    vty_out (vty, "debug isis events%s",
+             VTY_NEWLINE);
+    write++;
+  }
+
+  return write;
+}
+
 DEFUN (debug_isis_adj,
        debug_isis_adj_cmd,
        "debug isis adj-packets",
@@ -1893,6 +1966,8 @@
   install_element (ENABLE_NODE, &show_database_detail_cmd);
   install_element (ENABLE_NODE, &show_debugging_cmd);
 
+  install_node(&debug_node, config_write_debug);
+
   install_element (ENABLE_NODE, &debug_isis_adj_cmd);
   install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
   install_element (ENABLE_NODE, &debug_isis_csum_cmd);
@@ -1916,6 +1991,29 @@
   install_element (ENABLE_NODE, &debug_isis_events_cmd);
   install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
 
+  install_element (CONFIG_NODE, &debug_isis_adj_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
+  install_element (CONFIG_NODE, &debug_isis_csum_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
+  install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
+  install_element (CONFIG_NODE, &debug_isis_err_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
+  install_element (CONFIG_NODE, &debug_isis_snp_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
+  install_element (CONFIG_NODE, &debug_isis_upd_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
+  install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
+  install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
+  install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
+  install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
+  install_element (CONFIG_NODE, &debug_isis_events_cmd);
+  install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
+
   install_element (CONFIG_NODE, &router_isis_cmd);
   install_element (CONFIG_NODE, &no_router_isis_cmd);