* made a statement-like macro out of WRITE_BUF
[olsrd.git] / src / cfgparser / cfgfile_gen.c
index 974c5d7..341e8d8 100644 (file)
@@ -36,7 +36,7 @@
  * to the project. For more information see the website or contact
  * the copyright holders.
  *
- * $Id: cfgfile_gen.c,v 1.8 2007/09/13 16:08:13 bernd67 Exp $
+ * $Id: cfgfile_gen.c,v 1.9 2007/10/15 21:01:17 bernd67 Exp $
  */
 
 
@@ -361,12 +361,13 @@ olsrd_write_cnf(struct olsrd_config *cnf, const char *fname)
 
 #define MAX_LINESIZE 250
 
-#define WRITE_TO_BUF(s,args...) \
-        { \
-        if((bufsize - size) < MAX_LINESIZE) \
-            return -1; \
-        size += snprintf(&buf[size], MAX_LINESIZE, s, ##args);\
-        }
+#define WRITE_TO_BUF(fmt, args...)                                      \
+    do {                                                                \
+        if((bufsize - size) < MAX_LINESIZE) {                           \
+            return -1;                                                  \
+        }                                                               \
+        size += snprintf(&buf[size], MAX_LINESIZE, fmt, ##args);        \
+    } while (0)
 
 int
 olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
@@ -393,241 +394,241 @@ olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
       return -1;
     }
 
-  WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION)
+  WRITE_TO_BUF("#\n# Configuration file for olsr.org olsrd\n# automatically generated by olsrd-cnf %s\n#\n\n\n", PARSER_VERSION);
 
   /* Debug level */
-  WRITE_TO_BUF("# Debug level(0-9)\n# If set to 0 the daemon runs in the background\n\nDebugLevel\t%d\n\n", cnf->debug_level)
+  WRITE_TO_BUF("# Debug level(0-9)\n# If set to 0 the daemon runs in the background\n\nDebugLevel\t%d\n\n", cnf->debug_level);
 
   /* IP version */
   if(cnf->ip_version == AF_INET6)
-      WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t6\n\n")
+      WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t6\n\n");
   else
-      WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t4\n\n")
+      WRITE_TO_BUF("# IP version to use (4 or 6)\n\nIpVersion\t4\n\n");
 
   /* HNA IPv4 */
-  WRITE_TO_BUF("# HNA IPv4 routes\n# syntax: netaddr netmask\n\nHna4\n{\n")
+  WRITE_TO_BUF("# HNA IPv4 routes\n# syntax: netaddr netmask\n\nHna4\n{\n");
   while(h4)
     {
       in4.s_addr = h4->net.v4;
-      WRITE_TO_BUF("    %s ", inet_ntoa(in4))
+      WRITE_TO_BUF("    %s ", inet_ntoa(in4));
       in4.s_addr = h4->netmask.v4;
-      WRITE_TO_BUF("%s\n", inet_ntoa(in4))
+      WRITE_TO_BUF("%s\n", inet_ntoa(in4));
       h4 = h4->next;
     }
-  WRITE_TO_BUF("}\n\n")
+  WRITE_TO_BUF("}\n\n");
 
 
   /* HNA IPv6 */
-  WRITE_TO_BUF("# HNA IPv6 routes\n# syntax: netaddr prefix\n\nHna6\n{\n")
+  WRITE_TO_BUF("# HNA IPv6 routes\n# syntax: netaddr prefix\n\nHna6\n{\n");
   while(h6)
     {
-      WRITE_TO_BUF("    %s/%d\n", (char *)inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len)
+      WRITE_TO_BUF("    %s/%d\n", (char *)inet_ntop(AF_INET6, &h6->net.v6, ipv6_buf, sizeof(ipv6_buf)), h6->prefix_len);
       h6 = h6->next;
     }
 
-  WRITE_TO_BUF("}\n\n")
+  WRITE_TO_BUF("}\n\n");
 
   /* No interfaces */
-  WRITE_TO_BUF("# Should olsrd keep on running even if there are\n# no interfaces available? This is a good idea\n# for a PCMCIA/USB hotswap environment.\n# \"yes\" OR \"no\"\n\nAllowNoInt\t")
+  WRITE_TO_BUF("# Should olsrd keep on running even if there are\n# no interfaces available? This is a good idea\n# for a PCMCIA/USB hotswap environment.\n# \"yes\" OR \"no\"\n\nAllowNoInt\t");
   if(cnf->allow_no_interfaces)
-    WRITE_TO_BUF("yes\n\n")
+    WRITE_TO_BUF("yes\n\n");
   else
-    WRITE_TO_BUF("no\n\n")
+    WRITE_TO_BUF("no\n\n");
 
   /* TOS */
-  WRITE_TO_BUF("# TOS(type of service) to use. Default is 16\n\n")
-  WRITE_TO_BUF("TosValue\t%d\n\n", cnf->tos)
+  WRITE_TO_BUF("# TOS(type of service) to use. Default is 16\n\n");
+  WRITE_TO_BUF("TosValue\t%d\n\n", cnf->tos);
 
   /* RtTable */
-  WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n")
-  WRITE_TO_BUF("RtTable\t%d\n\n", cnf->rttable)
+  WRITE_TO_BUF("# Policy Routing Tableto use. Default is 254\n\n");
+  WRITE_TO_BUF("RtTable\t%d\n\n", cnf->rttable);
 
   /* Willingness */
-  WRITE_TO_BUF("# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n")
+  WRITE_TO_BUF("# The fixed willingness to use(0-7)\n# If not set willingness will be calculated\n# dynammically based on battery/power status\n\n");
   if(cnf->willingness_auto)
-    WRITE_TO_BUF("#Willingness\t4\n\n")
+    WRITE_TO_BUF("#Willingness\t4\n\n");
   else
-    WRITE_TO_BUF("Willingness%d\n\n", cnf->willingness)
+    WRITE_TO_BUF("Willingness%d\n\n", cnf->willingness);
 
   /* IPC */
-  WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n")
-  WRITE_TO_BUF("IpcConnect\n{\n")
-  WRITE_TO_BUF("   MaxConnections  %d\n", cnf->ipc_connections)
+  WRITE_TO_BUF("# Allow processes like the GUI front-end\n# to connect to the daemon.\n\n");
+  WRITE_TO_BUF("IpcConnect\n{\n");
+  WRITE_TO_BUF("   MaxConnections  %d\n", cnf->ipc_connections);
 
   while(ih)
     {
       in4.s_addr = ih->host.v4;
-      WRITE_TO_BUF("   Host          %s\n", inet_ntoa(in4))
+      WRITE_TO_BUF("   Host          %s\n", inet_ntoa(in4));
       ih = ih->next;
     }
   while(ie)
     {
       in4.s_addr = ie->net.v4;
-      WRITE_TO_BUF("   Net           %s ", inet_ntoa(in4))
+      WRITE_TO_BUF("   Net           %s ", inet_ntoa(in4));
       in4.s_addr = ie->mask.v4;
-      WRITE_TO_BUF("%s\n", inet_ntoa(in4))
+      WRITE_TO_BUF("%s\n", inet_ntoa(in4));
       ie = ie->next;
     }
 
-  WRITE_TO_BUF("}\n\n")
+  WRITE_TO_BUF("}\n\n");
 
 
 
   /* Hysteresis */
-  WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n")
+  WRITE_TO_BUF("# Hysteresis adds more robustness to the\n# link sensing.\n# Used by default. 'yes' or 'no'\n\n");
 
   if(cnf->use_hysteresis)
     {
-      WRITE_TO_BUF("UseHysteresis\tyes\n\n")
-      WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n")
-      WRITE_TO_BUF("HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling)
-      WRITE_TO_BUF("HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high)
-      WRITE_TO_BUF("HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low)
+      WRITE_TO_BUF("UseHysteresis\tyes\n\n");
+      WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
+      WRITE_TO_BUF("HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
+      WRITE_TO_BUF("HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
+      WRITE_TO_BUF("HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
     }
   else
     {
-      WRITE_TO_BUF("UseHysteresis\tno\n\n")
-      WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n")
-      WRITE_TO_BUF("#HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling)
-      WRITE_TO_BUF("#HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high)
-      WRITE_TO_BUF("#HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low)
+      WRITE_TO_BUF("UseHysteresis\tno\n\n");
+      WRITE_TO_BUF("# Hysteresis parameters\n# Do not alter these unless you know \n# what you are doing!\n# Set to auto by default. Allowed\n# values are floating point values\n# in the interval 0,1\n# THR_LOW must always be lower than\n# THR_HIGH!!\n\n");
+      WRITE_TO_BUF("#HystScaling\t%0.2f\n", cnf->hysteresis_param.scaling);
+      WRITE_TO_BUF("#HystThrHigh\t%0.2f\n", cnf->hysteresis_param.thr_high);
+      WRITE_TO_BUF("#HystThrLow\t%0.2f\n\n", cnf->hysteresis_param.thr_low);
     }
 
   /* Pollrate */
-  WRITE_TO_BUF("# Polling rate in seconds(float).\n# Auto uses default value 0.05 sec\n\n")
-  WRITE_TO_BUF("Pollrate\t%0.2f\n", cnf->pollrate)
+  WRITE_TO_BUF("# Polling rate in seconds(float).\n# Auto uses default value 0.05 sec\n\n");
+  WRITE_TO_BUF("Pollrate\t%0.2f\n", cnf->pollrate);
 
   /* TC redundancy */
-  WRITE_TO_BUF("# TC redundancy\n# Specifies how much neighbor info should\n# be sent in TC messages\n# Possible values are:\n# 0 - only send MPR selectors\n# 1 - send MPR selectors and MPRs\n# 2 - send all neighbors\n#\n# defaults to 0\n\n")
-  WRITE_TO_BUF("TcRedundancy\t%d\n\n", cnf->tc_redundancy)
+  WRITE_TO_BUF("# TC redundancy\n# Specifies how much neighbor info should\n# be sent in TC messages\n# Possible values are:\n# 0 - only send MPR selectors\n# 1 - send MPR selectors and MPRs\n# 2 - send all neighbors\n#\n# defaults to 0\n\n");
+  WRITE_TO_BUF("TcRedundancy\t%d\n\n", cnf->tc_redundancy);
 
   /* MPR coverage */
-  WRITE_TO_BUF("# MPR coverage\n# Specifies how many MPRs a node should\n# try select to reach every 2 hop neighbor\n# Can be set to any integer >0\n# defaults to 1\n\n")
+  WRITE_TO_BUF("# MPR coverage\n# Specifies how many MPRs a node should\n# try select to reach every 2 hop neighbor\n# Can be set to any integer >0\n# defaults to 1\n\n");
 
-  WRITE_TO_BUF("MprCoverage\t%d\n\n", cnf->mpr_coverage)
+  WRITE_TO_BUF("MprCoverage\t%d\n\n", cnf->mpr_coverage);
 
-  WRITE_TO_BUF("# Link quality level\n# 0 = do not use link quality\n# 1 = use link quality for MPR selection\n# 2 = use link quality for MPR selection and routing\n\n")
-  WRITE_TO_BUF("LinkQualityLevel\t%d\n\n", cnf->lq_level)
+  WRITE_TO_BUF("# Link quality level\n# 0 = do not use link quality\n# 1 = use link quality for MPR selection\n# 2 = use link quality for MPR selection and routing\n\n");
+  WRITE_TO_BUF("LinkQualityLevel\t%d\n\n", cnf->lq_level);
 
-  WRITE_TO_BUF("# Link quality window size\n\n")
-  WRITE_TO_BUF("LinkQualityWinSize\t%d\n\n", cnf->lq_wsize)
+  WRITE_TO_BUF("# Link quality window size\n\n");
+  WRITE_TO_BUF("LinkQualityWinSize\t%d\n\n", cnf->lq_wsize);
 
-  WRITE_TO_BUF("# Clear screen when printing debug output?\n\n")
-  WRITE_TO_BUF("ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no")
+  WRITE_TO_BUF("# Clear screen when printing debug output?\n\n");
+  WRITE_TO_BUF("ClearScreen\t%s\n\n", cnf->clear_screen ? "yes" : "no");
 
   /* Plugins */
-  WRITE_TO_BUF("# Olsrd plugins to load\n# This must be the absolute path to the file\n# or the loader will use the following scheme:\n")
-  WRITE_TO_BUF("# - Try the paths in the LD_LIBRARY_PATH \n#   environment variable.\n# - The list of libraries cached in /etc/ld.so.cache\n# - /lib, followed by /usr/lib\n\n")
+  WRITE_TO_BUF("# Olsrd plugins to load\n# This must be the absolute path to the file\n# or the loader will use the following scheme:\n");
+  WRITE_TO_BUF("# - Try the paths in the LD_LIBRARY_PATH \n#   environment variable.\n# - The list of libraries cached in /etc/ld.so.cache\n# - /lib, followed by /usr/lib\n\n");
   if(pe)
     {
       while(pe)
        {
-         WRITE_TO_BUF("LoadPlugin \"%s\"\n{\n", pe->name)
+         WRITE_TO_BUF("LoadPlugin \"%s\"\n{\n", pe->name);
           pp = pe->params;
           while(pp)
             {
-              WRITE_TO_BUF("    PlParam \"%s\" \"%s\"\n", pp->key, pp->value)
+              WRITE_TO_BUF("    PlParam \"%s\" \"%s\"\n", pp->key, pp->value);
               pp = pp->next;
             }
-         WRITE_TO_BUF("}\n")
+         WRITE_TO_BUF("}\n");
          pe = pe->next;
        }
     }
-  WRITE_TO_BUF("\n")
+  WRITE_TO_BUF("\n");
 
   
   
 
   /* Interfaces */
-  WRITE_TO_BUF("# Interfaces\n# Multiple interfaces with the same configuration\n")
-  WRITE_TO_BUF("# can shar the same config block. Just list the\n# interfaces(e.g. Interface \"eth0\" \"eth2\"\n\n")
+  WRITE_TO_BUF("# Interfaces\n# Multiple interfaces with the same configuration\n");
+  WRITE_TO_BUF("# can shar the same config block. Just list the\n# interfaces(e.g. Interface \"eth0\" \"eth2\"\n\n");
   /* Interfaces */
   if(in)
     {
       olsr_bool first = OLSR_TRUE;
       while(in)
        {
-         WRITE_TO_BUF("Interface \"%s\"\n{\n", in->name)
+         WRITE_TO_BUF("Interface \"%s\"\n{\n", in->name);
 
           if(first)
-            WRITE_TO_BUF("    # IPv4 broadcast address to use. The\n    # one usefull example would be 255.255.255.255\n    # If not defined the broadcastaddress\n    # every card is configured with is used\n\n")
+            WRITE_TO_BUF("    # IPv4 broadcast address to use. The\n    # one usefull example would be 255.255.255.255\n    # If not defined the broadcastaddress\n    # every card is configured with is used\n\n");
 
 
          if(in->cnf->ipv4_broadcast.v4)
            {
              in4.s_addr = in->cnf->ipv4_broadcast.v4;
-             WRITE_TO_BUF("    Ip4Broadcast\t %s\n", inet_ntoa(in4))
+             WRITE_TO_BUF("    Ip4Broadcast\t %s\n", inet_ntoa(in4));
            }
          else
            {
              if(first)
-               WRITE_TO_BUF("    #Ip4Broadcast\t255.255.255.255\n")
+               WRITE_TO_BUF("    #Ip4Broadcast\t255.255.255.255\n");
            }
          
-          if(first) WRITE_TO_BUF("\n")
+          if(first) WRITE_TO_BUF("\n");
 
           if(first)
-             WRITE_TO_BUF("    # IPv6 address scope to use.\n    # Must be 'site-local' or 'global'\n\n")
+             WRITE_TO_BUF("    # IPv6 address scope to use.\n    # Must be 'site-local' or 'global'\n\n");
          if(in->cnf->ipv6_addrtype)
-           WRITE_TO_BUF("    Ip6AddrType \tsite-local\n")
+           WRITE_TO_BUF("    Ip6AddrType \tsite-local\n");
          else
-           WRITE_TO_BUF("    Ip6AddrType \tglobal\n")
+           WRITE_TO_BUF("    Ip6AddrType \tglobal\n");
 
-          if(first) WRITE_TO_BUF("\n")
+          if(first) WRITE_TO_BUF("\n");
 
           if(first)
-           WRITE_TO_BUF("    # IPv6 multicast address to use when\n    # using site-local addresses.\n    # If not defined, ff05::15 is used\n")
-         WRITE_TO_BUF("    Ip6MulticastSite\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)))
-          if(first) WRITE_TO_BUF("\n")
+           WRITE_TO_BUF("    # IPv6 multicast address to use when\n    # using site-local addresses.\n    # If not defined, ff05::15 is used\n");
+         WRITE_TO_BUF("    Ip6MulticastSite\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_site.v6, ipv6_buf, sizeof(ipv6_buf)));
+          if(first) WRITE_TO_BUF("\n");
           if(first)
-           WRITE_TO_BUF("    # IPv6 multicast address to use when\n    # using global addresses\n    # If not defined, ff0e::1 is used\n")
-         WRITE_TO_BUF("    Ip6MulticastGlobal\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)))
-          if(first) WRITE_TO_BUF("\n")
+           WRITE_TO_BUF("    # IPv6 multicast address to use when\n    # using global addresses\n    # If not defined, ff0e::1 is used\n");
+         WRITE_TO_BUF("    Ip6MulticastGlobal\t%s\n", (char *)inet_ntop(AF_INET6, &in->cnf->ipv6_multi_glbl.v6, ipv6_buf, sizeof(ipv6_buf)));
+          if(first) WRITE_TO_BUF("\n");
          
          
           if(first)
-            WRITE_TO_BUF("    # Emission and validity intervals.\n    # If not defined, RFC proposed values will\n    # in most cases be used.\n\n")
+            WRITE_TO_BUF("    # Emission and validity intervals.\n    # If not defined, RFC proposed values will\n    # in most cases be used.\n\n");
          
          
          if(in->cnf->hello_params.emission_interval != HELLO_INTERVAL)
-           WRITE_TO_BUF("    HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval)
+           WRITE_TO_BUF("    HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
           else if(first)
-           WRITE_TO_BUF("    #HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval)
+           WRITE_TO_BUF("    #HelloInterval\t%0.2f\n", in->cnf->hello_params.emission_interval);
          if(in->cnf->hello_params.validity_time != NEIGHB_HOLD_TIME)
-           WRITE_TO_BUF("    HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time)
+           WRITE_TO_BUF("    HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
           else if(first)
-           WRITE_TO_BUF("    #HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time)
+           WRITE_TO_BUF("    #HelloValidityTime\t%0.2f\n", in->cnf->hello_params.validity_time);
          if(in->cnf->tc_params.emission_interval != TC_INTERVAL)
-           WRITE_TO_BUF("    TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval)
+           WRITE_TO_BUF("    TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
           else if(first)
-           WRITE_TO_BUF("    #TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval)
+           WRITE_TO_BUF("    #TcInterval\t\t%0.2f\n", in->cnf->tc_params.emission_interval);
          if(in->cnf->tc_params.validity_time != TOP_HOLD_TIME)
-           WRITE_TO_BUF("    TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time)
+           WRITE_TO_BUF("    TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
           else if(first)
-           WRITE_TO_BUF("    #TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time)
+           WRITE_TO_BUF("    #TcValidityTime\t%0.2f\n", in->cnf->tc_params.validity_time);
          if(in->cnf->mid_params.emission_interval != MID_INTERVAL)
-           WRITE_TO_BUF("    MidInterval\t\t%0.2f\n", in->cnf->mid_params.emission_interval)
+           WRITE_TO_BUF("    MidInterval\t\t%0.2f\n", in->cnf->mid_params.emission_interval);
           else if(first)
-           WRITE_TO_BUF("    #MidInterval\t%0.2f\n", in->cnf->mid_params.emission_interval)
+           WRITE_TO_BUF("    #MidInterval\t%0.2f\n", in->cnf->mid_params.emission_interval);
          if(in->cnf->mid_params.validity_time != MID_HOLD_TIME)
-           WRITE_TO_BUF("    MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time)
+           WRITE_TO_BUF("    MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
           else if(first)
-           WRITE_TO_BUF("    #MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time)
+           WRITE_TO_BUF("    #MidValidityTime\t%0.2f\n", in->cnf->mid_params.validity_time);
          if(in->cnf->hna_params.emission_interval != HNA_INTERVAL)
-           WRITE_TO_BUF("    HnaInterval\t\t%0.2f\n", in->cnf->hna_params.emission_interval)
+           WRITE_TO_BUF("    HnaInterval\t\t%0.2f\n", in->cnf->hna_params.emission_interval);
           else if(first)
-           WRITE_TO_BUF("    #HnaInterval\t%0.2f\n", in->cnf->hna_params.emission_interval)
+           WRITE_TO_BUF("    #HnaInterval\t%0.2f\n", in->cnf->hna_params.emission_interval);
          if(in->cnf->hna_params.validity_time != HNA_HOLD_TIME)
-           WRITE_TO_BUF("    HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time)       
+           WRITE_TO_BUF("    HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);      
           else if(first)
-           WRITE_TO_BUF("    #HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time)      
+           WRITE_TO_BUF("    #HnaValidityTime\t%0.2f\n", in->cnf->hna_params.validity_time);     
          
           mult = in->cnf->lq_mult;
 
           if (mult == NULL)
            {
               if(first)
-               WRITE_TO_BUF("    #LinkQualityMult\tdefault 1.0\n")
+               WRITE_TO_BUF("    #LinkQualityMult\tdefault 1.0\n");
            }
           else
            {
@@ -636,8 +637,7 @@ olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
                  inet_ntop(cnf->ip_version, &mult->addr, ipv6_buf,
                            sizeof (ipv6_buf));
                  
-                 WRITE_TO_BUF("    LinkQualityMult\t%s %0.2f\n",
-                         ipv6_buf, mult->val)
+                 WRITE_TO_BUF("    LinkQualityMult\t%s %0.2f\n", ipv6_buf, mult->val);
                  
                  mult = mult->next;
                }
@@ -645,30 +645,30 @@ olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
 
          if(first)
            {
-             WRITE_TO_BUF("    # When multiple links exist between hosts\n");
-             WRITE_TO_BUF("    # the weight of interface is used to determine\n");
-             WRITE_TO_BUF("    # the link to use. Normally the weight is\n")
-             WRITE_TO_BUF("    # automatically calculated by olsrd based\n");
-             WRITE_TO_BUF("    # on the characteristics of the interface,\n");
-             WRITE_TO_BUF("    # but here you can specify a fixed value.\n");
-             WRITE_TO_BUF("    # Olsrd will choose links with the lowest value.\n")
-             WRITE_TO_BUF("    # Note:\n");
-             WRITE_TO_BUF("    # Interface weight is used only when LinkQualityLevel is 0.\n");
-             WRITE_TO_BUF("    # For any other value of LinkQualityLevel, the interface ETX\n");
-             WRITE_TO_BUF("    # value is used instead.\n\n");
+             WRITE_TO_BUF("    # When multiple links exist between hosts\n");;
+             WRITE_TO_BUF("    # the weight of interface is used to determine\n");;
+             WRITE_TO_BUF("    # the link to use. Normally the weight is\n");
+             WRITE_TO_BUF("    # automatically calculated by olsrd based\n");;
+             WRITE_TO_BUF("    # on the characteristics of the interface,\n");;
+             WRITE_TO_BUF("    # but here you can specify a fixed value.\n");;
+             WRITE_TO_BUF("    # Olsrd will choose links with the lowest value.\n");
+             WRITE_TO_BUF("    # Note:\n");;
+             WRITE_TO_BUF("    # Interface weight is used only when LinkQualityLevel is 0.\n");;
+             WRITE_TO_BUF("    # For any other value of LinkQualityLevel, the interface ETX\n");;
+             WRITE_TO_BUF("    # value is used instead.\n\n");;
             }
          if(in->cnf->weight.fixed)
            {
-             WRITE_TO_BUF("    Weight\t %d\n\n", in->cnf->weight.value)
+             WRITE_TO_BUF("    Weight\t %d\n\n", in->cnf->weight.value);
            }
          else
            {
               if(first)
-                       WRITE_TO_BUF("    #Weight\t 0\n\n")
+                       WRITE_TO_BUF("    #Weight\t 0\n\n");
            }
 
          
-         WRITE_TO_BUF("}\n\n")
+         WRITE_TO_BUF("}\n\n");
          in = in->next;
          first = OLSR_FALSE;
        }
@@ -676,7 +676,7 @@ olsrd_write_cnf_buf(struct olsrd_config *cnf, char *buf, olsr_u32_t bufsize)
     }
 
 
-  WRITE_TO_BUF("\n# END AUTOGENERATED CONFIG\n")
+  WRITE_TO_BUF("\n# END AUTOGENERATED CONFIG\n");
 
   return size;
 }